# List

See [create](/developer/api/cep/audiences/create.md) to see an introduction about Audience API.

### API Description

## List

> List audiences.

```json
{"openapi":"3.1.0","info":{"title":"Batch - REST API","version":"2.9"},"tags":[{"name":"Audiences"}],"servers":[{"url":"https://api.batch.com/{version}","description":"production","variables":{"version":{"default":"2.11","description":"Version of the API"}}}],"security":[{"rest_key":[]}],"components":{"securitySchemes":{"rest_key":{"type":"http","scheme":"bearer","description":"## API Key Authentication\n\nAuthentication is required in order to interact with Batch's APIs.\n\nBatch implements authentication using API Keys, that we call the \"REST API Key\".\nYou can find it on your dashboard.\n\nPlease make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would\neasily be extractable.\n\n### How to authenticate\n\nIn order to authenticate your requests, add your REST API Key in the `Authorization` header and prefix it by `Bearer`. Example: `Authorization: Bearer bcd38d9rfb38ra28`.\n"}},"parameters":{"HeaderProjectKey":{"in":"header","name":"X-Batch-Project","description":"The unique project key, identifying a project on the Batch platform","schema":{"type":"string"},"required":true}},"schemas":{"oneAudience":{"type":"object","properties":{"name":{"type":"string"},"display_name":{"type":"string"},"type":{"type":"string","enum":["CUSTOM_ID"]},"nb_ids":{"type":"integer"},"indexing_state":{"type":"string","enum":["APPLIED","IN_PROGRESS","REPLACED"]},"created":{"type":"string","description":"UTC Date in a RFC 3339 format."},"updated":{"type":"string","description":"UTC Date in a RFC 3339 format."}}},"Error":{"type":"object","required":["error_message","error_code"],"properties":{"error_message":{"description":"A human readable error message","type":"string"},"error_code":{"description":"Error code","type":"string"}}}},"responses":{"400":{"description":"The request is malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The Rest API Key is not valid for this project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Batch's services are under maintenance. Please try again later","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/audiences/list":{"get":{"operationId":"audience_list","summary":"List","description":"List audiences.","tags":["Audiences"],"parameters":[{"$ref":"#/components/parameters/HeaderProjectKey"},{"name":"from","in":"query","description":"A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the `next_from` value returned in a previous response to request subsequent results.","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"A limit on the number of objects to be returned.","required":false,"schema":{"type":"integer","default":10,"maximum":100}}],"responses":{"200":{"description":"If the GET to the API endpoint is successful you will receive an HTTP 200 confirmation and information about your audiences.","content":{"application/json":{"schema":{"type":"object","properties":{"audiences":{"description":"An array of objects describing each audience.","type":"array","items":{"type":"object","$ref":"#/components/schemas/oneAudience"}},"count":{"description":"The total number of objects.","type":"integer"},"has_more":{"description":"Whether or not there are more elements available after this set. If `false`, this set comprises the end of the list.","type":"boolean"},"next_from":{"description":"A cursor for use in pagination. If has_more is `true`, you can pass the value of `next_from` to a subsequent call to fetch the next page of results.","type":"string"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"429":{"$ref":"#/components/responses/429"},"500":{"$ref":"#/components/responses/500"},"503":{"$ref":"#/components/responses/503"}}}}}}
```

### Request structure

#### Route

The Audience API exposes a GET endpoint that allows to list audiences :

`/audiences/list`

#### Headers and authentication

See [Overview → Using Project APIs](/developer/api/cep.md#request-headers-and-authentication).

#### Query parameters

See API Description.

### Responses

#### Success

If the GET to the API endpoint is successful you will receive an **HTTP 200** confirmation and information about your audiences.

```json
{
  "audiences": [
    {
      "name": "string",
      "display_name": "string",
      "type": "CUSTOM_ID",
      "nb_ids": 0,
      "indexing_state": "APPLIED",
      "created": "2023-08-12T22:30:05Z",
      "updated": "2023-08-12T22:30:05Z"
    }
  ],
  "count": 4012,
  "has_more": true,
  "next_from": "676DEZREZ"
}
```

3 values are possible for indexing state

* `IN_PROGRESS` : update processing is in progress
* `APPLIED` : update processing is finished
* `REPLACED` : the audience content has been replaced since the issue of the indexing token.

Pagination infos:

* `next_from` can be used for the next call to list to retrieve the next page
* `count` is only returned for the first page

#### Failure

If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at <support@batch.com> if you need further support.

See the list of potential failures in the API Description.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.batch.com/developer/api/cep/audiences/list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
