Authentication and authorization
Which credentials should I use?
I need to install the app on a store → use APP credentials (from the developer dashboard). Endpoints: /app/authorize, /app/client/generate.
I need to create a customer, order or payment → use MERCHANT credentials (returned at the end of the installation). Endpoints: /v1/customers, /v1/orders, /v1/payments/*.
I'm not sure → do you have a merchant who installed your app? If yes, use merchant credentials. If not, follow the installation flow first to obtain them.
Understanding the credentials
The Appmax API uses two pairs of credentials (client_id and client_secret). Both have the same format but serve completely different purposes. Confusing the two is the most common cause of integration errors.
| Aspect | App credentials | Merchant credentials |
|---|---|---|
| Obtained from | Developer dashboard, when creating the application | Response of /app/client/generate, at the end of the installation |
| How many exist | 1 pair per app | 1 pair per merchant that installed the app |
| Used for | Installation flow (/app/authorize, /app/client/generate) | Transactional operations: customers, orders, payments, refunds |
| Expire | No, as long as the app exists | No (see below for when they change) |
| Generated token is valid for | 1 hour | 1 hour |
DANGER
App credentials do not allow creating customers, orders, or payments. If you receive a 401 on the transactional API, you are likely using the wrong credentials.
WARNING
Both use the same endpoint (https://auth.appmax.com.br/oauth2/token) with the same request format. Only the client_id/client_secret you send changes, and with it the token's permissions. Keep each merchant's pair associated with that merchant, in a secure location.
Both phases (installation with the app credentials, operation with the merchant credentials) appear in the diagram in App installation.
Common credential errors
| Error | Likely cause | Solution |
|---|---|---|
401 when creating customer/order | Using app credentials instead of merchant credentials | Use the credentials returned by /app/client/generate |
401 when calling /app/authorize | Using merchant credentials instead of app credentials | Use the credentials from the developer dashboard |
500 when calling /app/client/generate | Incomplete installation flow (missing redirect) | Follow all 4 steps of the installation flow in order |
401 expired token | JWT token older than 1 hour | Generate a new token with the same credentials |
403 on /oauth2/token | Wrong endpoint (using the API URL instead of auth) | Use https://auth.appmax.com.br/oauth2/token |
Why don't we use refresh tokens?
The API adopts an authentication model without refresh tokens. This decision is based on the server-to-server communication architecture.
Detailed reasons
Server-to-server nature: communication occurs directly between servers in controlled, secure environments. This reduces the need for additional token renewal mechanisms.
Security and simplicity: short-lived tokens (1 hour) limit the usage window. In server-to-server environments where credentials are stored securely, this approach simplifies management.
Reduced complexity: eliminates secure refresh token storage, token rotation, and renewal logic.
Compliance with best practices: in server-to-server integrations, it is common to use short-lived access tokens with key-based authentication.
Obtaining the token
The token is valid for 1 hour. When it expires, repeat the same request.
Example with merchant credentials
curl --location 'https://auth.appmax.com.br/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=MERCHANT_CLIENT_ID' \
--data-urlencode 'client_secret=MERCHANT_CLIENT_SECRET'{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...",
"token_type": "Bearer",
"expires_in": 3600
}Example with app credentials
curl --location 'https://auth.appmax.com.br/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=APP_CLIENT_ID' \
--data-urlencode 'client_secret=APP_CLIENT_SECRET'WARNING
Merchant credentials do not expire. They change in three situations: a reinstall of the app, which issues a new pair; uninstalling, which deactivates them; and the panel's API screen, which lets you generate a new client_secret or revoke the pair.