Nimbu Developer Docs

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

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:

EndpointPurpose
GET https://<site-domain>/oauth2/authorizeStorefront consent page where the customer logs in and approves (authorization code flow)
POST https://api.nimbu.io/oauth2/tokensToken endpoint: authorization_code, refresh_token, password grants
GET / POST https://api.nimbu.io/oauth2/userinfoOpenID Connect userinfo for a token with the openid scope
GET https://api.nimbu.io/oauth2/certsJWKS. 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 S256 is accepted; a challenge with any other method is rejected at authorize time. Public clients must send a code_challenge. Confidential clients may skip PKCE, but once a challenge is bound to a code, the matching code_verifier is always required.
  • redirect_uri: the value sent to /oauth2/tokens must 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 username is 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 typeHow it is issuedRequired headersTypical use cases
User-scopedPersonal access tokens (POST /auth/login, POST /tokens without site_id)Authorization, X-Nimbu-SiteBackoffice automation, multi-site tooling, testing
Site-scopedPOST /tokens with a site_id or via dashboard-generated site keysAuthorizationStorefront integrations scoped to a single site
  • User tokens inherit the permissions of the backoffice user. Provide X-Nimbu-Site for 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-Site because the token resolves the site internally.
  • Both token types surface granted scopes in X-OAuth-Scopes, while X-Accepted-OAuth-Scopes indicates 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 scopes array 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 with 403, compare your scopes to the ones advertised in X-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

ScopeTitleGrants
openidOpenID - Standard OpenID ClaimSign the customer in; required for an id_token and /oauth2/userinfo
profileOpenID - Profile ClaimName and basic profile claims
emailOpenID - Email ClaimEmail address claims
full_profileOpenID - full_profile claimThe full customer profile, including custom fields

See OpenID Connect for the exact claims per scope.

Read Access

ScopeTitleGrants
read_siteRead-Only Site AccessThis includes: site settings and related settings.
read_settingsRead-Only Settings AccessSite settings, checkout, notifications, taxes, and shipping configuration
read_channelsRead-Only Channel AccessAll channels and entries, excluding privacy-sensitive channels
read_sensitive_channelsRead-Only Privacy-Sensitive Channel AccessAccess to privacy-sensitive channels and entries.
read_contentRead-Only Content AccessThis includes: pages, navigation, media, copywriting, uploads, redirects and blogs.
read_themesRead-Only Theme AccessThis includes: theme source code for layouts, templates, snippets and assets.
read_cloudcodeRead-Only Cloud Code AccessAll cloud code sources
read_productsRead-Only Product AccessAccess to products, inventory, collections, types, vendors and custom fields
read_customersRead-Only Customer AccessThis includes: customer accounts, groups, addresses and custom fields.
read_ordersRead-Only Order AccessAccess to orders, including order items, fulfillment info and order history
read_couponsRead-Only Coupon AccessThis includes: customer coupons
read_subscriptionsRead-Only Subscription AccessCustomer subscriptions
read_devicesRead-Only Device AccessThis includes: device tokens
read_webhooksRead-Only Webhook AccessWebhooks
read_domainsRead-Only Domain AccessCustom domain configuration
read_sendersRead-Only Email Sender AccessEmail sender domains and their verification status

Write Access

ScopeTitleGrants
write_siteRead/Write Site AccessThis includes: site settings and related settings.
write_settingsRead/Write Settings AccessUpdate site settings, checkout, notifications, taxes, and shipping configuration
write_channelsRead/Write Channel AccessAll channels and entries, excluding privacy-sensitive channels
write_sensitive_channelsRead/Write Privacy-Sensitive Channel AccessAccess to privacy-sensitive channels and entries.
write_contentRead/Write Content AccessThis includes: pages, navigation, media, copywriting, uploads, redirects and blogs.
write_themesRead/Write Theme AccessThis includes: theme source code for layouts, templates, snippets and assets.
write_cloudcodeRead/Write Cloud Code AccessAll cloud code sources
write_productsRead/Write Product AccessAccess to products, inventory, collections, types, vendors and custom fields
write_customersRead/Write Customer AccessThis includes: customer accounts, groups, addresses and custom fields.
write_ordersRead/Write Order AccessAccess to orders, including order items, fulfillment info and order history
write_couponsRead/Write Coupon AccessThis includes: customer coupons
write_subscriptionsRead/Write Subscription AccessManage customer subscriptions
write_devicesRead/Write Device AccessThis includes: updating device tokens and sending push notifications
write_webhooksRead/Write Webhook AccessCreate, update, and delete webhooks
write_domainsRead/Write Domain AccessCreate, update, and delete custom domains
write_sendersRead/Write Email Sender AccessCreate, verify, and delete email sender domains

Special

ScopeTitleGrants
skip_confirmationAllow Skip Email ConfirmationAbility 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-Scopes echoes what you currently have; X-Accepted-OAuth-Scopes reveals what you still need. Compare them first when debugging access issues.

On this page