Access tokens
Exchange your client credentials for a bearer token.
Endpoints
Get an access token
https://api.dawatrack.com/partner-api/v1/oauth/token/
Exchange a client_id and client_secret for a bearer token, using the OAuth2 client credentials grant.
The token lasts one hour and carries your credential's scopes. Send it as Authorization: Bearer <token> on every other call.
The token is opaque, not a JWT, so don't try to decode it. There is no refresh token: request a new one when it expires.
OAuth 2.0 (RFC 6749): grant_type, if sent, is client_credentials; the credentials may come with HTTP Basic instead of the body. Errors carry error (invalid_client 401, invalid_request or unsupported_grant_type 400) and error_description. Every response has Cache-Control: no-store.
Request body
JSON. Send Content-Type: application/json.
-
grant_typestring OptionalOptional; when sent, client_credentials (RFC 6749 §4.4).
-
client_idstring RequiredOr send client_id and client_secret with HTTP Basic (RFC 6749 §2.3.1) instead of in the body.
-
client_secretstring RequiredYour credential's secret.
Example request
curl -X POST https://api.dawatrack.com/partner-api/v1/oauth/token/ \
-H "Content-Type: application/json" \
-d '{
"client_id": "dtpk_...",
"client_secret": "..."
}'
import requests
response = requests.post(
"https://api.dawatrack.com/partner-api/v1/oauth/token/",
json={
"client_id": "dtpk_...",
"client_secret": "..."
},
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.dawatrack.com/partner-api/v1/oauth/token/", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"client_id": "dtpk_...",
"client_secret": "..."
}),
});
console.log(await response.json());
Response fields
-
access_tokenstringThe bearer token to send on other calls.
-
token_typestringAlways Bearer.
-
expires_inintegerSeconds until this token expires.
-
scopestringSpace-separated scopes granted to this token.
-
environmentstringSANDBOX or PRODUCTION - inherited from the credential used.
Example response
{
"access_token": "AbC123...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "products:read batches:read recalls:read",
"environment": "SANDBOX"
}
Status codes
200 | OK |
400 | The request is invalid, for example a malformed GTIN or a missing field |
401 | No valid access token |
429 | Rate limit exceeded |
Partner API v1. The API reference is generated from the API's own code.