API Tokens
Manage service-account API tokens — the bearer tokens used for server-to-server integrations (the same auth method used by the examples throughout this reference). The group lets you create a token, read its metadata, update its name/description, and delete it.
Creating and storing a token
Creating a token provisions a hidden service account with the admin role in the current company; the token value is shown exactly once, in the create response. Deleting a token also removes the underlying service account.
Reading a token
When a token is read (listed or fetched by id) the token field is no longer returned — only metadata is available (name, description, created_at, last_used_at).
Request body
The create and update request body accepts:
name— required, a string up to 255 characters.description— optional, a string up to 1000 characters, nullable.
Endpoints
| Method | Path | Summary |
|---|---|---|
| GET | /v1/api-tokensList API tokens | List API tokens |
| POST | /v1/api-tokensCreate an API token | Create an API token |
| GET | /v1/api-tokens/{id}Get an API token | Get an API token |
| PUT | /v1/api-tokens/{id}Update a token's name/description | Update a token's name/description |
| PATCH | /v1/api-tokens/{id}Partially update a token's name/description | Partially update a token's name/description |
| DELETE | /v1/api-tokens/{id}Delete an API token (and its service account) | Delete an API token (and its service account) |
Examples
Create an API token
Request
curl -X POST https://api.aisar.app/v1/api-tokens \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "n8n Integration",
"description": "Server-to-server token for the n8n automation"
}'Response
{
"data": {
"id": 42,
"name": "n8n Integration",
"description": "Server-to-server token for the n8n automation",
"created_at": "2026-03-15T10:00:00.000000Z",
"token": "42|aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789abcdefg"
}
}List tokens
Request
curl https://api.aisar.app/v1/api-tokens \
-H "Authorization: Bearer YOUR_API_TOKEN"Response
{
"data": [
{
"id": 42,
"name": "n8n Integration",
"description": "Server-to-server token for the n8n automation",
"created_at": "2026-03-15T10:00:00.000000Z",
"last_used_at": "2026-03-16T08:12:44.000000Z"
}
]
}Get a token by id
Request
curl https://api.aisar.app/v1/api-tokens/42 \
-H "Authorization: Bearer YOUR_API_TOKEN"Response
{
"data": {
"id": 42,
"name": "n8n Integration",
"description": "Server-to-server token for the n8n automation",
"created_at": "2026-03-15T10:00:00.000000Z",
"last_used_at": "2026-03-16T08:12:44.000000Z"
}
}Update name and description
Request
curl -X PUT https://api.aisar.app/v1/api-tokens/42 \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "n8n Integration (prod)",
"description": "Rotated server-to-server token for the n8n automation"
}'Response
{
"data": {
"id": 42,
"name": "n8n Integration (prod)",
"description": "Rotated server-to-server token for the n8n automation",
"created_at": "2026-03-15T10:00:00.000000Z",
"last_used_at": "2026-03-16T08:12:44.000000Z"
}
}Delete a token
Request
curl -X DELETE https://api.aisar.app/v1/api-tokens/42 \
-H "Authorization: Bearer YOUR_API_TOKEN"Response
{
"data": {
"message": "API token deleted."
}
}