By default Macropay issues organization-scoped tokens. A token can only
read and write the data of the single organization the user picked during
consent — least-privilege by default, which keeps each tenant’s revenue,
customers, and payouts isolated.
The flow at a glance
1
Redirect to the authorization URL
Send the user to Macropay’s consent screen with your client ID and scopes.
2
User grants access
They approve the requested scopes and select an organization. Macropay
redirects back to your
redirect_uri with a one-time code.3
Exchange the code for tokens
POST the code to the token endpoint to receive an access_token,
refresh_token, and id_token.4
Call the API on their behalf
Send the access token as a
Bearer credential on every request.1. Send the user to the authorization URL
Start the flow by redirecting the user to:string
required
Selects the authorization-code flow — the only flow Macropay supports, and the
right choice for server-side and PKCE-protected clients alike.
string
required
The Client ID issued when you registered your OAuth 2.0 client.
string
required
Where Macropay returns the user after consent. It must exactly match one of
the redirect URIs you registered on the client.
string
required
A space-separated list of scopes to request. Each must be among the scopes you
declared on the client.

redirect_uri
with a single-use code in the query string — ready to exchange for tokens.
2. Exchange the code for an access token
POST the authorization code to the token endpoint, authenticating with your
Client ID and Client Secret:
Terminal
3. Call the API on the user’s behalf
Pass the access token as aBearer credential. This works the same whether the
token came from this OAuth flow or from an Organization Access Token:
Terminal
userinfo can create products, open checkout
sessions, or ingest agent usage signals, all attributed to that tenant.
Organization vs. user tokens
The default flow yields an organization-level token. The user selects one organization at consent time, and the token can only act on that organization’s data:sub_type=user: