Skip to main content
Nymble Commerce supports two authentication methods. Use credential-based login tokens for user-facing applications where your server exchanges credentials for a scoped token. Use 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 your OrgCode, 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

string
required
Your organization code. This identifies which Nymble Commerce tenant you are authenticating against. Example: org_52a3021e813.
string
required
Your client ID. Issued when your API credentials are provisioned. Acts as the username component of your credential pair.
string
required
Your client secret. Issued alongside your ClientId. Treat this as a password — never expose it in client-side code or public repositories.

Response fields

string
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.
string
The token scheme. Always returns "api-key".
integer
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 the AccessToken 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 the x-api-key request header.
API keys are scoped to your organization and bypass the credential login flow entirely — there’s no expiry to manage and no login call required. This makes them ideal for:
  • 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 via POST /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: These claims are populated when your API credentials are provisioned and enriched at login time.

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.
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


Security best practices

Never expose your ClientSecret in client-side code. Your ClientSecret is equivalent to a password. Keep it server-side only — in environment variables or a secrets manager — and never commit it to source control or embed it in mobile apps or browser JavaScript.
Use API keys for server-to-server integrations. For backend services, cron jobs, and ERP integrations, use a pre-issued API key via the x-api-key header rather than the credential login flow. API keys have no expiry to manage and avoid the overhead of token exchange.
Cache login tokens until near expiry. A token is valid for ExpiresIn seconds (typically 86,400 seconds / 24 hours). Store it in memory or a short-lived cache and reuse it across requests. Refresh it only when it’s within a few minutes of expiry. This keeps you well within the login rate limit and reduces latency.
Rotate credentials immediately if compromised. If you suspect your ClientSecret or API key has been exposed, contact Nymble Commerce support to rotate your credentials. Previously issued tokens will be invalidated when credentials are rotated.