Sites

Create and manage sites and routes for headless storefront sales channels.

Note: For the “urls” object, we no longer modify the www prefix of the primary URL. The API returns URLs exactly as the customer enters them, similar to the “url” field.

  • If the customer saves a URL with www, the API returns it with www.
  • If the customer saves a URL without www, the API returns it without www.

Sites

Sites link headless storefronts to sales channels. To create a site, send a POST request to /stores/{{STORE_HASH}}/v3/sites.

1POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites
2X-Auth-Token: {{ACCESS_TOKEN}}
3Content-Type: application/json
4Accept: application/json
5
6{
7 "url": "http://store.example.com/",
8 "channel_id": 5
9}

Response

1{
2 "id": 1,
3 "url": "http://store.example.com/",
4 "channel_id": 5,
5 "created_at": "2022-01-04T04:15:50.000Z",
6 "updated_at": "2022-01-04T04:15:50.000Z"
7}

To get a list of sites, send a GET request to /stores/{{STORE_HASH}}/v3/sites.

1GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites
2X-Auth-Token: {{ACCESS_TOKEN}}
3Accept: application/json

Site routes

Site routes tell BigCommerce how to link to pages on a headless storefront. To create a route for a site, send a POST request to /stores/{{STORE_HASH}}/v3/sites/{site_id}/routes.

1POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites/{site_id}/routes
2X-Auth-Token: {{ACCESS_TOKEN}}
3Content-Type: application/json
4Accept: application/json
5
6{
7 "type": "product",
8 "matching": "12",
9 "route": "/en/product?id=12"
10}

Route types

The following route types are supported.

TypeDescription
productRoute for product details pages
brandRoute to brand pages
categoryRoute to category pages
blogRoute to blog page
homeRoute to storefront homepage
cartRoute to shopper’s cart
checkoutRoute to checkout page
searchRoute to store search page
accountRoute to account profile page
loginRoute to account login page
returnsRoute for return policy page
staticRoute to a static page
create_accountRoute to create new shopper account page
forgot_passwordRoute to shopper forgot password page
account_order_statusRoute for order status page
account_new_returnRoute for product returns page
recover_abandoned_cartRoute for URL in emails for a shopper to recover their abandoned cart

Route variables

The following route variables are supported.

VariableDescription
{id}The ID of the requested item
{slug}The slug for the requested item (if available). Note: the slug value may contain / slash
{lang}The language string that the client is using

Example:

1POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites/{site_id}/routes
2X-Auth-Token: {{ACCESS_TOKEN}}
3Content-Type: application/json
4Accept: application/json
5
6{
7 "type": "product",
8 "matching": "*",
9 "route": "/{lang}/{slug}?id={id}"
10}

Additional Information