BigCommerce Troubleshooting

The REST Admin API returns 401 or 403

REST Admin API calls fail with 401 or 403: check the X-Auth-Token, store hash and OAuth scopes, then recreate the API account with the scopes the operation needs.

Last updated · Integrations and account operations · Error code: 401 Unauthorized or 403 Forbidden · Applies to: BigCommerce REST Admin (Management) API with store-level, app-level or account-level API accounts; B2B Edition REST Management API

Symptoms

  • A call to the REST Admin API (for example https://api.bigcommerce.com/stores/{store_hash}/v3/...) returns HTTP 401 Unauthorized.
  • Or the call returns HTTP 403 Forbidden, often only for some endpoints or only for writes, while other requests with the same token succeed.
  • An integration, connector or app that worked before starts failing with 401 or 403 after a credential change, a new store, or a change in the store owner.
  • GET requests work, but POST, PUT or DELETE requests to the same resource are refused.

Cause

The two codes mean different things. BigCommerce's status code reference describes 401 as a request where the client "failed to provide credentials or its credentials were invalid", and 403 as one where "permissions do not allow the operation."

Common causes of a 401, most likely first:

  • The X-Auth-Token header is missing, misspelled, or holds the wrong value. The REST Admin API expects the access token of an API account in this header.
  • The API account was deleted. Deleting a store-level account is how BigCommerce revokes its credentials, and a deleted account cannot be recovered.
  • For app-level tokens, the token was refreshed. Changing the app's OAuth scopes, or a change to the store owner's email address, triggers a token refresh, and the store owner must reauthorize the app.

Common causes of a 403, most likely first:

  • The API account lacks the OAuth scope the endpoint needs. Most resources have a modify scope and a read-only scope, and read-only scopes limit the account to GET and HEAD requests.
  • The account has a modify scope for a different resource than the one the request touches, for example Products set to modify but Orders left at read-only or none.

Resolution

  1. Read the status code first. Treat 401 as "who are you" and 403 as "you cannot do this". Save the response body and the request details with the token removed.
  2. Check the headers. Confirm the request sends X-Auth-Token with the API account access token, plus Accept: application/json and, for requests with a body, Content-Type: application/json. The X-Auth-Client header is no longer required.
  3. Check the store hash. The API path for an API account has the form https://api.bigcommerce.com/stores/{store_hash}/. The store hash in your request URL must match the store the account was created in, which matters most when one integration serves several stores.
  4. Test a safe read. Send a simple GET to a documented read endpoint with the same token from a tool such as cURL, outside your integration. If the read also fails with 401, the token or store hash is the problem, not the integration code.
  5. Compare scopes with the operation. In the control panel, go to Settings > Store-level API accounts and open the account to review its scopes. A write to orders needs Orders set to modify (store_v2_orders), not read-only (store_v2_orders_read_only). The API accounts guide lists the scope for each resource.
  6. Create a new account if scopes are wrong. Store-level API account scopes and tokens cannot be edited after creation. Create a new account with the right scopes, update the integration, then retire the old one. Deleting an account cannot be undone. Webhooks, metafields and scripts are only accessible to the API account that created them, and webhooks do not persist when that account is deleted, so recreate them under the new account before you delete the old one.
  7. For apps, update scopes and reauthorize. App-level scopes are managed in the Developer Portal. Changing them triggers a token refresh, and the store owner must reauthorize the app before the new token works.
  8. Verify the fix. Repeat the safe read, then run the original write once against a test record. A 2xx response on both confirms the fix.

How to prevent it

  • Give each integration its own API account, named for the system that uses it, so you can rotate or remove one without breaking the rest.
  • Grant the smallest scopes that cover the job, but list the writes the integration will need before you create the account, because store-level scopes are fixed.
  • Store tokens in a secrets manager, not in code. Store-level and app-level access tokens do not expire based on time and cannot be manually invalidated, so a leaked store-level token stays valid until you delete its account.

B2B and ERP angle

ERP connectors often read with one scope set and write with another. A connector may import orders without trouble and then fail with 403 when it tries to update order status or push shipments back, because the account only has read-only order scope. Review the full list of ERP-to-store writes, such as inventory, prices, order status and customers, before you create the account.

If you use B2B Edition, its REST Management API lives at https://api-b2b.bigcommerce.com and requires an X-Store-Hash header as well as X-Auth-Token. Its token needs the B2B Edition scope set to modify, as described in the B2B Edition authentication guide. Account-level API accounts can reach all stores under the parent account, which can help multi-store setups but deserves tighter control.

When to get help

Contact BigCommerce support if a newly created account with the correct scopes and store hash still returns 401 or 403 on a simple read. Include the endpoint, the time of the request, and the response body, but never the token.

Sources

More in the BigCommerce knowledge base, including every article on Integrations and account operations.