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

# Export Audience Contacts

> Export an audience's contacts, and call history if the audience has been dialed by a campaign, as a binary Excel (.xlsx) file.

Use this endpoint to **export an audience's contacts (and call history, if any) as an Excel file** (.xlsx).

## Endpoint

**GET** `/audience/contacts/export`

**Authentication:** Required (workspace auth)

## Query Parameters

| Parameter     | Type   | Required | Description         |
| ------------- | ------ | -------- | ------------------- |
| `audience_id` | number | Yes      | Audience identifier |

## Response

Returns an Excel file (`.xlsx`) with up to two sheets:

| Sheet               | Contents                                                                                                                                                                                                   |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Audience Contacts` | `Mobile No` plus one column per input variable (dynamic, derived from the audience's saved variables and the contacts' own data)                                                                           |
| `Call History`      | Only included when this audience has been dialed by at least one campaign — `Mobile`, `Campaign ID`, `Call ID`, `Attempt`, `Call Status`, `Duration`, `Time`, `Agent Name`, `Disposition`, `Recording URL` |

## Notes

* The response is a binary Excel file stream, not JSON.
* Set your HTTP client to handle binary/file responses.
* Only active (non-deleted) contacts are included in the `Audience Contacts` sheet.
* If phone number masking is enabled for the workspace, mobile numbers are masked in both sheets.
* `Recording URL` links are signed (time-limited) at export time.

## Error Cases

| Error                     | Cause                                                                         |
| ------------------------- | ----------------------------------------------------------------------------- |
| `Audience Id is missing.` | `audience_id` not provided                                                    |
| `Audience not found`      | `audience_id` doesn't belong to the caller's company/workspace, or is deleted |

## Example cURL

```bash theme={null}
curl -X GET "https://www.tryunleashx.com/api/v1/global/audience/contacts/export?audience_id=55" \
  -H "token: <api_key>" \
  -o audience_contacts.xlsx
```


## OpenAPI

````yaml api-reference/openapi.json GET /audience/contacts/export
openapi: 3.1.0
info:
  title: >-
    UnleashX - Build human like conversations | Voice Agents | Automations | AI
    Workforce
  version: 1.0.0
  description: UnleashX - Your home for human like conversations
servers:
  - url: https://www.tryunleashx.com/api/v1/global/
security:
  - bearerAuth: []
paths:
  /audience/contacts/export:
    get:
      tags:
        - Audience
      summary: Export audience contacts
      description: >-
        Export an audience's contacts, and call history if the audience has been
        dialed by a campaign, as a binary Excel (.xlsx) file.
      parameters:
        - name: token
          in: header
          required: true
          description: API token for authentication
          schema:
            type: string
        - name: audience_id
          in: query
          required: true
          schema:
            type: integer
          description: Audience identifier
      responses:
        '200':
          description: Excel file download
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: Audience Id is missing.
        '401':
          description: Unauthorized
        '404':
          description: Audience not found
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````