> ## 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.

# Download Audience Format

> Download an Excel (.xlsx) template for uploading audience data to a campaign. Columns are dynamically generated based on the agent's metadata input fields.

Use this endpoint to **download an Excel template** for uploading audience data to a campaign.

## Endpoint

**GET** `/audience-format`

**Authentication:** Required (workspace auth)

## Query Parameters

| Parameter     | Type   | Required | Description         |
| ------------- | ------ | -------- | ------------------- |
| `campaign_id` | number | Yes      | Campaign identifier |

## Response

Returns a downloadable **Excel file** (`.xlsx`).

* **Content-Type:** `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
* **Filename:** `audience_format_<timestamp>.xlsx`

### Template Columns

The Excel file always includes `mobile_no` as the first column. Additional columns are dynamically generated based on the **agent's configured metadata input fields**.

| Column           | Description                                             |
| ---------------- | ------------------------------------------------------- |
| `mobile_no`      | Phone number in E.164 format (e.g. `+12025550123`)      |
| `<custom_field>` | Additional fields defined in the agent's metadata input |

## Notes

* The campaign must have an agent assigned. If no agent is linked, the request returns an error.
* Fill the template and upload it when creating or updating a campaign via the `audience` field.

## Error Cases

| Error                                                     | Cause                                    |
| --------------------------------------------------------- | ---------------------------------------- |
| `Campaign not exist Or Agent is not assigned to campaign` | Invalid `campaign_id` or no agent linked |

## Example cURL

```bash theme={null}
curl -X GET "https://www.tryunleashx.com/api/v1/global/audience-format?campaign_id=42" \
  -H "Authorization: <api_key>" \
  --output audience_template.xlsx
```


## OpenAPI

````yaml api-reference/openapi.json GET /audience-format
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-format:
    get:
      tags:
        - Campaigns
      summary: Download audience format
      description: >-
        Download an Excel (.xlsx) template for uploading audience data to a
        campaign. Columns are dynamically generated based on the agent's
        metadata input fields.
      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
      responses:
        '200':
          description: Excel file download
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: Campaign not exist Or Agent is not assigned to campaign
        '401':
          description: Unauthorized
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````