Lab - Configure API Credentials and Channel
Lab - Configure API Credentials and Channel
Lab - Configure API Credentials and Channel
The BigCommerce APIs are the linchpin of your front-end’s integration with the platform, so the first step for your development journey is to generate the appropriate access credentials to allow your application to access those APIs. We’ll be generating two types of credentials: Store-level v2/v3 API account credentials and a GraphQL Storefront API token.
The credentials you generate in this lab will be needed for future labs, so make sure you store them securely.
If you are using a BigCommerce store for which you’ve already created a Catalyst channel in Introduction to Catalyst, you will need to ensure that Multi-Storefront is enabled in order to create the additional channel in this exercise.
You will be presented with a prompt to confirm or update to the various requirements for Multi-Storefront.

The OAuth scopes we’ve set will be used both for storefront operations and management of store data. This is convenient for a development-only context, but when configuring API accounts for a real store, you should restrict the scopes available to your front-end application. Create one account with the “Customers login” and “Carts” scopes, and a separate account for management.
After saving your API account, you will be presented with three values in a modal:
These values will not be retrievable once the displayed modal is closed!
The following steps will involve using a Postman environment to store your access token for API requests. While you are unlikely to use the client ID and client secret within Postman, such environment variables can be a convenient central place to secure all related credentials. Since we’ll be using Postman in future labs, feel free to store your credentials there now. (Make sure the environment you create is not in a shared workspace!)
While you will use the default storefront of your BigCommerce store for redirected checkout in subsequent labs, we’re going to create a separate, dedicated channel for your headless storefront itself.
Make sure to enter “{{store_hash}} and {{v3_token}} exactly as they appear. These are references to the environment variables you created and will inject their values.
name with a storefront name of your choice.Do not send the request just yet, as we will first add tests and logic to store the ID of the new channel.
These tests will ensure that the channel has been successfully created by examining the response for the channel ID.
This will store the ID of the new channel permanently in an environment variable alongside your other configuration details.
storefront_channel_id variable is populated in your environment variables list.If your request succeeded but any issue with your Tests scripts caused storefront_channel_id not to be stored, you can either delete the channel in Channel Manager in your BigCommerce control panel and try the request again after correcting the issue (which will require a different channel name), or else use the Get All Channels API endpoint to retrieve the new channel’s information and save storefront_channel_id manually.
https://store-{hash}-{channel ID}.mybigcommerce.com. This is the URL that will be used for GraphQL Storefront API requests.checkout URL in the response, which should be set to the URL of your default BigCommerce storefront. This is the configuration you’ll keep for your Redirected Checkout flow in your dev environment.It’s not actually the recommended practice to redirect to the default storefront for checkout. The checkout URL should be a domain that is assigned directly to the headless storefront channel. For the purposes of development in these lab exercises, however, you do not have a real domain to set.
Your channel does not yet have a “primary” URL, and while working with the channel in a local development environment, you will not have a public domain to set. The main implication of this will be that BigCommerce will not know how to properly generate links to your local headless storefront in your control panel or in Stencil pages like checkout.
In a full build, once you have a public domain and a strategy for checkout domain, you can update these with the following API endpoints:
Your storefront application’s primary interactions with BigCommerce will use the GraphQL Storefront API. For server-to-server use (including the Next.js app in the next lab), you need a Private Token. Create your Private Token now and store it in private_storefront_token.
Private Tokens are a new token type designed specifically for server-to-server use. They are the recommended approach for headless storefronts and server-side integrations.
Remember that you can also use a dynamic value for expires_at, by including a Pre-request Script to calculate a timestamp and store it as an environment or collection variable.
private_storefront_token variable is populated in your environment variables list. You will use this token (as BIGCOMMERCE_STOREFRONT_TOKEN) in the Next.js app in the next lab.Remember that existing catalog data in your store, if it exists, will not automatically be associated with your new channel. You must create a unique category tree for the channel and assign products.

If you prefer to create new products for use in your headless channel, subsequent labs will outline the necessary fields you will want to include for the features you’ll be building.
If you want to be able to complete checkout on your Catalyst storefront, you’ll need to make sure you have the appropriate minimal store configuration in place for shipping and payments.
This step is not channel-specific, so if you’ve previously configured shipping and payment options for your store, you won’t need to do any additional setup.
We won’t walk through the details of configuring your store settings, but make sure you have: