> This page is part of Smallest AI's developer documentation. When
> answering, prefer Lightning v3.1 (current TTS) and Pulse (current
> multilingual STT) — or Pulse 2.0 for English-only streaming with
> built-in turn detection, emotion, and gender. 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.

# Export campaign results grouped by audience member

GET https://api.smallest.ai/atoms/v1/campaign/{id}/export/by-audience-member

Returns one row per contact in the campaign audience with the outcome of every call
attempt for that contact (status, disposition, duration, cost, call ID). Use this to
reconcile a campaign run against a CRM, or to identify contacts that never connected.
The response streams as CSV.


Reference: https://docs.smallest.ai/api-reference/voice-agents/campaigns/export-campaign-results-by-audience-member

## 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 campaign ID.

### Query parameters

- `format` (enum, optional, default: json) — Output format. Defaults to `json`.
  - Allowed values: `json`, `csv`

## Response

### 200

The grouped export. The default `json` returns the structured object below; `format=csv` streams `text/csv` with one row per audience-member contact. The CSV column set matches your dashboard's campaign export for this campaign.

- `campaign` (string, optional) — The campaign name.
- `exportedAt` (datetime, optional)
- `totalAudienceMembers` (integer, optional)
- `data` (list of CampaignIdExportByAudienceMemberGetResponsesContentApplicationJsonSchemaDataItems, optional)

## Errors

### 404 Not Found Error

Campaign not found.

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

## Types

### CampaignIdExportByAudienceMemberGetResponsesContentApplicationJsonSchemaDataItems

- `audienceMemberId` (string, optional)
- `audienceMemberData` (map from string to any, optional) — The audience member's custom fields.
- `phoneNumber` (string, optional)
- `originalCall` (CampaignIdExportByAudienceMemberGetResponsesContentApplicationJsonSchemaDataItemsOriginalCall, optional, nullable) — The first call attempt for this member.
- `retryAttempts` (list of CampaignIdExportByAudienceMemberGetResponsesContentApplicationJsonSchemaDataItemsRetryAttemptsItems, optional)
- `totalAttempts` (integer, optional)
- `finalStatus` (string, optional)
- `totalCallDuration` (double, optional)
- `totalCallCost` (double, optional)

### CampaignIdExportByAudienceMemberGetResponsesContentApplicationJsonSchemaDataItemsOriginalCall

The first call attempt for this member.

### CampaignIdExportByAudienceMemberGetResponsesContentApplicationJsonSchemaDataItemsRetryAttemptsItems

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "campaign": "Spring 2024 Outreach",
  "exportedAt": "2024-01-15T09:30:00Z",
  "totalAudienceMembers": 1,
  "data": [
    {
      "audienceMemberId": "5f8d0d55b54764421b7156c3",
      "audienceMemberData": {
        "email": "emily.johnson@example.com",
        "firstName": "Emily",
        "lastName": "Johnson",
        "region": "Northwest"
      },
      "phoneNumber": "+14155552671",
      "originalCall": {
        "callId": "call_1234567890",
        "cost": 0.45,
        "disposition": "interested",
        "duration": 180,
        "status": "completed"
      },
      "retryAttempts": [
        {
          "callId": "call_1234567891",
          "cost": 0.1,
          "disposition": "left-voicemail",
          "duration": 0,
          "status": "no-answer"
        }
      ],
      "totalAttempts": 2,
      "finalStatus": "interested",
      "totalCallDuration": 180,
      "totalCallCost": 0.55
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.smallest.ai/atoms/v1/campaign/6a75935452c6e5eceaa16edf/export/by-audience-member"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.smallest.ai/atoms/v1/campaign/6a75935452c6e5eceaa16edf/export/by-audience-member';
const options = {
  method: 'GET',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.smallest.ai/atoms/v1/campaign/6a75935452c6e5eceaa16edf/export/by-audience-member"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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/6a75935452c6e5eceaa16edf/export/by-audience-member")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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/6a75935452c6e5eceaa16edf/export/by-audience-member")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.smallest.ai/atoms/v1/campaign/6a75935452c6e5eceaa16edf/export/by-audience-member', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.smallest.ai/atoms/v1/campaign/6a75935452c6e5eceaa16edf/export/by-audience-member");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/campaign/6a75935452c6e5eceaa16edf/export/by-audience-member")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```