Get a Site’s Routes
GET /stores/{store_hash}/v3/sites/{site_id}/routes
Request
Get a site’s routes.
Authentication
- X-Auth-Token in header - required
Parameters
- store_hash in path - string
- Accept in header with default of application/json - string - required
The MIME type of the response body.
- site_id in path - integer - required
- type in query - string
Filter routes by a specified resource type.
- page in query - integer
Specifies the page number in a limited (paginated) list of items.
- limit in query - integer
Controls the number of items per page in a limited (paginated) list of items.
example
curl --request GET \ --url 'https://api.bigcommerce.com/stores/[store_hash]/v3/sites/[site_id]/routes' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'X-Auth-Token: xxxxxxxxxxxxxxxxx'
Response
Body
dataarray[object]
metaobject
Meta data relating to pagination.
response
{ "data": [ { "id": 1, "type": "product", "matching": "5", "route": "/products?id={id}" }, { "id": 2, "type": "category", "matching": "44", "route": "/category/{slug}" } ], "meta": { "pagination": { "total": 1, "count": 1, "per_page": 50, "current_page": 1, "total_pages": 1 } } }
Create a Site Route
POST /stores/{store_hash}/v3/sites/{site_id}/routes
Request
Create routes that tell BigCommerce how to link to pages on a headless storefront.
Usage Notes
- For a list of supported route types, see Route types.
Authentication
- X-Auth-Token in header - required
Parameters
- store_hash in path - string
- site_id in path - integer - required
- Content-Type in header with default of application/json - string - required
The MIME type of the request body.
Body
typestring
The type of resource being routed to; supported types.
Allowed: product | brand | category | page | blog | home | cart | checkout | search | account | login | returns | static
matchingstring
Depending on the resource type, this can be an ID (matching a specific item), or a "*" wildcard (matching all items of that type).
For example, a route with a type: "product" and matching: "5" will be used for the product with the ID of 5.
Example: 5
routestring
The route template that will be used to generate the URL for the requested resource.
Supports several tokens:
{id}
The ID of the requested item.{slug}
The slug for the requested item (if available). Note: theslug
value may contain/
slash.{language}
The language string that the client is using.
Example: /my-amazing-product
example
{ "type": "product", "matching": "5", "route": "/my-amazing-product" }
Response
Body
data
Route object used in responses.
metaobject
Response metadata.
response
{ "data": { "id": 123, "type": "checkout", "matching": "5", "route": "/my-amazing-product" }, "meta": {} }
Update a Site’s Routes
PUT /stores/{store_hash}/v3/sites/{site_id}/routes
Request
Upsert routes for site with ID {site_id}
.
Usage Notes
id
is required when updating an existing route.
Authentication
- X-Auth-Token in header - required
Parameters
- store_hash in path - string
- site_id in path - integer - required
- Content-Type in header with default of application/json - string - required
The MIME type of the request body.
Body
Route object used in responses.
idinteger
Unique ID for this route. Required when updating an existing route.
typestring
The type of resource being routed to; supported types.
Allowed: product | brand | category | page | blog | home | cart | checkout | search | account | login | returns | static
matchingstring
Depending on the resource type, this can be an ID (matching a specific item), or a "*" wildcard (matching all items of that type).
For example, a route with a type: "product" and matching: "5" will be used for the product with the ID of 5.
Example: 5
routestring
The route template that will be used to generate the URL for the requested resource.
Supports several tokens:
{id}
The ID of the requested item.{slug}
The slug for the requested item (if available). Note: theslug
value may contain/
slash.{language}
The language string that the client is using.
Example: /my-amazing-product
example
{ "id": 0, "type": "product", "matching": "5", "route": "/my-amazing-product" }
Response
Body
dataarray[object]
metaobject
Meta data relating to pagination.
response
{ "data": [ { "id": 123, "type": "brand", "matching": "5", "route": "/my-amazing-product" }, { "id": 345, "type": "blog", "matching": "5", "route": "/my-amazing-product" }, { "id": 234, "type": "returns", "matching": "5", "route": "/my-amazing-product" } ], "meta": { "pagination": { "total": 80, "count": 50, "per_page": 50, "current_page": 50, "total_pages": 2, "links": { "current": "?page=1&limit=50", "next": "?page=2&limit=50" } } } }
Get a Site Route
GET /stores/{store_hash}/v3/sites/{site_id}/routes/{route_id}
Request
Get a site’s route.
Authentication
- X-Auth-Token in header - required
Parameters
- store_hash in path - string
- Accept in header with default of application/json - string - required
The MIME type of the response body.
- site_id in path - string - required
- route_id in path - string - required
example
curl --request GET \ --url 'https://api.bigcommerce.com/stores/[store_hash]/v3/sites/[site_id]/routes/[route_id]' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'X-Auth-Token: xxxxxxxxxxxxxxxxx'
Response
Body
data
Route object used in responses.
metaobject
Response metadata.
response
{ "data": { "id": 60474753, "type": "checkout", "matching": "5", "route": "/my-amazing-product" }, "meta": {} }
Update a Site Route
PUT /stores/{store_hash}/v3/sites/{site_id}/routes/{route_id}
Request
Update a site’s route.
Authentication
- X-Auth-Token in header - required
Parameters
- store_hash in path - string
- site_id in path - string - required
- route_id in path - string - required
- Content-Type in header with default of application/json - string - required
The MIME type of the request body.
Body
typestring
requiredThe type of resource being routed to; supported types.
Allowed: product | brand | category | page | blog | home | cart | checkout | search | account | login | returns | static
matchingstring
requiredDepending on the resource type, this can be an ID (matching a specific item), or a "*" wildcard (matching all items of that type).
For example, a route with a type: "product" and matching: "5" will be used for the product with the ID of 5.
Example: 5
routestring
requiredThe route template that will be used to generate the URL for the requested resource.
Supports several tokens:
{id}
The ID of the requested item.{slug}
The slug for the requested item (if available). Note: theslug
value may contain/
slash.{language}
The language string that the client is using.
Example: /my-amazing-product
example
{ "type": "product", "matching": "5", "route": "/my-amazing-product" }
Response
Body
data
Route object used in responses.
metaobject
Response metadata.
response
{ "data": { "id": 123, "type": "checkout", "matching": "5", "route": "/my-amazing-product" }, "meta": {} }
Delete a Site Route
DELETE /stores/{store_hash}/v3/sites/{site_id}/routes/{route_id}
Request
Delete a site’s route.
Authentication
- X-Auth-Token in header - required
Parameters
- store_hash in path - string
- Accept in header with default of application/json - string - required
The MIME type of the response body.
- site_id in path - string - required
- route_id in path - string - required
example
curl --request DELETE \ --url 'https://api.bigcommerce.com/stores/[store_hash]/v3/sites/[site_id]/routes/[route_id]' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'X-Auth-Token: xxxxxxxxxxxxxxxxx'