Welcome to Turnqey's API authentication guide. This document will walk you through the process of authenticating with our API service to access Turnqey's crypto asset data aggregation platform. As a developer integrating with our APIs, understanding our authentication model is the first step to building powerful crypto portfolio tracking applications.
Turnqey uses a standard OAuth 2.0 Client Credentials flow for API authentication. This guide explains how to request access tokens, use them correctly, and implement best practices for token management in your applications.
Before you begin, you should have:
Security Notice: Your client ID and client secret are sensitive credentials. Never share these values in client-side code, public repositories, or with unauthorized parties.
The authentication process follows these steps:
To request an access token, make a POST request to our token endpoint with your client credentials.
POST https://api.turnqey.xyz/v1/api/tokenPOST https://sandbox.turnqey.xyz/v1/api/token| Header Name | Description | Required |
|---|---|---|
| clientId | The client ID provided by Turnqey | Yes |
| clientSecret | The client secret provided by Turnqey | Yes |
| accept | Specify application/json | Yes |
curl -X GET 'https://api.turnqey.xyz/v1/api/token' \
-H 'accept: application/json' \
-H 'clientId: your_client_id' \
-H 'clientSecret: your_client_secret'{
"statusCode": 200,
"message": "POST Request successful.",
"isError": false,
"result": {
"expiresOn": "2024-06-14T13:29:36.8287785+05:30",
"expiresIn": 3599,
"token": "eyJ0eXAiO.............................................WLLC26yzxcDiuqJjg"
}
}The accessToken is a JSON Web Token (JWT) that expires in one hour (3600 seconds).
{
"statusCode": 400,
"isError": true,
"responseException": {
"exceptionMessage": {
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"errors": {
"ClientId": [
"The ClientId field is required."
],
"ClientSecret": [
"The ClientSecret field is required."
]
},
"traceId": "00-0bc42ada3bcc75768a1s3eac5cf3f939-2c4a967c49b4aa1d-00"
}
}
}Access tokens expire after one hour (3600 seconds). Your application should handle token expiration gracefully by: