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
| Property | Value |
|---|---|
| Function Name | calls-batch-list |
| HTTP Method | GET |
| Authentication | Supabase JWT (Bearer token) |
| Required Role | Any authenticated agency user |
Request
Headers
Authorization: Bearer <supabase_jwt_token>
Query Parameters
| Field | Type | Required | Description |
|---|---|---|---|
status | string | No | Filter by batch status: pending, scheduled, processing, paused, completed, failed, cancelled |
campaign_id | string (UUID) | No | Filter by campaign |
limit | number | No | Number of results per page. Default: 25, max: 100. |
offset | number | No | Pagination 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
| Status | Condition |
|---|---|
| 401 | Missing or invalid authorization header |
| 403 | User is not associated with an agency |
| 405 | HTTP method is not GET |
| 500 | Failed to fetch batches from the database |
Behavior
- Authenticates the user via Supabase JWT and retrieves their
agency_id. - Queries the
v_call_batch_summaryview filtered by the user'sagency_id. - Applies optional
statusandcampaign_idfilters. - Returns results ordered by
created_atdescending (newest first) with pagination.
Database Tables
| Table / View | Operation | Description |
|---|---|---|
users | Read | Fetches user profile to determine agency_id |
v_call_batch_summary | Read | Pre-built view with batch summaries, agent names, campaign names, and progress stats |
External APIs
None.
Related Functions
- Create Call Batch -- Create a new batch of outbound calls
- Get Call Batch -- View batch details with paginated contacts