Get B2B Storefront Token

Generates a storefront authToken based on the supplied `customerId` of a storefront customer or Company user. You can use [Get Users](/developer/api-reference/rest/b2b/management/users) to retrieve the IDs of Company users, or you can use [Get All Customers](/developer/api-reference/rest/admin/management/customers/v3) to retrieve IDs for B2C customers and B2B buyers alike. You can also use the [BigCommerce Storefront GraphQL API](/developer/api-reference/graphql/storefront/authentication#login-mutation) to generate a Customer Access Token (CAT) and include it in the request, but this is not required for a successful response. The storefront authToken obtained from this endpoint is valid for **1 day**.

Authentication

X-Auth-Tokenstring
### Authentication header | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-accounts). | ### Further reading For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

Request

This endpoint expects an object.
customerIdintegerRequired
The ID of a BigCommerce customer account with a corresponding Company user account.
channelIdintegerOptional
The storefront channel ID where the order was placed.
customerAccessTokenobjectOptional

This object contains information related to the Customer Access Token (CAT) being associated with the storefront authToken.

Response

OK
codeintegerDefaults to 200
The HTTP Status code of the response.
dataobject
metaobject