Sites
- Host: api.bigcommerce.com/stores/store_hash/v3
- Protocols:
https
- Accepts:
application/json
- Responds With:
application/json
Create and manage sites and routes for headless storefront sales channels.
Authentication
Authenticate requests by sending an OAuth access_token
via X-Auth-Token
HTTP header.
GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites
Content-Type: application/json
X-Auth-Token: {{ACCESS_TOKEN}}
OAuth Scopes
UI Name | Permission | Parameter |
---|---|---|
Sites & Routes | modify | store_sites |
Sites & Routes | read-only | store_sites_read_only |
For more information on authenticating BigCommerce APIs, see Authentication.
Sites
Sites link headless storefronts to sales channels. To create a site, send a POST
request to /stores/{{STORE_HASH}}/v3/sites
.
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
{
"url": "http://store.example.com/",
"channel_id": 5
}
{
"id": 1,
"url": "http://store.example.com/",
"channel_id": 5,
"created_at": "2018-01-04T04:15:50.000Z",
"updated_at": "2018-01-04T04:15:50.000Z"
}
To get a list of sites, send a GET
request to /stores/{{STORE_HASH}}/v3/sites
.
GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites
X-Auth-Token: {{ACCESS_TOKEN}}
Accept: 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
.
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites/{site_id}/routes
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
{
"type": "product",
"matching": "12",
"route": "/en/product?id=12"
}
Route types
The following route types are supported.
Type | Description |
---|---|
account_new_return |
Route for shopper account page |
account_order_status |
Route for shopper order status account page |
cart |
Route to shopper’s cart |
checkout |
Route to checkout |
create_account |
Route to the create a shopper account page |
forgot_password |
Route to shopper forgot password page |
home |
Route to headless storefront homepage |
order_confirmation |
Route to the order confirmation page |
product |
Route for product details pages |
recover_abandoned_cart |
Route for URL in emails for a shopper to recover their abandoned cart |
unsubscribe |
Route for unsubscribe URL in emails |
Route variables
The following route variables are supported
Variable | Description |
---|---|
{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:
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/sites/{site_id}/routes
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
{
"type": "product",
"matching": "*",
"route": "/{lang}/{slug}?id={id}"
}