Skip to main content

List Call Batches

Returns a paginated list of call batches for the agency using the v_call_batch_summary view. Includes agent name, campaign name, progress percentage, and remaining count.

Endpoint

PropertyValue
Function Namecalls-batch-list
HTTP MethodGET
AuthenticationSupabase JWT (Bearer token)
Required RoleAny authenticated agency user

Request

Headers

Authorization: Bearer <supabase_jwt_token>

Query Parameters

FieldTypeRequiredDescription
statusstringNoFilter by batch status: pending, scheduled, processing, paused, completed, failed, cancelled
campaign_idstring (UUID)NoFilter by campaign
limitnumberNoNumber of results per page. Default: 25, max: 100.
offsetnumberNoPagination offset. Default: 0.

Response

Success (200)

{
"batches": [
{
"id": "uuid",
"agency_id": "uuid",
"campaign_id": "uuid",
"campaign_name": "Q1 Outreach",
"agent_mapping_id": "uuid",
"agent_name": "Sales Agent",
"from_number": "+15551234567",
"status": "processing",
"total_contacts": 1000,
"queued": 500,
"in_progress": 5,
"completed": 400,
"failed": 10,
"skipped": 0,
"progress_percentage": 41.0,
"remaining_count": 590,
"calls_per_minute": 30,
"max_concurrent": 10,
"scheduled_for": null,
"created_at": "2025-01-15T10:30:00Z",
"started_at": "2025-01-15T10:31:00Z"
}
],
"pagination": {
"total": 42,
"limit": 25,
"offset": 0,
"has_more": true
}
}

Error Responses

StatusCondition
401Missing or invalid authorization header
403User is not associated with an agency
405HTTP method is not GET
500Failed to fetch batches from the database

Behavior

  • Authenticates the user via Supabase JWT and retrieves their agency_id.
  • Queries the v_call_batch_summary view filtered by the user's agency_id.
  • Applies optional status and campaign_id filters.
  • Returns results ordered by created_at descending (newest first) with pagination.

Database Tables

Table / ViewOperationDescription
usersReadFetches user profile to determine agency_id
v_call_batch_summaryReadPre-built view with batch summaries, agent names, campaign names, and progress stats

External APIs

None.