Create Creative Template

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.

❗️

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.

Fields Object

The Fields of a creative template set which fields a UI user should enter for a creative. Each Field has its own object:

Key

Type

Name
(string)

Required. The name of the field. Must be 255 characters or less. Example: "Caption"

Variable
(string)

Required. The macro name of the field to be used in the Contents and/or accessed via a Decision API response. The macro name must begin with "ct". Example: "ctCaption"

Type
(string)

Required. The data type of the field. See the table below. Example: "String"

Required
(boolean)

If true, the field will be validated as required when the creative is saved. A required field cannot also be Hidden. Defaults to false

Description
(string)

A description of the field for the UI. Example: "This is the caption for the ad."

Hidden
(string)

If true, sets whether the field is hidden in the UI. Defaults to false.

Default
(string (if Type is string) or array (if Type is array))

Required only if Hidden is true, otherwise not allowed. It sets a default value for the field. Example:

"a" (if string)

["a" "b" "c"] (if array)

AdQuery
(boolean)

If true, the field can be queried via the AdQuery feature.

🚧

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 of the field will be the Default.

📘

There is a maximum of 100 fields per creative template.

Field Types

Value

Description

Example

String

A string. Max length of String values is 20,000 characters

"This is some text"

File

A file uploaded directly via the Kevel UI or API. The file name itself uses the Variable name {{ctImage}}.

"http://static.adzerk.net/ad.gif"

ExternalFile

An external URL of an image

"http://domain.com/ad.gif"

Array

An array of strings. For example, a list of tracking pixels to be served with the ad

["http://domain.com/pixel1.gif","http://domain2.com/pixel2.gif"]

Number

A float

0.5
1744819

Object

An object. Max size of Object values is 1 KB

{
    "SKU": "ZG011AQA",
    "Name": "Coca-Cola with Coffee Dark Blend - 12 fl oz",
    "AdvertiserId": 1,
    "image": "https://example.s3.amazonaws.com/Coca+Cola+with+Coffee.jpg",
    "price": "2.39",
    "description": "Great Coca-Cola taste infused with Brazilian coffee in Coca-Cola with Coffee Dark Blend."
  }

If your template creative requires uploading multiple images, you will need a file Field for uploading the image and a string Field for the image's path. See the example Fields below:

{
        "Field": {
          "Name": "Image1 Full URL",
          "Required": false,
          "Variable": "ctImage1",
          "Type": "String",
          "Hidden": true,
          "Default": "{{contentUrl}}/{{ctImage1}}"
        }
      },
      {
        "Field": {
          "Name": "Image2 Full URL",
          "Required": false,
          "Variable": "ctImage2",
          "Type": "String",
          "Hidden": true,
          "Default": "{{contentUrl}}/{{ctImage2}}"
        }
      },
      {
        "Field": {
          "Name": "Image1",
          "Required": true,
          "Variable": "ctBaseImage1",
          "Type": "File"
        }
      },
      {
        "Field": {
          "Name": "Image2",
          "Required": true,
          "Variable": "ctBaseImage2",
          "Type": "File"
        }
      }

Contents Object

A creative template can have 0 or more Contents that determine how the data set in the Fields should be outputted into the creative.

Each Contents has a Type that corresponds to the data type ados.js should use to render the creative, and the Body of the Content will be written to contents of the creative.

📘

There is a maximum of 10KB (or 10000 characters) of Contents data per template.

Key

Type

Type
(string)

Required. The data type ados.js should use to render the creative. Ex: "HTML"

Body
(string)

The data that should be written to the body of the creative. Max 10000 characters. Can use macros. Ex: "

Check out my cool caption: {{ctCaption}}
"

Content Types

Value

Description

Example(s)

HTML

If served via ados.js, executes the HTML on a page. Can also use macros for displaying uploaded images, etc.

This does not wrap the data in any tags, so it can also be used for non-HTML data types such as XML or JSON.

<div>This is the name: {{ctName}}</div>

{{contentUrl}}/{{ctImage}}

{"foo":"bar"} 

<foo>bar</foo>

JavaScript

If served via ados.js, executes JavaScript code in a <script> tag. You can define new functions, integrate with code currently running on the page, etc.

No example available

JavaScriptExternal

If served via ados.js, executes an externally hosted JavaScript file, written into <script src="..."> tags. Use the full path to the file.

http://domain.com/script.js

CSS

If served via ados.js, adds CSS into a page's stylesheet.

#azk12345 { width: auto; }

#azk{{placement.div.id}} { width: auto; }

Raw

If served via ados.js, wraps the data in a friendly Kevel iframe.

If served via the Decision API, can be used for any data type.


{"JSON":true}

🚧

Since Decision API responses do not render creatives on a page, the value of a Type will instead be rendered as the type in response, and the Body as body.

Language
Authentication
Header