Create Site Route

Create routes that tell BigCommerce how to link to pages on a [headless storefront](/developer/docs/storefront/headless). ## Usage Notes * For a list of supported route types, see [Route types](/developer/api-reference/rest/admin/management/sites#route-types).

Authentication

X-Auth-Tokenstring
### OAuth scopes | UI Name | Permission | Parameter | |:--------|:-----------|:----------| | Channel Listings | modify | `store_channel_listings` | | Channel Listings | read-only | `store_channel_listings_read_only` | | Channel Settings | modify | `store_channel_settings` | | Channel Settings | read-only | `store_channel_settings_read_only` | | Sites & Routes | modify | `store_sites` | | Sites & Routes | read-only | `store_sites_read_only` | ### Authentication header | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#api-accounts). | ### Further reading For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

Path parameters

site_idintegerRequired
The ID of the site.
store_hashstringRequired
Permanent ID of the BigCommerce store.

Headers

AcceptstringRequiredDefaults to application/json
The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body.

Request

This endpoint expects an object.
typeenumOptional

The type of resource being routed to; supported types.

matchingstringOptional

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.

routestringOptional

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: the slug value may contain / slash.
  • {language} The language string that the client is using.

Response

The requested site route.
dataobjectOptional
Route object used in responses.
metaobjectOptional
Response metadata.

Errors

422
Unprocessable Entity Error
502
Bad Gateway Error