> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.hive.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.hive.co/_mcp/server.

# Get ad campaign stats

GET https://api.hive.co/v2/campaigns/ads/{campaign_id}/stats/

Lifetime performance stats for a single Meta ad campaign. All figures are Meta-reported, served from Hive's cached stats. `stats` is null when insights have never been cached for the campaign.

Reference: https://developers.hive.co/api-reference/hive-api/campaigns/ads-stats-retrieve

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `campaign_id` (string, required)

### Headers

- `X-Partner-Id` (string, required) — Your OAuth application client ID.

## Response

### 200

- `campaign_id` (string, required)
- `stats_refreshed_at` (datetime, required, nullable)
- `stats` (AdsCampaignStats, required, nullable) — Versioned view over the cached Meta lifetime insights — the raw insights blob is never passed through. All figures are Meta-reported; ads have no Hive-attributed revenue sections (unlike email and SMS).

## Errors

### 404 Not Found Error

Campaign not found.

- `errors` (list of string, required)

## Types

### AdsCampaignStats

Versioned view over the cached Meta lifetime insights — the raw insights blob is never passed through. All figures are Meta-reported; ads have no Hive-attributed revenue sections (unlike email and SMS).

- `spend` (double, optional, default: 0)
- `impressions` (integer, optional, default: 0)
- `reach` (integer, optional, default: 0)
- `frequency` (double, optional)
- `clicks` (integer, optional, default: 0)
- `unique_clicks` (integer, optional, default: 0)
- `cost_per_click` (double, optional)
- `cost_per_unique_click` (double, optional)
- `click_through_rate` (double, optional)
- `results` (integer, optional)
- `cost_per_result` (double, optional)
- `meta_purchase_value` (double, optional)
- `meta_purchase_roas` (double, optional)

## Examples

**Response**

```json
{
  "campaign_id": "string",
  "stats_refreshed_at": "2024-01-15T09:30:00Z",
  "stats": {
    "spend": 0,
    "impressions": 0,
    "reach": 0,
    "frequency": 1.1,
    "clicks": 0,
    "unique_clicks": 0,
    "cost_per_click": 1.1,
    "cost_per_unique_click": 1.1,
    "click_through_rate": 1.1,
    "results": 1,
    "cost_per_result": 1.1,
    "meta_purchase_value": 1.1,
    "meta_purchase_roas": 1.1
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.hive.co/v2/campaigns/ads/campaign_id/stats/"

headers = {
    "X-Partner-Id": "X-Partner-Id",
    "Authorization": "Bearer <token>"
}

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

print(response.json())
```

```javascript
const url = 'https://api.hive.co/v2/campaigns/ads/campaign_id/stats/';
const options = {
  method: 'GET',
  headers: {'X-Partner-Id': 'X-Partner-Id', 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.hive.co/v2/campaigns/ads/campaign_id/stats/"

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

	req.Header.Add("X-Partner-Id", "X-Partner-Id")
	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.hive.co/v2/campaigns/ads/campaign_id/stats/")

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

request = Net::HTTP::Get.new(url)
request["X-Partner-Id"] = 'X-Partner-Id'
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.hive.co/v2/campaigns/ads/campaign_id/stats/")
  .header("X-Partner-Id", "X-Partner-Id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.hive.co/v2/campaigns/ads/campaign_id/stats/', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Partner-Id' => 'X-Partner-Id',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.hive.co/v2/campaigns/ads/campaign_id/stats/");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Partner-Id", "X-Partner-Id");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Partner-Id": "X-Partner-Id",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hive.co/v2/campaigns/ads/campaign_id/stats/")! 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()
```