---
updatedAt: 2026-11-06T14:56:49.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Create Creative Template

## Why Create a Creative Template?

When you want to create multiple creatives for your network, a creative template is a quick and easy way to create a standard format and style for all of your creatives while maintaining a consistent "look and feel."

This creates a new creative template for your network. The body of the request is a JSON object with the below fields. Do not specify an `Id` when creating a template. An `Id` will be assigned and returned with the response.

> ❗️ **Warning**
>
> All string keys and values are case sensitive. For example, `Name` is accepted but `name` is not, and the value `String` is accepted but `string` is not.

***

## API Syntax

When using the Create Creative Template API endpoint, it is important to understand the syntax required to make the request. Because the Kevel API is a RESTful API, there is a specific request format that must be followed to ensure the endpoint can process the request.

```
POST https://api.kevel.co/v2/creative-templates
```

Where:

* `POST`: the type of API request being made
* `https://api.kevel.co`: the base URL for the request
* `v2`: the API version
* `creative-templates`: the API endpoint being called

***

## Object Fields

The table below lists the various fields you can include in your `POST` request when creating a new creative template.

Each field in a creative template defines what a UI user should enter for a creative.

| Key                | Type            | Description                                                                                                                                                                                                                                                                                      |
| :----------------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Name`             | string          | **Required.** The name of the field. Must be ≤255 characters. Example: `"Caption"`.                                                                                                                                                                                                              |
| `Variable`         | string          | **Required.** The macro name of the field to be used in the `Contents` and/or Decision API response. Must begin with `ct`. Example: `"ctCaption"`. Only letters, numbers, and underscores are allowed.                                                                                           |
| `Type`             | string          | **Required.** The data type of the field. See **Field Types** below. Example: `"String"`.                                                                                                                                                                                                        |
| `Required`         | boolean         | If true, the field must be filled in. A required field cannot also be `Hidden`. Defaults to `false`.                                                                                                                                                                                             |
| `Description`      | string          | Optional. Description of the field in the UI. Example: `"This is the caption for the ad."`.                                                                                                                                                                                                      |
| `Hidden`           | boolean         | If true, hides the field in the UI. Defaults to `false`.                                                                                                                                                                                                                                         |
| `Default`          | string or array | Required only if `Hidden` is true. Defines a default value. Example: `"sponsored-brands"` or `["biz-123","org-456"]`.                                                                                                                                                                            |
| `AdQuery`          | boolean         | If true, the field can be queried via [AdQuery](https://dev.kevel.com/docs/adquery).                                                                                                                                                                                                                                    |
| `MaxBytes`         | integer         | File upload size limit (bytes). Max 2 MB (2,097,152). Only used when `Type` = `File`.                                                                                                                                                                                                            |
| `AllowedValues`    | array           | Optional. Restricts inputs for `String` or `Number` fields to specific values.                                                                                                                                                                                                                   |
| `Regex`            | string          | Optional. Enforces a regex pattern for `String` fields.                                                                                                                                                                                                                                          |
| `AllowPhraseMatch` | boolean         | Enables phrase ("fuzzy") matching for `String` fields in AdQuery. See [AdQuery documentation](https://dev.kevel.com/docs/adquery#phrase-or-fuzzy-matching).                                                                                                                                                             |
| `IndexOnly`        | boolean         | If true, the field is used for AdQuery targeting only and is left out of the field data returned in ad decision responses. Requires `AdQuery` to be `true`. Only for `String`, `Number` and `Array` fields. Defaults to `false`. See [Targeting-only fields](https://dev.kevel.com/docs/adquery#targeting-only-fields). |

> 🚧 **Caution**
>
> You cannot provide a `Default` if a field is not `Hidden`.
>
> If a creative API request sets a value for a `Hidden` field that uses a `Default`, the creative will be saved with that overridden value. Otherwise, the value will remain the `Default`.

> 📘 **Note**
>
> There is a maximum of **100 fields** per creative template.

> 🚧 **Restrictions When Adding Custom Validation**
>
> `AllowedValues` and `Regex` rules can only be **added**, not modified or removed, once saved. This prevents existing creatives from entering invalid states due to rule changes.

> 🚧 **`IndexOnly` Cannot Be Turned Off**
>
> Once `IndexOnly` is `true` on a field, it cannot be set back to `false`. Every later update to the template must include `"IndexOnly": true` for that field. An update that sets it to `false`, or leaves it out, is rejected.

***

## Field Types

| Value          | Description                                                                         | Example                                                                                    |
| :------------- | :---------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- |
| `String`       | A string value. Max length: 20,000 characters.                                      | `"This is some text"`                                                                      |
| `File`         | A file uploaded via Kevel UI or API. The file name uses the variable `{{ctImage}}`. | `https://static.adzerk.net/ad.gif`                                                         |
| `ExternalFile` | A URL for an externally hosted file or image.                                       | `https://domain.com/ad.gif`                                                                |
| `Array`        | A list of strings. For example, tracking pixels to serve with the ad.               | `["https://tracker1", "https://tracker2"]`                                                 |
| `Number`       | A numeric (float) value.                                                            | `0.5`, `1744819`                                                                           |
| `Object`       | A JSON object. Max size: 1 KB.                                                      | `json { "SKU": "ZG011AQA", "Name": "Coca-Cola with Coffee Dark Blend", "price": "2.39" } ` |

If your creative template requires **multiple images**, include both a file field (for upload) and a string field (for the path).

Total uploaded files per creative cannot exceed **10 MB** (for example, 5 × 2 MB files).

```json
[
  {
    "Field": {
      "Name": "Image1 Full URL",
      "Required": false,
      "Variable": "ctImage1",
      "Type": "String",
      "Hidden": true,
      "Default": "{{contentUrl}}/{{ctImage1}}"
    }
  },
  {
    "Field": {
      "Name": "Image1",
      "Required": true,
      "Variable": "ctBaseImage1",
      "Type": "File"
    }
  }
]
```

***

## Contents Object

A creative template can have 0 or more `Contents` that determine how the field data is rendered in the creative.

Each content entry includes a `Type` (rendering method) and a `Body` (creative markup).

> 📘 **Note**
>
> Maximum **10 KB** (`10,000` characters) of content data per template.

| Key    | Type   | Description                                                                                                                     |
| :----- | :----- | :------------------------------------------------------------------------------------------------------------------------------ |
| `Type` | string | **Required.** The data type ados.js uses to render the creative. Example: `"HTML"`.                                             |
| `Body` | string | The creative body markup. Max 10,000 characters. Macros allowed. Example: `<div>Check out my cool caption: {{ctCaption}}</div>` |

***

## Content Types

| Value                | Description                                                                                                                            | Example                                          |
| :------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------- |
| `HTML`               | Executes as HTML via ados.js. Can include macros like `{{ctName}}`. Does **not** wrap data in tags, so it can also output XML or JSON. | `<div>This is the name: {{ctName}}</div>`        |
| `JavaScript`         | Executes JavaScript code in a `<script>` tag when served via ados.js.                                                                  | *No example provided.*                           |
| `JavaScriptExternal` | Executes an external JS file included with `<script src="...">`.                                                                       | `https://domain.com/script.js`                   |
| `CSS`                | Injects CSS into a page's stylesheet via ados.js.                                                                                      | `#azk12345 { width: auto; }`                     |
| `Raw`                | Wraps data in a Kevel iframe (ados.js) or returns raw body (Decision API).                                                             | `{{contentUrl}}/{{ctImage}}` or `{"JSON": true}` |

> 🚧 **Caution**
>
> Decision API responses return `type` and `body` fields instead of rendering creatives on a page.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "management-api-2",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.kevel.co"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "X-Adzerk-ApiKey",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v2/creative-templates": {
      "post": {
        "summary": "Create Creative Template",
        "description": "",
        "operationId": "create-creative-template",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "Name",
                  "Description"
                ],
                "properties": {
                  "Name": {
                    "type": "string",
                    "description": "The friendly name of the creative template, visible in the UI. Must be 50 characters or less"
                  },
                  "Description": {
                    "type": "string",
                    "description": "A *short* description of a template, visible in the UI. Best used as a version number. Must be 100 characters or less"
                  },
                  "IsArchived": {
                    "type": "boolean",
                    "description": "If true, archives the creative template. Defaults to `false`.",
                    "default": false
                  },
                  "Fields": {
                    "type": "array",
                    "description": "Sets the creative template Fields. Requires zero or more objects. See above for more details."
                  },
                  "Contents": {
                    "type": "array",
                    "description": "Sets the creative template Contents. Requires zero or more objects. See above for more details."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{  \n  \"Id\":12345,\n  \"Description\": \"Template Description\",\n  \"Name\": \"Template Name v1\",\n  \"IsArchived\": false,\n  \"Fields\": [\n    {\n      \"Name\": \"Title\",\n      \"Description\": \"The Template Title\",\n      \"Type\": \"String\",\n      \"Variable\": \"ctTitle\",\n      \"Required\": true,\n      \"AdQuery\": false\n    },\n    {\n      \"Name\": \"Thumbnail\",\n      \"Description\": \"The URL of a Thumbnail Image\",\n      \"Type\": \"String\",\n      \"Variable\": \"ctThumbnailUrl\",\n      \"Required\": false,\n      \"AdQuery\": true\n    }\n  ],\n  \"Contents\": [\n    {\n      \"Type\": \"Raw\",\n      \"Body\": \"{\\\"title\\\": \\\"{{ctTitle}\\\", \\\"thumbnailUrl\\\": \\\"{{ctThumbnailUrl}}\\\" }\"\n    }\n  ]\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "Id": {
                      "type": "integer",
                      "example": 12345,
                      "default": 0
                    },
                    "Description": {
                      "type": "string",
                      "example": "Template Description"
                    },
                    "Name": {
                      "type": "string",
                      "example": "Template Name v1"
                    },
                    "IsArchived": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "Fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "Name": {
                            "type": "string",
                            "example": "Title"
                          },
                          "Description": {
                            "type": "string",
                            "example": "The Template Title"
                          },
                          "Type": {
                            "type": "string",
                            "example": "String"
                          },
                          "Variable": {
                            "type": "string",
                            "example": "ctTitle"
                          },
                          "Required": {
                            "type": "boolean",
                            "example": true,
                            "default": true
                          },
                          "AdQuery": {
                            "type": "boolean",
                            "example": false,
                            "default": true
                          }
                        }
                      }
                    },
                    "Contents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "Type": {
                            "type": "string",
                            "example": "Raw"
                          },
                          "Body": {
                            "type": "string",
                            "example": "{\"title\": \"{{ctTitle}\", \"thumbnailUrl\": \"{{ctThumbnailUrl}}\" }"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -X POST -H \"X-Adzerk-ApiKey:$ADZERK_API_KEY\" -H \"Content-Type: application/json\" -d '{\"Description\":\"Template Description\",\"Name\":\"Template Name v1\",\"IsArchived\":false,\"Fields\":[{\"Name\":\"Title\",\"Description\":\"The Template Title\",\"Type\":\"String\",\"Variable\":\"ctTitle\",\"Required\":true,\"AdQuery\":false},{\"Name\":\"Thumbnail\",\"Description\":\"The URL of a Thumbnail Image\",\"Type\":\"String\",\"Variable\":\"ctThumbnailUrl\",\"Required\":false,\"AdQuery\":true}],\"Contents\":[{\"Type\":\"Raw\",\"Body\":\"{\\\"title\\\":\\\"{{ctTitle}}\\\",\\\"thumbnailUrl\\\":\\\"{{ctThumbnailUrl}}\\\"}\"}]}' \"https://api.kevel.co/v2/creative-templates\""
            },
            {
              "language": "javascript",
              "code": "const Adzerk = require('@adzerk/management-sdk');\nconst apiKey = process.env.ADZERK_API_KEY;\n\nasync function createCreativeTemplate() {\n  let specifications = await Adzerk.fetchSpecifications();\n  let client = await Adzerk.buildClient({apiKey, specifications});\n\n  let creativeTemplate = await client.run('creativeTemplate', 'create', {\n    description: 'Template Description',\n    name: 'Template Name v1', // TIP: include version in name\n    isArchived: false,\n    fields: [{\n      name: 'Title',\n      description: 'The Template Title',\n      type: 'String',\n      variable: 'ctTitle',\n      required: true,\n      adQuery: false,\n    }, {\n      name: 'Thumbnail',\n      description: 'The URL of a Thumbnail Image',\n      type: 'String',\n      variable: 'ctThumbnailUrl',\n      required: false,\n      adQuery: true\n    }],\n    contents: [{\n      type: 'Raw', // Use \"Raw\" for JSON payloads\n      body: '{\"title\": \"{{ctTitle}}\", \"thumbnailUrl\": \"{{ctThumbnailUrl}}\" }'\n    }],\n  });\n  console.log(creativeTemplate);\n}\n\ncreateCreativeTemplate();"
            },
            {
              "language": "ruby",
              "code": "require \"adzerk\"\n\ndef create_creative_template()\n    client = Adzerk::Client.new(ENV[\"ADZERK_API_KEY\"])\n    data = {\n        description: 'Template Description',\n        name: 'Template Name v3', # TIP: include version in name\n        is_archived: false,\n        fields: [{\n            name: 'Title',\n            description: 'The Template Title',\n            type: 'String',\n            variable: 'ctTitle',\n            required: true,\n          \tad_query: false,\n        },\n        {\n            name: 'Thumbnail',\n            description: 'The URL of a Thumbnail Image',\n            type: 'String',\n            variable: 'ctThumbnailUrl',\n            required: false,\n          \tad_query: true,\n        }],\n        contents: [{\n            type: 'Raw',  # Use \"Raw\" for JSON payloads\n            body: '{\"title\": \"{{ctTitle}}\", \"thumbnailUrl\": \"{{ctThumbnailUrl}}\" }'\n        }]\n    }\n    pp client.creative_templates.create(data)\nend\ncreate_creative_template()"
            }
          ],
          "samples-languages": [
            "curl",
            "javascript",
            "ruby"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "X-Adzerk-Sdk-Version",
        "value": "Readme.io:ManagementAPI2"
      }
    ],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```