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

# Meta ads

> Read a Meta Ad Library search page with a q keyword as JSON with the meta-ads parser. $1 per 1,000 calls. Send the page to scrape.

Reads a Meta Ad Library search page with a q keyword, a page view with a view\_all\_page\_id, or an ad page with an id, and returns its data as JSON.

## Make a request

Send the page's URL to [scrape](https://docs.stophy.dev/api-reference/endpoint/scrape.md) with a `json` format that names the parser. Get an API key in the [Quickstart](https://docs.stophy.dev/quickstart).

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=nike&search_type=keyword_exact_phrase","formats":[{"type":"json","parser":"meta-ads"}]}'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=nike&search_type=keyword_exact_phrase",
    formats: [{ type: "json", parser: "meta-ads" }],
  }),
});
console.log(await response.json());
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={
        "url": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=nike&search_type=keyword_exact_phrase",
        "formats": [{"type": "json", "parser": "meta-ads"}],
    },
)
print(response.json())
```

## Read the response

The parser's data is in `data.json`. Its fields include `adId`, `adUrl`, `pageId`, `pageName`, `pageUrl` and `pageAvatarUrl`. This sample is cut to the first items.

```json theme={null}
{
  "success": true,
  "data": {
    "json": {
      "results": [
        {
          "adId": "1550534860016399",
          "adUrl": "https://www.facebook.com/ads/library/?id=1550534860016399",
          "pageId": "115939511520844",
          "pageName": "Perfect themes",
          "pageUrl": "https://facebook.com/100093512920259",
          "pageAvatarUrl": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/701421303_1593266515068546_6584706353812290058_n.jpg?stp=dst-jpg_s60…",
          "pageCategories": [
            "Topic"
          ],
          "pageLikes": 18581,
          "isActive": true,
          "firstShownAt": "2026-05-19T07:00:00.000Z",
          "lastShownAt": null,
          "platforms": [
            "facebook",
            "instagram",
            "audienceNetwork"
          ],
          "format": "image",
          "text": "🔥🍭Themepack is a FREE and personalized APP😍 various styles of Theme💎 、Weather💖、Photo😊、Clock、Calendar to pick any…",
          "linkUrl": "http://play.google.com/store/apps/details?id=com.iconchanger.widget.theme.shortcut",
          "linkTitle": "𝕊𝕦𝕡𝕖𝕣 𝕙𝕠𝕥 𝕨𝕚𝕕𝕘𝕖𝕥𝕤 𝕒𝕡𝕡 ！",
          "linkDescription": null,
          "ctaText": "Install now",
          "imageUrls": [
            "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/700927950_933331229664450_6487763311056032772_n.jpg?_nc_cat=111&ccb=…"
          ],
          "videoUrls": [],
          "cards": [],
          "versions": null,
          "categories": [],
          "paidBy": null,
          "spendMin": null,
          "spendMax": null,
          "spendCurrency": null,
          "impressionsMin": null,
          "impressionsMax": null,
          "reachMin": null,
          "reachMax": null,
          "countries": []
        }
      ],
      "cursor": "AQHTFYpc21jgjbhLWsCOd9JSuy7msUL1luJh8uiG-cX_v-3pw-d_l39pX5QljfX7STmR"
    }
  }
}
```

## Options

Send options in the `options` object of the `json` format.

| Option | What it does |
| - | - |
| `mediaType` | The Ad Library's own Media type filter: image, video, or text (no image or video). |
| `platforms` | The Ad Library's own Platform filter: only ads shown on at least one of these platforms. |
| `language` | The Ad Library's own Language filter: a two-letter code like en. Only ads written in this language. |
| `shownFrom` | The Ad Library's own Impressions by date: ads shown on or after this day. |
| `shownTo` | The Ad Library's own Impressions by date: ads shown on or before this day. |
| `cursor` | The cursor from the previous response. Send it as is. |

## Price

\$1 per 1,000 calls. See [Pricing](https://docs.stophy.dev/account/pricing.md).

## Limits and errors

* The URL must be a Meta Ad Library search page with a q keyword, a page view with a view\_all\_page\_id, or an ad page with an id. Any other URL fails with `invalidRequest`.
* To read the next page, send the `cursor` from the response as the `cursor` option. Paging needs an API key.
* The answer comes back in `data.json`. If the page cannot be read, the call fails with an error code from [Errors](https://docs.stophy.dev/api-reference/errors.md).

## Related

* [Pre-built parsers](https://docs.stophy.dev/scrape/prebuilt-parsers) lists every parser.
* [Scrape](https://docs.stophy.dev/scrape/overview) has the options every scrape takes.
* [Google ads](https://docs.stophy.dev/scrape/prebuilt-parsers/ads/google-ads.md)
* [TikTok ads](https://docs.stophy.dev/scrape/prebuilt-parsers/ads/tiktok-ads.md)
* [LinkedIn ads](https://docs.stophy.dev/scrape/prebuilt-parsers/ads/linkedin-ads.md)


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