BigCommerce
Theme & Content APIs
Custom Template Associations

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 /storefront/custom-template-associations

Request

Get a collection of the storeʼs custom template associations across all storefronts.

Authentication

  • X-Auth-Token in header
    required

Parameters

  • store_hash in path - string
  • channel_id in query - integer

    Return results or act upon only template associations in the specified channel.

  • entity_id:in in query - array

    A 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 in query - string

    Filter associations by type.

    Allowed values: product | category | brand | page
  • limit in query - integer

    Number of results to return per page.

  • page in query - integer

    Which page number to return, based on the limit value. Used to paginate large collections.

  • is_valid in query - boolean

    Optional 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

OK

Body

object | application/json
  • data
    array[object]

  • meta
    object

example-1

Upsert Custom Template Associations

PUT /storefront/custom-template-associations

Request

Upsert new custom template associations data across all storefronts. If an existing record is found for the combination of channel ID, entity ID, and type, the existing record will be overwritten with the new template.

Authentication

  • X-Auth-Token in header
    required

Parameters

  • store_hash in path - string
  • Content-Type in header with default of application/json - string
    required

    The MIME type of the request body.

Body

array | application/json
  • channel_id
    integer
    required

  • entity_type
    string
    required

    Allowed: product | category | brand | page

  • entity_id
    integer
    required

  • file_name
    string
    required

example-1

Response

Success response for batch upsert of custom template associations

Body

object | application/json

    example

    Delete Custom Template Associations

    DELETE /storefront/custom-template-associations

    Request

    Delete custom template associations. At least one query parameter must be used.

    Authentication

    • X-Auth-Token in header
      required

    Parameters

    • store_hash in path - string
    • id:in in query - array

      A comma-separated string that specifies a list of association IDs to delete.

    • channel_id in query - integer

      Return results or act upon only template associations in the specified channel.

    • type in query - string

      Filter associations by type.

      Allowed values: product | category | brand | page
    • entity_id:in in query - array

      A 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.

    example

    Response

    No Content

    Did you find what you were looking for?