**Version: 202601**

# Create theme custom template

**POST** `/openapi/2026-01/themes/:theme_id/theme-templates`

Create a custom template and bind it to objects (products, collections) in one call; with empty `relations` the template is created without bindings.

## Request

**Path Parameters**

- `theme_id` string (required)

  Theme ID this template belongs to

**application/json**

**Body | Example**

**Body (required)**

- `type` string (required)

  Template type. One of `product`, `collection`, `product_coll`, `page`
- `title` string (required)

  Template display name
- `relations` string[]

  Bound object IDs (products / collections). Empty = create without binding
- `from` string

  Source template suffix to copy from, e.g. default
- `oseid` string

  Edit session ID the creation is performed within
- `selected_all` int32

  Bind every object matching `front_query_params` instead of listing them in `relations`: 0 = no (default), 1 = yes. When 1, the object set comes from `front_query_params`
- `front_query_params` object

  Filter that defines the object set when `selected_all` = 1; ignored otherwise

  - `search_keyword` string

    Keyword the object set is filtered by; only used when `selected_all` = 1
  - `collection_id` string

    Collection the object set is filtered by; only used when `selected_all` = 1

```json
{
  "type": "string",
  "title": "string",
  "relations": [
    "string"
  ],
  "from": "string",
  "oseid": "string",
  "selected_all": 0,
  "front_query_params": {
    "search_keyword": "string",
    "collection_id": "string"
  }
}
```

## Responses

**200**

OK

**application/json**

**Schema | Example**

**Schema**

- `code` string

  error code
- `message` string

  error message
- `data` object

  - `theme_template` object

    The created theme template. Only `id` is populated — all other fields are empty; call the template list endpoint to read the full record

    - `id` string

      Template unique ID
    - `theme_id` string

      Theme ID this template belongs to
    - `store_id` string

      Store ID
    - `doc_id` string

      Underlying doc (template file) ID
    - `type` string

      Template type: `product` (product detail page bound to products), `collection` (collection detail page), `product_coll` (product detail page bound to a collection), `page` (custom page, legacy)
    - `title` string

      Template display name
    - `suffix` string

      Template route suffix
    - `from` string

      Source template suffix the template was copied from
    - `obj_id` string

      The FIRST bound object's ID (product / collection / page id); empty when nothing is bound. A template may be bound to many objects — see `count` for the total; this field never lists them all
    - `obj_title` string

      The first bound object's display title (the same object as `obj_id`)
    - `source` string

      Data-operation source: which entry point wrote this record. Read-only, and not the same as `from`, which is the template this one was copied from
    - `created_at` string

      Created at
    - `updated_at` string

      Updated at
    - `icon` string

      Template icon URL
    - `count` string

      Number of objects bound to this template, returned as a decimal string (e.g. `12`), not as a number

```json
{
  "code": "string",
  "message": "string",
  "data": {
    "theme_template": {
      "id": "string",
      "theme_id": "string",
      "store_id": "string",
      "doc_id": "string",
      "type": "string",
      "title": "string",
      "suffix": "string",
      "from": "string",
      "obj_id": "string",
      "obj_title": "string",
      "source": "string",
      "created_at": "string",
      "updated_at": "string",
      "icon": "string",
      "count": "string"
    }
  }
}
```
