Creating Channels
This section demonstrates how to create a channel and a channel site for a headless storefront.
Creating channels
Before you can display products on a headless storefront, you need to create a channel and a channel site for that storefront. A channel is essentially a sales platform such as a headless storefront, a marketplace, or a POS system. A site is a domain that links a headless storefront to a sales channel.
You can create both using the Channels API.
- Send a
POST
request to the/channels
endpoint to create a channel for your headless platform. Retrieve the channel ID returned in the response. You will use it to create a channel site and authenticate cross-origin requests. - Pass that channel ID in a
POST
request to/channels/{channel_id}/site
to create a site for the provided channel. - Create a headless storefront by setting the status of the default BigCommerce storefront to inactive and then create an active headless storefront within that one free storefront limit.
- Give this channel the primary domain and set the checkout domain for the headless storefront by sending a
PUT
request to the/channels/{channel_id}/site/checkout-url
endpoint. - Optionally, you can add a 3P SSL certificate for the checkout domain by sending a
GET
request to the/sites/{site_id}/certificate
endpoint. See Upsert a Site’s SSL/TLS Certificate Information for details. - After setting up the channel, you can authenticate cross-origin requests by creating a JWT token through the GraphQL Storefront API. Create your GraphQL Storefront API token with the same channel ID as your headless platform; otherwise, your request will be rejected.