Skip to main content
GET
/
api
/
call
/
batches
/
{userId}
curl --location '{{baseUrl}}/api/call/batches/64e5f12345abcdef12345678?page=1&limit=10&search=Marketing' \
  --header 'Authorization: Bearer {{authToken}}'
{
  "message": "Batches fetched successfully",
  "status": true,
  "code": 200,
  "errorMessage": "",
  "data": {
    "batches": [
      {
        "_id": "64e5f12345abcdef98765432",
        "batchName": "Marketing Campaign May 2025",
        "totalCalls": 150,
        "callsPicked": 120,
        "callsCompleted": 100,
        "queue_status": "active",
        "createdAt": "2025-05-01T12:00:00.000Z",
        "updatedAt": "2025-05-15T14:30:00.000Z"
      },
      {
        "_id": "64e5f12345abcdef98765433",
        "batchName": "Sales Outreach June 2025",
        "totalCalls": 200,
        "callsPicked": 150,
        "callsCompleted": 120,
        "queue_status": "paused",
        "createdAt": "2025-06-01T09:00:00.000Z",
        "updatedAt": "2025-06-10T16:45:00.000Z"
      }
    ],
    "pagination": {
      "total": 25,
      "page": 1,
      "limit": 10,
      "totalPages": 3
    }
  }
}

Overview

This endpoint lists every batch created by the authenticated user with pagination and search support. Only non-deleted batches are returned by default. Use this to monitor active campaigns, view batch summaries, and track campaign statistics.

Prerequisites

  • Bearer token for an authenticated user.
  • The user must own the batches being retrieved.

Request

Authorization
string
required
Bearer token for the authenticated user.
userId
string
required
User identifier. The authenticated user must match this ID.
page
integer
default:"1"
Page number for pagination.
limit
integer
default:"10"
Number of batches to return per page (default: 10).
Search term to filter batches by batchName or queue_status.
curl --location '{{baseUrl}}/api/call/batches/64e5f12345abcdef12345678?page=1&limit=10&search=Marketing' \
  --header 'Authorization: Bearer {{authToken}}'

Response

{
  "message": "Batches fetched successfully",
  "status": true,
  "code": 200,
  "errorMessage": "",
  "data": {
    "batches": [
      {
        "_id": "64e5f12345abcdef98765432",
        "batchName": "Marketing Campaign May 2025",
        "totalCalls": 150,
        "callsPicked": 120,
        "callsCompleted": 100,
        "queue_status": "active",
        "createdAt": "2025-05-01T12:00:00.000Z",
        "updatedAt": "2025-05-15T14:30:00.000Z"
      },
      {
        "_id": "64e5f12345abcdef98765433",
        "batchName": "Sales Outreach June 2025",
        "totalCalls": 200,
        "callsPicked": 150,
        "callsCompleted": 120,
        "queue_status": "paused",
        "createdAt": "2025-06-01T09:00:00.000Z",
        "updatedAt": "2025-06-10T16:45:00.000Z"
      }
    ],
    "pagination": {
      "total": 25,
      "page": 1,
      "limit": 10,
      "totalPages": 3
    }
  }
}
data
object
required
Contains the batches array and pagination metadata.
data.batches
array[object]
required
Array of batch records with summary statistics.
data.batches[]._id
string
required
Unique identifier for the batch.
data.batches[].batchName
string
required
Display name for the batch.
data.batches[].totalCalls
integer
required
Total number of calls in the batch.
data.batches[].callsPicked
integer
required
Number of calls that were picked up/answered.
data.batches[].callsCompleted
integer
required
Number of calls that completed successfully.
data.batches[].queue_status
string
required
Current status of the batch queue (e.g., “active”, “paused”, “completed”).
data.batches[].createdAt
string
required
Timestamp when the batch was created (ISO 8601 format).
data.batches[].updatedAt
string
required
Timestamp when the batch was last updated (ISO 8601 format).
data.pagination
object
required
Pagination metadata.
data.pagination.total
integer
required
Total number of batches matching the search criteria.
data.pagination.page
integer
required
Current page number.
data.pagination.limit
integer
required
Number of records per page.
data.pagination.totalPages
integer
required
Total number of pages available.

Error Handling

  • 400 Bad Request – Invalid userId format or invalid query parameters.
  • 404 Not Found – No batches found for the authenticated user.
  • 500 Internal Server Error – Failed to fetch batch data; retry or contact support.
Filtering Behavior:
  • Only non-deleted batches are returned (isDeleted: false)
  • Use the search parameter to filter by batch name or queue status
  • Results are sorted by creation date in descending order (newest first)
  • Pagination helps manage large lists of batches efficiently
Combine this endpoint with GET /api/call/batch-details/{id} to first get an overview of all batches, then drill down into specific batch details.

Authorizations

Authorization
string
header
required

Bearer token authentication for workspace access

Path Parameters

userId
string
required

Query Parameters

page
integer
default:1
limit
integer
default:10

Response

Batches fetched successfully