Discard
GuidesAPI ReferenceChangelogDiscussions
GuidesAPI ReferenceChangelogDiscussionsLog In

Update Ad Sets

Update Ad Sets

The fields of one or more Ad Sets can be updated by making a PATCH call to the Ad Sets endpoint. The payload should be an array of partial or whole Ad Sets, each specifying the fields to be modified.

For example, the following call would update the name, startDate, endDate, bidAmount and frequency capping settings of an existing Ad Set:

The bid amount value supports a maximum of 4 decimal digits. If more digits are provided, the amount will be rounded.

https://api.criteo.com/2022-04/marketing-solutions/ad-sets
{
    "data": [
        {
            "type": "PatchAdSet",
            "id": "12345",
            "attributes": {
                "name": "Updated Ad Set Name",
                "scheduling": {
                    "startDate": { "value": "2021-01-19T10:18:28.632Z" },
                    "endDate": { "value": "2021-01-20T10:18:28.632Z" }
                },
                "bidding": {
                    "bidAmount": { "value": 0.9 }
                },
                "frequencyCapping": {
                    "frequency": "hourly",
                    "maximumImpressions": 12
                }
            }
        }
    ]
}

The API will return an array of Ad Sets that have been updated successfully in the response data. These will contain only two parameters, type and id.

{
    "data": [
        {
            "type": "AdSetId",
            "id": "12345"
        }
    ],
    "errors": [],
    "warnings": []
}

🚧

Ad Set Patch Limit

Note that there is a limit of 50 ad sets per single request. If you are updating more than 50 ad sets, please split them into chunks of 50 and make multiple requests.

 

Partial Success / Partial Failure

Each Ad Set update is processed individually and can succeed or fail without impacting other updates in the same payload.

As a result, those Ad Set updates processed successfully will be returned in the data array of the response, while Ad Sets updates that have failed will return as an entry in the errors array of the response.

🚧

HTTP Response Codes

As a result of this individual processing, the API may respond with a 200 HTTP response code, but the result of its processing may have one or more failures.

 

For instance, for this payload which intends to update two Ad Sets:

https://api.criteo.com/2022-04/marketing-solutions/ad-sets
{
    "data": [
        {
            "type": "PatchAdSet",
            "id": "12345",
            "attributes": {
                "bidding": {
                    "bidAmount": { "value": 0.9 }
                }
            }
        },
        {
            "type": "PatchAdSet",
            "id": "67890",
            "attributes": {
                "bidding": {
                    "bidAmount": { "value": -2 }
                }
            }
        }
    ]
}

 

The response might look like:

{
    "data": [
        {
            "type": "AdSetId",
            "id": "12345"
        }
    ],
    "errors": [
        {
            "traceIdentifier": "56ed4096-f96a-4944-8881-05468efe0ec9",
            "type": "validation",
            "code": "campaign--ad-set-update-check--invalid-bid-amount",
            "instance": "@data/1",
            "title": "Invalid bid amount",
            "detail": "The bid amount value is invalid: either it's an adaptative cost controller and it must be null, or it's not the valid interval of values."
        }
    ],
    "warnings": []
}

📘

Error instance

The instance field for validation errors will specify the index of the related update, beginning with index 0. For the example above, @data/1 refers to the second requested update in the request's data array.

A full list of error codes can be found on the Validation Errors page at the end of this section.


What’s Next

Learn how to start and stop Ad Sets

Did this page help you?