> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Audience Service API

> Get audience information via API.

The Audience Service API allows you to directly retrieve audience information to use in marketing campaigns or other analysis.

The Audience Service endpoints require an Access Token. To generate the token, you'll need your API credentials. To generate credentials, log into your app as a Partner Administrator and navigate to the **Authentication** > **Audience API Key** section. Here, create your `client_id` and `client_secret` to be used with the Access Token endpoint.

Only one set of credentials may be active at one time. When you create credentials, be sure to copy the `client_id` and `client_secret`. The secret cannot be retrieved once you have navigated away from the page.

### Parameters

The Audience Service API endpoints may require the following parameters.

| Field                   | Data Type | Description                                                                                    |
| :---------------------- | :-------- | :--------------------------------------------------------------------------------------------- |
| `client_id`             | String    | Credentials created in your app.                                                               |
| `client_secret`         | String    | Credentials created in your app.                                                               |
| `token`                 | String    | Bearer token used with all Audience Service endpoints, created with the Create Token endpoint. |
| `id_or_slug`            | String    | The ID or slug of the audience. Used in the path.                                              |
| `institution_public_id` | String    | Query parameter for the public id of the institution.                                          |

### Examples

Audience data may be requested in either JSON or CSV format.

#### Requests

Format your requests to accept your preferred format, JSON or CSV.

<RequestExample>
  ```text JSON Request theme={null}
  GET /api/v1/audience/audience_1/list?institution_public_id=INST_PUBLIC_ID HTTP/1.1
  Host: yourdomain.access.mx.com
  Authorization: Bearer mock_token_123
  Accept: application/json
  ```

  ```text CSV Request theme={null}
  GET /api/v1/audience/audience_1/list.csv?institution_public_id=INST_PUBLIC_ID HTTP/1.1
  Host: yourdomain.access.mx.com
  Authorization: Bearer mock_token_123
  Accept: text/csv
  ```
</RequestExample>

#### Responses

Data will be returned in the requested format.

<ResponseExample>
  ```json JSON theme={null}
  {
    "audience_id": "audience_1",
    "count": 5,
    "institution_id": "INST_PUBLIC_ID",
    "list": [
      "02b70bd917264a3181beac85c1abd71e",
      "8e468df6954c4d29b63aa983d8cf6155",
      "17093a20cf144035a20b46544075fb08",
      "92246bce171a4d6dbd708a25656c2da4",
      "c248c09004c4460398535caeeb753b91"
    ],
    "updated_on": "2023-10-01"
  }
  ```

  ```text CSV theme={null}
  02b70bd917264a3181beac85c1abd71e
  8e468df6954c4d29b63aa983d8cf6155
  17093a20cf144035a20b46544075fb08
  92246bce171a4d6dbd708a25656c2da4
  c248c09004c4460398535caeeb753b91
  ```
</ResponseExample>

## Quick Links

<CardGroup cols={2}>
  <Card title="Audiences overview" href="/products/data/marketing-hub/">
    Use the Audience tool to create audiences.
  </Card>

  <Card title="Audience Service API Reference" href="/api-reference/audience/overview/index">
    Learn more about the API.
  </Card>
</CardGroup>
