Skip to main content

Create API Token

POST /v2/auth/api-token

Creates a new API token for the authenticated user. This endpoint performs an authorization step and issues a new token that can be used to authenticate subsequent API requests. Tokens can be configured with or without an expiration date depending on the request settings.

Request Body

{
"name": "Example Token",
"isExpirable": false,
"expiration": "2023-07-09"
}

Response Example

{
"data": {
"name": "Example Token",
"hash": "$2b$12$examplehashstring",
"expiration": null,
"userId": "user-id-1",
"tenant": "tenant-id-1",
"isExpirable": false,
"_id": "token-db-id-1",
"created": "2025-10-21T14:05:37.559Z",
"updated": "2025-10-21T14:05:37.559Z",
"__v": 0,
"id": "token-db-id-1"
},
"apiToken": "<jwt-placeholder-token>"
}