# Foreplay Brand Ads API

> List the social ads a brand has run by Foreplay brand ID, with creative, copy, platforms, run dates and landing page, filtered by format, platform and run time.

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

## Facts

- Provider: Foreplay
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/foreplay/brand-ads`
- Price: From $0.0525 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-ads` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `brand_ids` | array | yes |  |
| `limit` | integer | no |  |
| `collect` | string | no |  |
| `cursor` | string | no |  |
| `display_format` | string | no | carousel, dco, dpa, event, image, multi_images, multi_medias, multi_videos, page_like, text, video |
| `end_date` | string | no |  |
| `languages` | string | no |  |
| `live` | string | no |  |
| `market_target` | string | no |  |
| `niches` | string | no |  |
| `order` | string | no | newest, oldest, longest_running, most_relevant |
| `publisher_platform` | string | no | facebook, instagram, audience_network, messenger, tiktok, youtube, linkedin, threads, whatsapp |
| `running_duration_max_days` | string | no |  |
| `running_duration_min_days` | string | no |  |
| `start_date` | string | no |  |
| `video_duration_max` | string | no |  |
| `video_duration_min` | string | no |  |

## FAQ

### How do I use the Foreplay Brand Ads API?

Send a POST request to https://api.sandbase.ai/v1/api/foreplay/brand-ads 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 Ads API cost?

From $0.0525 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 Ads API accept?

Required: brand_ids (array). Optional: limit (integer), collect (string), cursor (string), display_format (one of carousel, dco, dpa, event, image, multi_images, multi_medias, multi_videos, page_like, text, video), end_date (string) and languages (string) and 10 more. The Parameters table and the Playground on this page list every field.

### What does the Foreplay Brand Ads 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 Ads 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 Ads

List the social ads a brand has run by Foreplay brand ID, with creative, copy, platforms, run dates and landing page, filtered by format, platform and run time.

#### Request

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

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

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `brand_ids` | array | Yes | Brand ID(s) to search for. Can be a single ID or multiple IDs separated by commas. |
| `limit` | integer | No | Pagination limit (max 250). Controls the number of ads returned per request. |
| `collect` | string | No | Best-effort live fallback. If the cached results are empty and `collect=true`, the API translates each brand id to its Meta page id (`adlibraryid`), kicks off a live fetch through our Spyder pipeline, and polls for ~30 s |
| `cursor` | string | No | Cursor for pagination. Use the cursor value from the previous response's metadata to get the next page of results. |
| `display_format` | string | No | Filter by one or more display formats. Available formats (11): carousel, dco, dpa, event, image, multi_images, multi_medias, multi_videos, page_like, text, video Example: `?display_format=video&display_format=carousel` |
| `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 |
| `languages` | string | No | Filter by languages. Accepts various language formats: 'french', 'FR', 'romanian', 'ro', 'english', 'en', etc. Example: `?languages=en&languages=fr` |
| `live` | string | No | Filter ads by live status. `true` means currently active ads, `false` means inactive ads. Leave empty to include both. |
| `market_target` | string | No | Filter by market target. Available targets: b2b (business-to-business), b2c (business-to-consumer) Example: `?market_target=b2b` |
| `niches` | string | No | Filter by one or more niches. Available niches: travel, food, fashion, beauty, health, technology, automotive, finance, education, entertainment, sports, home, pets, business, other Example: `?niches=travel&niches=fashio |
| `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. |
| `publisher_platform` | string | No | Filter by one or more publisher platforms. Available platforms: facebook, instagram, audience_network, messenger, tiktok, youtube, linkedin, threads, whatsapp Example: `?publisher_platform=facebook&publisher_platform=ins |
| `running_duration_max_days` | string | No | Filter ads by maximum running duration in days. Must be a positive integer. |
| `running_duration_min_days` | string | No | Filter ads by minimum running duration in days. Must be a positive integer. |
| `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 |
| `video_duration_max` | string | No | Filter ads by maximum video duration in seconds. Only applies to video ads. |
| `video_duration_min` | string | No | Filter ads by minimum video duration in seconds. Only applies to video ads. |

#### Pricing

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