> ## 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 Campaign Audience Data

> Export campaign audience data as an Excel (.xlsx) file with optional filters. Columns include dynamic fields based on agent metadata.

Use this endpoint to **export campaign audience data as an Excel file** (.xlsx) with optional filters.

## Endpoint

**GET** `/export-campaign-audience-data`

**Authentication:** Required (workspace auth)

## Query Parameters

| Parameter      | Type            | Required | Description                               |
| -------------- | --------------- | -------- | ----------------------------------------- |
| `campaign_id`  | number          | **Yes**  | Campaign identifier                       |
| `mobile_no`    | string          | No       | Partial mobile number search (LIKE)       |
| `status`       | string \| array | No       | Audience status filter (see values below) |
| `call_status`  | string \| array | No       | Filter by call status                     |
| `first_status` | string \| array | No       | Filter by first call status               |
| `last_status`  | string \| array | No       | Filter by last call status                |
| `attempt`      | number \| array | No       | Filter by number of attempts made         |
| `date_range`   | string          | No       | Date range filter                         |

## Audience Status Values

| Status      | Description          |
| ----------- | -------------------- |
| `fresh`     | Not yet called       |
| `completed` | Call completed       |
| `halted`    | Call halted          |
| `inqueue`   | In queue for calling |

## Response

Returns an Excel file (`.xlsx`) with the following columns:

| Column            | Description                                  |
| ----------------- | -------------------------------------------- |
| ID                | Audience record identifier                   |
| Mobile No         | Audience mobile number                       |
| *Dynamic Columns* | Columns based on agent metadata input fields |
| Status            | Audience status label                        |
| Attempt           | Attempts made vs max retry (e.g., `2/3`)     |
| Call Status       | Last call status                             |
| Duration          | Total call duration                          |
| Disposition       | Last disposition                             |
| Modified By       | User who last modified                       |
| Updated Date      | Last update date                             |

## Notes

* The response is a binary Excel file stream, not JSON.
* Set your HTTP client to handle binary/file responses.
* Dynamic columns are derived from the agent's metadata input configuration.
* The `campaign_id` must belong to the authenticated company and workspace.
* Date filter applies to `CREATED_DATE` of the audience record.

## Example cURL

```bash theme={null}
curl -X GET "https://www.tryunleashx.com/api/v1/global/export-campaign-audience-data?campaign_id=42&status=completed" \
  -H "token: <api_key>" \
  -o campaign_audience.xlsx
```


## OpenAPI

````yaml api-reference/openapi.json GET /export-campaign-audience-data
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:
  /export-campaign-audience-data:
    get:
      tags:
        - Campaigns
      summary: Export campaign audience data
      description: >-
        Export campaign audience data as an Excel (.xlsx) file with optional
        filters. Columns include dynamic fields based on agent metadata.
      parameters:
        - name: token
          in: header
          required: true
          description: API token for authentication
          schema:
            type: string
        - name: campaign_id
          in: query
          required: true
          schema:
            type: integer
          description: Campaign identifier
        - name: mobile_no
          in: query
          required: false
          schema:
            type: string
          description: Partial mobile number search
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - fresh
              - completed
              - halted
              - inqueue
          description: >-
            Filter by audience status. Valid values: fresh, completed, halted,
            inqueue
        - name: call_status
          in: query
          required: false
          schema:
            type: string
          description: Filter by call status
        - name: first_status
          in: query
          required: false
          schema:
            type: string
          description: Filter by first call status
        - name: last_status
          in: query
          required: false
          schema:
            type: string
          description: Filter by last call status
        - name: attempt
          in: query
          required: false
          schema:
            type: integer
          description: Filter by attempt count
        - name: date_range
          in: query
          required: false
          schema:
            type: string
          description: Date range filter
      responses:
        '200':
          description: Excel file download
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: Bad Request - campaign_id is required
        '401':
          description: Unauthorized
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````