Issue user token
POST/v1/users/:user_id/tokens
Issues a bearer token for one of the project's end users. Your backend calls this and hands the token to the user's app, which then calls the end-user operations (sessions, messages, files, voice) with it. expires_in sets its lifetime (60–86400 seconds, 3600 by default). A disabled user cannot be issued a token. Issuing a new token leaves the user's earlier ones working; revoke them to stop them.
Request
Responses
- 201
- 401
- 403
- 404
- 413
- 422
- 429
- 500
Successful Response
Authentication failed: the credential is missing, malformed, expired, or revoked.
invalid_token— The access token is invalid.project_disabled— This project is not active.token_expired— The access token has expired.user_disabled— This user is not active.invalid_secret— The API secret is invalid.
The caller is authenticated but not permitted to perform this action.
permission_denied— You do not have permission to perform this action.project_disabled— This project is not active.user_disabled— This user is not active.
The requested resource does not exist, or is not visible to the caller.
project_not_found— The requested project was not found.user_not_found— The requested user was not found.
The request body is larger than the allowed limit.
payload_too_large— The request body is too large.
A request value failed validation; the details array names each offending field.
validation_failed— The request payload failed validation.
Either too many requests (a Retry-After header says when to retry) or the billing account is out of credits (no Retry-After — top up to continue); the code field tells the two apart.
rate_limited— Too many requests. Please slow down.
An unexpected server-side error occurred.
internal— An unexpected error occurred.