> ## 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 Campaign Details

> Get a campaign's status and page through its contacts with the latest call attempt of each.

## Overview

Fetch a single campaign's name and status, and a paginated list of its contacts. Each contact comes with the result of its latest call attempt. You can filter by call status, outcome, duration and date, search by phone number or call ID, and sort.

## Prerequisites

* An API key for your workspace
* The campaign's `batchId`: the `_id` from [Get Campaigns](https://docs.weya.ai/api-reference/Campaigns/getBatch.md), the ID returned when you created the campaign, or the last part of the campaign's URL in the dashboard. The campaign must have been created by the user who owns the API key.

## Request

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

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

**batchId** `string` *required*

ID of the campaign.

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

Page number. Ignored when `cursor` is sent.

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

Contacts per page, from 1 to 500. Larger values are capped at 500.

**cursor** `string`

Cursor for the next page. Pass the `data.nextCursor` value from the previous response, with the same `sortBy`, `sortOrder`, `filter` and `search`. Faster than `page` for large campaigns.

**sortBy** `string` (default: updatedAt)

Field to sort by: `updatedAt`, `createdAt`, `retry_count`, `call_started_at`, `call_duration` or `call_status`. Any other value sorts by `createdAt`.

**sortOrder** `string` (default: desc)

`asc` for ascending. Any other value sorts descending.

**search** `string`

Matches contacts whose phone number contains this text, or whose call has exactly this call ID (`request_uuid`, `call_uuid` or stream ID).

**filter** `string`

URL-encoded JSON object. Applies to each contact's latest call attempt. Fields:

* `call_status` – array of statuses, for example `["completed", "no-answer"]`
* `call_outcome` – array of call outcomes
* `hangup_source` – array of hangup sources
* `call_durationMin`, `call_durationMax` – call duration in seconds
* `createdAtMin`, `createdAtMax` – call start time (ISO 8601)
* `crm_sync_status` – array of `synced`, `failed` or `not_synced`. Covers webhook and Google Sheet syncs only.

Example: `{"call_status":["completed"],"call_durationMin":30}`. Unknown fields are ignored, and a value that isn't valid JSON is ignored, so check the `total` you get back.

```bash cURL theme={null}
curl --location --globoff 'https://api.weya.live/backend/api/call/batch-details/67def9053495307c718d9dfb?limit=50&sortBy=call_started_at&sortOrder=desc&filter={"call_status":["completed"]}' \
  --header 'x-api-key: YOUR_API_KEY'
```

## Response

```json 200 OK theme={null}
{
  "status": true,
  "code": 200,
  "message": "Calls fetched successfully",
  "errorMessage": null,
  "data": {
    "batchId": "67def9053495307c718d9dfb",
    "batchName": "Marketing Campaign May 2025",
    "batchStatus": "in-progress",
    "hasCrm": true,
    "hasCrmSyncData": true,
    "page": 1,
    "limit": 50,
    "total": 150,
    "totalPages": 3,
    "nextCursor": "eyJpZCI6IjEyMyIsInNvcnRWYWx1ZSI6IjIwMjUtMDUtMTUifQ==",
    "data": [
      {
        "_id": "2f6c1a3e-6b1d-4c52-9f0a-3a7d2e9b8c11",
        "phoneNumber": "+12125551234",
        "createdAt": "2025-05-15T14:00:00.000Z",
        "updatedAt": "2025-05-15T14:32:00.000Z",
        "retry_count": 1,
        "attempts": 1,
        "followUpAt": null,
        "followUpAtRaw": null,
        "isExpired": false,
        "tool_status": "success",
        "tool_counts": { "success": 2, "failure": 0, "total": 2 },
        "phoneLogs": {
          "call_status": "completed",
          "call_duration": 120,
          "call_started_at": "2025-05-15T14:30:00.000Z",
          "hangup_source": null,
          "hangup_reason": null,
          "call_outcome": "Interested",
          "call_journey": null,
          "call_uuid": "a1b2c3d4-0000-0000-0000-000000000000",
          "request_uuid": "a1b2c3d4-0000-0000-0000-000000000000",
          "webhook_events": []
        }
      }
    ]
  }
}
```

**data.batchId** `string` *required*

Campaign ID.

**data.batchName** `string` *required*

Campaign name.

**data.batchStatus** `string` *required*

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

**data.hasCrm** `boolean`

`true` when the campaign sends call outcomes to a CRM, webhook or Google Sheet, or has done so before.

**data.hasCrmSyncData** `boolean`

`true` when webhook or Google Sheet sync records exist for this campaign, so the `crm_sync_status` filter applies.

**data.page** `integer` *required*

Current page number.

**data.limit** `integer` *required*

Contacts per page.

**data.total** `integer` *required*

Number of contacts matching the filter and search.

**data.totalPages** `integer` *required*

Number of pages.

**data.nextCursor** `string | null`

Cursor to pass as `cursor` for the next page. `null` when this page is empty.

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

The contacts on this page.

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

Contact (call) ID.

**data.data\[].phoneNumber** `string`

Contact's phone number. Masked when phone number masking is turned on for your organization.

**data.data\[].retry\_count** `integer`

Retry counter for this contact. Reset to 0 when the contact is marked for retry.

**data.data\[].attempts** `integer`

Number of call attempts ever made to this contact. Unlike `retry_count`, it is never reset.

**data.data\[].followUpAt** `string | null`

When the next attempt is scheduled, if it is after the latest call started.

**data.data\[].isExpired** `boolean`

`true` when the contact won't be called again.

**data.data\[].tool\_status** `string | null`

Result of the tools the agent ran during calls to this contact: `success` (all succeeded), `warning` (some failed), `error` (all failed), or `null` (no tools ran). `tool_counts` gives the `success`, `failure` and `total` counts.

**data.data\[].phoneLogs** `object`

The latest call attempt: `call_status`, `call_duration` (seconds), `call_started_at`, `hangup_source`, `hangup_reason`, `call_outcome`, `call_journey`, `call_uuid`, `request_uuid`, and `webhook_events` (webhook and Google Sheet sync records for this attempt). Fields are `null` until the contact has been called.

> [!NOTE]
>
> The response doesn't include the contact's CSV variables (`lead_data`) or call transcripts and recordings.

## Error Handling

Errors return `status: false`, with the reason in `errorMessage`.

* **400 Bad Request** – `Invalid Batch ID`: `batchId` is not a valid ID.
* **401 Unauthorized** – Missing or invalid API key.
* **404 Not Found** – `Batch not found`: no campaign with this ID was created by the user who owns the API key, or it was deleted.
* **500 Internal Server Error** – Unexpected server error.


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