OAuth /oauth
Issuing access tokens and the authorization code flow.
New to this part of the API? Start with the guide: Authentication
Issue an access token
/oauth/token
Public — no token required
Partner integrations use the partner grant type — the only one supported for payouts. The
resulting access token is valid for 180 minutes and is sent to payout endpoints as
Authorization: Bearer <token>. A generic OAuth2 client library often defaults to
client_credentials; override that, because a token obtained any other way is not part of this
contract.
Third-party applications acting on behalf of a user use authorization_code after the user has
approved the client at /oauth/authorize, and refresh_token to renew. Those tokens are
long-lived: read expires_in rather than hardcoding a lifetime.
Every grant reachable through this endpoint accepts an optional expires_at: it shortens the
lifetime of the access token being issued and never extends it beyond the default. The refresh
token keeps its own lifetime.
Body grant_type=partner
| Field | Type | Description | |
|---|---|---|---|
grant_type |
string | required |
Always partner
|
client_id |
string | required |
Identifier of the OAuth client issued during onboarding. |
client_secret |
string | required |
Secret of the same client. Keep it on your backend — it is not for browser code. |
scope |
string |
Space-separated scopes. Optional — payout endpoints do not check scopes. |
|
expires_at |
string (date-time) |
Optional. Date and time when the issued access token must expire, ISO 8601 (for example
|
Body grant_type=authorization_code
| Field | Type | Description | |
|---|---|---|---|
grant_type |
string | required |
Always authorization_code
|
client_id |
string | required |
Identifier of the OAuth client the user approved. |
client_secret |
string | required |
Secret of the same client. |
redirect_uri |
string (uri) | required |
Must match the redirect URI registered for the client. |
code |
string | required |
Authorization code returned by |
code_verifier |
string |
PKCE verifier, required when the client was registered as public. |
|
expires_at |
string (date-time) |
Optional. Date and time when the issued access token must expire, ISO 8601 (for example
|
Body grant_type=refresh_token
| Field | Type | Description | |
|---|---|---|---|
grant_type |
string | required |
Always refresh_token
|
refresh_token |
string | required |
The refresh token issued alongside the access token you are renewing. |
client_id |
string | required |
Identifier of the OAuth client the token belongs to. |
client_secret |
string | required |
Secret of the same client. |
scope |
string |
Space-separated scopes. Defaults to the scopes of the original token. |
|
expires_at |
string (date-time) |
Optional. Date and time when the issued access token must expire, ISO 8601 (for example
|
Example call
curl -X POST "$BASE_URL/oauth/token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"grant_type": "partner",
"client_id": "42",
"client_secret": "<client secret>"
}'
const response = await fetch(`${baseUrl}/oauth/token`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"grant_type": "partner",
"client_id": "42",
"client_secret": "<client secret>"
}),
});
const data = await response.json();
import requests
response = requests.post(
f"{base_url}/oauth/token",
headers={
"Accept": "application/json",
},
json={
"grant_type": "partner",
"client_id": "42",
"client_secret": "<client secret>"
},
)
data = response.json()
$client = new GuzzleHttp\Client();
$response = $client->request('POST', "{$baseUrl}/oauth/token", [
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'grant_type' => 'partner',
'client_id' => '42',
'client_secret' => '<client secret>',
],
]);
$data = json_decode((string)$response->getBody(), true);
Third-party application
{
"grant_type": "authorization_code",
"client_id": "42",
"client_secret": "<client secret>",
"redirect_uri": "https://partner.example.com/oauth/callback",
"code": "<code from the authorize redirect>"
}
Responses
Token issued. The body below is what the partner grant returns — three keys, no refresh
token. authorization_code and refresh_token add refresh_token to the same shape.
{
"token_type": "Bearer",
"expires_in": 10800,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9…"
}
4 fields
| Field | Type | Description |
|---|---|---|
token_type |
string | |
expires_in |
integer |
Lifetime in seconds — 10800 (180 minutes) for the |
access_token |
string | |
refresh_token |
string |
Returned for |
The request or the client credentials were rejected
{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}
4 fields
| Field | Type | Description |
|---|---|---|
error |
string | |
error_description |
string | |
hint |
string |
Present when the server can point at the offending parameter. |
message |
string |
Deprecated duplicate of |
The request or the client credentials were rejected
{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}
4 fields
| Field | Type | Description |
|---|---|---|
error |
string | |
error_description |
string | |
hint |
string |
Present when the server can point at the offending parameter. |
message |
string |
Deprecated duplicate of |
The rate limit was exceeded. Which limit depends on where the endpoint lives: /payments/* and
/oauth/* share one bucket of 300 requests per minute per IP address, while an endpoint of
/payment-requests/* that changes something is capped at 60 per minute per OAuth client and per IP,
on a counter shared with its siblings — see Overview.
The response carries Retry-After with the number of seconds to wait, plus X-RateLimit-Limit and
X-RateLimit-Remaining.
{
"message": "Too Many Attempts."
}
1 fields
| Field | Type | Description |
|---|---|---|
message |
string |
Human-readable reason. Carries no numeric code — these endpoints are not payment endpoints. |
Start the authorization code flow
/oauth/authorize
🔒 Dashboard session
Send the user's browser here. The request is validated and the user is redirected to the Garna
consent screen; after approval the browser returns to your redirect_uri with a code.
The pending authorization is held for 5 minutes.
This endpoint needs an active Garna dashboard session, not an OAuth token — it is browser navigation, not a server-to-server call. A user who is not signed in is redirected to the sign-in page with the original URL preserved, and lands back here after signing in.
Do not send Accept: application/json here, even though every other endpoint in this
documentation requires it: without a session the JSON branch answers 401 with an empty
{"redirect": {}} body instead of redirecting, and the flow stops.
Build the URL below and redirect the browser to it:
$BASE_URL/oauth/authorize?client_id=<client id>&redirect_uri=<redirect uri>&response_type=code&scope=user.common%20user.balance
Parameters
| Name | In | Type | Description | |
|---|---|---|---|---|
client_id |
query | string | required | Identifier of your OAuth client. |
redirect_uri |
query | string (uri) | required | Must match the URI registered for your client. |
response_type |
query | string | required | Always |
scope |
query | string | Space-separated scopes. |
|
state |
query | string | Opaque value echoed back on the redirect — use it to tie the response to the session that started the flow. |
Responses
Redirect to the consent screen, or to the sign-in page when the browser carries no dashboard
session — in that case the original URL travels along in redirect_to and the user returns
here after signing in.
The request or the client credentials were rejected
{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}
4 fields
| Field | Type | Description |
|---|---|---|
error |
string | |
error_description |
string | |
hint |
string |
Present when the server can point at the offending parameter. |
message |
string |
Deprecated duplicate of |
Only when the request asks for JSON: no dashboard session, and the body is {"redirect": {}}.
Navigate here instead of calling it as an API.
{
"redirect": []
}
1 fields
| Field | Type | Description |
|---|---|---|
redirect |
object |
Get public information about an OAuth client
/oauth/clients/{clientId}
Public — no token required
Public client details used when rendering your own consent or connection screens: display name, avatar, and links to the client's agreement and privacy policy. Those four fields are the whole response — the client's own record is not exposed here.
Parameters
| Name | In | Type | Description | |
|---|---|---|---|---|
clientId |
path | integer | required | Numeric id of the OAuth client, the same value you send as |
Example call
curl "$BASE_URL/oauth/clients/<clientId>" \
-H "Accept: application/json"
const response = await fetch(`${baseUrl}/oauth/clients/<clientId>`, {
method: 'GET',
headers: {
Accept: 'application/json',
},
});
const data = await response.json();
import requests
response = requests.get(
f"{base_url}/oauth/clients/<clientId>",
headers={
"Accept": "application/json",
},
)
data = response.json()
$client = new GuzzleHttp\Client();
$response = $client->request('GET', "{$baseUrl}/oauth/clients/<clientId>", [
'headers' => [
'Accept' => 'application/json',
],
]);
$data = json_decode((string)$response->getBody(), true);
Responses
The client
{
"data": {
"name": "Partner application",
"avatar": "https://partner.example.com/logo.png",
"agreement_link": "https://partner.example.com/terms",
"privacy_link": "https://partner.example.com/privacy"
}
}
5 fields
| Field | Type | Description |
|---|---|---|
data |
object |
Client as |
data.name |
string | |
data.avatar |
string | |
data.agreement_link |
string | |
data.privacy_link |
string |
No such client
{
"message": "Unauthenticated."
}
1 fields
| Field | Type | Description |
|---|---|---|
message |
string |
Human-readable reason. Carries no numeric code — these endpoints are not payment endpoints. |
The rate limit was exceeded. Which limit depends on where the endpoint lives: /payments/* and
/oauth/* share one bucket of 300 requests per minute per IP address, while an endpoint of
/payment-requests/* that changes something is capped at 60 per minute per OAuth client and per IP,
on a counter shared with its siblings — see Overview.
The response carries Retry-After with the number of seconds to wait, plus X-RateLimit-Limit and
X-RateLimit-Remaining.
{
"message": "Too Many Attempts."
}
1 fields
| Field | Type | Description |
|---|---|---|
message |
string |
Human-readable reason. Carries no numeric code — these endpoints are not payment endpoints. |