Custom Template Associations
Associate a Stencil themeʼs custom templates with products, categories, brands, and pages.
Creating template associations
To create a template association, use the Upsert custom template associations endpoint
Entity IDs
The value of the entity ID is the ID property for the given entity. For example, a category entity ID is the id
property for the particular category object you want to act upon.
To get the entity IDs for categories, products, and brands, use the Get categories, Get products, and Get brands endpoints, respectively.
To get the entity ID for a page, use the Get pages endpoint.
Getting available templates
To get a list of available custom templates for each entity type, send a request to the Get all themes endpoint, then use the variation.uuid
property as the path parameter in a request to the Get custom templates endpoint.
To get the version UUID for an active theme, use the Get a channel active theme endpoint.
Resources
Get Custom Template Associations
GET https://api.bigcommerce.com/stores/{store_hash}/v3/storefront/custom-template-associationsRequest
Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- Accept in header with default of application/json - stringrequiredThe MIME type of the response body.
- channel_id in query - integerReturn results or act upon only template associations in the specified channel.
- entity_id:in in query - arrayA comma-separated list of entity IDs to return or act upon. Must be used together with the
type
filter. Currently, all supported entities have integer-type IDs.Type: array[integer] - type in query - stringFilter associations by type.
Allowed: product | category | brand | page
- limit in query - integerNumber of results to return per page.
- page in query - integerWhich page number to return, based on the limit value. Used to paginate large collections.
- is_valid in query - booleanOptional toggle to filter for exclusively valid or invalid associations entries. An invalid entry is one where its file name does not match up to an existing custom layout file in the currently active theme for the channel.
example
Response
Body
dataarray[object]
example-1
Upsert Custom Template Associations
PUT https://api.bigcommerce.com/stores/{store_hash}/v3/storefront/custom-template-associationsRequest
Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- Accept in header with default of application/json - stringrequiredThe MIME type of the response body.
- Content-Type in header with default of application/json - stringrequiredThe MIME type of the request body.
Body
channel_idinteger
requiredentity_typestring
requiredAllowed: product | category | brand | page
entity_idinteger
requiredfile_namestring
required
example-1
Response
Body
example
Delete Custom Template Associations
DELETE https://api.bigcommerce.com/stores/{store_hash}/v3/storefront/custom-template-associationsRequest
Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- Accept in header with default of application/json - stringrequiredThe MIME type of the response body.
- id:in in query - arrayA comma-separated string that specifies a list of association IDs to delete.Type: array[integer]
- channel_id in query - integerReturn results or act upon only template associations in the specified channel.
- type in query - stringFilter associations by type.
Allowed: product | category | brand | page
- entity_id:in in query - arrayA comma-separated list of entity IDs to return or act upon. Must be used together with the
type
filter. Currently, all supported entities have integer-type IDs.Type: array[integer]
example
Response
See something you can improve? Edit this file on GitHub