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

# Preview Campaign Recipients

> Check a recipient CSV before you create a campaign. Nothing is stored

Parse a recipient CSV and report what a campaign would do with it. Nothing is stored and no call is placed. Use it before [Create campaign](https://docs.60db.ai/api-reference/agents/create-campaign.md).

Send `agent_id` to also see the agent's variables, the CSV columns and how many rows fill each variable.

## Request

### Headers

**Authorization** `string` *required*

Bearer token with your API key (scope `agents`)

**Content-Type** `string` *required*

application/json

### Body

**csv\_text** `string` *required*

The CSV as text. Up to 5 MB. See [CSV format](https://docs.60db.ai/features/agents-campaigns.md#csv-format)

**phone\_line\_id** `string`

The phone line `id`. Its default country code is used for numbers without `+`

**agent\_id** `string`

The agent `id`. Adds `agent_variables`, `columns` and `coverage` to the response

## Response

**200 OK**

```json theme={null}
{
  "success": true,
  "data": {
    "headers": ["phone_number", "name", "city"],
    "valid_count": 248,
    "valid": [
      { "row": 2, "phone": "+919876543210", "variables": { "name": "Asha", "city": "Pune" } }
    ],
    "invalid_count": 1,
    "invalid": [{ "row": 5, "value": "12345", "reason": "invalid_number" }],
    "duplicates": 2,
    "dnc": 3,
    "agent_variables": [
      { "key": "customer_name", "fallback": "there", "used_in": ["script", "greeting"] }
    ],
    "columns": [
      { "key": "name", "header": "name", "sample": "Asha" },
      { "key": "city", "header": "city", "sample": "Pune" }
    ],
    "coverage": {
      "customer_name": { "from_column": null, "rows_with_value": 0 }
    }
  }
}
```

| Field | Meaning |
| - | - |
| `valid_count`, `valid` | Rows that can be called. `valid` holds up to 200 rows |
| `invalid_count`, `invalid` | Rows that cannot be used. `reason` is `invalid_number` or `variables_too_large`. `invalid` holds up to 200 rows |
| `duplicates` | Rows with a number already listed earlier in the file. They are dropped |
| `dnc` | Rows whose number is on your do-not-call list |
| `agent_variables` | Only with `agent_id`. The `{{key}}` and `{{key\|fallback}}` placeholders in the agent's script and greeting |
| `columns` | Only with `agent_id`. Each CSV column that becomes a variable. `sample` is the first non-empty value, cut to 60 characters |
| `coverage` | Only with `agent_id`. For each agent variable, the column that fills it by default (same name) and how many valid rows have a value |

## Errors

| Status | Code | Meaning |
| - | - | - |
| 400 | `VALIDATION_ERROR` | `csv_text` is missing or larger than 5 MB |
| 400 | `CAMPAIGN_INVALID` | The CSV cannot be used. For example, it has no phone column, a duplicate header, or more than 20,000 rows. `field` is `csv_text` |
| 403 | `POLICY_DENY` | Your role cannot place calls, or the API key lacks the `agents` scope |
| 404 | `PHONE_LINE_NOT_FOUND` | No phone line with this `phone_line_id` in your workspace |
| 404 | `AGENT_NOT_FOUND` | No agent with this `agent_id` in your workspace |
| 429 | `RATE_LIMITED` | More than 30 checks in the last minute |

## Example

```bash cURL theme={null}
curl -X POST https://api.60db.ai/agents/campaigns/recipients/preview \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "csv_text": "phone_number,name\n+919876543210,Asha\n",
    "agent_id": "AGENT_ID"
  }'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.