Skip to main content

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

PropertyValue
Function Namecalls-batch-pause
HTTP MethodPOST
AuthenticationSupabase JWT (Bearer token)
Required Roleagency_owner or agency_admin

Request

Headers

Authorization: Bearer <supabase_jwt_token>
Content-Type: application/json

Body

FieldTypeRequiredDescription
batch_idstring (UUID)YesThe 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

StatusCondition
400batch_id is missing
400Batch is not in a pausable state (only processing or scheduled batches can be paused)
401Missing or invalid authorization header
403User is not associated with an agency
403User role is not agency_owner or agency_admin
404Batch not found or does not belong to the user's agency
405HTTP method is not POST
500Failed to update batch status

Behavior

  • Authenticates the user via Supabase JWT and verifies agency_owner or agency_admin role.
  • Validates that the batch exists, belongs to the user's agency, and has a status of processing or scheduled.
  • Updates the batch status to paused and records paused_at timestamp.
  • 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

TableOperationDescription
usersReadFetches user profile to determine agency_id and role
call_batchesRead/WriteVerifies batch status and updates to paused

External APIs

None.