> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rasen.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rasen.ai/_mcp/server.

# Create and start a campaign

A campaign calls a recipient list with a published agent. Creating a campaign saves a draft.
To start dialing, move it through **plan → admit → start**. Each command needs the campaign's
current `ETag` in `If-Match` and a separate `Idempotency-Key`.

The examples use `RASEN_API_BASE` and `RASEN_API_KEY` from the
[Quickstart](/get-started/quickstart). You need `calls.write` for changes and `calls.read` for
campaign and recipient reads. Publish the agent and configure an outbound number first
([Telephony connections](/guides/telephony), [Phone routing](/guides/phone-numbers)).

## 1. Create a draft

Save a new idempotency key before sending the request. Keep it for retries of this same action.

```bash
CREATE_KEY=$(uuidgen)
curl --fail-with-body -sS -D campaign-headers.txt -o campaign.json \
  -X POST "$RASEN_API_BASE/campaigns" \
  -H "Authorization: Bearer $RASEN_API_KEY" -H "Idempotency-Key: $CREATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "agent_…", "name": "Appointment reminders",
       "recipients": [{"to_e164": "+12025550123", "contact_ref": "appointment-001",
                       "variables": {"customer_name": "Alex"}}],
       "max_attempts_per_recipient": 1, "max_concurrent_calls": 1,
       "dialing_time_zone": "UTC"}'
```

The `201` response contains the campaign `id`, `revision` and `state`, plus an `ETag` header.
Use that `id` as `CAMPAIGN_ID`. Inline campaigns accept 1 to 100,000 recipients. Each recipient
requires `to_e164`; optional `variables` contain at most 64 string values.

Optional settings include `from_phone_number_id`, retry count and backoff, concurrency, ringing
timeout, a dialing time zone, and absolute or daily dialing windows. The accepted concurrency
range is 1 to 1,000; workspace capacity and admission policy still apply.

## 2. Plan and admit

Use the ETag from creation or `GET /campaigns/{campaign_id}` for planning. Each successful command
returns a new ETag; use it for the next command. After a lost response, retry with the same key and
the original request. After a stale revision refusal, read and review the campaign again.

```bash
PLAN_KEY=$(uuidgen)
curl --fail-with-body -sS -D plan-headers.txt -X POST \
  "$RASEN_API_BASE/campaigns/$CAMPAIGN_ID/plan" \
  -H "Authorization: Bearer $RASEN_API_KEY" \
  -H "If-Match: $ETAG_FROM_CREATE" -H "Idempotency-Key: $PLAN_KEY"

ADMIT_KEY=$(uuidgen)
curl --fail-with-body -sS -D admit-headers.txt -X POST \
  "$RASEN_API_BASE/campaigns/$CAMPAIGN_ID/admit" \
  -H "Authorization: Bearer $RASEN_API_KEY" \
  -H "If-Match: $ETAG_FROM_PLAN" -H "Idempotency-Key: $ADMIT_KEY"
```

Planning returns progress, capacity ceiling and dialing-window information. Admission checks
whether the planned campaign can proceed. Do not send start after a refused plan or admission.

## 3. Start dialing

This operation starts real outbound calls. Use the ETag returned by admission.

```bash
START_KEY=$(uuidgen)
curl --fail-with-body -sS -X POST "$RASEN_API_BASE/campaigns/$CAMPAIGN_ID/start" \
  -H "Authorization: Bearer $RASEN_API_KEY" \
  -H "If-Match: $ETAG_FROM_ADMIT" -H "Idempotency-Key: $START_KEY"
```

In the docs, open **API Reference → Campaigns → Start an admitted campaign** and select **Try it**.
Provide your key, campaign ID, current ETag and a new idempotency key.

## Recipient files

`POST /campaigns/recipients/check` validates and previews a CSV or XLSX file without creating a
campaign. `POST /campaigns/upload` creates one from a file. Both use multipart form data with a
`recipients` file field; upload also requires `agent_id` and `name` and takes an idempotency key.
Use the [API Reference](/api-reference) for the full form fields and validation report.

```bash
curl --fail-with-body -sS -X POST "$RASEN_API_BASE/campaigns/recipients/check" \
  -H "Authorization: Bearer $RASEN_API_KEY" -F "recipients=@recipients.csv"
```

## Progress and controls

Read `GET /campaigns`, `GET /campaigns/{campaign_id}` and
`GET /campaigns/{campaign_id}/recipients`. Lists use `limit` and `next_cursor`.

| Command                       | Purpose                                                                      |
| ----------------------------- | ---------------------------------------------------------------------------- |
| `POST …/pause`                | Pause a dialing campaign.                                                    |
| `POST …/resume`               | Resume a paused campaign.                                                    |
| `POST …/retry`                | Retry selected outcomes; send a JSON body with optional `dispositions`.      |
| `POST …/cancel`               | Cancel a campaign.                                                           |
| `POST /campaign-suppressions` | Suppress a destination with `to_e164` and reason `do_not_call` or `opt_out`. |

State commands require the current ETag and an idempotency key. Suppression requires an idempotency
key. Treat unknown state values as unknown. To download campaign results and transcripts, use the
campaign ID with the [campaign evidence exports](/guides/calls#export-campaign-evidence).