Generate authentication token
Exchanges your client credentials for a JWT bearer token. Use the token in the Authorization header of subsequent requests as Bearer {token}.
Endpoint
http
POST /v1/api/tokenAuthentication: none. This endpoint exchanges your client credentials for a bearer token.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| clientId | string | Yes | Your Turnqey client ID. |
| clientSecret | string | Yes | Your Turnqey client secret. |
json
{
"clientId": "your-client-id",
"clientSecret": "your-client-secret"
}Example request
bash
curl -X POST 'https://api.turnqey.xyz/v1/api/token' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-d '{
"clientId": "your-client-id",
"clientSecret": "your-client-secret"
}'Example response
json
{
"statusCode": 200,
"message": "POST Request successful.",
"isError": false,
"result": {
"expiresOn": "2026-10-30T17:10:43+00:00",
"expiresIn": 3599,
"token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}| Field | Type | Description |
|---|---|---|
| result.token | string | JWT bearer token. |
| result.expiresIn | number | Seconds until the token expires. |
| result.expiresOn | string (date-time) | Absolute expiry timestamp. |
Errors
| Status | Meaning |
|---|---|
| 400 | Request body malformed, or clientId / clientSecret missing. |
| 401 | Client credentials rejected. |
| 429 | Too many token requests from your IP. Honour Retry-After and the X-RateLimit-* headers. |
Notes
- The token lifetime is not fixed. Read
expiresInorexpiresOnfrom the response and refresh shortly before expiry rather than on a hard-coded schedule. - Keep your client secret server-side. Never expose it in client-side code or public repositories.
- See Authentication for the full token lifecycle and Errors and Retries for error handling.