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

# [Audiences] Managing Audiences

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

## **Creating A New Audience**

A new audience can be created for a specific advertiser by making a POST call to the audience user list endpoint. The payload should specify the advertiser id as well as the name and description of the new audience.

<EndpointBadge method="post">
  ```http theme={null}
  https://api.criteo.com/legacy/marketing/v1/audiences/userlist
  ```
</EndpointBadge>

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.criteo.com/legacy/marketing/v1/audiences/userlist \
    --header 'Accept: application/json' \
    --header 'Content-Type: text/json' \
    --data '{"advertiserId":1234,"name":"Store Visitors","description":"Users who have visited a store"}'
  ```
</CodeGroup>

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

<CodeGroup>
  ```json JSON theme={null}
  {
    "audienceId": 7654
  }
  ```
</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/legacy/marketing/v1/audiences/{audienceId}
  ```
</EndpointBadge>

<CodeGroup>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url https://api.criteo.com/legacy/marketing/v1/audiences/7654 \
    --header 'Accept: application/json'
  ```
</CodeGroup>

The API will not return a response message. A 204 HTTP status code will be returned to confirm that the audience has been deleted.

   

## **Updating Audience Metadata**

The audience name and description can be updated by making a PUT call to the audiences endpoint with a specific audience id in the URL path. The payload should include the updated name and description.

<EndpointBadge method="put">
  ```http theme={null}
  https://api.criteo.com/legacy/marketing/v1/audiences/{audienceId}
  ```
</EndpointBadge>

<CodeGroup>
  ```bash cURL theme={null}
  curl --request PUT \
    --url https://api.criteo.com/legacy/marketing/v1/audiences/1234 \
    --header 'Accept: application/json' \
    --header 'Content-Type: text/json' \
    --data '{"name":"Store Visitors - Past Week","description":"Users who have visited a store in the past week"}'
  ```
</CodeGroup>

The API will not return a response message. A 204 HTTP status code will be returned to confirm that the audience data has been updated.
