Overview
Three actions control the execution state of a campaign and all its batches: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?
Next Steps
Get Campaign Stats
Monitor live progress
Manage Individual Batches
Pause/cancel at the batch level