API reference
Authentication
Get an access token with your client ID and secret.
Get an access token
POST/oauth/token
Trade your client ID and secret for a bearer token that lasts one hour. Send the credentials in the form body, or as an HTTP Basic header.
Form fields
grant_typestringrequired | Always client_credentials. |
client_idstringrequired | Starts with tqz_test_ or tqz_live_. Not needed if you use HTTP Basic. |
client_secretstringrequired | Shown once when you create the credentials. Not needed if you use HTTP Basic. |
scopestring | Space-separated scopes. Leave out to receive every scope your credentials have; ask for fewer to narrow the token. |
POST /oauth/token · test
curl -X POST "https://api.tranzaq.com/oauth/token" \
-d grant_type=client_credentials \
-d client_id=tqz_test_1a2b3c4d \
-d client_secret=$CLIENT_SECRETconst response = await fetch("https://api.tranzaq.com/oauth/token", {
method: "POST",
body: new URLSearchParams({
grant_type: "client_credentials",
client_id: process.env.TRANZAQ_CLIENT_ID,
client_secret: process.env.TRANZAQ_CLIENT_SECRET,
}),
});
const { access_token, expires_in } = await response.json();var response = await http.PostAsync("/oauth/token", new FormUrlEncodedContent(new Dictionary<string, string>
{
["grant_type"] = "client_credentials",
["client_id"] = Environment.GetEnvironmentVariable("TRANZAQ_CLIENT_ID")!,
["client_secret"] = Environment.GetEnvironmentVariable("TRANZAQ_CLIENT_SECRET")!,
})); // http.BaseAddress = "https://api.tranzaq.com"
var token = (await response.Content.ReadFromJsonAsync<JsonElement>()).GetProperty("access_token").GetString();import os, requests
response = requests.post("https://api.tranzaq.com/oauth/token", data={
"grant_type": "client_credentials",
"client_id": os.environ["TRANZAQ_CLIENT_ID"],
"client_secret": os.environ["TRANZAQ_CLIENT_SECRET"],
})
token = response.json()["access_token"]Answer · 200
Response · test
{
"access_token": "eyJhbGciOiJIUzI1NiIs…",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "balance.read payouts.write"
}Errors
- 400unsupported_grant_type: only client_credentials is supported. invalid_scope: you asked for a scope your credentials do not have.
- 401invalid_client: the ID or secret is wrong, or the credentials were revoked, expired, or the business is not active.
- 429More than 30 token requests a minute from one address.