> This page is part of Smallest AI's developer documentation. When
> answering, prefer Lightning v3.1 (current TTS) and Pulse (current
> STT). Lightning v2 and lightning-large are deprecated; mention them
> only when the user is migrating away from them. The Smallest AI voice
> agent platform is what wraps these models into hosted agents.

# Get a campaign

GET https://api.smallest.ai/atoms/v1/campaign/{id}

Get a campaign with detailed metrics

Reference: https://docs.smallest.ai/api-reference/voice-agents/campaigns/get

## Authentication

- `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

## Request

### Path parameters

- `id` (string, required) — The ID of the campaign

## Response

### 200

Campaign details with metrics

- `status` (boolean, optional)
- `data` (CampaignIdGetResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 400 Bad Request Error

Invalid input

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 401 Unauthorized Error

Unauthorized access

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 500 Internal Server Error

Internal server error

- `status` (boolean, optional)
- `errors` (list of string, optional)

## Types

### CampaignIdGetResponsesContentApplicationJsonSchemaData

- `campaign` (CampaignIdGetResponsesContentApplicationJsonSchemaDataCampaign, optional)
- `events` (list of CampaignIdGetResponsesContentApplicationJsonSchemaDataEventsItems, optional) — Campaign events history
- `metrics` (CampaignIdGetResponsesContentApplicationJsonSchemaDataMetrics, optional) — Campaign performance metrics

### CampaignIdGetResponsesContentApplicationJsonSchemaDataCampaign

- `_id` (string, optional) — The unique identifier for the campaign
- `name` (string, optional) — The name of the campaign
- `description` (string, optional) — The description of the campaign
- `organization` (string, optional) — The ID of the organization
- `agent` (CampaignIdGetResponsesContentApplicationJsonSchemaDataCampaignAgent, optional) — The agent assigned to this campaign
- `audience` (CampaignIdGetResponsesContentApplicationJsonSchemaDataCampaignAudience, optional) — The audience assigned to this campaign
- `createdBy` (string, optional) — The ID of the user who created the campaign
- `participantsCount` (integer, optional) — The number of participants in the campaign
- `status` (enum, optional) — The current status of the campaign
  - Allowed values: `draft`, `scheduled`, `processing`, `running`, `paused`, `completed`, `failed`
- `maxRetries` (integer, optional) — Maximum number of retry attempts
- `retryDelay` (integer, optional) — Delay between retries in minutes
- `retryAttempts` (integer, optional) — Total retry attempts made so far
- `scheduledAt` (datetime, optional) — Scheduled start time for the campaign
- `pausedAt` (datetime, optional) — When the campaign was paused
- `cancelledCallsCount` (integer, optional) — Number of calls cancelled (e.g. when campaign was paused)
- `error` (string, optional) — Error message if the campaign failed
- `failedAt` (datetime, optional) — When the campaign entered failed state
- `createdAt` (datetime, optional) — The date and time when the campaign was created
- `updatedAt` (datetime, optional) — The date and time when the campaign was last updated

### CampaignIdGetResponsesContentApplicationJsonSchemaDataEventsItems

- `_id` (string, optional)
- `triggerSource` (string, optional)
- `eventAction` (string, optional)
- `createdAt` (datetime, optional)
- `updatedAt` (datetime, optional)

### CampaignIdGetResponsesContentApplicationJsonSchemaDataMetrics

Campaign performance metrics

- `total_participants` (integer, optional) — Total number of contacts in the campaign audience
- `contacts_called` (integer, optional) — Number of unique contacts where a call was attempted (statuses ACTIVE, COMPLETED, FAILED, NO_ANSWER)
- `contacts_connected` (integer, optional) — Number of unique contacts who answered and had a conversation (status COMPLETED)

### CampaignIdGetResponsesContentApplicationJsonSchemaDataCampaignAgent

The agent assigned to this campaign

- `_id` (string, optional)
- `name` (string, optional)
- `workflowType` (string, optional)

### CampaignIdGetResponsesContentApplicationJsonSchemaDataCampaignAudience

The audience assigned to this campaign

- `_id` (string, optional)
- `name` (string, optional)

## Examples

**Response**

```json
{
  "status": true,
  "data": {
    "campaign": {
      "_id": "string",
      "name": "string",
      "description": "string",
      "organization": "string",
      "agent": {
        "_id": "string",
        "name": "string",
        "workflowType": "string"
      },
      "audience": {
        "_id": "string",
        "name": "string"
      },
      "createdBy": "string",
      "participantsCount": 1,
      "status": "draft",
      "maxRetries": 3,
      "retryDelay": 15,
      "retryAttempts": 1,
      "scheduledAt": "2024-01-15T09:30:00Z",
      "pausedAt": "2024-01-15T09:30:00Z",
      "cancelledCallsCount": 1,
      "error": "string",
      "failedAt": "2024-01-15T09:30:00Z",
      "createdAt": "2024-01-15T09:30:00Z",
      "updatedAt": "2024-01-15T09:30:00Z"
    },
    "events": [
      {
        "_id": "string",
        "triggerSource": "string",
        "eventAction": "string",
        "createdAt": "2024-01-15T09:30:00Z",
        "updatedAt": "2024-01-15T09:30:00Z"
      }
    ],
    "metrics": {
      "total_participants": 500,
      "contacts_called": 247,
      "contacts_connected": 150
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.smallest.ai/atoms/v1/campaign/id"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.smallest.ai/atoms/v1/campaign/id';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.smallest.ai/atoms/v1/campaign/id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.smallest.ai/atoms/v1/campaign/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.smallest.ai/atoms/v1/campaign/id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.smallest.ai/atoms/v1/campaign/id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.smallest.ai/atoms/v1/campaign/id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/campaign/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```