# Foreplay Brand Ad Analytics API

> Get ad analytics for a brand by Foreplay brand ID: active and total ads, formats, platforms, launch cadence and longest-running creatives over a date range.

Source: https://www.sandbase.ai/apis/foreplay/brand-analytics
API reference: https://www.sandbase.ai/apis/foreplay/brand-analytics#api

## Facts

- Provider: Foreplay
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/foreplay/brand-analytics`
- Price: From $0.1225 per call
- Capabilities: api, foreplay, advertising, ad library
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/foreplay/brand-analytics` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `end_date` | string | no |  |
| `order` | string | no | newest, oldest, longest_running, most_relevant |
| `start_date` | string | no |  |

## FAQ

### How do I use the Foreplay Brand Ad Analytics API?

Send a POST request to https://api.sandbase.ai/v1/api/foreplay/brand-analytics with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the Foreplay Brand Ad Analytics API cost?

From $0.1225 per call, billed from your SandBase balance. You are only charged for calls you make; there is no subscription.

### What parameters does the Foreplay Brand Ad Analytics API accept?

Required: id (string). Optional: end_date (string), order (one of newest, oldest, longest_running, most_relevant) and start_date (string). The Parameters table and the Playground on this page list every field.

### What does the Foreplay Brand Ad Analytics API return?

A JSON response returned in the same HTTP request (synchronous).

### Do I need a Foreplay developer account or API key?

No. Foreplay Brand Ad Analytics runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for Foreplay API access separately.

## README

### Foreplay Brand Ad Analytics

Get ad analytics for a brand by Foreplay brand ID: active and total ads, formats, platforms, launch cadence and longest-running creatives over a date range.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/api/foreplay/brand-analytics" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": "3YfFtyvZ3viTAbbLaWLV"}'
```

The result is returned in `outputs[0].data`.

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | Yes | Page ID or Brand ID. Brand IDs are 20-25 character alphanumeric strings with mixed case. Page IDs are numeric Facebook page identifiers. |
| `end_date` | string | No | End date (inclusive). Format: 'YYYY-MM-DD', 'YYYY-MM-DDTHH:MM:SS', or 'YYYY-MM-DD HH:MM:SS'. If you provide only the date (e.g. '2024-11-12'), it will be interpreted as '2024-11-12 00:00:00'. To include all results for a |
| `order` | string | No | Order of results: 'newest' (default), 'oldest', 'longest_running', or 'most_relevant'. Sorts ads by creation date, longest running duration, or relevance to the search query. |
| `start_date` | string | No | Start date (inclusive). Format: 'YYYY-MM-DD', 'YYYY-MM-DDTHH:MM:SS', or 'YYYY-MM-DD HH:MM:SS'. If you provide only the date (e.g. '2024-11-12'), it will be interpreted as '2024-11-12 00:00:00'. To get all ads from a spec |

#### Pricing

Billed at the actual upstream cost of each call (about $0.1225 for the request above). Failed calls are not charged.
