Skip to main content

Overview

Three actions control the execution state of a campaign and all its batches:

Pause Campaign

POST https://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_PROGRESS batches → 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

POST https://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 PAUSED batches → in_progress
  • Redis pause flags are cleared
  • execute_batch is re-triggered for each batch to drain remaining PENDING contacts

Example Request

Response 200 OK


Cancel Campaign

POST https://api.graine.ai/api/v1/campaigns/{campaign_id}/cancel Hard-stops a campaign. This is terminal — a cancelled campaign cannot be resumed.
Cancel is irreversible. Use Pause if you want to stop temporarily and resume later.

What happens internally

  1. All in-flight batches are cancelled (Redis cancel flag set + batch.status = CANCELLED)
  2. All contacts with status PENDING, DISPATCHED, RETRYING, or FOLLOWUP_SCHEDULED are marked SKIPPED
  3. All APScheduler retry/followup/batch-start jobs for these batches are removed from Postgres
  4. Campaign status → cancelled
Calls already accepted by the telephony router finish naturally. No new outbound calls go out after this point.

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