Overview
Three actions control the execution state of a campaign and all its batches:| Action | Endpoint | Effect |
|---|---|---|
| Pause | POST /campaigns/{id}/pause | Stops new calls; in-flight calls finish naturally |
| Resume | POST /campaigns/{id}/resume | Restarts dispatching from where it left off |
| Cancel | POST /campaigns/{id}/cancel | Hard-stops everything — terminal, no resume possible |
Pause Campaign
POSThttps://api.graine.ai/api/v1/campaigns/{campaign_id}/pause
Pauses the campaign and all its IN_PROGRESS batches. No new calls go out. In-flight calls complete naturally.
What happens internally
- Campaign status →
paused - All
IN_PROGRESSbatches →paused - A Redis pause flag is set per batch, stopping the Kafka consumer from dispatching further contacts
- Scheduled retry/followup jobs are preserved (they will fire again on resume)
Example Request
Response 200 OK
Resume Campaign
POSThttps://api.graine.ai/api/v1/campaigns/{campaign_id}/resume
Resumes a paused campaign and all its PAUSED batches. Pending contacts start dispatching immediately (respecting working hours and concurrency limits).
What happens internally
- Campaign status →
active - All
PAUSEDbatches →in_progress - Redis pause flags are cleared
execute_batchis re-triggered for each batch to drain remainingPENDINGcontacts
Example Request
Response 200 OK
Cancel Campaign
POSThttps://api.graine.ai/api/v1/campaigns/{campaign_id}/cancel
Hard-stops a campaign. This is terminal — a cancelled campaign cannot be resumed.
What happens internally
- All in-flight batches are cancelled (Redis cancel flag set +
batch.status = CANCELLED) - All contacts with status
PENDING,DISPATCHED,RETRYING, orFOLLOWUP_SCHEDULEDare markedSKIPPED - All APScheduler retry/followup/batch-start jobs for these batches are removed from Postgres
- Campaign status →
cancelled
Example Request
Response 200 OK
Pause vs Cancel — Which to Use?
| Scenario | Recommendation |
|---|---|
| Temporary halt (lunch break, holiday) | Pause → Resume later |
| Agent script needs fixing | Pause → Update agent → Resume |
| Compliance hold on specific numbers | Pause → Skip affected contacts → Resume |
| Campaign completed early / wrong contacts uploaded | Cancel |
| Hard regulatory stop — never call these contacts again | Cancel |
Next Steps
Get Campaign Stats
Monitor live progress
Manage Individual Batches
Pause/cancel at the batch level