x-api-key header authentication for machine-to-machine (M2M) integrations where a pre-issued API key is passed directly in every request. Choose the method that matches your integration architecture — both grant access to the same API surface, scoped to your organization.
Login Token Authentication
Use login token authentication when your application authenticates on behalf of a user or customer session. Your server exchanges yourOrgCode, ClientId, and ClientSecret for a short-lived access token, then passes that token in the x-api-key header on all subsequent requests.
Endpoint
Request body
Your organization code. This identifies which Nymble Commerce tenant you are authenticating against. Example:
org_52a3021e813.Your client ID. Issued when your API credentials are provisioned. Acts as the username component of your credential pair.
Your client secret. Issued alongside your
ClientId. Treat this as a password — never expose it in client-side code or public repositories.Response fields
A signed access token. Pass this value in the
x-api-key header of every subsequent API request. The token encodes your organization context and role claims so you don’t need to pass them separately.The token scheme. Always returns
"api-key".The token’s lifetime in seconds. Typically
86400 (24 hours). Cache the token and reuse it until it approaches expiry rather than requesting a new one on every call.Example request
Example response
Using the token
Pass theAccessToken value in the x-api-key header on every subsequent request:
The
/api/auth/login endpoint is rate-limited to 10 requests per minute per ClientId. If you exceed this limit, you’ll receive a 429 Too Many Requests response. Cache your token and reuse it for its full ExpiresIn duration to stay well within this limit.API Key Authentication
For server-to-server integrations, automated pipelines, and backend services, use a pre-issued API key instead of the credential login flow. Pass your API key directly in thex-api-key request header.
- ERP and accounting system integrations
- Scheduled data sync jobs
- Webhook processors and event-driven pipelines
- Internal tooling that runs with elevated or admin-level access
Contact your Nymble Commerce account administrator to obtain or rotate your organization’s API key. API keys carry the same organizational scope as a login token but are not tied to an individual user session.
Token claims
When you authenticate viaPOST /api/auth/login, the returned AccessToken encodes your organization context. The Nymble Commerce API reads these claims on every request, so you don’t need to pass organization context explicitly in most endpoints.
Key claims carried in the token:
| Claim | Type | Description |
|---|---|---|
OrganizationId | string | The unique ID of your Nymble Commerce organization. Used to scope all data access — products, customers, orders, and more. |
CustomerNumber | string | The customer account number associated with the authenticated user. Scopes cart and order operations to that customer. |
PriceTier | string | The pricing tier assigned to the customer (e.g., Wholesale, Retail). Applied automatically when listing products and calculating order totals. |
CurrencyCode | string | The currency for this session (e.g., USD, CAD). Used to format prices consistently across catalog and order responses. |
Authorization roles
Every Nymble Commerce user or integration is assigned a role that determines which API endpoints and resources are accessible. Roles are configured during account provisioning.| Role | Access level |
|---|---|
| Admin | Full access to all organization resources: customers, products, orders, invoices, payments, settings, and analytics. Required for bulk operations, customer management, and organization configuration. |
| Customer | Access to their own account, the product catalog, their carts, and their order and invoice history. Cannot access other customers’ data. |
| SalesRep | Access to the accounts and orders assigned to that rep. Can place and manage orders on behalf of assigned customers. Cannot access accounts outside their assignment. |
Roles are set when your account is provisioned. To add, change, or remove roles for a user or integration credential, contact Nymble Commerce support.
Common authentication errors
| HTTP Status | Error | Cause and resolution |
|---|---|---|
401 Unauthorized | Missing or invalid credential | Your request is missing the x-api-key header, the token is malformed, or the token has expired. Re-authenticate to get a new token and retry. |
403 Forbidden | Insufficient role or permissions | Your token is valid but your role doesn’t have access to the requested resource. Check that your role (Admin, Customer, SalesRep) is appropriate for the endpoint you’re calling. |
429 Too Many Requests | Rate limit exceeded | You’ve exceeded 10 login requests per minute on /api/auth/login. Implement token caching to avoid repeated logins. Back off and retry after 60 seconds. |