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

# Build a voice campaign workflow

> Build Nixflex voice campaigns with reviewed recipients, duplicate handling, consent and local contact hours, then reconcile launch and cancellation results.

**FIXED · campaign** **MUST** Resume covers only unattempted work in the existing running launch, and neither resume nor reuse replays completed work.\
reuse\_campaign\_id replaces settings and recipients atomically only on an owned, never-launched voice draft or scheduled campaign. A launch claim prevents replacement. SMS creation always generates a fresh ID, even if the request forwards this field. Omit it for SMS.

**NOT OFFERED → do this instead · campaign** A launched or finished campaign cannot run again. For another run create a campaign with a fresh ID, selected recipients and reviewed settings. The dashboard’s Use again button follows the same rule for voice: it edits a campaign that never launched, otherwise it opens a new campaign filled with the original settings and recipients for review before launch. SMS campaigns have no Use again button.

**YOU CAN CHANGE · campaign** Use schedule\_type=schedule, scheduled\_date (YYYY-MM-DD), timezone, window\_days and optional paired window\_start\_minutes/window\_end\_minutes. UTC date checks, local windows and capacity apply.

**SCOPE · campaign** `DELETE /v1/calls/batch/{id}` deletes a voice campaign. Voice and SMS have separate cancel routes. Cancel stops future work. Running attempts may finish.

For one owned sender, send business\_number (encode + as %2B) on `GET /v1/campaigns` or `GET /v1/sms/campaigns`. Omit for account scope. Keep the same number and status through SMS cursors. Restart paging if either changes. Voice include\_totals=true covers returned campaigns only (default 50, max 200).

Pickup rate = answered attempts / all attempts, including failed starts. Answered means over five seconds with no detected voicemail. Sum counts before dividing. Zero attempts means no rate. SMS delivery rate = delivered / (delivered + failed).

[Read the compact AI rules](https://docs.nixflex.com/ai-rules.md#campaigns)

Prepare a voice campaign’s recipients and permission checks, create executable work, then track that same campaign through its results.

Creation: **Executable work** · Recipients: **Reviewed rows** · Recovery: **Existing campaign ID**

**The important part**

* Campaign lists cover the account. Use your saved customer-to-campaign mapping and read each [voice campaign by ID](https://docs.nixflex.com/api-reference/voice-campaigns/get.md). A sender filter on the list is unavailable.

* To run a campaign again, create a new one. A voice campaign that has never launched can be edited in place. See [voice creation and controls](https://docs.nixflex.com/api-reference/calls/batch-create.md) for the difference between editing, cancelling, resuming and deleting.

* Campaign creation can launch immediately or run when its schedule is due.

* A duplicate warning is not a sending lock; choose the required policy deliberately.

* Cancel stops future dispatch and does not hang up active calls.

[Business guide](https://docs.nixflex.com/guides/business/voice-campaigns.md) · [API reference](https://docs.nixflex.com/api-reference/introduction.md) · [Glossary](https://docs.nixflex.com/guides/glossary.md)

## Choose the task

| Task | Outcome |
| - | - |
| [Prepare and launch](https://docs.nixflex.com/guides/developer/campaigns/prepare-and-launch.md) | Validate the complete recipient set before executable work. |
| [Results and controls](https://docs.nixflex.com/guides/developer/campaigns/results-and-controls.md) | Resolve holds and control future dispatch. |

## Prerequisites

Keep the account credential in `NIXFLEX_API_KEY` on your server. SDK and CLI examples require Node/CLI 0.11.0 or later or Python 0.4.0 or later. Use identifiers owned by the intended account. Raw HTTP base URL: `https://api.nixflex.com/v1`. Node and Python SDK base URL: `https://api.nixflex.com`. The SDK adds `/v1`. Choose an active owned agent, an eligible sender and recipients you are permitted to contact. The example below only lists existing campaigns.

## 1. Read existing campaigns

```bash cURL theme={"dark"}
curl --request GET \
  --url "https://api.nixflex.com/v1/campaigns?status=running&limit=2" \
  --header "Authorization: Bearer $NIXFLEX_API_KEY"
```

```javascript Node theme={"dark"}
import Nixflex from 'nixflex';

const c = new Nixflex({
  apiKey: process.env.NIXFLEX_API_KEY,
  baseUrl: 'https://api.nixflex.com',
  maxRetries: 0,
});
const result = await c.campaigns.list({"status": "running", "limit": 2});
```

```python Python theme={"dark"}
import os
from nixflex import Nixflex

with Nixflex(
    api_key=os.environ["NIXFLEX_API_KEY"],
    base_url="https://api.nixflex.com",
    max_retries=0,
) as c:
    result = c.campaigns.list(status='running', limit=2)
```

```powershell CLI (PowerShell) theme={"dark"}
nixflex campaigns list --status running --limit 2 --json --base-url "https://api.nixflex.com"
```

## 2. Prepare and preview recipients

Build rows with `phone`, nested `variables`, and known `country`/`timezone` values. Supply a nonblank campaign `prompt`; use `prompt_override` only for deliberate row-specific instructions. Preview local hours and validate every required value. Choose `duplicate_policy:reject` if duplicate contacts must be prevented; `warn` retains them.

## 3. Create executable work

POST `/v1/calls/batch` with `agent_id`, `from_number`, `prompt` and recipients. `schedule_type:now` requests launch immediately; `schedule` uses `scheduled_date` in YYYY-MM-DD form and may run automatically when due. `duplicate_choice_required` is advisory, not a sending lock. Consent and current dispatch checks still apply.

## 4. Track and control the existing campaign

Save `campaign_id` even if launch is uncertain. Read campaign state and holds. Use the documented consent, cancel and resume endpoints for that same campaign. Cancel prevents further dispatch; it does not hang up active calls. Resume does not mean repeat completed recipients.

## 5. Reconcile before replacement

`reuse_campaign_id` replaces an owned never-launched draft or scheduled voice campaign; it is not an idempotency key. Do not recreate after `campaign_outcome_unknown`. [Delete the owned voice campaign](https://docs.nixflex.com/api-reference/voice-campaigns/delete.md) after eligible work settles.

## Example response

Creation returns `campaign_id`, recipient validation and current status. Immediate launch can also return `queued`, `failed` and legacy `dialed`; `dialed` counts enqueued jobs, not connected calls. [Create response fields](https://docs.nixflex.com/api-reference/calls/batch-create.md) define the exact shape.

## Errors and limits

| Condition | Handling |
| - | - |
| Duplicate warning | Review it before calling create; warn does not stop dispatch. |
| Missing consent/location/contact hold | Resolve that reason on the existing campaign. |
| Unknown creation or launch outcome | Reconcile using the saved campaign ID. |
| Maximum recipients | Up to 100,000 accepted rows; request-size limits can apply first. |
| Wider hours | Record a valid explanation; current policy still applies. |

## Delete content deliberately

Deleting a voice or SMS campaign cancels waiting work, hangs up its running calls, then removes the campaign and recipient list. Calls already made and texts already sent stay in history. Used charges stay in billing; there are no refunds. Owner and Admin can delete; Member cannot. Cancel alone stops future dispatch and lets active calls finish; Delete also requests their hang-up.

If hang-up is not confirmed, HTTP 503 `hangup_pending` returns `error.details.deleted:false` and `error.details.retry_pending:true`. Deletion stays queued and continues automatically. Repeating the same DELETE for the same account and ID safely resumes it. A lost response or `deletion_unavailable` is not success: check the list, then repeat that same DELETE if needed. Missing and foreign IDs share HTTP 404. Bulk call deletion and account closure keep separate safety rules.

Read [delete call data](https://docs.nixflex.com/guides/business/privacy/delete-call-data.md) for the dashboard task and [single-call deletion](https://docs.nixflex.com/api-reference/calls/delete.md) for response fields.

## Next steps

* [Create campaign](https://docs.nixflex.com/api-reference/calls/batch-create.md)
* [Cancel campaign](https://docs.nixflex.com/api-reference/voice-campaigns/post-calls-batch-id-cancel.md)
* [Contact controls](https://docs.nixflex.com/guides/developer/contact-controls.md)

Read one owned campaign with [Get a voice campaign](https://docs.nixflex.com/api-reference/voice-campaigns/get.md). It returns the same saved fields as the list, without recipients, and sends `Cache-Control: no-store`. A 503 keeps the result unavailable; it must not clear the campaign or turn the wider-hours choice into false.


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