# Get Audience

`GET /audiences`

Retrieve an audience by ID with optional pagination.

## Authentication

Send your API key in the `PINNACLE-API-KEY` header.

## Parameters

- `id` — query, string. Audience ID. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`.
- `page` — query, integer, optional, default: 1; minimum: 1. Page number. If provided with or without limit, returns paginated contacts.
- `limit` — query, integer, optional, default: 50; minimum: 1; maximum: 100. Items per page. If provided with or without page, returns paginated contacts.

## Responses

### 200

Successfully retrieved audience.

Content type: `application/json`. Schema: `With Pagination | Count Only`.

- Variant: With Pagination
- `id` — `string`. Audience public ID. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`.
- `name` — `string`. Audience name.
- `description` — `string`. Audience description.
- `contacts` — `object[]`. Array of contact objects (paginated).
- `contacts[].description` — `string`, optional. Additional information about the contact.
- `contacts[].email` — `string`, optional. Contact's email address, if available.
- `contacts[].id` — `string`. Unique ID of the contact. This identifier is a string that always begins with the prefix `co_`, for example: `co_1234567890`.
- `contacts[].name` — `string`, optional. Full name of the contact, if available.
- `contacts[].phoneNumber` — `string`. Contact's phone number in E.164 format.
- `contacts[].tags` — `string[]`, optional. List of tags associated with the contact.
- `contactCount` — `integer`. Total number of contacts in audience.
- `pagination` — `object`
- `pagination.page` — `integer`. Current page number (1-indexed).
- `pagination.limit` — `integer`. Items per page (max 100, default 50).
- `pagination.total` — `integer`. Total number of contacts in the audience.
- `pagination.hasMore` — `boolean`. Whether more pages exist.
- Variant: Count Only
- `id` — `string`. Audience public ID. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`.
- `name` — `string`. Audience name.
- `description` — `string`. Audience description.
- `contactCount` — `integer`. Total number of contacts in audience.

Use the Get Audience endpoint with the pagination parameters to get the audience with its contacts.

Example:

```json
{
  "id": "aud_abc123",
  "name": "VIP Customers",
  "description": "Our most valuable customers",
  "contacts": [
    {
      "id": "co_def456",
      "phoneNumber": "+12125551234",
      "name": "John Doe",
      "email": "john@example.com",
      "tags": [
        "vip",
        "enterprise"
      ],
      "description": "Premium customer"
    }
  ],
  "contactCount": 150,
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 150,
    "hasMore": true
  }
}
```

### 400

Validation failed. The payload has missing required fields and/or invalid types.

See https://zod.dev/error-formatting for more information.

Content type: `application/json`. Schema: `object`.

- `description` — `string`. Human-readable summary of validation failures.
- `errors` — `object`. Structured dictionary of issues containing two main sections:
- `errors`: Array of global validation errors not tied to specific fields
- `properties`: Object mapping field names to their specific validation errors, where each field contains an `errors` array

Example:

```json
{
  "description": "✖ Invalid input: expected string, received number\n  → at example_field",
  "errors": {
    "errors": [
      "Unrecognized key: 'extraKey'"
    ],
    "properties": {
      "example_field": {
        "errors": [
          "Invalid input: expected string, received NaN"
        ]
      }
    }
  }
}
```

### 401

The request lacks valid authentication credentials or the provided credentials are invalid.

Ensure you're including a valid API key in the request headers and that your account has the necessary permissions to access this endpoint.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "Invalid API key."
}
```

### 403

Your subscription does not include access to this feature.

This occurs when attempting to use functionality that requires a higher subscription tier.
Please upgrade your subscription to access this feature.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "Your subscription does not include access to this feature."
}
```

### 404

The requested resource could not be found.

This may occur if the identifier is incorrect, the resource has been deleted, or you don't have permission to access it.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "The requested resource could not be found."
}
```

### 500

An unexpected error occurred on Pinnacle's servers while processing your request.

If this error persists, please contact support with the request details.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "An unexpected error occurred while processing your request."
}
```

## SDK examples

### TypeScript

```typescript
import { PinnacleClient } from "rcs-js";

const client = new PinnacleClient({
  apiKey: process.env.PINNACLE_API_KEY!,
});

await client.audiences.get({
    id: "aud_abc123"
});
```

### Python

```python
import os
from rcs import Pinnacle

client = Pinnacle(
    api_key=os.environ["PINNACLE_API_KEY"],
)

client.audiences.get(
    id="aud_abc123",
)
```

### Ruby

```ruby
require "rcs"

client = Pinnacle::Client.new(
  api_key: ENV.fetch("PINNACLE_API_KEY")
)

client.audiences.get(id: "aud_abc123")
```

## Machine-readable schema

[OpenAPI 3.1 JSON](https://docs.pinnacle.sh/openapi.json)
