Generate authentication token
Creates a JWT for API authentication using your client credentials. Access tokens are valid for one hour, so generate a new token each hour. 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
{
"isError": false,
"message": "Success",
"result": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600
},
"statusCode": 200
}Notes
- Tokens expire after one hour (3600 seconds). Refresh proactively before expiry.
- 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.