> ## 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.

# Campaigns Endpoints

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>;
};

View and manage all your campaigns

<Info>
  **A Few Things to Know**

  Learn more about campaign management with our API [**here**](/retail-media/v2026-preview/docs/campaigns)!
</Info>

 

## Endpoints

| Method   | Endpoint                          | Description                                                   |
| -------- | --------------------------------- | ------------------------------------------------------------- |
| **POST** | `/accounts/{accountId}/campaigns` | Create a new campaign for the specified account.              |
| **GET**  | `/accounts/{accountId}/campaigns` | Retrieve all campaigns associated with the specified account. |
| **GET**  | `/campaigns/{campaignId}`         | Retrieve details of a specific campaign by its ID.            |
| **PUT**  | `/campaigns/{campaignId}`         | Update details of a specific campaign by its ID.              |

<Info>
  **Info**

  **Create Operations:**

  * When using the `POST` method to create a resource, all Required fields must be included. Any Optional fields that are omitted will be set to their default values.

  **Update Operations:**

  * When using the `PUT` method to update a resource, all Write fields can be specified. Omitting any of these fields is treated as setting them to `null`, where applicable.
</Info>

## Campaign Attributes

<table>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Data Type
      </th>

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

  <tbody>
    <tr>
      <td>
        `id`
      </td>

      <td>
        string
      </td>

      <td>
        Campaign ID

        Accepted values: int64\
        Writeable? N / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `accountId`\*
      </td>

      <td>
        string
      </td>

      <td>
        [Account](https://developers.criteo.com/retail-media/docs/account) ID

        Accepted values: int64\
        Writeable? N / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `name`\*
      </td>

      <td>
        string
      </td>

      <td>
        Campaign name; must be unique within an [Account](https://developers.criteo.com/retail-media/docs/account)

        Accepted values: up to 255-chars string\
        Writeable? Y / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `type`
      </td>

      <td>
        enum
      </td>

      <td>
        Campaign type\
        If attribute is passed in the call, a value must be specified

        Accepted values: `auction`, `preferred`\
        Default: `auction`\
        Writeable? Y / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `budget`
      </td>

      <td>
        decimal
      </td>

      <td>
        Campaign lifetime spend cap; uncapped if omitted or set to `null`.\
        Note that preferred campaign types cannot have budgets as these campaign types must be uncapped

        Accepted values: equals/greater than zero\
        Default: `null`\
        Writeable? Y / Nullable? Y
      </td>
    </tr>

    <tr>
      <td>
        `budgetSpent`
      </td>

      <td>
        decimal
      </td>

      <td>
        Amount the campaign has already spent

        Accepted values: equals/greater than zero\
        Default: `0.0`\
        Writeable? N / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `budgetRemaining`
      </td>

      <td>
        decimal
      </td>

      <td>
        Amount the campaign has remaining until cap is hit; `null` if budget is uncapped

        Accepted values: between zero and `budget`\
        Default: `null`\
        Writeable? N / Nullable? Y
      </td>
    </tr>

    <tr>
      <td>
        `clickAttributionWindow`\*
      </td>

      <td>
        enum
      </td>

      <td>
        Post-click attribution window

        Accepted values: `7D`, `14D`, `30D`\
        Default: `30D`\
        Writeable? Y / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `viewAttributionWindow`\*
      </td>

      <td>
        enum
      </td>

      <td>
        Post-view attribution window

        Accepted values: `None`,`1D`,`7D`, `14D`, `30D`\
        Default: `None`\
        Writeable? Y / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `clickAttributionScope`
      </td>

      <td>
        enum
      </td>

      <td>
        Post-click attribution scope

        Accepted values:  `sameSku`, `sameSkuCategory`, `sameSkuCategoryBrand`\
        Default: `sameSkuCategory`\
        Writeable? Y / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `viewAttributionScope`
      </td>

      <td>
        enum
      </td>

      <td>
        Post-view attribution scope

        Accepted values:  `sameSku`, `sameSkuCategory`, `sameSkuCategoryBrand`\
        Default: `sameSku`\
        Writeable? Y / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `drawableBalanceIds`
      </td>

      <td>
        list\<string>
      </td>

      <td>
        List of [Balances](https://developers.criteo.com/retail-media/docs/balances) the campaign is able to draw from; at least one balance is required for a campaign to start

        Accepted values:  list of `balanceId`\
        Default: `[]`\
        Writeable? N / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `status`
      </td>

      <td>
        enum
      </td>

      <td>
        Campaign status, derived from the status of [Line Items](https://developers.criteo.com/retail-media/docs/line-items) it holds; `active` if at least one line item is active. To understand the conditions that will cause a status to change, check out [Campaign & Line Item Status](https://developers.criteo.com/retail-media/docs/campaign-lineitem-status)

        Accepted values: `active`, `inactive`\
        Default: `inactive`\
        Writeable? N / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `monthlyPacing`
      </td>

      <td>
        decimal
      </td>

      <td>
        The maximum monthly spend allowed for the campaign in the currency of the account. The spend is constrained by remaining account balance and total budget of the campaign. Monthly budget spend reset monthly at the start of the month based on the account timezone

        Accepted values: `null` or greater than zero\
        Default: `null`\
        Writeable? Y / Nullable? Y
      </td>
    </tr>

    <tr>
      <td>
        `dailyPacing`
      </td>

      <td>
        decimal
      </td>

      <td>
        The maximum daily spend allowed for the campaign in the currency of the account, as long as not set to `null` and `isAutoDailyPacing = false`; otherwise no daily spend limit will be enforced

        Accepted values: `null` or greater than zero\
        Default: `null`\
        Writeable? Y / Nullable? Y
      </td>
    </tr>

    <tr>
      <td>
        `isAutoDailyPacing`
      </td>

      <td>
        boolean
      </td>

      <td>
        Auto daily pacing flag for the campaign budget. The daily pacing value is automatically calculated with respect to the days left in the month for the account. The campaign's remaining account balance, total budget, and monthly pacing value are constrained by account's timezone and the campaign status. If auto daily pacing is enabled, `dailyPacing` value should be left empty (`null`).\
        Note the value may be affected by budget override. Daily budget spend is reset daily at the start of the day based on the account timezone. To activate, either campaign's `endDate` and `budget` or `monthlyPacing` must be specified, overwriting `dailyPacing` with the new respective pace (if not set previously)

        Accepted values: `true`, `false`\
        Writeable? Y / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `startDate`\*
      </td>

      <td>
        timestamp
      </td>

      <td>
        Campaign start date. The campaign starts inactive if invalid start date is not today or end date is in previous day.

        Accepted values: `yyyy-mm-ddThh:mm:ss±hh:mm`(in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601))\
        Default: creation timestamp\
        Writeable? Y / Nullable? Y

        ⚠️ **Note**: if time/timezone designators are not provided, the default value to be considered will be `00:00:00+00:00` (i.e., midnight in UTC - account timezone not taken in consideration here)
      </td>
    </tr>

    <tr>
      <td>
        `endDate`\*
      </td>

      <td>
        timestamp
      </td>

      <td>
        Campaign end date. The campaign starts inactive if invalid start date is not today or end date is in previous day

        Accepted values: `yyyy-mm-ddThh:mm:ss±hh:mm`(in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601))\
        Default: `null`\
        Writeable? Y / Nullable? Y

        ⚠️ **Note**: if time/timezone designators are not provided, the default value to be considered will be `00:00:00+00:00` (i.e., midnight in UTC - account timezone not taken in consideration here)
      </td>
    </tr>

    <tr>
      <td>
        `createdAt`
      </td>

      <td>
        timestamp
      </td>

      <td>
        Timestamp of campaign creation, in UTC

        Accepted values: `yyyy-mm-ddThh:mm:ss±hh:mm`(in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601))\
        Writeable? N / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `updatedAt`
      </td>

      <td>
        timestamp
      </td>

      <td>
        Timestamp of last campaign update, in UTC

        Accepted values: `yyyy-mm-ddThh:mm:ss±hh:mm`(in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601))\
        Writeable? N / Nullable? N
      </td>
    </tr>

    <tr>
      <td>
        `companyName`
      </td>

      <td>
        string
      </td>

      <td>
        This optional field, exclusively accessible to marketplaces within the European Union (in compliance with the Digital Service Act - DSA), will display the name of the company associated with the advertisement.

        Accepted values: up to 255-chars string\
        Writeable? Y / Nullable? Y
      </td>
    </tr>

    <tr>
      <td>
        `onBehalfCompanyName`
      </td>

      <td>
        string
      </td>

      <td>
        This optional field, exclusively accessible to marketplaces within the European Union (in compliance with the Digital Service Act - DSA), will display the name of the company (on behalf of `companyName`) associated with the advertisement

        Accepted values: up to 255-chars string\
        Writeable? Y / Nullable? Y
      </td>
    </tr>
  </tbody>
</table>

*\*Required*

<Info>
  ****Digital Service Act (DSA)****

  In compliance with the Digital Services Act (DSA), marketplaces within the European Union will receive information about the company name associated with each advertisement.
</Info>

## Create a Campaign

This endpoint creates a new campaign in the specified account.

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

**Sample Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl -L -X POST 'https://api.criteo.com/{version}/retail-media/accounts/5/campaigns' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer <MY_ACCESS_TOKEN>' \
  -d '{
      "data": {
          "type": "<string>",
          "attributes": {
              "name": "Valentine Day Sale",
              "isAutoDailyPacing": false,
              "startDate": "2024-02-12",
              "endDate": "2024-02-15",
              "type": "auction",
              "drawableBalanceIds": [
                  "142000305654435840"
              ],
              "clickAttributionWindow": "30D",
              "viewAttributionWindow": "None",
              "budget": 100,
              "monthlyPacing": 50,
              "dailyPacing": 10,
              "clickAttributionScope": "sameSkuCategory",
              "viewAttributionScope": "sameSkuCategory",
              "companyName": "Test Company A",
              "onBehalfCompanyName": "Test Company B"
          }
      }
  }'
  ```

  ```python Python expandable theme={null}
  import http.client
  import json

  conn = http.client.HTTPSConnection("api.criteo.com")
  payload = json.dumps({
    "data": {
      "type": "<string>",
      "attributes": {
        "name": "Valentine Day Sale",
        "isAutoDailyPacing": False,
        "startDate": "2024-02-12",
        "endDate": "2024-02-15",
        "type": "auction",
        "drawableBalanceIds": [
          "142000305654435840"
        ],
        "clickAttributionWindow": "30D",
        "viewAttributionWindow": "None",
        "budget": 100,
        "monthlyPacing": 50,
        "dailyPacing": 10,
        "clickAttributionScope": "sameSkuCategory",
        "viewAttributionScope": "sameSkuCategory",
        "companyName": "Test Company A",
        "onBehalfCompanyName": "Test Company B"
      }
    }
  })
  headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer <MY_ACCESS_TOKEN>'
  }
  conn.request("POST", "/{version}/retail-media/accounts/5/campaigns", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\"data\":{\"type\":\"<string>\",\"attributes\":{\"name\":\"Valentine Day Sale\",\"isAutoDailyPacing\":false,\"startDate\":\"2024-02-12\",\"endDate\":\"2024-02-15\",\"type\":\"auction\",\"drawableBalanceIds\":[\"142000305654435840\"],\"clickAttributionWindow\":\"30D\",\"viewAttributionWindow\":\"None\",\"budget\":100,\"monthlyPacing\":50,\"dailyPacing\":10,\"clickAttributionScope\":\"sameSkuCategory\",\"viewAttributionScope\":\"sameSkuCategory\",\"companyName\":\"Test Company A\",\"onBehalfCompanyName\":\"Test Company B\"}}}");
  Request request = new Request.Builder()
    .url("https://api.criteo.com/{version}/retail-media/accounts/5/campaigns")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .addHeader("Accept", "application/json")
    .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/campaigns');
  $request->setMethod(HTTP_Request2::METHOD_POST);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer <TOKEN>'
  ));
  $request->setBody('{"data":{"type":"<string>","attributes":{"name":"Valentine Day Sale","isAutoDailyPacing":false,"startDate":"2024-02-12","endDate":"2024-02-15","type":"auction","drawableBalanceIds":["142000305654435840"],"clickAttributionWindow":"30D","viewAttributionWindow":"None","budget":100,"monthlyPacing":50,"dailyPacing":10,"clickAttributionScope":"sameSkuCategory","viewAttributionScope":"sameSkuCategory","companyName":"Test Company A","onBehalfCompanyName":"Test Company B"}}}');
  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**

<CodeGroup>
  ```json JSON expandable theme={null}
  {
      "data": {
          "id": "544937665113018368",
          "type": "RetailMediaCampaignV202301",
          "attributes": {
              "accountId": "5",
              "promotedBrandIds": [],
              "budgetSpent": 0.00000000,
              "budgetRemaining": 100.00000000,
              "status": "inactive",
              "createdAt": "2024-02-12T17:47:43+00:00",
              "updatedAt": "2024-02-12T17:47:43+00:00",
              "type": "auction",
              "drawableBalanceIds": [
                  "142000305654435840"
              ],
              "clickAttributionWindow": "30D",
              "viewAttributionWindow": "1D",
              "name": "Valentine Day Sale",
              "budget": 100.00000000,
              "monthlyPacing": 50.00000000,
              "dailyPacing": 10.00000000,
              "isAutoDailyPacing": false,
              "startDate": "2024-02-12T00:00:00+00:00",
              "endDate": "2024-02-15T00:00:00+00:00",
              "clickAttributionScope": "sameSkuCategory",
              "viewAttributionScope": "sameSkuCategory",
              "companyName": "Test Company A",
              "onBehalfCompanyName": "Test Company B"
          }
      }
  }
  ```
</CodeGroup>

## Get All Campaigns By Account Id

This endpoint lists all campaigns in the specified account. Results are paginated.

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

**Sample Request**

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

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

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

  payload={}
  headers = {
    'Accept': 'application/json',
    '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/4/campaigns")
    .method("GET", body)
    .addHeader("Accept", "application/json")
    .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/4/campaigns');
  $request->setMethod(HTTP_Request2::METHOD_GET);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));

  $request->setHeader(array(
    'Accept' => 'application/json',
    '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**

<CodeGroup>
  ```json JSON expandable theme={null}
  {
      "metadata": {
          "totalItemsAcrossAllPages": 306,
          "currentPageSize": 2,
          "currentPageIndex": 8,
          "totalPages": 153,
          "nextPage": "https://api.criteo.com/{version}/retail-media/accounts/5/campaigns?pageIndex=9&pageSize=2",
          "previousPage": "https://api.criteo.com/{version}/retail-media/accounts/5/campaigns?pageIndex=7&pageSize=2"
      },
      "data": [
          {
              "id": "360028769027026944",
              "type": "RetailMediaCampaignV202301",
              "attributes": {
                  "accountId": "5",
                  "promotedBrandIds": [],
                  "budgetSpent": 0.00000000,
                  "budgetRemaining": null,
                  "status": "inactive",
                  "createdAt": "2022-09-20T11:45:47+00:00",
                  "updatedAt": "2023-09-12T13:50:06+00:00",
                  "type": "preferred",
                  "drawableBalanceIds": [],
                  "clickAttributionWindow": "14D",
                  "viewAttributionWindow": "14D",
                  "name": "Spring Sale 1",
                  "budget": null,
                  "monthlyPacing": null,
                  "dailyPacing": null,
                  "isAutoDailyPacing": false,
                  "startDate": null,
                  "endDate": null,
                  "clickAttributionScope": "sameSkuCategory",
                  "viewAttributionScope": "sameSkuCategory",
                  "companyName": null,
                  "onBehalfCompanyName": null
              }
          },
          {
              "id": "360029773808807936",
              "type": "RetailMediaCampaignV202301",
              "attributes": {
                  "accountId": "5",
                  "promotedBrandIds": [
                      "82539",
                      "105804",
                      "113465",
                      "117905",
                      "120242",
                      "125722",
                      "126509",
                      "135449",
                      "190104",
                      "2000000201",
                      "2000002375",
                      "2000002969"
                  ],
                  "budgetSpent": 0.00000000,
                  "budgetRemaining": 555.00000000,
                  "status": "inactive",
                  "createdAt": "2022-09-20T11:49:47+00:00",
                  "updatedAt": "2023-09-12T13:50:06+00:00",
                  "type": "auction",
                  "drawableBalanceIds": [],
                  "clickAttributionWindow": "30D",
                  "viewAttributionWindow": "1D",
                  "name": "Spring Sales 2",
                  "budget": 555.00000000,
                  "monthlyPacing": null,
                  "dailyPacing": null,
                  "isAutoDailyPacing": false,
                  "startDate": "2022-09-20T04:00:00+00:00",
                  "endDate": "2022-09-21T03:59:59+00:00",
                  "clickAttributionScope": "sameSkuCategory",
                  "viewAttributionScope": "sameSku",
                  "companyName": null,
                  "onBehalfCompanyName": null
              }
          }
      ]
  }
  ```
</CodeGroup>

## Get a Specific Campaign

This endpoint retrieves the specified campaign.

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

**Sample Request**

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

  ```python Python theme={null}
  import http.client

  conn = http.client.HTTPSConnection("api.criteo.com")
  payload = ''
  headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer <MY_ACCESS_TOKEN>'
  }
  conn.request("GET", "/{version}/retail-media/campaigns/1240", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
  ```

  ```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/campaigns/1240")
    .method("GET", body)
    .addHeader("Accept", "application/json")
    .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/campaigns/1240');
  $request->setMethod(HTTP_Request2::METHOD_GET);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'Accept' => 'application/json',
    '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**

<CodeGroup>
  ```json JSON expandable theme={null}
  {
      "data": {
          "id": "544937665113018368",
          "type": "RetailMediaCampaignV202301",
          "attributes": {
              "accountId": "5",
              "promotedBrandIds": [],
              "budgetSpent": 0.00000000,
              "budgetRemaining": null,
              "status": "inactive",
              "createdAt": "2024-02-12T17:47:43+00:00",
              "updatedAt": "2024-02-12T17:56:04+00:00",
              "type": "auction",
              "drawableBalanceIds": [
                  "142000305654435840"
              ],
              "clickAttributionWindow": "30D",
              "viewAttributionWindow": "1D",
              "name": "Valentine Day Sale",
              "budget": null,
              "monthlyPacing": 50.00000000,
              "dailyPacing": null,
              "isAutoDailyPacing": false,
              "startDate": "2024-02-12T00:00:00+00:00",
              "endDate": "2024-02-15T00:00:00+00:00",
              "clickAttributionScope": "sameSku",
              "viewAttributionScope": "sameSku",
              "companyName": "ABC Test Company",
              "onBehalfCompanyName": "ABC Test Company"
          }
      }
  }
  ```
</CodeGroup>

## Update a Specific Campaign

This endpoint allows you to update a specified campaign. The following example demonstrates how to switch to an uncapped campaign budget and modify the post-view attribution window.

<EndpointBadge method="put">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/campaigns/{campaignId}
  ```
</EndpointBadge>

**Sample Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl -L -X PUT 'https://api.criteo.com/{version}/retail-media/campaigns/544937665113018368' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer <TOKEN>' \
  -d '{
  	"data": {
      "id": "544937665113018368",
      "type": "UpdateCampaign",
          "attributes": {
              "name": "Valentine Day Sale",
              "isAutoDailyPacing": false,
              "startDate": "2024-02-12",
              "endDate": "2024-02-15",
              "type": "auction",
              "drawableBalanceIds": [
                  "142000305654435840"
              ],
              "clickAttributionWindow": "30D",
              "viewAttributionWindow": "1D",
              "budget": null,
              "monthlyPacing": 50,
              "dailyPacing": 10,
              "clickAttributionScope": "sameSku",
              "viewAttributionScope": "sameSku",
              "companyName": "ABC Test Company",
              "onBehalfCompanyName": "ABC Test Company"
          }
  	}
  }'
  ```

  ```python Python expandable theme={null}
  import http.client
  import json

  conn = http.client.HTTPSConnection("api.criteo.com")
  payload = json.dumps({
    "data": {
      "id": "544937665113018368",
      "type": "UpdateCampaign",
      "attributes": {
        "name": "Valentine Day Sale",
        "isAutoDailyPacing": "false",
        "startDate": "2024-02-12",
        "endDate": "2024-02-15",
        "type": "auction",
        "drawableBalanceIds": [
          "142000305654435840"
        ],
        "clickAttributionWindow": "30D",
        "viewAttributionWindow": "1D",
        "budget": None,
        "monthlyPacing": "50",
        "dailyPacing": "10",
        "clickAttributionScope": "samesku",
        "viewAttributionScope": "samesku",
        "companyName": "ABC Test Company",
        "onBehalfCompanyName": "ABC Test Company"
      }
    }
  })
  headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer <TOKEN>'
  }
  conn.request("PUT", "/{version}/retail-media/campaigns/544937665113018368", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\"data\":{\"id\":\"544937665113018368\",\"type\":\"UpdateCampaign\",\"attributes\":{\"name\":\"Valentine Day Sale\",\"isAutoDailyPacing\":\"false\",\"startDate\":\"2024-02-12\",\"endDate\":\"2024-02-15\",\"type\":\"auction\",\"drawableBalanceIds\":[\"142000305654435840\"],\"clickAttributionWindow\":\"30D\",\"viewAttributionWindow\":\"1D\",\"budget\":null,\"monthlyPacing\":\"50\",\"dailyPacing\":\"10\",\"clickAttributionScope\":\"samesku\",\"viewAttributionScope\":\"samesku\",\"companyName\":\"ABC Test Company\",\"onBehalfCompanyName\":\"ABC Test Company\"}}}");
  Request request = new Request.Builder()
    .url("https://api.criteo.com/{version}/retail-media/campaigns/544937665113018368")
    .method("PUT", body)
    .addHeader("Content-Type", "application/json")
    .addHeader("Accept", "application/json")
    .addHeader("Authorization", "Bearer <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/campaigns/544937665113018368');
  $request->setMethod(HTTP_Request2::METHOD_PUT);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer<TOKEN>'
  ));
  $request->setBody('{"data":{"id":"544937665113018368","type":"UpdateCampaign","attributes":{"name":"Valentine Day Sale","isAutoDailyPacing":"false","startDate":"2024-02-12","endDate":"2024-02-15","type":"auction","drawableBalanceIds":["142000305654435840"],"clickAttributionWindow":"30D","viewAttributionWindow":"1D","budget": null,"monthlyPacing":"50","dailyPacing":"10","clickAttributionScope":"samesku","viewAttributionScope":"samesku","companyName":"ABC Test Company","onBehalfCompanyName":"ABC Test Company"}}}');
  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**

<CodeGroup>
  ```json JSON expandable theme={null}
  {
      "data": {
          "id": "544937665113018368",
          "type": "RetailMediaCampaignV202301",
          "attributes": {
              "accountId": "5",
              "promotedBrandIds": [],
              "budgetSpent": 0.00000000,
              "budgetRemaining": null,
              "status": "inactive",
              "createdAt": "2024-02-12T17:47:43+00:00",
              "updatedAt": "2024-02-12T17:56:04+00:00",
              "type": "auction",
              "drawableBalanceIds": [
                  "142000305654435840"
              ],
              "clickAttributionWindow": "30D",
              "viewAttributionWindow": "1D",
              "name": "Valentine Day Sale",
              "budget": null,
              "monthlyPacing": 50.00000000,
              "dailyPacing": null,
              "isAutoDailyPacing": false,
              "startDate": "2024-02-12T00:00:00+00:00",
              "endDate": "2024-02-15T00:00:00+00:00",
              "clickAttributionScope": "sameSku",
              "viewAttributionScope": "sameSku",
              "companyName": "ABC Test Company",
              "onBehalfCompanyName": "ABC Test Company"
          }
      }
  }
  ```
</CodeGroup>

## Responses

| Response | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 🟢`200`  | Call completed with success                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 🟢`201`  | Campaign was created successfully                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 🔴 `400` | Validation Error - one or more required field was not found. Confirm if all required fields are present in the API call<ul><li>\*Invalid isautodailypacing\*\* - *Cannot turn on IsAutoDailyPacing and add a DailyPacing value*</li></ul>IsAutoDailyPacing and Daily Pacing can not be active at the same time. Passing this in the call will return a 400 error<ul><li>\*Invalid budget\*\* - *Budget is not allowed for the Preferred campaign.*</li></ul> |
