Authentication
Choose the right token type, send the required headers, and understand scopes when calling the Nimbu API.
Sending Credentials
- Include
Authorization: Bearer <token>on every authenticated request. - When you authenticate with a user-scoped token, add
X-Nimbu-Site: <site_id>so the API can resolve the site context. - Site-scoped tokens already encode the site and do not require the extra header.
Create & Manage Tokens
- POST /auth/login — exchange a username and password for a user-scoped personal access token.
- GET /tokens — list the tokens visible to the caller.
- POST /tokens — mint a scoped token programmatically. Provide
site_idto create a site token or omit it to stay user-scoped. - DELETE /tokens/{token_id} — revoke a token.
- POST /auth/logout — invalidate the token currently in use.
OAuth 2.0
Register an OAuth 2 app on your site to let customers sign in to your integration. The token endpoints live on the API host:
| Endpoint | Purpose |
|---|---|
GET https://<site-domain>/oauth2/authorize | Storefront consent page where the customer logs in and approves (authorization code flow) |
POST https://api.nimbu.io/oauth2/tokens | Token endpoint: authorization_code, refresh_token, password grants |
GET / POST https://api.nimbu.io/oauth2/userinfo | OpenID Connect userinfo for a token with the openid scope |
GET https://api.nimbu.io/oauth2/certs | JWKS. Holds the OpenID Connect id_token key and the MCP token signing keys; pick the key by kid |
Token responses are JSON with access_token, token_type, expires_in, and, depending on the
grant, refresh_token and id_token. Confidential clients authenticate with client_id +
client_secret (HTTP Basic or form fields). Public clients send only client_id.
Rules the token endpoint enforces:
- PKCE: only
S256is accepted; a challenge with any other method is rejected at authorize time. Public clients must send acode_challenge. Confidential clients may skip PKCE, but once a challenge is bound to a code, the matchingcode_verifieris always required. redirect_uri: the value sent to/oauth2/tokensmust be identical to the one used at authorize time.- Refresh tokens do not rotate. A REST refresh token can be reused until it is revoked. Only MCP grants rotate refresh tokens.
- Password grant: customers only, and only for apps with the resource-owner password grant
enabled and bound to a site. The
usernameis the customer's email.
curl -X POST "https://api.nimbu.io/oauth2/tokens" \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d grant_type=authorization_code \
-d code="$CODE" \
-d redirect_uri="https://app.example.com/callback" \
-d code_verifier="$CODE_VERIFIER"Revocation. Customer tokens stop working when the customer changes their password. Backoffice
user tokens stay valid until they expire, are deleted (DELETE /tokens/{token_id}, POST /auth/logout), or all of that user's tokens are revoked ("log out all sessions", or turning off
two-factor authentication). Password changes and account locks do not revoke them.
To use Nimbu as a "Login with Nimbu" identity provider for other apps, see OpenID Connect. AI agents connect through the MCP server, which has its own OAuth setup (discovery, client ID metadata documents, dynamic client registration); see MCP.
Token Types
| Token type | How it is issued | Required headers | Typical use cases |
|---|---|---|---|
| User-scoped | Personal access tokens (POST /auth/login, POST /tokens without site_id) | Authorization, X-Nimbu-Site | Backoffice automation, multi-site tooling, testing |
| Site-scoped | POST /tokens with a site_id or via dashboard-generated site keys | Authorization | Storefront integrations scoped to a single site |
- User tokens inherit the permissions of the backoffice user. Provide
X-Nimbu-Sitefor nearly every API call so Nimbu can load the correct site and ACLs. These tokens may see multiple sites if the account has access. - Site tokens are already bound to one site. You can omit
X-Nimbu-Sitebecause the token resolves the site internally. - Both token types surface granted scopes in
X-OAuth-Scopes, whileX-Accepted-OAuth-Scopesindicates the scopes the endpoint expected.
Customer Sessions & ACLs
Channel entry ACLs are evaluated against the current customer. Send a customer session token with
Session-Token: <token> or X-Nimbu-Session-Token: <token> when a site or user token should behave
like that customer. Customer OAuth tokens already resolve the customer from the bearer token.
Non-master tokens are ACL-filtered. Master tokens bypass channel and entry ACLs by default; add
use_acl=true on channel entry routes when you want the same filtered view a customer would see.
See Channel Access Control for channel ACL scopes, row-level grants, and row-level denies.
Working With Scopes
- Supply the
scopesarray when creating or updating a token. Each scope string must match the catalogue below. - Responses echo your active scopes in
X-OAuth-Scopes. If an endpoint fails with403, compare your scopes to the ones advertised inX-Accepted-OAuth-Scopes. - Use separate tokens for automation with different privilege levels to adhere to least privilege.
- Tokens can be rotated without downtime by creating a new scoped token, updating clients, and then revoking the old credential.
Scope Catalogue
Identity & OpenID
| Scope | Title | Grants |
|---|---|---|
openid | OpenID - Standard OpenID Claim | Sign the customer in; required for an id_token and /oauth2/userinfo |
profile | OpenID - Profile Claim | Name and basic profile claims |
email | OpenID - Email Claim | Email address claims |
full_profile | OpenID - full_profile claim | The full customer profile, including custom fields |
See OpenID Connect for the exact claims per scope.
Read Access
| Scope | Title | Grants |
|---|---|---|
read_site | Read-Only Site Access | This includes: site settings and related settings. |
read_settings | Read-Only Settings Access | Site settings, checkout, notifications, taxes, and shipping configuration |
read_channels | Read-Only Channel Access | All channels and entries, excluding privacy-sensitive channels |
read_sensitive_channels | Read-Only Privacy-Sensitive Channel Access | Access to privacy-sensitive channels and entries. |
read_content | Read-Only Content Access | This includes: pages, navigation, media, copywriting, uploads, redirects and blogs. |
read_themes | Read-Only Theme Access | This includes: theme source code for layouts, templates, snippets and assets. |
read_cloudcode | Read-Only Cloud Code Access | All cloud code sources |
read_products | Read-Only Product Access | Access to products, inventory, collections, types, vendors and custom fields |
read_customers | Read-Only Customer Access | This includes: customer accounts, groups, addresses and custom fields. |
read_orders | Read-Only Order Access | Access to orders, including order items, fulfillment info and order history |
read_coupons | Read-Only Coupon Access | This includes: customer coupons |
read_subscriptions | Read-Only Subscription Access | Customer subscriptions |
read_devices | Read-Only Device Access | This includes: device tokens |
read_webhooks | Read-Only Webhook Access | Webhooks |
read_domains | Read-Only Domain Access | Custom domain configuration |
read_senders | Read-Only Email Sender Access | Email sender domains and their verification status |
Write Access
| Scope | Title | Grants |
|---|---|---|
write_site | Read/Write Site Access | This includes: site settings and related settings. |
write_settings | Read/Write Settings Access | Update site settings, checkout, notifications, taxes, and shipping configuration |
write_channels | Read/Write Channel Access | All channels and entries, excluding privacy-sensitive channels |
write_sensitive_channels | Read/Write Privacy-Sensitive Channel Access | Access to privacy-sensitive channels and entries. |
write_content | Read/Write Content Access | This includes: pages, navigation, media, copywriting, uploads, redirects and blogs. |
write_themes | Read/Write Theme Access | This includes: theme source code for layouts, templates, snippets and assets. |
write_cloudcode | Read/Write Cloud Code Access | All cloud code sources |
write_products | Read/Write Product Access | Access to products, inventory, collections, types, vendors and custom fields |
write_customers | Read/Write Customer Access | This includes: customer accounts, groups, addresses and custom fields. |
write_orders | Read/Write Order Access | Access to orders, including order items, fulfillment info and order history |
write_coupons | Read/Write Coupon Access | This includes: customer coupons |
write_subscriptions | Read/Write Subscription Access | Manage customer subscriptions |
write_devices | Read/Write Device Access | This includes: updating device tokens and sending push notifications |
write_webhooks | Read/Write Webhook Access | Create, update, and delete webhooks |
write_domains | Read/Write Domain Access | Create, update, and delete custom domains |
write_senders | Read/Write Email Sender Access | Create, verify, and delete email sender domains |
Special
| Scope | Title | Grants |
|---|---|---|
skip_confirmation | Allow Skip Email Confirmation | Ability to skip email confirmation when creating a new customer account |
Troubleshooting
401 Unauthorized— missing or invalid bearer token. Confirm the token is active and not revoked.403 Forbidden— token is valid but lacks one or more scopes or the site ACL denies the action.429 Too Many Requests— back off and retry after the time indicated in the rate limit headers.X-OAuth-Scopesechoes what you currently have;X-Accepted-OAuth-Scopesreveals what you still need. Compare them first when debugging access issues.