Pause Call Batch
Pauses a processing or scheduled batch. No new calls will be initiated, but in-progress calls will continue until they complete. The batch can later be resumed with calls-batch-resume.
Endpoint
| Property | Value |
|---|---|
| Function Name | calls-batch-pause |
| HTTP Method | POST |
| Authentication | Supabase JWT (Bearer token) |
| Required Role | agency_owner or agency_admin |
Request
Headers
Authorization: Bearer <supabase_jwt_token>
Content-Type: application/json
Body
| Field | Type | Required | Description |
|---|---|---|---|
batch_id | string (UUID) | Yes | The batch to pause |
Response
Success (200)
{
"success": true,
"batch_id": "uuid",
"status": "paused",
"paused_at": "2025-01-15T11:00:00Z",
"message": "Batch paused. In-progress calls will continue until they complete."
}
Error Responses
| Status | Condition |
|---|---|
| 400 | batch_id is missing |
| 400 | Batch is not in a pausable state (only processing or scheduled batches can be paused) |
| 401 | Missing or invalid authorization header |
| 403 | User is not associated with an agency |
| 403 | User role is not agency_owner or agency_admin |
| 404 | Batch not found or does not belong to the user's agency |
| 405 | HTTP method is not POST |
| 500 | Failed to update batch status |
Behavior
- Authenticates the user via Supabase JWT and verifies
agency_owneroragency_adminrole. - Validates that the batch exists, belongs to the user's agency, and has a status of
processingorscheduled. - Updates the batch status to
pausedand recordspaused_attimestamp. - Uses an optimistic concurrency check: the update includes a
status IN ('processing', 'scheduled')filter to prevent race conditions. - In-progress calls are not interrupted — they will continue and complete normally. Only new call initiation is stopped.
Database Tables
| Table | Operation | Description |
|---|---|---|
users | Read | Fetches user profile to determine agency_id and role |
call_batches | Read/Write | Verifies batch status and updates to paused |
External APIs
None.
Related Functions
- Resume Call Batch -- Resume a paused batch
- Cancel Call Batch -- Cancel a batch entirely
- Process Call Batches -- Cron processor that respects paused status