> 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.

# Retrieve all campaigns

GET https://api.smallest.ai/atoms/v1/campaign

Get all campaigns for the authenticated organization.

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

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

### Query parameters

- `page` (integer, optional, default: 1) — Page number for pagination
- `offset` (integer, optional, default: 5) — Number of campaigns per page
- `status` (enum, optional) — Filter campaigns by status
  - Allowed values: `draft`, `scheduled`, `processing`, `running`, `paused`, `completed`, `failed`
- `search` (string, optional) — Search campaigns by name
- `sortField` (enum, optional, default: createdAt) — Field to sort by
  - Allowed values: `createdAt`, `updatedAt`
- `sortOrder` (enum, optional, default: desc) — Sort direction
  - Allowed values: `asc`, `desc`

## Response

### 200

A list of campaigns

- `status` (boolean, optional)
- `data` (CampaignGetResponsesContentApplicationJsonSchemaData, 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

### CampaignGetResponsesContentApplicationJsonSchemaData

- `campaigns` (list of CampaignGetResponsesContentApplicationJsonSchemaDataCampaignsItems, optional)
- `pagination` (CampaignGetResponsesContentApplicationJsonSchemaDataPagination, optional)
- `totalCampaignCount` (integer, optional) — Total number of campaigns in the organization (unfiltered)

### CampaignGetResponsesContentApplicationJsonSchemaDataCampaignsItems

- `_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` (CampaignGetResponsesContentApplicationJsonSchemaDataCampaignsItemsAgent, optional) — The agent assigned to this campaign
- `audience` (CampaignGetResponsesContentApplicationJsonSchemaDataCampaignsItemsAudience, 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) — Current status of the campaign
  - Allowed values: `draft`, `scheduled`, `processing`, `running`, `paused`, `completed`, `failed`
- `maxRetries` (integer, optional) — Maximum retry attempts per failed call
- `retryDelay` (integer, optional) — Delay in minutes between retry attempts
- `retryAttempts` (integer, optional) — Total retry attempts made so far
- `scheduledAt` (datetime, optional)
- `pausedAt` (datetime, optional)
- `cancelledCallsCount` (integer, optional)
- `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

### CampaignGetResponsesContentApplicationJsonSchemaDataPagination

- `total` (integer, optional)
- `page` (integer, optional)
- `offset` (integer, optional)
- `hasMore` (boolean, optional)
- `totalPages` (integer, optional)

### CampaignGetResponsesContentApplicationJsonSchemaDataCampaignsItemsAgent

The agent assigned to this campaign

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

### CampaignGetResponsesContentApplicationJsonSchemaDataCampaignsItemsAudience

The audience assigned to this campaign

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

## Examples

**Response**

```json
{
  "status": true,
  "data": {
    "campaigns": [
      {
        "_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": 1,
        "retryDelay": 1,
        "retryAttempts": 1,
        "scheduledAt": "2024-01-15T09:30:00Z",
        "pausedAt": "2024-01-15T09:30:00Z",
        "cancelledCallsCount": 1,
        "createdAt": "2024-01-15T09:30:00Z",
        "updatedAt": "2024-01-15T09:30:00Z"
      }
    ],
    "pagination": {
      "total": 1,
      "page": 1,
      "offset": 1,
      "hasMore": true,
      "totalPages": 1
    },
    "totalCampaignCount": 1
  }
}
```

**SDK Code**

```python
import requests

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

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

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

print(response.json())
```

```javascript
const url = 'https://api.smallest.ai/atoms/v1/campaign';
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"

	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")

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")
  .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', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.smallest.ai/atoms/v1/campaign");
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")! 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()
```