Create an access token
POST/api/auth/token
Exchanges a partner's clientId, clientSecret, and partnerId for a short-lived JWT access token. The returned token must be sent as a Bearer token in the Authorization header of subsequent requests. Optionally, a user-scoped token can be minted for one user by also sending userId (the user's id, as used in GET /api/users/by-id/{id}); the user must belong to your partner account, and the id is echoed back as user_id. Endpoints that support it then use that user and ignore any userId passed in the request; Without userId, the token is issued exactly as before.
Request
- application/json
Body
required
Possible values: Value must match regular expression admin|user
Optional, scope 'user' only. Mints the token for this user: the user's id as used in GET /api/users/by-id/{id}. Must be one of your partner account's users. Omit it for a token that is not tied to a user.
Responses
- 200
- 400
- 401
- 403
- 404
- 500
Token issued successfully
- application/json
- Schema
- Example (from schema)
Schema
The user the token was minted for. Present only when userId was sent in the request.
{
"access_token": "string",
"token_type": "string",
"expires_in": 0,
"partner_id": "string",
"scope": "string",
"user_id": "XT_CUST_abc123"
}
userId sent with a scope other than 'user'. Possible error codes
-
ERROR_INVALID_PARAMETERS
- application/json
- Schema
- Example (from schema)
Schema
Error code
A verbose error message
{
"error_code": "string",
"error_message": "string"
}
Invalid partnerId, clientId, or clientSecret
- application/json
- Schema
- Example (from schema)
Schema
Error code
A verbose error message
{
"error_code": "string",
"error_message": "string"
}
userId belongs to another partner. Possible error codes
-
ERROR_NO_PERMISSIONS_TO_RESOURCE
- application/json
- Schema
- Example (from schema)
Schema
Error code
A verbose error message
{
"error_code": "string",
"error_message": "string"
}
userId not found. Possible error codes
-
ERROR_USER_NOT_FOUND
- application/json
- Schema
- Example (from schema)
Schema
Error code
A verbose error message
{
"error_code": "string",
"error_message": "string"
}
JWT authentication is not available
- application/json
- Schema
- Example (from schema)
Schema
Error code
A verbose error message
{
"error_code": "string",
"error_message": "string"
}