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

# Meta ads

> Search the Meta Ad Library, continue through results, and inspect individual ads.

## Search ads

```http theme={null}
GET https://api.vexqo.dev/facebook/ads
X-API-Key: YOUR_API_KEY
```

Supply `q`, `page_id`, or both. A keyword search matches ad text; `page_id` scopes the request to one advertiser.

| Parameter | Default | Use |
| - | - | - |
| `q` | — | Search text, up to 100 characters. |
| `page_id` | — | Numeric Facebook advertiser page ID. |
| `country` | `ALL` | Two-letter country code, such as `US`, or `ALL`. |
| `limit` | `30` | Requested ads, from 1 to 100. |
| `search_type` | `keyword_unordered` | Use `keyword_exact_phrase` for an exact phrase. |
| `active_status` | See below | `active`, `inactive`, or `all`. |
| `media_type` | `all` | `all`, `image`, `video`, `meme`, `image_and_meme`, or `none`. |
| `start_date`, `end_date` | — | Inclusive activity window in `YYYY-MM-DD` format. |
| `platforms` | — | Comma-separated platforms; see the live reference for supported values. |
| `languages` | — | Comma-separated language codes, such as `en,pt_BR`. |
| `sort_by` | `total_impressions` | Also accepts `relevancy_monthly_grouped`. |
| `include_products` | `false` | Follow destination links for product enrichment; adds credit usage. |
| `include_page_info` | `false` | Include advertiser information; requires `page_id`. |
| `cursor` | — | Continue from `search_information.next_cursor`. |

`ad_type` supports `all`, `political_and_issue_ads`, `housing_ads`, `employment_ads`, and `credit_ads`. Availability still depends on what the source exposes.

```bash theme={null}
curl --fail-with-body --get "https://api.vexqo.dev/facebook/ads" \
  --header "X-API-Key: $VEXQO_API_KEY" \
  --data-urlencode "q=running shoes" \
  --data-urlencode "country=US" \
  --data-urlencode "media_type=video" \
  --data-urlencode "limit=30"
```

## Date filters

The date window selects ads that **ran during the period**, regardless of when they started. Dates follow the Ad Library’s Pacific-time calendar. `end_date` cannot precede `start_date`.

When `active_status` is omitted, the API uses `active`, or `all` when `end_date` is before today. Set it explicitly when comparing historical searches.

## Pagination

Read `search_information.next_cursor` from the response. If it is present, send it as `cursor` with the same search arguments. Stop when there is no next cursor. Use a URL encoder: cursors are opaque strings.

`include_page_info=true` is only valid on the first request, without a cursor. Set it to `false` or omit it on subsequent requests. A `410` response means the saved cursor is no longer available; start a fresh search and deduplicate by ad ID.

> [!NOTE]
>
> The source’s reported total can differ from the number of ads you can retrieve. Keep the returned search information, inspect partial results, and avoid treating a result count as a complete archive.

## Get one ad

```bash theme={null}
curl --fail-with-body "https://api.vexqo.dev/facebook/ads/AD_ID" \
  --header "X-API-Key: $VEXQO_API_KEY"
```

Replace `AD_ID` with a numeric ad ID. This endpoint retrieves the detail view for one ad. Creative, advertiser, delivery, and destination fields depend on what the source makes available.

## Capture an advertiser’s page

`GET /facebook/pages/{page_id}/ads` captures the advertiser’s Ad Library page. You can repeat `ad_id` to select specific ads and set `wait_seconds` from 5 to 60 (default 40). This is a bounded page capture, not an exhaustive paginated search. For ongoing advertiser discovery, prefer `/facebook/ads?page_id=...`.

See [credits and errors](https://docs.vexqo.dev/usage.md) for charges and retry behavior, or open the [complete API reference](https://api.vexqo.dev/docs) for all parameter definitions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.