# Facebook Ads Library

See every ad a brand is running in Meta's Ad Library — one row per ad with creative copy, headline, CTA, destination link, dates, how long it's been live, format, platforms, the advertiser's profile, carousel cards, and EU reach where it's disclosed.

**Pricing:** $6 / 1k ads

**Endpoint:** `POST /api/v1/agents/facebook/ads/run`

**Auth:** `Authorization: Bearer mk_live_...`

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `urls` | array | Yes | Facebook page URLs or handles, one per line (e.g. facebook.com/nike). |
| `maxResults` | integer | No | Number of ads to return per page. Use 0 for all. |
| `activeStatus` | string | No | Which ads to return. |
| `isDetailsPerAd` | boolean | No | Pull each ad's advertiser profile and EU transparency block. Keep on for the full record. |

## Example

```bash
curl -X POST https://api.mindcase.co/api/v1/agents/facebook/ads/run \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"params":{"urls":["..."]}}'
```

```python
import requests

resp = requests.post(
    "https://api.mindcase.co/api/v1/agents/facebook/ads/run",
    headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
    json={"params": {
    "urls": [
        "..."
    ]
}},
)
data = resp.json()
```

## Get the results

`run` is async and returns a `job_id`. Poll until `status` is `completed`, then read the rows:

```bash
# 1) check status
curl https://api.mindcase.co/api/v1/jobs/JOB_ID \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"

# 2) when status == completed, fetch the rows
curl https://api.mindcase.co/api/v1/jobs/JOB_ID/results \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"
```

Full API reference (auth, jobs, balance, endpoints): https://mindcase.co/skills.md

## Response columns

| Field | Display name | Type |
|-------|--------------|------|
| `adUrl` | Ad URL | url |
| `libraryId` | Library ID | text |
| `pageName` | Page Name | text |
| `pageUrl` | Page URL | url |
| `headline` | Headline | text |
| `bodyText` | Body Text | text |
| `linkDescription` | Link Description | text |
| `ctaText` | CTA Text | text |
| `destinationUrl` | Destination URL | url |
| `format` | Format | text |
| `startDate` | Start Date | datetime |
| `endDate` | End Date | datetime |
| `daysActive` | Days Active | number |
| `mediaUrl` | Media URL | url |
| `mediaType` | Media Type | text |
| `platforms` | Platforms | array |
| `advertiser` | Advertiser | object |
| `cards` | Cards | object_array |
| `euReach` | EU Reach | object |
| `reachBreakdown` | Reach Breakdown | object_array |
| `variantCount` | Variant Count | number |
