> ## Documentation Index
> Fetch the complete documentation index at: https://developers.criteo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creative Builder

export const EndpointBadge = ({method = "GET", children}) => {
  const METHOD_STYLES = {
    GET: {
      bg: "mint-bg-[#2AB673]"
    },
    POST: {
      bg: "mint-bg-[#3064E3]"
    },
    PUT: {
      bg: "mint-bg-[#C28C30]"
    },
    PATCH: {
      bg: "mint-bg-[#DA622B]"
    },
    DELETE: {
      bg: "mint-bg-[#CB3A32]"
    },
    API: {
      bg: "mint-bg-black"
    }
  };
  const key = method.toUpperCase();
  const styles = METHOD_STYLES[key] ?? METHOD_STYLES.API;
  return <div className="relative mt-7">
      <span className={`absolute -top-2 -left-2 z-10 ${styles.bg} text-white px-2.5 py-0.5 rounded-full text-xs font-bold tracking-wide`}>
        {key}
      </span>
      {children}
    </div>;
};

<Note>
  **Getting Started**

  The creative builder will enable to construction of new creatives through the API. In this document, you will find details regarding the different sections of a creative template variable. A creative comprises five [template variable values](/retail-media/docs/creative-builder#template-variable-value), which is a required array used in the **POST** or **PUT** calls when building a new creative. Any existing [template variable](/retail-media/docs/creative-builder#template-variable) can be found under `sections` of the **GET** Retailer Template endpoint.
</Note>

 

## **Endpoints**

<table>
  <thead>
    <tr>
      <th>
        <p>
          Verb
        </p>
      </th>

      <th>
        <p>
          Endpoint
        </p>
      </th>

      <th>
        <p>
          Description
        </p>
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        <p>
          <b>
            GET
          </b>
        </p>
      </td>

      <td>
        <p>
          <code>
            /\{retailer-id}/templates
          </code>
        </p>
      </td>

      <td>
        <p>
          Get a list of available creative templates for a specified retailer
        </p>
      </td>
    </tr>

    <tr>
      <td>
        <p>
          <b>
            POST
          </b>
        </p>
      </td>

      <td>
        <p>
          <code>
            /\{account-id}/creatives
          </code>
        </p>
      </td>

      <td>
        <p>
          Create a new account creative
        </p>
      </td>
    </tr>

    <tr>
      <td>
        <p>
          <b>
            GET
          </b>
        </p>
      </td>

      <td>
        <p>
          <code>
            /\{account-id}/creatives/\{creative-id}
          </code>
        </p>
      </td>

      <td>
        <p>
          Get account creative by creative id
        </p>
      </td>
    </tr>

    <tr>
      <td>
        <p>
          <b>
            PUT
          </b>
        </p>
      </td>

      <td>
        <p>
          <code>
            /\{account-id}/creatives/\{creative-id}
          </code>
        </p>
      </td>

      <td>
        <p>
          Update an existing creative
        </p>
      </td>
    </tr>
  </tbody>
</table>

 

## **Creative Attributes**

<ParamField path="id" type="string">
  **Value:** int64

  **Is Nullable?** No

  Id for the entity
</ParamField>

<ParamField path="type" type="string">
  **Value:** -

  **Is Nullable?** No

  Canonical type name of the entity. These types correspond to the different values that can be set to a particular `TemplateVariableValue`
</ParamField>

<ParamField path="creativeFormat" type="enum , string" required>
  **Is Nullable?** No

  Creative template available to use for template creation

  `Unknown`,

  `FlagShip`,

  `Showcase`,

  `SponsoredProducts`,

  `Butterfly`,

  `BundleBoost`,

  `IAB`,

  `CUSTOM`,

  `DisplayPanel` ,

  `DigitalShelfTalker`
</ParamField>

<ParamField path="name" type="string" required>
  **Value:** -

  **Is Nullable?** false

  The name of the template
</ParamField>

<ParamField path="retailerId" type="integer">
  **Value:** int32

  **Is Nullable?** No

  The retailer associated to the template
</ParamField>

<ParamField path="skuCollectionMin" type="integer" required>
  **Value:** int32

  **Is Nullable?** No

  Min number of collections to configure in the ad
</ParamField>

<ParamField path="skuCollectionMax" type="integer">
  **Value:** int32

  **Is Nullable?** Yes

  Max number of collections that can be configured in the ad
</ParamField>

<ParamField path="skuPerCollectionMin" type="integer" required>
  **Value:** int32

  **Is Nullable?** No

  Min number of SKUs to be configured in the ad for each collection
</ParamField>

<ParamField path="skuPerCollectionMax" type="integer">
  **Value:** int32

  **Is Nullable?** Yes

  Max number of SKUs to be configured in the ad for each collection
</ParamField>

<ParamField path="displayableSkusMax" type="integer">
  **Value:** int32

  **Is Nullable?** Yes

  Max number of SKUs that can serve at once for this ad
</ParamField>

<ParamField path="allCollectionsMandatory" type="boolean" required>
  **Value:** `true`,`false`

  **Is Nullable?** No

  If set to true, the ad will only serve if a SKU from each collection is available
</ParamField>

<ParamField path="createdAt" type="string" required>
  **Value:** date-time

  **Is Nullable?** No

  The time at which the template was created
</ParamField>

<ParamField path="updatedAt" type="string" required>
  **Value:** date-time

  **Is Nullable?** No

  The time at which the template was updated
</ParamField>

<ParamField path="creativeFormatType" type="integer">
  **Value:** -

  **Is Nullable?** No

  Type of creative format
</ParamField>

<ParamField path="environments" type="integer">
  **Value:** `Web` = 1 , `Mobile` = 2 , `App` = 3

  **Is Nullable?** No

  Type of web environment creative format is eligible to serve on
</ParamField>

<ParamField path="associatedLineItemsId" type="string">
  **Value:** int64

  **Is Nullable?** No

  Line item ids that is associated with the creative
</ParamField>

## Environments Variable

Provides the list of environments details suitable for the ad, like page type and display environment

<ParamField path="environments:pageType" type="enum | strings" required>
  **Is Nullable?** No

  Page type where the creative is suitable to deliver

  `Unknown`,

  `Search`,

  `Home`,

  `Browse`,

  `Checkout`,

  `Category`,

  `ProductDetail`,

  `Confirmation`,

  `Merchandising`,

  `Deals`,

  `Favorites`,

  `SearchBar`,

  `CategoryMenu`
</ParamField>

<ParamField path="environments:environments" type="array of enum | strings" required>
  **Is Nullable?** No

  List of environments per `pageType` where the creative is suitable to deliver

  `Web`,

  `Mobile`,

  `App`,

  `Lockout`,

  `Mixed`,

  `iOS`,

  `Android`
</ParamField>

## Template Variable

Provides the template settings details, such as the type of variables available in each template.

<ParamField path="templateVariable.id" type="string" required>
  **Is Nullable?** No

  The id of the template variable
</ParamField>

<ParamField path="templateVariable.required" type="boolean" required>
  **Value:** `true`, `false`

  **Is Nullable?** No

  Presents if the template variable is a required field
</ParamField>

<ParamField path="templateVariable.type" type="enum | strings" required>
  **Is Nullable?** No

  The type variable of the template settings. The variable type will determine which `ChoiceVariableSpecification` that can be used

  `Text`,

  `Choice`,

  `Color`,

  `Files`,

  `Hyperlink`
</ParamField>

## Template Variable | ChoiceVariableSpecification

This field wraps an array of strings that should contain the ***choices*** provided by the corresponding *ChoiceVariableSpecification*. Choice variables are optional, and they are equivalent to a set of drop-down choices one would select in the RMP UI.

<ParamField path="choiceVariableSpecification.options.ChoiceOption.dependentVariables" type="string" required>
  **Is Nullable?** No

  Template variables unblocked when the option is chosen
</ParamField>

<ParamField path="choiceVariableSpecification.options.ChoiceOption.id" type="string" required>
  **Value:** -

  **Is Nullable?** No

  The id of the option
</ParamField>

<ParamField path="choiceVariableSpecification.maxSelected" type="integer">
  **Value:** int32

  **Is Nullable?** Yes

  The maximum number of selectable options
</ParamField>

<ParamField path="choiceVariableSpecification.minSelected" type="integer">
  **Value:** int32

  **Is Nullable?** Yes

  The minimum number of selectable options
</ParamField>

## Template Variable | textVariableSpecification

Variables in the `texVariableSpecification` specifies the max number of characters

<ParamField path="textVariableSpecification.maxChars" type="integer">
  **Value:** -

  **Is Nullable?** yes

  The maximum amount of characters accepted for the text
</ParamField>

## Template Variable | filesVariablesSpecification

Present if the variable is set to one or more asset ids.  The fields here specify the acceptable file extensions of the assets and the min and max numbers that can be provided.

<ParamField path="filesVariablesSpecification.extensions" type="enum - string" required>
  **Is Nullable?** No

  The accepted file extensions

  `unknown`,

  `jpeg`,

  `png`,

  `gif`,

  `pdf`
</ParamField>

<ParamField path="filesVariablesSpecification.maxBytes" type="integer">
  **Value:** int32

  **Is Nullable?** Yes

  The maximum amount of bytes per file
</ParamField>

<ParamField path="filesVariablesSpecification.minFiles" type="integer" required>
  **Value:** int32

  **Is Nullable?** Yes

  The minimum amount of files requires
</ParamField>

<ParamField path="filesVariablesSpecification.maxFile" type="integer">
  **Value:** int32

  **Is Nullable?** Yes

  The maximum amount of files required
</ParamField>

## Template Variable Value

Provided when creating ([POST](/retail-media/docs/creative-builder#create-creative)) or updating ([PUT](/retail-media/docs/creative-builder#update-creatives)) a creative.

<ParamField path="templateVariableValue.id" type="string" required>
  **Value:** -

  **Is Nullable?** No

  The id of the template variable the value is applied to. The id is equivalent to the template field name one would see in RMP. This variable in the POST/PUT calls informs which template fields to be modified.
</ParamField>

<ParamField path="templateVariableValue.textVariableValue.text" type="string" required>
  **Value:** -

  **Is Nullable?** No

  The displayed text
</ParamField>

<ParamField path="templateVariableValue.choiceVariableValue.chosenOptions" type="string">
  **Value:** -

  **Is Nullable?** No

  The chosen options
</ParamField>

<ParamField path="templateVariableValue.colorVariableValue.color" type="string" required>
  **Value:** -

  **Is Nullable?** False

  The displayed color (HEX format)
</ParamField>

<ParamField path="templateVariableValue.filesVariableValue.assetIds" type="string" required>
  **Value:** min. length: 1

  **Is Nullable?** No

  The assets representing the images to be displayed
</ParamField>

<ParamField path="templateVariableValue.hyperlinkVariableValue.url" type="string" required>
  **Value:** -

  **Is Nullable?** No

  The url to redirect to
</ParamField>

## **Get Retailer Templates**

Get a list of available creative templates for a specific retailer

<EndpointBadge method="get">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/retailers/{retailer-id}/templates
  ```
</EndpointBadge>

**Sample Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl -L -X GET 'https://api.criteo.com/{version}/retail-media/retailers/299/templates' \
  -H 'Authorization: Bearer <MY_ACCESS_TOKEN>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.criteo.com/{version}/retail-media/retailers/299/templates"

  payload={}
  headers = {
    'Authorization': 'Bearer <MY_ACCESS_TOKEN>'
  }

  response = requests.request("GET", url, headers=headers, data=payload)

  print(response.text)
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();

  MediaType mediaType = MediaType.parse("text/plain");
  RequestBody body = RequestBody.create(mediaType, "");

  Request request = new Request.Builder()
    .url("https://api.criteo.com/{version}/retail-media/retailers/299/templates")
    .method("GET", body)
    .addHeader("Authorization", "Bearer <MY_ACCESS_TOKEN>")
    .build();

  Response response = client.newCall(request).execute();
  ```

  ```php PHP theme={null}
  <?php
  require_once 'HTTP/Request2.php';
  $request = new HTTP_Request2();
  $request->setUrl('https://api.criteo.com/{version}/retail-media/retailers/299/templates');
  $request->setMethod(HTTP_Request2::METHOD_GET);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));

  $request->setHeader(array(
    'Authorization' => 'Bearer <MY_ACCESS_TOKEN>'
  ));

  try {
    $response = $request->send();
    if ($response->getStatus() == 200) {
      echo $response->getBody();
    }
    
    else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
      $response->getReasonPhrase();
    }
  }

  catch(HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
  ```
</CodeGroup>

**Sample Response**

```json JSON expandable theme={null}
{
    "data": [
        {
            "attributes": {
                "creativeFormat": "CUSTOM",
                "name": "Overrides Test Template",
                "retailerId": 299,
                "skuCollectionMin": 1,
                "skuCollectionMax": 20,
                "skuPerCollectionMin": 1,
                "skuPerCollectionMax": null,
                "displayableSkusMax": 5,
                "allCollectionsMandatory": false,
                "createdAt": "0001-01-01T00:00:00+00:00",
                "updatedAt": "0001-01-01T00:00:00+00:00",
                "sections": [
                    {
                        "title": "Background Images",
                        "description": null,
                        "templateVariables": [
                            {
                                "id": "desktop_background_image",
                                "required": false,
                                "type": "Files",
                                "filesVariablesSpecification": {
                                    "extensions": [
                                        "Jpeg",
                                        "Gif",
                                        "Png"
                                    ],
                                    "minFiles": 0
                                }
                            },
                            {
                                "id": "border_color",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "button_color",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "selected_button_color",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "button_text_color",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "selected_button_text_color",
                                "required": false,
                                "type": "Color"
                            }
                        ]
                    },
                    {
                        "title": "Redirection URL",
                        "description": null,
                        "templateVariables": [
                            {
                                "id": "optional_footer_type",
                                "required": false,
                                "type": "Choice",
                                "choiceVariableSpecification": {
                                    "options": [
                                        {
                                            "dependentVariables": [],
                                            "id": "Open a file"
                                        },
                                        {
                                            "dependentVariables": [],
                                            "id": "Legal Text"
                                        },
                                        {
                                            "dependentVariables": [],
                                            "id": "Open a link"
                                        }
                                    ]
                                }
                            },
                            {
                                "id": "optional_footer_redirect_target",
                                "required": false,
                                "type": "Choice",
                                "choiceVariableSpecification": {
                                    "options": [
                                        {
                                            "dependentVariables": [],
                                            "id": "On current page"
                                        },
                                        {
                                            "dependentVariables": [],
                                            "id": "On new page"
                                        }
                                    ]
                                }
                            },
                            {
                                "id": "optional_footer_text_color",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "optional_footer_background_color",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "optional_footer_type_2",
                                "required": false,
                                "type": "Choice",
                                "choiceVariableSpecification": {
                                    "options": [
                                        {
                                            "dependentVariables": [],
                                            "id": "Open a file"
                                        },
                                        {
                                            "dependentVariables": [],
                                            "id": "Legal Text"
                                        },
                                        {
                                            "dependentVariables": [],
                                            "id": "Open a link"
                                        }
                                    ]
                                }
                            },
                            {
                                "id": "optional_footer_redirect_target_2",
                                "required": false,
                                "type": "Choice",
                                "choiceVariableSpecification": {
                                    "options": [
                                        {
                                            "dependentVariables": [],
                                            "id": "On current page"
                                        },
                                        {
                                            "dependentVariables": [],
                                            "id": "On new page"
                                        }
                                    ]
                                }
                            },
                            {
                                "id": "optional_footer_text_color_2",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "optional_footer_background_color_2",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "redirect_target",
                                "required": false,
                                "type": "Choice",
                                "choiceVariableSpecification": {
                                    "options": [
                                        {
                                            "dependentVariables": [],
                                            "id": "On current page"
                                        },
                                        {
                                            "dependentVariables": [],
                                            "id": "On new page"
                                        }
                                    ]
                                }
                            },
                            {
                                "id": "footer_text_color",
                                "required": false,
                                "type": "Color"
                            },
                            {
                                "id": "footer_background_color",
                                "required": false,
                                "type": "Color"
                            }
                        ]
                    }
                ],
                "id": "52"
            },
            "id": "52",
            "type": "Template"
        }
    ],
    "warnings": [],
    "errors": []
}
```

## **Create Creative**

* The create creative endpoint will generate a new creative for an account id. The endpoint request body consists of an array called `templateVariableValues` which will be used to specify the template variables that will be modified during the creative generation.

* The template variables that can be modified are dependent on each creative template. This information is provided in the [GET | Retailer Templates](/retail-media/docs/creative-builder#get-retailer-templates) response, under the `templateVariables` array.

* Multiple template variables can be specified in each call. See the sample response for an example of how to set up the endpoint.

 

<Warning>
  **Creative Asset Upload API**

  The Create Creative endpoint will require an `assetId`. Before generating a new creative ID, upload new creative assets files using the [Creative Asset Upload endpoint](/retail-media/docs/creative-asset-upload) to obtain the `assetId`.
</Warning>

<EndpointBadge method="post">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/accounts/{account-id}/creatives
  ```
</EndpointBadge>

**Sample Request**

<CodeGroup>
  ```bash cURL expandable theme={null}
  curl -L -X POST 'https://api.criteo.com/{version}/retail-media/accounts/5/creatives' \
  -H 'Authorization: Bearer <MY_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
      "name": " Demo API CreativeV5",
      "brandId": 118301,
      "retailerId": 299,
      "templateId": 51,
      "templateVariableValues": [
          {
              "id": "cta_text",
              "textVariableValue": {
                  "text": "Call To Action Text"
              }
          },
          {
              "id": "optional_footer_type",
              "choiceVariableValue": {
                  "chosenOptions": [
                      "Open a file"
                  ]
              }
          },
          {
              "id": "optional_footer_redirect_target",
              "choiceVariableValue": {
                  "chosenOptions": [
                      "On current page"
                  ]
              }
          },
          {
              "id": "button_text_color",
              "colorVariableValue": {
                  "color": "#4C88a5"
              }
          },
          {
              "id": "footer_background_color",
              "colorVariableValue": {
                  "color": "#2133CD"
              }
          },
          {
              "id": "desktop_background_image",
              "filesVariableValue": {
                  "assetIds": [
                      "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
                  ]
              }
          },
          {
              "id": "optional_redirect_url",
              "hyperlinkVariableValue": {
                  "url": "https://www.criteo.com"
              }
          }
      ]
  }'
  ```

  ```python Python expandable theme={null}
  import requests
  import json

  url = "https://api.criteo.com/{version}/retail-media/accounts/5/creatives"

  payload = json.dumps({
    "name": " Demo API CreativeV9",
    "brandId": 118301,
    "retailerId": 299,
    "templateId": 51,
    "templateVariableValues": [
      {
        "id": "cta_text",
        "textVariableValue": {
          "text": "Call To Action Text"
        }
      },
      {
        "id": "optional_footer_type",
        "choiceVariableValue": {
          "chosenOptions": [
            "Open a file"
          ]
        }
      },
      {
        "id": "optional_footer_redirect_target",
        "choiceVariableValue": {
          "chosenOptions": [
            "On current page"
          ]
        }
      },
      {
        "id": "button_text_color",
        "colorVariableValue": {
          "color": "#4C88a5"
        }
      },
      {
        "id": "footer_background_color",
        "colorVariableValue": {
          "color": "#2133CD"
        }
      },
      {
        "id": "desktop_background_image",
        "filesVariableValue": {
          "assetIds": [
            "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
          ]
        }
      },
      {
        "id": "optional_redirect_url",
        "hyperlinkVariableValue": {
          "url": "https://www.criteo.com"
        }
      }
    ]
  })
  headers = {
    'Authorization': 'Bearer <MY_ACCESS_TOKEN>',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();

  MediaType mediaType = MediaType.parse("application/json");

  RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \" Demo API CreativeV9\",\r\n    \"brandId\": 118301,\r\n    \"retailerId\": 299,\r\n    \"templateId\": 51,\r\n    \"templateVariableValues\": [\r\n        {\r\n            \"id\": \"cta_text\",\r\n            \"textVariableValue\": {\r\n                \"text\": \"Call To Action Text\"\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"optional_footer_type\",\r\n            \"choiceVariableValue\": {\r\n                \"chosenOptions\": [\r\n                    \"Open a file\"\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"optional_footer_redirect_target\",\r\n            \"choiceVariableValue\": {\r\n                \"chosenOptions\": [\r\n                    \"On current page\"\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"button_text_color\",\r\n            \"colorVariableValue\": {\r\n                \"color\": \"#4C88a5\"\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"footer_background_color\",\r\n            \"colorVariableValue\": {\r\n                \"color\": \"#2133CD\"\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"desktop_background_image\",\r\n            \"filesVariableValue\": {\r\n                \"assetIds\": [\r\n                    \"000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470\"\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"optional_redirect_url\",\r\n            \"hyperlinkVariableValue\": {\r\n                \"url\": \"https://www.criteo.com\"\r\n            }\r\n        }\r\n    ]\r\n}");
  Request request = new Request.Builder()
    .url("https://api.criteo.com/{version}/retail-media/accounts/5/creatives")
    .method("POST", body)
    .addHeader("Authorization", "Bearer <MY_ACCESS_TOKEN>")
    .addHeader("Content-Type", "application/json")
    .build();

  Response response = client.newCall(request).execute();
  ```

  ```php PHP expandable theme={null}
  <?php
  require_once 'HTTP/Request2.php';
  $request = new HTTP_Request2();
  $request->setUrl('https://api.criteo.com/{version}/retail-media/accounts/5/creatives');
  $request->setMethod(HTTP_Request2::METHOD_POST);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'Authorization' => 'Bearer <MY_ACCESS_TOKEN>',
    'Content-Type' => 'application/json'
  ));
  $request->setBody('{
  \n    "name": " Demo API CreativeV9",
  \n    "brandId": 118301,
  \n    "retailerId": 299,
  \n    "templateId": 51,
  \n    "templateVariableValues": [
  \n        {
  \n            "id": "cta_text",
  \n            "textVariableValue": {
  \n                "text": "Call To Action Text"
  \n            }
  \n        },
  \n        {
  \n            "id": "optional_footer_type",
  \n            "choiceVariableValue": {
  \n                "chosenOptions": [
  \n                    "Open a file"
  \n                ]
  \n            }
  \n        },
  \n        {
  \n            "id": "optional_footer_redirect_target",
  \n            "choiceVariableValue": {
  \n                "chosenOptions": [
  \n                    "On current page"
  \n                ]
  \n            }
  \n        },
  \n        {
  \n            "id": "button_text_color",
  \n            "colorVariableValue": {
  \n                "color": "#4C88a5"
  \n            }
  \n        },
  \n        {
  \n            "id": "footer_background_color",
  \n            "colorVariableValue": {
  \n                "color": "#2133CD"
  \n            }
  \n        },
  \n        {
  \n            "id": "desktop_background_image",
  \n            "filesVariableValue": {
  \n                "assetIds": [
  \n                    "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
  \n                ]
  \n            }
  \n        },
  \n        {
  \n            "id": "optional_redirect_url",
  \n            "hyperlinkVariableValue": {
  \n                "url": "https://www.criteo.com"
  \n            }
  \n        }
  \n    ]
  \n}');
  try {
    $response = $request->send();
    if ($response->getStatus() == 200) {
      echo $response->getBody();
    }
    else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
      $response->getReasonPhrase();
    }
  }
  catch(HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
  ```
</CodeGroup>

**Sample Response**

```json expandable theme={null}
{
    "data": {
        "attributes": {
            "name": " Demo API CreativeV5",
            "status": "Ready",
            "brandId": 118301,
            "retailerId": 299,
            "associatedLineItemIds": [],
            "updatedAt": "2022-10-05T16:25:15.1327786+00:00",
            "creativeFormatType": 0,
            "environments": [
                {
                    "pageType": "Category",
                    "environments": [
                        "Web"
                    ]
                }
            ],
            "templateVariableValues": [
                {
                    "id": "desktop_background_image",
                    "filesVariableValue": {
                        "assetIds": [
                            "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
                        ]
                    }
                },
                {
                    "id": "optional_redirect_url",
                    "hyperlinkVariableValue": {
                        "url": "https://www.criteo.com"
                    }
                }
            ],
            "id": "365534915380219904"
        },
        "id": "365534915380219904",
        "type": "Creative"
    },
    "warnings": [],
    "errors": []
}
```

## **Get Creatives**

Get account creative by creative id

<EndpointBadge method="get">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/accounts/{account-id}/creatives/{creative-id}
  ```
</EndpointBadge>

**Sample Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl -L -X GET 'https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365342206324719616' \
  -H 'Authorization: Bearer <MY_ACCESS_TOKEN>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365622472262426624"

  payload={}
  headers = {
    'Authorization': 'Bearer <MY_ACCESS_TOKEN>'
  }

  response = requests.request("GET", url, headers=headers, data=payload)

  print(response.text)
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("text/plain");

  RequestBody body = RequestBody.create(mediaType, "");

  Request request = new Request.Builder()
    .url("https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365622472262426624")
    .method("GET", body)
    .addHeader("Authorization", "Bearer <MY_ACCESS_TOKEN>")
    .build();

  Response response = client.newCall(request).execute();
  ```

  ```php PHP theme={null}
  <?php
  require_once 'HTTP/Request2.php';
  $request = new HTTP_Request2();
  $request->setUrl('https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365622472262426624');
  $request->setMethod(HTTP_Request2::METHOD_GET);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'Authorization' => 'Bearer <MY_ACCESS_TOKEN>'
  ));

  try {
    $response = $request->send();
    if ($response->getStatus() == 200) {
      echo $response->getBody();
    }
    
    else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
      $response->getReasonPhrase();
    }
  }

  catch(HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
  ```
</CodeGroup>

**Sample Response**

```json expandable theme={null}
{
    "data": {
        "attributes": {
            "name": " Demo API Creative",
            "status": "Ready",
            "brandId": 118301,
            "retailerId": 299,
            "associatedLineItemIds": [],
            "updatedAt": "2022-10-05T03:39:29.7085127+00:00",
            "creativeFormatType": 0,
            "environments": [
                {
                    "pageType": "Category",
                    "environments": [
                        "Web"
                    ]
                }
            ],
            "templateVariableValues": [
                {
                    "id": "desktop_background_image",
                    "filesVariableValue": {
                        "assetIds": [
                            "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
                        ]
                    }
                },
                {
                    "id": "button_text_color",
                    "colorVariableValue": {
                        "color": "#4C88a5"
                    }
                },
                {
                    "id": "optional_footer_type",
                    "choiceVariableValue": {
                        "chosenOptions": [
                            "Open a file"
                        ]
                    }
                },
                {
                    "id": "optional_footer_redirect_target",
                    "choiceVariableValue": {
                        "chosenOptions": [
                            "On current page"
                        ]
                    }
                },
                {
                    "id": "footer_background_color",
                    "colorVariableValue": {
                        "color": "#2133CD"
                    }
                }
            ],
            "id": "365342206324719616"
        },
        "id": "365342206324719616",
        "type": "Creative"
    },
    "warnings": [],
    "errors": []
}
```

## **Update Creatives**

The endpoint will allow for updating existing creatives. The API endpoint request body uses the same `templateVariableValues` model as the one used in the [POST | Create Creative](/retail-media/docs/creative-builder#create-creative) call, but this time allows for updating any of the existing template variable fields.

<Warning>
  **Changes to the Creative ID when Updating Creatives**

  When generating a new creative, the initial id is known as a "parentId," of the creative. Every new update made to that creative creates a new "childId" which is a copy of the previous creative containing new updates. This means that the `creativeId` will change whenever a new update is made to the creative.

  To ensure that your line item is using the correct `creativeId`, your application will need to call the latest `creativeId` from the [Get Creatives endpoint  ](/retail-media/docs/creative-builder#get-creatives) before associating a new creative to the line item.
</Warning>

<EndpointBadge method="put">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/accounts/{account-id}/creatives/{creative-id}
  ```
</EndpointBadge>

**Sample Request**\
In this example, updates are made to change the `brandId`, `optional_footer_type`, `button_text_color`, `footer_background_color`

<CodeGroup>
  ```bash cURL expandable theme={null}
  curl -L -X PUT 'https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365534915380219904' \
  -H 'Authorization: Bearer <MY_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
      "name": " Demo API CreativeV5_Updated",
      "brandId": 2000030397,
      "retailerId": 299,
      "templateId": 51,
      "templateVariableValues": [
          {
              "id": "cta_text",
              "textVariableValue": {
                  "text": "Call To Action Text"
              }
          },
          {
              "id": "optional_footer_type",
              "choiceVariableValue": {
                  "chosenOptions": [
                      "Legal Text"
                  ]
              }
          },
          {
              "id": "optional_footer_redirect_target",
              "choiceVariableValue": {
                  "chosenOptions": [
                      "On current page"
                  ]
              }
          },
          {
              "id": "button_text_color",
              "colorVariableValue": {
                  "color": "#fe5000"
              }
          },
          {
              "id": "footer_background_color",
              "colorVariableValue": {
                  "color": "#fe5000"
              }
          },
          {
              "id": "desktop_background_image",
              "filesVariableValue": {
                  "assetIds": [
                      "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
                  ]
              }
          },
          {
              "id": "optional_redirect_url",
              "hyperlinkVariableValue": {
                  "url": "https://www.criteo.com"
              }
          }
      ]
  }'
  ```

  ```python Python expandable theme={null}
  import requests
  import json

  url = "https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365597911370309632"

  payload = json.dumps({
    "name": " Demo API CreativeV8_UPDATED_VERSION_2",
    "brandId": 118301,
    "retailerId": 299,
    "templateId": 51,
    "templateVariableValues": [
      {
        "id": "cta_text",
        "textVariableValue": {
          "text": "Call To Action Text"
        }
      },
      {
        "id": "optional_footer_type",
        "choiceVariableValue": {
          "chosenOptions": [
            "Open a file"
          ]
        }
      },
      {
        "id": "optional_footer_redirect_target",
        "choiceVariableValue": {
          "chosenOptions": [
            "On current page"
          ]
        }
      },
      {
        "id": "button_text_color",
        "colorVariableValue": {
          "color": "#4C88a5"
        }
      },
      {
        "id": "footer_background_color",
        "colorVariableValue": {
          "color": "#2133CD"
        }
      },
      {
        "id": "desktop_background_image",
        "filesVariableValue": {
          "assetIds": [
            "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
          ]
        }
      },
      {
        "id": "optional_redirect_url",
        "hyperlinkVariableValue": {
          "url": "https://www.criteo.com"
        }
      }
    ]
  })
  headers = {
    'Authorization': 'Bearer <MY_ACCESS_TOKEN>',
    'Content-Type': 'application/json'
  }

  response = requests.request("PUT", url, headers=headers, data=payload)

  print(response.text)
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");

  RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \" Demo API CreativeV8_UPDATED_VERSION_2\",\r\n    \"brandId\": 118301,\r\n    \"retailerId\": 299,\r\n    \"templateId\": 51,\r\n    \"templateVariableValues\": [\r\n        {\r\n            \"id\": \"cta_text\",\r\n            \"textVariableValue\": {\r\n                \"text\": \"Call To Action Text\"\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"optional_footer_type\",\r\n            \"choiceVariableValue\": {\r\n                \"chosenOptions\": [\r\n                    \"Open a file\"\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"optional_footer_redirect_target\",\r\n            \"choiceVariableValue\": {\r\n                \"chosenOptions\": [\r\n                    \"On current page\"\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"button_text_color\",\r\n            \"colorVariableValue\": {\r\n                \"color\": \"#4C88a5\"\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"footer_background_color\",\r\n            \"colorVariableValue\": {\r\n                \"color\": \"#2133CD\"\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"desktop_background_image\",\r\n            \"filesVariableValue\": {\r\n                \"assetIds\": [\r\n                    \"000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470\"\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"id\": \"optional_redirect_url\",\r\n            \"hyperlinkVariableValue\": {\r\n                \"url\": \"https://www.criteo.com\"\r\n            }\r\n        }\r\n    ]\r\n}");
  Request request = new Request.Builder()
    .url("https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365597911370309632")
    .method("PUT", body)
    .addHeader("Authorization", "Bearer <MY_ACCESS_TOKEN>")
    .addHeader("Content-Type", "application/json")
    .build();

  Response response = client.newCall(request).execute();
  ```

  ```php PHP expandable theme={null}
  <?php
  require_once 'HTTP/Request2.php';
  $request = new HTTP_Request2();
  $request->setUrl('https://api.criteo.com/{version}/retail-media/accounts/5/creatives/365597911370309632');
  $request->setMethod(HTTP_Request2::METHOD_PUT);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'Authorization' => 'Bearer <MY_ACCESS_TOKEN>',
    'Content-Type' => 'application/json'
  ));
  $request->setBody('{
  \n    "name": " Demo API CreativeV8_UPDATED_VERSION_2",
  \n    "brandId": 118301,
  \n    "retailerId": 299,
  \n    "templateId": 51,
  \n    "templateVariableValues": [
  \n        {
  \n            "id": "cta_text",
  \n            "textVariableValue": {
  \n                "text": "Call To Action Text"
  \n            }
  \n        },
  \n        {
  \n            "id": "optional_footer_type",
  \n            "choiceVariableValue": {
  \n                "chosenOptions": [
  \n                    "Open a file"
  \n                ]
  \n            }
  \n        },
  \n        {
  \n            "id": "optional_footer_redirect_target",
  \n            "choiceVariableValue": {
  \n                "chosenOptions": [
  \n                    "On current page"
  \n                ]
  \n            }
  \n        },
  \n        {
  \n            "id": "button_text_color",
  \n            "colorVariableValue": {
  \n                "color": "#4C88a5"
  \n            }
  \n        },
  \n        {
  \n            "id": "footer_background_color",
  \n            "colorVariableValue": {
  \n                "color": "#2133CD"
  \n            }
  \n        },
  \n        {
  \n            "id": "desktop_background_image",
  \n            "filesVariableValue": {
  \n                "assetIds": [
  \n                    "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
  \n                ]
  \n            }
  \n        },
  \n        {
  \n            "id": "optional_redirect_url",
  \n            "hyperlinkVariableValue": {
  \n                "url": "https://www.criteo.com"
  \n            }
  \n        }
  \n    ]
  \n}');
  try {
    $response = $request->send();
    if ($response->getStatus() == 200) {
      echo $response->getBody();
    }
    else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
      $response->getReasonPhrase();
    }
  }
  catch(HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
  ```
</CodeGroup>

**Sample Response**

```json expandable theme={null}
{
    "data": {
        "attributes": {
            "name": " Demo API CreativeV5_Updated",
            "status": "Ready",
            "brandId": 2000030397,
            "retailerId": 299,
            "associatedLineItemIds": [],
            "updatedAt": "2022-10-05T16:32:54.290397+00:00",
            "creativeFormatType": 0,
            "environments": [
                {
                    "pageType": "Category",
                    "environments": [
                        "Web"
                    ]
                }
            ],
            "templateVariableValues": [
                {
                    "id": "desktop_background_image",
                    "filesVariableValue": {
                        "assetIds": [
                            "000b34dae90dfe5831e95600dc02ed5f3b4d9f52c4955a804eb26bbe9c29f470"
                        ]
                    }
                },
                {
                    "id": "optional_redirect_url",
                    "hyperlinkVariableValue": {
                        "url": "https://www.criteo.com"
                    }
                }
            ],
            "id": "365534915380219904"
        },
        "id": "365534915380219904",
        "type": "Creative"
    },
    "warnings": [],
    "errors": []
}
```
