> ## Documentation Index
> Fetch the complete documentation index at: https://docs.weya.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Campaigns

> Retrieve a paginated list of your campaigns, with search and status filters.

## Overview

List the campaigns created by the user who owns the API key. Deleted campaigns are never returned. Results are paginated and sorted by last update, newest first.

## Prerequisites

* An API key for your workspace

## Request

**x-api-key** `string` *required*

Your workspace API key. Create one from the profile menu in the dashboard → **API Keys**.

**userId** `string` *required*

Your user ID. The path needs a value, but it isn't used to filter: campaigns are always returned for the user who owns the API key.

**page** `integer` (default: 1)

Page number.

**limit** `integer` (default: 10)

Number of campaigns per page.

**search** `string`

Case-insensitive text matched against the campaign name and `queue_status`. Partial matches are returned.

**channel\_type** `string`

Only return campaigns of this channel: `voice`, `video`, `whatsapp` or `web_chat`. If omitted, campaigns of every channel are returned.

**statusFilter** `string`

Filter by a group of statuses. What each value matches depends on `channel_type`:

* **Voice** (or `channel_type` omitted):
  * `active` – `in-progress`, plus `completed` campaigns updated in the last 2 hours. `in-progress` campaigns are listed first.
  * `inactive` – `pending`, `paused`, `freezed` or `failed`.
  * `completed` – `completed` campaigns last updated more than 2 hours ago.
* **Video and web chat**: `active` (link not revoked) or `inactive` (link revoked).
* **WhatsApp**: `active` or `inactive`.

Any other value, or no value, returns every status.

**status** `string`

Only return campaigns with exactly this `queue_status`, for example `paused`.

**type** `string`

Only return campaigns of this type: `outbound`, `inbound` or `mixed`.

**createdAtMin** `string`

Only return campaigns created at or after this date (ISO 8601).

**createdAtMax** `string`

Only return campaigns created at or before this date (ISO 8601).

```bash cURL theme={null}
curl --location 'https://api.weya.live/backend/api/call/batches/64e5f12345abcdef12345678?page=1&limit=10&channel_type=voice&search=Marketing' \
  --header 'x-api-key: YOUR_API_KEY'
```

## Response

```json 200 OK theme={null}
{
  "status": true,
  "code": 200,
  "message": "Batches fetched successfully",
  "errorMessage": null,
  "data": {
    "batches": [
      {
        "_id": "64e5f12345abcdef98765432",
        "batchName": "Marketing Campaign May 2025",
        "type": "outbound",
        "queue_status": "in-progress",
        "totalCalls": 150,
        "callsPicked": 120,
        "callsCompleted": 100,
        "callStats": {
          "leads": 150,
          "leadsConnected": 96,
          "connectivityPct": 64,
          "dials": 210,
          "basis": "lead",
          "legacy": { "totalCalls": 150, "callsPicked": 120, "callsCompleted": 100 }
        },
        "createdAt": "2025-05-01T12:00:00.000Z",
        "updatedAt": "2025-05-15T14:30:00.000Z"
      }
    ],
    "pagination": {
      "total": 25,
      "page": "1",
      "limit": "10",
      "totalPages": 3,
      "hasNextPage": true,
      "hasPrevPage": false
    }
  }
}
```

**data.batches** `array[object]` *required*

The campaigns on this page.

**data.batches\[].\_id** `string` *required*

Campaign ID.

**data.batches\[].batchName** `string` *required*

Campaign name.

**data.batches\[].type** `string`

Campaign type: `outbound`, `inbound` or `mixed`.

**data.batches\[].channel\_type** `string`

Channel, for video, WhatsApp and web chat campaigns. Voice campaigns may not have this field.

**data.batches\[].queue\_status** `string` *required*

Campaign status. For voice campaigns: `pending`, `in-progress`, `paused`, `freezed` (outside the calling window), `completed` or `failed`.

**data.batches\[].totalCalls** `integer`

Number of contacts (leads) in the campaign.

**data.batches\[].callsPicked** `integer`

Legacy counter of dials placed. Use `callStats` instead.

**data.batches\[].callsCompleted** `integer`

Legacy counter of dials that lasted 10 seconds or more. Use `callStats` instead.

**data.batches\[].callStats** `object`

Per-contact call statistics for the campaign's whole history. They are updated every few minutes, so recent calls may not be counted yet. Missing when no statistics are available yet.

* `leads` – contacts counted in the statistics
* `leadsConnected` – of those, contacts with a connected call
* `connectivityPct` – `leadsConnected` as a percentage of `leads`
* `dials` – total call attempts
* `basis` – always `lead`
* `legacy` – the `totalCalls`, `callsPicked` and `callsCompleted` counters

**data.batches\[].createdAt** `string`

When the campaign was created (ISO 8601).

**data.batches\[].updatedAt** `string`

When the campaign was last updated (ISO 8601).

**data.pagination** `object` *required*

Pagination details: `total`, `page`, `limit`, `totalPages`, `hasNextPage` and `hasPrevPage`. `page` and `limit` are returned as strings when you pass them in the query.

## Error Handling

* **401 Unauthorized** – Missing or invalid API key.
* **500 Internal Server Error** – Unexpected server error.

When no campaign matches, the response is `200` with an empty `batches` array.

> [!TIP]
>
> Use `GET /api/call/batch-details/{batchId}` to get the details and calls of one campaign.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.