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

# Export Reach and Frequency Report

> Addressable API for exporting campaign reach and frequency

### Example Request

```
GET /campaigns/exportClientReachFrequencyReport
```

## Example API Usage

Here are examples of how to fetch Reach and Frequency data from the Addressable.tv API endpoint in different programming languages:

<CodeGroup>
  ```python Python theme={null}
  import requests

  url = "https://api.addressable.tv/campaigns/exportClientReachFrequencyReport"
  headers = {
      "x-api-key": "YOUR_API_KEY",
      "client": "YOUR_CLIENT_KEY"
  }

  response = requests.get(url, headers=headers)
  data = response.json()
  print(data)
  ```

  ```javascript Javascript theme={null}
  const fetch = require('node-fetch');

  const url = 'https://api.addressable.tv/campaigns/exportClientReachFrequencyReport';
  const headers = {
    'x-api-key': 'YOUR_API_KEY',
    client: 'YOUR_CLIENT_KEY',
  };

  fetch(url, { headers })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error(error));
  ```

  ```java Java theme={null}
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.net.URI;

  public class FetchReachFrequencyReport {
      public static void main(String[] args) {
          HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://api.addressable.tv/campaigns/exportClientReachFrequencyReport"))
              .header("x-api-key", "YOUR_API_KEY")
              .header("client", "YOUR_CLIENT_KEY")
              .build();

          client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
              .thenApply(HttpResponse::body)
              .thenAccept(System.out::println)
              .join();
      }
  }
  ```

  ```go Go theme={null}
  package main

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

  func main() {
      url := "https://api.addressable.tv/campaigns/exportClientReachFrequencyReport"
      client := &http.Client{}
      req, _ := http.NewRequest("GET", url, nil)

      req.Header.Add("x-api-key", "YOUR_API_KEY")
      req.Header.Add("client", "YOUR_CLIENT_KEY")

      resp, err := client.Do(req)
      if err != nil {
          fmt.Println(err)
          return
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```csharp C# theme={null}
  using System;
  using System.Net.Http;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main()
      {
          var client = new HttpClient();
          var request = new HttpRequestMessage
          {
              Method = HttpMethod.Get,
              RequestUri = new Uri("https://api.addressable.tv/campaigns/exportClientReachFrequencyReport")
          };

          request.Headers.Add("x-api-key", "YOUR_API_KEY");
          request.Headers.Add("client", "YOUR_CLIENT_KEY");

          var response = await client.SendAsync(request);
          response.EnsureSuccessStatusCode();
          var data = await response.Content.ReadAsStringAsync();
          Console.WriteLine(data);
      }
  }
  ```

  ```cpp C++ theme={null}
  #include <curl/curl.h>
  #include <iostream>
  #include <string>

  static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
  {
      ((std::string*)userp)->append((char*)contents, size * nmemb);
      return size * nmemb;
  }

  int main()
  {
      CURL *curl;
      CURLcode res;
      std::string readBuffer;

      curl = curl_easy_init();
      if(curl) {
          struct curl_slist *headers = NULL;
          headers = curl_slist_append(headers, "x-api-key: YOUR_API_KEY");
          headers = curl_slist_append(headers, "client: YOUR_CLIENT_KEY");

          curl_easy_setopt(curl, CURLOPT_URL, "https://api.addressable.tv/campaigns/exportClientReachFrequencyReport");
          curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
          curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
          curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);

          res = curl_easy_perform(curl);
          if(res != CURLE_OK)
              std::cout << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl;

          curl_easy_cleanup(curl);
          curl_slist_free_all(headers);
      }

      std::cout << readBuffer << std::endl;
      return 0;
  }
  ```
</CodeGroup>

## Response Schema

The API returns an array of campaign-level Reach and Frequency records.

### Example Response

```json theme={null}
[
  {
    "campaignId": 1234,
    "campaignName": "Holiday Campaign 2024",
    "status": "ACTIVE",
    "reach": 84231,
    "impressions": 194500,
    "frequency": 2.31,
    "clientCampaignId": "CAMP-2024-001",
    "clientAgency": ""
  }
]
```

### Response Fields

| Field              | Type   | Description                                                      |
| ------------------ | ------ | ---------------------------------------------------------------- |
| `campaignId`       | number | Internal campaign ID                                             |
| `campaignName`     | string | Campaign name                                                    |
| `status`           | string | Campaign status                                                  |
| `reach`            | number | Distinct users reached                                           |
| `impressions`      | number | Total delivered impressions                                      |
| `frequency`        | number | Average frequency (`impressions / reach`), rounded to 2 decimals |
| `clientCampaignId` | string | Your campaign identifier when available                          |
| `clientAgency`     | string | Agency of Record (AOR) for the campaign when available           |

### Notes

* The report currently uses a rolling \~45-day lookback window.
* Frequency is derived from aggregated impressions and reach.
* If reach is `0`, frequency is returned as `0`.
