Authentication
There are two different flows. Partner integrations move money from their own backend and act as
themselves. Third-party applications read data belonging to a Garna user and act on that user's
behalf, limited by scopes. Both end at POST /oauth/token, but nothing else about them is the same.
Call order
A partner integration makes one call and is then done with OAuth until the token expires:
| Call | What you get |
|---|---|
POST /oauth/token with grant_type=partner |
An access token valid for 180 minutes, and no refresh token |
A third-party application goes through the user's browser first:
| Call | What you get |
|---|---|
GET /oauth/clients/{clientId} |
Optional: the client's public name, avatar and policy links, for a connect screen of your own |
GET /oauth/authorize |
A redirect to the consent screen — browser navigation, not a call from your backend |
POST /oauth/token with grant_type=authorization_code |
An access token and a refresh token |
POST /oauth/token with grant_type=refresh_token |
A renewed access token, once the access token expires |
Two of those calls are not yours to make: the browser navigates to /oauth/authorize, and the browser
comes back to your redirect_uri. Which side does what:
sequenceDiagram
participant U as User's browser
participant Y as Your backend
participant A as Garna API
Y->>A: GET /oauth/clients/{clientId}
A-->>Y: public client details, if you render your own screen
Y->>U: redirect to the authorization endpoint
U->>A: GET /oauth/authorize
A-->>U: consent screen, then a redirect back with a code
U->>Y: your redirect_uri, carrying the code
Y->>A: POST /oauth/token, grant_type authorization_code
A-->>Y: access_token and refresh_token
Y->>A: POST /oauth/token, grant_type refresh_token
A-->>Y: a renewed access_token
Partner integrations
1. Request a token
The grant type is partner, and it is the only one supported for payouts. A generic OAuth2 client library
will often reach for client_credentials by default — override that: partner is what your integration
must ask for, and a token obtained any other way is not part of this contract.
curl -X POST "$BASE_URL/oauth/token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"grant_type": "partner",
"client_id": "<your client id>",
"client_secret": "<your client secret>"
}'
{
"token_type": "Bearer",
"expires_in": 10800,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..."
}
Always send Accept: application/json. Without it, failures come back as an HTML error page instead of
a JSON body — including the authentication failures below.
The token is valid for 180 minutes. This flow issues no refresh token: when the token expires, request a new one with the same credentials. Cache the token for its lifetime instead of requesting one per API call.
Need a shorter token? Add an optional expires_at — an ISO 8601 date-time saying when the issued token
must expire. A value without a zone is read as UTC:
curl -X POST "$BASE_URL/oauth/token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"grant_type": "partner",
"client_id": "<your client id>",
"client_secret": "<your client secret>",
"expires_at": "2026-09-01T12:00:00Z"
}'
The value only shortens the lifetime, never extends it past the 180 minutes above, and expires_in in
the response reflects what you asked for. Four things come back as 400 invalid_request with the reason
in hint: a date beyond the ceiling, a date less than 60 seconds ahead, a string that is not a date-time,
and a value that is not a string at all.
2. Call the API
curl "$BASE_URL/payments/v2/status?request_id=<your request id>" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Accept: application/json"
What the server checks
Every partner request passes two independent layers, and they fail differently:
- The token — signature, expiry and standard claims. Rejected here, you get the framework's generic
authentication error, without a numeric code. Expiry is checked strictly: a token one second past
expires_inis already invalid. - The account behind the client — the token identifies your OAuth client, the client is bound to an account, and that account must be a company account. Rejected here, you get a numeric code.
| Result | Status | Body | Cause |
|---|---|---|---|
| Token rejected | 401 |
{"message": "Unauthenticated."} |
Missing, malformed, expired or revoked token |
| Client has no account | 401 |
{"message": "1000"} |
The token is valid, but no account is bound to the client |
| Account rejected | 403 |
{"message": "2000"} |
The client's account is not a company account |
Do not branch on 1000 to detect an expired token — that case never carries it. Treat any 401 as "get a
new token", and 403 as a configuration problem on your side.
Rate limit
/payments/* and /oauth/* are throttled at 300 requests per minute per IP address, and it is one
shared bucket for both — not a separate allowance per endpoint family and not per client. Several
integrations behind the same egress IP share it. Reading under /payment-requests/* is not throttled; use
batches rather than hundreds of single requests, and see Overview for the
limits on the endpoints there that change something.
Assume these numbers everywhere: build retry and backoff against them rather than against the largest burst an environment happens to accept.
Third-party applications
The user approves your application in the Garna dashboard, and you receive a token scoped to what the user agreed to share.
1. Send the user to the authorization endpoint
GET $BASE_URL/oauth/authorize
?client_id=<your client id>
&redirect_uri=<your registered redirect uri>
&response_type=code
&scope=user.common%20user.balance
The request is validated and the user is redirected to the dashboard consent screen. The pending authorization is kept for 5 minutes — if the user takes longer to approve, start the flow again.
redirect_uri must match the URI registered for your client.
This is the one place where a browser does the work, not your backend. The endpoint authenticates by dashboard session, not by token, and it behaves differently depending on how you reach it:
| How you reach it | What happens |
|---|---|
| Browser navigation, user signed in | 302 to the consent screen |
| Browser navigation, user not signed in | 302 to the sign-in page, with this URL preserved in redirect_to; after signing in the user lands back here and the flow continues |
| Request asking for JSON | 401 with an empty {"redirect": {}} body — no redirect, flow stops |
So do not send Accept: application/json on this one call, even though every other endpoint in this
documentation needs it. Redirect the browser; do not fetch this URL from your server.
If you render your own connect screen before sending the user here, the client's public name, avatar and
policy links come from GET /oauth/clients/{clientId} — see
Reading user data.
2. The user approves
The dashboard submits the approval. The user is then redirected back to your redirect_uri with a
short-lived code in the query string. If the user declines, the browser comes back to the same
redirect_uri with error=access_denied and your state, and no code is issued — handle that query
string as a normal outcome, not as a failure.
An account with no transactions yet may be moved to the partner's network when the user approves. This is not a one-off at first connection: while the account has no transactions, every approval moves it again, as long as your network differs from the one the account currently sits in. Accounts that already have transactions are never moved, and neither is anyone moved into the Garna system network. Network moves can also be switched off for an individual client — ask us if you need to know how yours is configured, rather than deriving it from what you observe.
3. Exchange the code for a token
curl -X POST "$BASE_URL/oauth/token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"grant_type": "authorization_code",
"client_id": "<your client id>",
"client_secret": "<your client secret>",
"redirect_uri": "<your registered redirect uri>",
"code": "<code from the redirect>"
}'
The response contains both access_token and refresh_token. These live far longer than a partner
token, so do not treat expiry as your signal to re-authorize: a 401 on a user endpoint means the user
revoked access — see Scopes. Read expires_in rather than hardcoding a
lifetime, store both tokens as you would store a password, and renew with:
curl -X POST "$BASE_URL/oauth/token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"grant_type": "refresh_token",
"refresh_token": "<refresh token>",
"client_id": "<your client id>",
"client_secret": "<your client secret>"
}'
Renewing returns a whole new pair, and the previous one dies at that moment: the old refresh token is
rejected on a second use and the old access token stops working too. Store both new values and drop the
old ones. Run the exchange in one place — two parallel calls with the same refresh token leave the second
one with a 401.
The optional expires_at above works here as well, both when exchanging the code and when renewing. Its
ceiling is the standard lifetime of a user token, and the refresh token keeps its own lifetime either way.
4. Call user endpoints
Each endpoint under /oauth/user, /oauth/employee-invitations and /oauth/company requires its own
scope; a token without that scope is rejected with 403 and {"message": "Invalid scope(s) provided."}.
The full list is in Scopes.
Token errors
Token endpoint failures use the OAuth2 error format, not the numeric payment codes:
{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}
message is a deprecated duplicate of error_description — read error and error_description.
Where to go next
- Endpoints: OAuth —
/oauth/tokenand/oauth/authorizewith full field tables - Errors — what the payout endpoints answer once the token is accepted
- Scopes — what each scope of a user token unlocks