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

# Audience (Legacy)

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

This page documents the legacy Audience endpoints, and should not be used for new integration. The scope of this endpoints is limited and the newer endpoints should be used instead.

## **Retrieving Audiences for a Specific Advertiser**

Audiences created through Criteo's API will be returned for the designated advertiser ID.

<EndpointBadge method="get">
  ```http theme={null}
  https://api.criteo.com/2021-10/audiences
  ```
</EndpointBadge>

 

 

The API will return an array of the **IDs**, **names**, **description**, **date of creation**, **date of last update**, **number of lines** in the contact list, as well as the number of **matched emails** in the contact list associated with the specified advertiser ID. Please note that the advertiser ID is required in the request URL.

 

<CodeGroup>
  ```json JSON theme={null}
  {
    "data": [
      {
        "type": "AudienceContactlist",
        "id": "1",
        "attributes": {
          "advertiserId": "18",
          "name": "Audience name",
          "description": "An Audience description",
          "createdAt": "2020-10-20T08:35:22.000Z",
          "updatedAt": "2020-10-20T08:35:22.000Z",
          "nbLines": 100,
          "nbLinesEmail": 10,
          "nbMatchesEmail": 10
        }
      }
    ],
      "errors": [],
      "warnings": []
  }
  ```
</CodeGroup>

## **Creating A New Audience**

A new audience can be created for a specific advertiser by making a POST call to the audience endpoint. The request body should specify the advertiser id, name, and description of the new audience.

<EndpointBadge method="post">
  ```http theme={null}
  https://api.criteo.com/2023-01/audiences
  ```
</EndpointBadge>

<CodeGroup>
  ```json JSON theme={null}
  {
    "data": {
      "type": "Audience",
      "attributes": {
          "advertiserId": "1",
          "name": "audienceX",
          "description": "audience X targets people who like shoes"
      }
    }
  }
  ```
</CodeGroup>

The API will return a unique **audience id** associated with the newly created audience.

<CodeGroup>
  ```json JSON theme={null}
  {
      "data": {
        "id": "12",
        "type": "Audience"
      },
      "errors": [],
      "warnings": []
  }
  ```
</CodeGroup>

 

 

## **Deleting An Audience**

An audience can be deleted by specifying the audience id in the URL path of a DELETE call to the audiences endpoint.

<EndpointBadge method="delete">
  ```http theme={null}
  https://api.criteo.com/2023-01/audiences/{audienceId}
  ```
</EndpointBadge>

The API will return an array with the audience ID that was deleted.

<CodeGroup>
  ```json JSON theme={null}
  {
      "data": {
        "id": "12",
        "type": "Audience"
      },
      "errors": [],
      "warnings": []
  }
  ```
</CodeGroup>

 

 

## **Updating Audience Metadata**

The audience name and description can be updated by making a PATCH request to the audiences endpoint with a specific audience ID in the URL path. The request body should include the updated name and description of the audience.

<EndpointBadge method="patch">
  ```http theme={null}
  https://api.criteo.com/2023-01/audiences/{audienceId}
  ```
</EndpointBadge>

<CodeGroup>
  ```json JSON theme={null}
  {
    "data": {
      "type": "Audience",
      "attributes": {
          "name": "audienceY",
          "description": "audience Y targets people who like pants"
      }
    }
  }
  ```
</CodeGroup>

The API will return an array of the updated **name** and **description** of the specified audience ID.

<CodeGroup>
  ```json JSON theme={null}
  {
      "data": {
        "type": "Audience",
        "id": "12",
        "attributes": {
            "name": "audienceY",
            "description": "audience Y targets people who like pants"
        }
      },
      "errors": [],
      "warnings": []
  }
  ```
</CodeGroup>

In addition to general API errors, you may encounter validation errors when creating or managing Audiences.

Below is a list of error codes for Audience validation and a more detailed description of their meaning.

## **Audience Validation Errors**

**`body-data-type-invalid`**\
The data-type provided cannot be accepted. The message will detail expected data type.

**`audience-invalid-name`**\
Invalid audience name.

**`invalid-audience-name-duplicated`**\
Given audience name already exists for the requested advertiser

**`invalid-schema`**\
Bad schema name. Please check the list of allowed schemas on [Managing Audiences](/marketing-solutions/v2023.07/docs/audience)

 

**`invalid-operation`**\
Bad operation name. Please check the list of allowed operations on [Managing Audiences](/marketing-solutions/v2023.07/docs/audience)

 

**`empty-identifiers`**\
None or invalid identifiers have been supplied with the request

 

**`invalid`**\
Request is invalid or the server wasn't able to process the request due to a serialization error.
