API Response

Introduction

Our APIs respond with data, errors, and meta/metadata blocks where appropriate.

For example:

  • {entityId} are unique across all Retail Media entities

  • data and errors blocks may be contained in responses expected to return multiple entities

  • meta (or metadata) appears only for paginated responses

Response example

{
    "data": [
        {
            "id": "{entityId}",
            "type": "{entityType}",
            "attributes": {
                "{fieldName}": {numericValue},
                "{fieldName}": "{stringValue}",
                // ...
            }
        },
        
        // ...
        
    ],
    "errors": [
        {
            "traceId": "{traceId}",
            "type": "{errorType}",
            "code": "{errorCode}",
            "instance": "{uri}",
            "title": "{errorTitle}",
            "detail": "{errorDetail}",
            "source": {
                "{fieldName}": "{fieldPath}",
                // ...
            }
        },
 
        // ...
         
    ],
    "metadata": {
        "totalItemsAcrossAllPages": {numberOfEntities},
        "currentPageSize": {pageSize},
        "currentPageIndex": {pageIndex},
        "totalPages": {numberOfPages},
        "nextPage": "https://api.criteo.com/{endpoint}?pageIndex={pageIndex}&pageSize={pageSize}",
        "previousPage": "https://api.criteo.com/{endpoint}?pageIndex={pageIndex}&pageSize={pageSize}"
    }
}

Data Attributes

AttributeTypeDescription
idstringUnique ID for the entity. Entity IDs are unique across all Retail Media entities
typestringType of entity
attributesobjectEntity attributes - may be omitted entirely if an entity does not have additional attributes

Error Attributes

AttributeTypeDescription
traceIdstringUnique ID for the error response
typestringType of error; machine-readable (e.g. validation)
codestringShort machine-readable string for the error (e.g. required-field)
instancestringURI referencing the endpoint that caused the error
titlestringShort human-readable string that summarizes the issue
detailstringHuman-readable explanation of the issue
sourceobjectObject referencing the field that caused the error

Pagination

Endpoints that retrieve all entities under a specific context supports pagination to navigate through all existing elements. Currently, there are two different formats to access the different pages that are based on different sets of query parameters and response blocks. Results are returned in ascending order by id

Examples of endpoints:

  1. List all Accounts associated with your API credentials

  2. List all Brands associated with the Account

  3. List all Retailers associated with the Account

offset & limit

Query ParametersTypeDescription
offsetintegerDefines the starting point from which records should be returned, i.e., will skip the first offset records (ordered by id) and return the subsequent ones; defaults to 0 if omitted
limitintegerSpecifies the maximum number of entities returned in a single page; defaults to 500 entities per page

Response example

{
    "data": [
        {
            "id": "{entityId}",
            "type": "{entityType}",
            "attributes": {
                "{fieldName}": {numericValue},
                "{fieldName}": "{stringValue}",
                // ...
            }
        },
        // ...
        
    ],
    "meta": {
        "count": {numberOfEntities},
        "offset": {offset},
        "limit": {limit}
    }
}

pageIndex & pageSize

Query ParametersTypeDescription
pageIndexintegerReturns the specified page of results given a pageSize; pages are 0-indexed
pageSizeintegerSpecifies the maximum number of entities returned in a single page; defaults to 25 entities per page

Response example

{
    "data": [
        {
            "id": "{entityId}",
            "type": "{entityType}",
            "attributes": {
                "{fieldName}": {numericValue},
                "{fieldName}": "{stringValue}",
                // ...
            }
        },
        // ...
        
    ],
    "metadata": {
        "totalItemsAcrossAllPages": {numberOfEntities},
        "currentPageSize": {pageSize},
        "currentPageIndex": {pageIndex},
        "totalPages": {numberOfPages},
        "nextPage": "https://api.criteo.com/{endpoint}?pageIndex={pageIndex}&pageSize={pageSize}",
        "previousPage": "https://api.criteo.com/{endpoint}?pageIndex={pageIndex}&pageSize={pageSize}"
    }
}

Filter by ID

All endpoints that retrieve all entities under a specific context supports an optional query parameter limitToId that can be used to retrieve the respective element. This param can also be combined multiple times to retrieve multiple elements at the same time.

Examples:

  1. Retrieve specific Account(s) from endpoint that lists all Accounts

  2. Retrieve specific Brand(s) from endpoint that lists all Brands associated with the Account

  3. Retrieve specific Retailer(s) from endpoint that lists all Retailers associated with the Account

Query ParametersTypeDescription
limitToIdintegerLimits results to the entity IDs specified; parameter key is repeated, e.g. limitToId=1&limitToId=2

Response example

{
    "data": [
        {
            "id": "1",
            "type": "{entityType}",
            "attributes": {
                "{fieldName}": {numericValue},
                "{fieldName}": "{stringValue}",
                // ...
            }
        },
        {
            "id": "2",
            "type": "{entityType}",
            "attributes": {
                "{fieldName}": {numericValue},
                "{fieldName}": "{stringValue}",
                // ...
            }
        },
        
    ],
    "meta": {
        "count": 2,
        "offset": 0,
        "limit": 500
    }
}


HTTP Response Codes

ResponseDescription
🔵 200 OKRequest successful
🔵 201 CreatedThe new entity was successfully created
🔵 204 No ContentRequest succeeded and no returned content should be expected
🟡 207 Multi-StatusThis may occur when operating on multiple entities, such as the call resulting in some successes but also some failures
🔴 400 Bad RequestFor improper syntax, check your call structure
🔴 401 UnauthorizedIf unauthenticated, refresh your access token
🔴 403 ForbiddenInsufficient rights to perform this action
🔴 404 Not FoundResource not found, check your entity IDs in the call
🔴 408 TimeoutRequest timed out
🔴 409 ConflictRequest conflicts with something, such as a campaign name that already exists
🔴 429 Too Many RequestsToo many requests
🔴 5xxSomething's wrong on Criteo's end...