Overview
Batches can be controlled independently of their parent campaign. This is useful when you have multiple batches under one campaign and want to pause just one.Pause Batch
POSThttps://api.graine.ai/api/v1/batches/{batch_id}/pause
Sets a Redis pause flag that stops the Kafka consumer from dispatching new contacts. In-flight calls complete naturally.
What happens internally
batch.status→paused- Redis pause flag set for this batch ID
- Kafka consumer skips this batch’s pending contacts
- Scheduled retry / follow-up jobs are preserved
Example Request
Response 200 OK
Resume Batch
POSThttps://api.graine.ai/api/v1/batches/{batch_id}/resume
Clears the Redis pause flag and re-triggers execute_batch to dispatch remaining PENDING contacts.
What happens internally
batch.status→in_progress- Redis pause flag cleared
execute_batchre-invoked — publishes allPENDINGcontacts to the dispatch Kafka topic
Example Request
Response 200 OK
Cancel Batch
POSThttps://api.graine.ai/api/v1/batches/{batch_id}/cancel
Hard-stops a batch. This is terminal — a cancelled batch cannot be resumed.
What happens internally
batch.status→CANCELLED- Redis cancel flag set for the batch
- All
PENDING,DISPATCHED,RETRYING, andFOLLOWUP_SCHEDULEDcontacts →SKIPPED - All APScheduler retry / follow-up jobs for this batch removed from Postgres
Example Request
Response 200 OK
Pause vs Cancel — Which to Use?
Next Steps
Force Dispatch
Manually re-trigger call dispatch
Debug Batch
Diagnose stuck or slow batches