Custom Template Associations

  • Version: 3.0.0
  • Servers:
    • https://api.bigcommerce.com/stores/store_hash/v3

Efficiently associate a stencil theme’s custom templates to products, categories, brands, and pages.

Authentication

Authenticate requests by including an OAuth access_token and client_id in the request headers.

GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/storefront/custom-template-associations
Content-Type: application/json
X-Auth-Token: {{ACCESS_TOKEN}}

OAuth scopes

UI Name Permission Parameter
Themes Read-only store_themes_read_only
Themes Manage store_themes_manage

Creating template associations

To associate custom templates to entities, send a PUT request to /v3/storefront/custom-template-associations.

PUT https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/storefront/custom-template-associations
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json

[
  {
    "channel_id": 1,
    "entity_type": "product",
    "entity_id": 12,
    "file_name": "custom-template-1.html"
  }
]

Open in Request Runner

Note

  • The allowed values for entity_type are product, category, brand, and page.

Getting entity IDs

Use the Catalog API to get the entity_id for category, product, and brand entity types. For example, to get all products, send a GET request to /v3/catalog/products.

GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/catalog/products
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json

Open in Request Runner

To get the entity_id for a content page, send a GET request to /v2/pages.

GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v2/pages
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json

Open in Request Runner

Getting available templates

To get available custom templates for each entity_type, send a GET request to /v3/themes/custom-templates/{version_uuid}.

GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/themes/custom-templates/{version_uuid}
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json

Open in Request Runner

Response:

{
  "data": {
    "product": [
      "custom-product-1.html"
    ],
    "category": [],
    "brand": [
      "custom-brand-1.html"
    ],
    "page": [
      "custom-page-1.html",
      "holiday-page.html"
    ]
  },
  "meta": {}
}

Getting theme UUIDs

To get the version_uuid for an active theme, send a GET request to /v3/channels/{channel_id}/active-theme.

GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/channels/{channel_id}/active-theme
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json

Open in Request Runner

Response:

{
  "data": {
    "active_theme_configuration_uuid": "748c5390-0b42-0139-b008-0242ac110013",
    "active_theme_uuid": "94bd1450-b873-0137-6902-0242ac11001f",
    "active_theme_version_uuid": "94dde070-b873-0137-6902-0242ac11001f",
    "saved_theme_configuration_uuid": "748c5390-0b42-0139-b008-0242ac110013"
  },
  "meta": {}
}

Additional information