Skip to navigation

Create a token

Creates a Storefront API token. This endpoint creates storefront tokens that support CORS via allowed_cors_origins and are intended for browser-based applications.

For server-to-server integrations, you must use the private token endpoint instead.

Required Scopes

  • Manage Storefront API Tokens

NOTE: While neither channel_id nor channel_ids is labelled as required, one must be included in the request body. Including neither will throw an error, and including both will result in unexpected behaviors.

Authentication

X-Auth-Tokenstring

OAuth scopes

UI NamePermissionParameter
Storefront API Customer Impersonation Tokensmanagestore_storefront_api_customer_impersonation
Storefront API Tokensmanagestore_storefront_api

Authentication header

HeaderArgumentDescription
X-Auth-Tokenaccess_tokenFor more about API accounts that generate access_tokens, see our Guide to API Accounts.

Further reading

For example requests and more information about authenticating BigCommerce APIs, see Authentication and Example Requests.

For more about BigCommerce OAuth scopes, see our Guide to API Accounts.

Path parameters

store_hashstringRequired
Permanent ID of the BigCommerce store.

Headers

AcceptstringRequiredDefaults to application/json

The MIME type of the response body.

Request

This endpoint expects an object.
expires_atintegerRequired>=0

Unix timestamp (UTC time) defining when the token should expire. Supports seconds, but does not support milliseconds, microseconds, or nanoseconds.

allowed_cors_originslist of stringsOptional

List of allowed domains for Cross-Origin Request Sharing. Currently accepts a maximum of two domains per created token.

namestringOptional<=120 characters

Optional label for the token. Surfaced by the list endpoints to help you identify tokens. Trimmed server-side and never included in the JWT. Must not contain 4-byte characters such as emoji.

channel_idslist of integersOptional

A list of channel IDs that are valid for the requested token. Use this field for one or more channel IDs. One of channel_id or channel_ids is required; including neither returns an error, and including both results in unexpected behavior.

channel_idintegerOptional>=1

Channel ID that is valid for the requested token. Use this field to enter a single channel ID. We support this field for backwards compatibility, but channel_ids is preferred. One of channel_id or channel_ids is required; including neither returns an error, and including both results in unexpected behavior.

Response

The newly created storefront API token.
dataobjectOptional
metaobjectOptional
Response metadata.