OAuth /oauth

Issuing access tokens and the authorization code flow.

Issue an access token

POST /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

FieldTypeDescription
grant_type string required

Always partner for a partner integration — the only grant type supported for payouts.

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 2026-09-01T12:00:00Z); a value without a zone is read as UTC. Omit it and the token gets the default lifetime. The value can only shorten that lifetime — 400 invalid_request comes back for a date beyond the default, a date less than 60 seconds ahead, an unparsable string or a non-string value. Does not affect the refresh token.

Body grant_type=authorization_code

FieldTypeDescription
grant_type string required

Always authorization_code when exchanging the code from /oauth/authorize.

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 /oauth/authorize.

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 2026-09-01T12:00:00Z); a value without a zone is read as UTC. Omit it and the token gets the default lifetime. The value can only shorten that lifetime — 400 invalid_request comes back for a date beyond the default, a date less than 60 seconds ahead, an unparsable string or a non-string value. Does not affect the refresh token.

Body grant_type=refresh_token

FieldTypeDescription
grant_type string required

Always refresh_token when renewing a user token.

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 2026-09-01T12:00:00Z); a value without a zone is read as UTC. Omit it and the token gets the default lifetime. The value can only shorten that lifetime — 400 invalid_request comes back for a date beyond the default, a date less than 60 seconds ahead, an unparsable string or a non-string value. Does not affect the refresh token.

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

200

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
FieldTypeDescription
token_type string
expires_in integer

Lifetime in seconds — 10800 (180 minutes) for the partner grant type. The user-token grants (authorization_code, refresh_token) issue a much longer-lived token; read this field instead of hardcoding a lifetime.

access_token string
refresh_token string

Returned for authorization_code and refresh_token grants.

400

The request or the client credentials were rejected

{
    "error": "invalid_client",
    "error_description": "Client authentication failed",
    "message": "Client authentication failed"
}
4 fields
FieldTypeDescription
error string
error_description string
hint string

Present when the server can point at the offending parameter.

message string

Deprecated duplicate of error_description.

401

The request or the client credentials were rejected

{
    "error": "invalid_client",
    "error_description": "Client authentication failed",
    "message": "Client authentication failed"
}
4 fields
FieldTypeDescription
error string
error_description string
hint string

Present when the server can point at the offending parameter.

message string

Deprecated duplicate of error_description.

429

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
FieldTypeDescription
message string

Human-readable reason. Carries no numeric code — these endpoints are not payment endpoints.

Start the authorization code flow

GET /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

NameInTypeDescription
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 code — this API supports the authorization code flow only.

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

302

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.

400

The request or the client credentials were rejected

{
    "error": "invalid_client",
    "error_description": "Client authentication failed",
    "message": "Client authentication failed"
}
4 fields
FieldTypeDescription
error string
error_description string
hint string

Present when the server can point at the offending parameter.

message string

Deprecated duplicate of error_description.

401

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
FieldTypeDescription
redirect object

Get public information about an OAuth client

GET /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

NameInTypeDescription
clientId path integer required

Numeric id of the OAuth client, the same value you send as client_id.

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

200

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
FieldTypeDescription
data object

Client as GET /oauth/clients/{clientId} returns it — four fields, everything a connect screen needs. The endpoint takes no token, so nothing beyond them is exposed.

data.name string
data.avatar string
data.agreement_link string
data.privacy_link string
404

No such client

{
    "message": "Unauthenticated."
}
1 fields
FieldTypeDescription
message string

Human-readable reason. Carries no numeric code — these endpoints are not payment endpoints.

429

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
FieldTypeDescription
message string

Human-readable reason. Carries no numeric code — these endpoints are not payment endpoints.