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

# Campaigns

> Call a list of contacts with one of your assistants: upload the contacts file, create the campaign, let it import, then start it. The flow, the NDJSON format, the limits, the statuses and who may do what.

A **campaign** calls a list of contacts with one of your [assistants](https://docs.verbeo.ai/api-reference/assistants/overview.md), from one of your [phone numbers](https://docs.verbeo.ai/api-reference/phone-numbers/overview.md). Verbeo places the calls, retries the contacts it did not reach, and keeps a result for every contact.

The contacts do not travel in the request that creates the campaign. You upload them first, as one [NDJSON file](#the-contacts-file), then create the campaign with that file. Verbeo imports it in the background, and the campaign can start once the import is done.

> [!NOTE]
>
> This is **version 2** of the campaigns API, and the one to build on. Integrations built on version 1 keep working.

## Endpoints

Every path is under `https://api.verbeo.ai/v2`.

| Endpoint | Purpose |
| - | - |
| [`POST /campaign/list`](https://docs.verbeo.ai/api-reference/campaign/list) | List your campaigns, newest first, by name or status |
| [`POST /campaign/imports`](https://docs.verbeo.ai/api-reference/campaign/reserve-import) | Reserve an upload for a contacts file |
| [`POST /campaign`](https://docs.verbeo.ai/api-reference/campaign/create) | Create a campaign with the file you uploaded |
| [`GET /campaign/{id}`](https://docs.verbeo.ai/api-reference/campaign/get) | One campaign, with its import's progress |
| [`PUT /campaign/{id}`](https://docs.verbeo.ai/api-reference/campaign/update) | Change its name, caller ID, retries, start time or business hours |
| [`DELETE /campaign/{id}`](https://docs.verbeo.ai/api-reference/campaign/delete) | Delete a campaign that never started |
| [`POST /campaign/{id}/start`](https://docs.verbeo.ai/api-reference/campaign/start) | Start a draft or scheduled campaign |
| [`POST /campaign/{id}/pause`](https://docs.verbeo.ai/api-reference/campaign/pause) | Pause a running campaign |
| [`POST /campaign/{id}/resume`](https://docs.verbeo.ai/api-reference/campaign/resume) | Resume a paused campaign |
| [`POST /campaign/{id}/cancel`](https://docs.verbeo.ai/api-reference/campaign/cancel) | Stop a campaign for good |
| [`POST /campaign/{id}/import/retry`](https://docs.verbeo.ai/api-reference/campaign/retry-import) | Run a failed import again, from where it stopped |
| [`POST /campaign/{id}/contacts`](https://docs.verbeo.ai/api-reference/campaign/contacts) | A page of its contacts, each with its call |
| [`GET /campaign/{id}/stats`](https://docs.verbeo.ai/api-reference/campaign/stats) | Its contacts per status |

The workspace comes from your API key, so no endpoint asks you for a workspace id.

> [!NOTE]
>
> The two lists are `POST`s because a list query is a document: page, size and filters arrive typed as themselves rather than coerced from a query string. They read, and change nothing.

## How it works

**1. Write the contacts file**

One JSON object a line, each with the number to call in +E.164. See [The contacts file](#the-contacts-file).

```json contacts.ndjson theme={null}
{"phone_number": "+14155550123", "contact_name": "Ann Lee", "custom_data": {"company": "Acme Corp"}}
{"phone_number": "+14155550124", "contact_name": "Ravi Kumar"}
```

**2. Reserve an upload**

Send the file's name and its size in bytes, which `wc -c < contacts.ndjson` prints ([Reserve an upload](https://docs.verbeo.ai/api-reference/campaign/reserve-import.md)):

```bash theme={null}
curl -X POST "https://api.verbeo.ai/v2/campaign/imports" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "file_name": "contacts.ndjson", "file_size": 164, "contact_count": 2 }'
```

The answer's `import.id` names the upload, and `upload.signed_url` is where the file goes. The link works for 2 hours.

**3. Upload the file**

One `PUT` of the whole file to `upload.signed_url`, exactly as the answer gave it:

```bash theme={null}
curl -X PUT "UPLOAD_SIGNED_URL" \
  -H "Content-Type: application/x-ndjson" \
  --data-binary @contacts.ndjson
```

The link goes to Verbeo's file storage, not to `api.verbeo.ai`, and takes no API key. Use `--data-binary`: curl's `-d` strips the newlines between the contacts.

**4. Create the campaign**

Name the upload, the assistant and the number to call from ([Create campaign](https://docs.verbeo.ai/api-reference/campaign/create.md)):

```bash theme={null}
curl -X POST "https://api.verbeo.ai/v2/campaign" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "import_id": "9b2f5c1e-4d3a-4e8b-a1f0-6c7d8e9f0a1b",
    "campaign_name": "Spring renewals",
    "agent_id": "550e8400-e29b-41d4-a716-446655440000",
    "phone_number_id": "7d9f3b52-4c1e-4a8e-9b1a-2f6c0d4e8a11",
    "max_retries": 2,
    "retry_intervals": [30, 120]
  }'
```

The campaign is a `draft`, and its import is queued.

**5. Wait for the import**

Read the campaign every few seconds ([Get campaign](https://docs.verbeo.ai/api-reference/campaign/get.md)) until `import.status` is `done`:

```bash theme={null}
curl "https://api.verbeo.ai/v2/campaign/0175091d-2c3b-4aef-8c45-dbbe24f7b3ff" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

`import.lines_read` of `import.total_lines` is how far it has got, and `import.skipped` lists the lines it passed over, with why. If the import is `failed`, `import.error_message` says why, and [Retry import](https://docs.verbeo.ai/api-reference/campaign/retry-import.md) runs it again from where it stopped.

**6. Start it**

```bash theme={null}
curl -X POST "https://api.verbeo.ai/v2/campaign/0175091d-2c3b-4aef-8c45-dbbe24f7b3ff/start" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

A campaign created with a `scheduled_at` needs no start: it becomes `scheduled` when its import is done, and starts at that time. Follow the calls with [List contacts](https://docs.verbeo.ai/api-reference/campaign/contacts.md) and [Contact counts](https://docs.verbeo.ai/api-reference/campaign/stats.md).

## The contacts file

NDJSON: one JSON object a line, in UTF-8, each line ending in `\n` or `\r\n`. Upload it with `Content-Type: application/x-ndjson`.

```json contacts.ndjson theme={null}
{"phone_number": "+14155550123", "contact_name": "Ann Lee", "custom_data": {"company": "Acme Corp", "renewal_date": "2026-12-01"}}
{"phone_number": "+919876543210", "contact_name": "Ravi Kumar", "custom_data": {"language": "hi"}}
{"phone_number": "+447700900123"}
```

| Field | Type | Rule |
| - | - | - |
| `phone_number` | string, required | The number to call in +E.164: a `+`, a country code that does not start with `0`, then digits only, 15 at most in all, e.g. `+14155550123`. No spaces, dashes or brackets. |
| `contact_name` | string or null | Up to 255 characters. The call gets it as the dynamic variable `{{contact_name}}`, and as `{{name}}` unless `custom_data` has a `name` of its own. |
| `custom_data` | object or null | Up to 10 KB as JSON, nested at most 16 levels deep. Each key is a dynamic variable of the call: `{{company}}` in the assistant's prompt. |

Any other key on a line is ignored. The numbers must already be in +E.164: the import does not read a number without a country code.

How the lines are read:

* **A blank line** (empty, or only whitespace) is passed over. It is neither a contact nor a skipped line.
* **A line that breaks a rule is skipped** with its reason, and the import goes on. `rows_skipped` counts every skipped line; `skipped` keeps the first 100 with their line numbers (line 1 is the file's first).
* **A number on two lines is called twice.** Duplicates are kept.

| Reason in `skipped` | The line |
| - | - |
| `not valid JSON` | is not JSON. |
| `not a JSON object` | is JSON, but not an object, e.g. an array. |
| `phone_number: must be a number in +E.164 format, e.g. +14155550123` | has no `phone_number`, or one that is not text in +E.164. |
| `contact_name: must be text of at most 255 characters` | has a `contact_name` that is not text, or is longer. |
| `custom_data: must be a JSON object` | has a `custom_data` that is not an object. |
| `custom_data: must be at most 10 KB` | has a `custom_data` over 10 KB as JSON. |
| `custom_data: must be nested at most 16 levels deep` | has a `custom_data` nested deeper. |
| `contact_name: holds a character the database cannot store (a NUL, or half of a surrogate pair)` | has a `contact_name` with `\u0000`, or a `\ud800`–`\udfff` escape that is not one half of a pair. |
| `custom_data: holds a character the database cannot store (a NUL, or half of a surrogate pair)` | has such a character in any key or text of `custom_data`. |

## Limits

| | Limit |
| - | - |
| Contacts a campaign | 100,000 lines that are not blank. A line that is then skipped counts too: the file is counted before it is read. |
| Lines a file | 200,000 in all, blank ones included. |
| File size | 50 MB (52,428,800 bytes). |
| File type | NDJSON, uploaded as `application/x-ndjson`. |
| Upload link | Works for 2 hours from the reserve. Create the campaign before it expires. |
| Contacts files a campaign | One, given at create. To call another list, create another campaign. |
| Skipped lines kept with their reason | The first 100. |
| Retries a contact | 0 to 6, each waiting 1 to 10,080 minutes (7 days). |
| Campaign name | 1 to 255 characters. |
| Page size | 1 to 100 campaigns (default 10); 1 to 1,000 contacts (default 100). |

## The campaign object

Every route that returns a campaign returns this. [List campaigns](https://docs.verbeo.ai/api-reference/campaign/list.md) returns it with a shorter `import`.

```json theme={null}
{
  "id": "0175091d-2c3b-4aef-8c45-dbbe24f7b3ff",
  "workspace_id": "123e4567-e89b-12d3-a456-426614174000",
  "campaign_name": "Spring renewals",
  "agent_id": "550e8400-e29b-41d4-a716-446655440000",
  "phone_number_id": "7d9f3b52-4c1e-4a8e-9b1a-2f6c0d4e8a11",
  "status": "draft",
  "total_contacts": 34998,
  "completed_calls": 0,
  "successful_calls": 0,
  "failed_calls": 0,
  "max_retries": 2,
  "retry_intervals": [30, 120],
  "scheduled_at": null,
  "started_at": null,
  "completed_at": null,
  "business_hours": {
    "tz": "America/New_York",
    "days": [1, 2, 3, 4, 5],
    "windows": [{ "start": 540, "end": 1020 }]
  },
  "default_country": null,
  "dormant_until": null,
  "last_warmup_at": null,
  "created_at": "2026-11-02T09:00:00.123456+00:00",
  "updated_at": "2026-11-02T09:00:41.654321+00:00",
  "import": {
    "id": "9b2f5c1e-4d3a-4e8b-a1f0-6c7d8e9f0a1b",
    "status": "importing",
    "file_name": "contacts.ndjson",
    "file_size": 4812345,
    "expected_count": 50000,
    "total_lines": 50000,
    "lines_read": 35000,
    "contacts_added": 34998,
    "rows_skipped": 2,
    "skipped": [
      { "line": 12, "reason": "phone_number: must be a number in +E.164 format, e.g. +14155550123" },
      { "line": 4108, "reason": "not valid JSON" }
    ],
    "error_message": null,
    "attempts": 1,
    "created_at": "2026-11-02T08:58:30.000123+00:00",
    "updated_at": "2026-11-02T09:00:41.654321+00:00"
  }
}
```

**id** `string` *required*

UUID of the campaign.

**workspace\_id** `string` *required*

UUID of your workspace.

**campaign\_name** `string` *required*

Its name, 1 to 255 characters.

**agent\_id** `string | null` *required*

The assistant that places the calls. `null` only on a finished campaign whose assistant has since been deleted.

**phone\_number\_id** `string | null` *required*

The number the calls come from: the caller ID. `null` only on a finished campaign whose number has since been deleted.

**status** `string` *required*

See [Campaign statuses](#campaign-statuses).

**total\_contacts** `number` *required*

The contacts in the campaign. It grows while the import runs.

**completed\_calls** `number` *required*

Contacts that are finished: reached, failed or cancelled.

**successful\_calls** `number` *required*

Contacts reached.

**failed\_calls** `number` *required*

Contacts that failed or were cancelled.

**max\_retries** `number` *required*

How many more times a contact that was not reached is called: 0 to 6.

**retry\_intervals** `number[]` *required*

Minutes to wait before each retry, the first retry first. A retry with no interval of its own waits 5 minutes.

**scheduled\_at** `string | null` *required*

When the campaign starts on its own.

**started\_at** `string | null` *required*

When it was first started.

**completed\_at** `string | null` *required*

When it finished, or was cancelled.

**business\_hours** `object | null` *required*

When calls may be placed, as [Create campaign](https://docs.verbeo.ai/api-reference/campaign/create.md) takes it. `null`: any time.

**default\_country** `string | null` *required*

A two-letter country code stored with the campaign.

**dormant\_until** `string | null` *required*

When a `dormant` campaign wakes.

**last\_warmup\_at** `string | null` *required*

When it last began to warm up.

**created\_at** `string` *required*

ISO 8601 timestamp with a UTC offset.

**updated\_at** `string` *required*

The last change, in the same format.

**import** `object | null` *required*

Its contacts file and how far its import has got: [the import object](#the-import-object). `null` for a campaign made without one, before version 2 or through version 1.

## The import object

```json theme={null}
{
  "id": "9b2f5c1e-4d3a-4e8b-a1f0-6c7d8e9f0a1b",
  "status": "failed",
  "file_name": "contacts.ndjson",
  "file_size": 4812345,
  "expected_count": 50000,
  "total_lines": 50000,
  "lines_read": 20000,
  "contacts_added": 19998,
  "rows_skipped": 2,
  "skipped": [
    { "line": 12, "reason": "phone_number: must be a number in +E.164 format, e.g. +14155550123" },
    { "line": 4108, "reason": "not valid JSON" }
  ],
  "error_message": "The import stopped 5 times before it finished. Retry it.",
  "attempts": 5,
  "created_at": "2026-11-02T08:58:30.000123+00:00",
  "updated_at": "2026-11-02T09:06:12.345678+00:00"
}
```

**id** `string` *required*

The upload's UUID: the `import_id` the campaign was created with.

**status** `string` *required*

See [Import statuses](#import-statuses).

**file\_name** `string` *required*

The name you gave the file.

**file\_size** `number` *required*

Its size in bytes: as you declared it, then as stored once the campaign is created.

**expected\_count** `number | null` *required*

The `contact_count` you gave, for a progress bar before the lines are counted.

**total\_lines** `number | null` *required*

The file's lines, blank ones included. `null` until Verbeo has counted them.

**lines\_read** `number` *required*

The lines saved so far: contacts, skipped and blank lines alike. A retry resumes after them.

**contacts\_added** `number` *required*

Contacts imported.

**rows\_skipped** `number` *required*

Lines skipped.

**skipped** `object[]` *required*

The first 100 skipped lines, each `{ "line", "reason" }`.

**error\_message** `string | null` *required*

Why the import failed.

**attempts** `number` *required*

Runs started. More than 1 when a run was cut off and resumed; the import fails after 5 runs that did not finish.

A list item's `import` carries `id`, `status`, `expected_count`, `total_lines`, `lines_read`, `contacts_added`, `rows_skipped` and `error_message`.

### Import statuses

| Status | Meaning |
| - | - |
| `uploading` | Reserved, waiting for the file and the create. |
| `queued` | The campaign is created; the import waits its turn. |
| `importing` | Verbeo is reading the file: `lines_read` of `total_lines`. |
| `done` | Every line is read. The file is deleted from storage. |
| `failed` | Stopped. `error_message` says why. The file is kept, so [Retry import](https://docs.verbeo.ai/api-reference/campaign/retry-import.md) can resume it, unless the campaign was cancelled. |

Why an import fails, in `error_message`:

| `error_message` | Why |
| - | - |
| `The file has 120,000 lines; a campaign takes at most 100,000 contacts, one a line. Split it into smaller campaigns.` | Over the limit, counting the lines that are not blank. Nothing was imported. |
| `The file has more than 200,000 lines, blank ones included; a campaign takes at most 100,000 contacts, one a line. Remove the blank lines, or split it into smaller campaigns.` | Too many lines in all. Nothing was imported. |
| `The import stopped 5 times before it finished. Retry it.` | Five runs were cut off before the end. |
| `The contacts file is no longer in storage. Create the campaign again.` | The file is gone. |
| `The campaign is no longer a draft, so it takes no more contacts.` | The campaign was cancelled while it imported. |

## Campaign statuses

| Status | Meaning |
| - | - |
| `draft` | Not started. Every campaign is a draft while its contacts import, and cannot start until the import is done. |
| `scheduled` | Starts on its own at `scheduled_at`. A draft with a `scheduled_at` becomes `scheduled` once its import is done. |
| `warmup` | Starting: Verbeo is getting the calling capacity ready. It becomes `in-progress` on its own. |
| `in-progress` | Placing calls. |
| `dormant` | Outside its business hours. It wakes on its own at `dormant_until`. |
| `paused` | No new calls are placed; calls under way finish. |
| `completed` | Every contact is finished. |
| `cancelled` | Stopped for good. The contacts not yet called are never called. |

## Who may do what

An API key acts as its workspace's **owner**, so it may call every route. The same routes serve the dashboard, where each member's role decides:

| Route | Roles | Pro plan |
| - | - | - |
| List, get, list contacts, contact counts | Any member | No |
| Reserve an upload, create | Owner, admin, developer | Yes |
| Start, resume | Owner, admin, developer | Yes |
| Update | Owner, admin, developer | Only to give a draft a time to start |
| Pause, cancel, retry import | Owner, admin, developer | No |
| Delete | Owner, admin | No |

A member without the role gets `403 FORBIDDEN`, naming the roles that would have worked.

**Campaigns are a Pro feature.** The workspace's latest subscription must be on a plan with campaigns, and active, trialing or past due. Without it, reserving, creating, starting, resuming and giving a draft a time to start are refused with `402 PAYMENT_REQUIRED`: `Campaigns are a Pro feature. Upgrade this workspace to the Pro plan to create or start a campaign.` Pausing and cancelling are never refused for it.

## Good to know

* **The upload link expires 2 hours after the reserve** (`upload.expires_at`). After that, creating with it is refused (`409`) and the upload is removed: reserve again and upload again.
* **A campaign cannot start until its import is done.** It is a draft meanwhile, and starting it is refused with `409`; so is starting one with no contacts.
* **Start and resume need the Pro plan** (`402`), and so does an update that gives a draft a time to start, since a scheduled campaign starts by itself. Pause and cancel do not.
* **Only a campaign that never started can be deleted.** One that has started keeps its history: deleting it is refused with `409`. Cancel it instead.
* **Contacts saved in the same batch come back in no set order.** The import saves the file 5,000 lines that are not blank at a time (fewer when the lines are long). [List contacts](https://docs.verbeo.ai/api-reference/campaign/contacts.md) returns the batches in order, but not each batch in file order. To match a contact to your own record, put your id in its `custom_data`.
* **A failed import resumes where it stopped.** [Retry import](https://docs.verbeo.ai/api-reference/campaign/retry-import.md) carries on after the last line saved, so no contact is added twice.
* **Cancelling or deleting a campaign while its contacts import stops the import.**
* **The dashboard uploads the same file another way.** It sends it in pieces through the resumable (TUS) link the reserve also answers with. An integration can use the plain `PUT` to `upload.signed_url`.

## Errors every route can give

| Code | Status | When |
| - | - | - |
| `UNAUTHORIZED` | 401 | The key is unknown, switched off or expired: `Invalid API key`, `API key is inactive`, `API key is expired`. A request with no `Authorization: Bearer vbr_…` header is a `401` too, but [outside the envelope](https://docs.verbeo.ai/api-reference/errors.md): its body carries `errorMessage` (`Missing or invalid Authorization header`) instead of `error`. |
| `FORBIDDEN` | 403 | A public key: `Public API keys cannot access the REST API. Use a private key (vbr_…).` |
| `VALIDATION_FAILED` | 422 | A body that is not JSON: `Request body is not valid JSON`. An `{id}` that is not a UUID: `must be a valid uuid`. A field that breaks a rule: the message names it first, e.g. `campaign_name: required`, and a required field left out is `campaign_name: Required`. |
| `NOT_FOUND` | 404 | No campaign with this id in your workspace: `Campaign not found`. A path or method the API does not serve: `No route for GET /campaign/0175091d-2c3b-4aef-8c45-dbbe24f7b3ff/contacts`. `GET`, `PUT` or `DELETE` on a one-word path such as `/campaign/list` reads it as an id instead: `422`, `must be a valid uuid`. |
| `INTERNAL_ERROR` | 500 | `Internal server error`: an unexpected failure. Safe to retry. |

The error envelope is on the [Errors](https://docs.verbeo.ai/api-reference/errors.md) page.


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