This page will help you to authenticate
Overview
The Token Trace API uses Bearer Tokens for authentication. You must include the Bearer Token in the Authorization header of your API requests to access protected endpoints. This ensures that only authorized users can retrieve and interact with the data.
Obtaining an Access Token (Bearer Token)
Your API Key, Secret and Username will be provided by the Token Trace Support team ([email protected]).
To obtain an access token, you must first authenticate yourself using the API key, API secret, and username.
You can do this by making a POST request to the /api/login endpoint. Here’s how to do it:
Request
Endpoint:
POST https://api.tokentrace.com/api/login
Headers:
'X-API-KEY': Your API key provided by Token Trace.
'X-API-SECRET': Your API secret provided by Token Trace
Body:
{
"username": "your_username"
}
Response
If the authentication is successful, the response will include an access token (Bearer Token).
Success Response (200):
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e...hIfh_4w"
}
Error Response (401):
{
"description": "Invalid credentials"
}
Using the Access Token (Bearer Token)
Once you have obtained an access token, include it in the Authorization header of your API requests as follows:
Header:
Authorization: Bearer your_access_token
Example Request
To access the '/api/crypto_scams' endpoint:
Request
GET https://api.tokentrace.com/api/crypto_scams
Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e...hIfh_4w
Token Expiration
The access token is valid for 1 week from the time of issuance. After it expires, you must re-authenticate using the '/api/login' endpoint to obtain a new token.
Token Expiry Error
If you attempt to use an expired token, you will receive a 401 Unauthorized error.
Error Response (401):
{
"description": "Token has expired"
}