Facebook API

Facebook Ads Library API

Send words or a brand name and a country, and get the ads Meta's Ad Library shows for them as JSON: the advertiser and its Page, the ad text, headline, link, call to action, images and videos, platforms, start date and days active.

  • 10 free credits
  • No card needed
  • No scraper to build or maintain
curl "https://pipefetch.com/v1/facebook/ads?q=nike&country=US" \
  -H "x-api-key: YOUR_API_KEY"
The response

What you get

  • Up to 30 ads per request, running now or also stopped
  • The advertiser: Page name, address, likes and categories
  • Ad text, headline, link, call to action and format
  • Image and video addresses of the creative
  • Platforms (Facebook, Instagram, Messenger, Audience Network), start date and days active
200 OK · application/json
{
  "data": {
    "query": "nike",
    "country": "US",
    "ads": [
      {
        "id": "1550534860016399",
        "url": "https://www.facebook.com/ads/library/?id=1550534860016399",
        "advertiser": {
          "name": "Perfect themes",
          "pageId": "115939511520844",
          "pageUrl": "https://www.facebook.com/100093512920259/",
          "pageLikes": 18492,
          "categories": [
            "Topic"
          ]
        },
        "text": "🔥🍭Themepack is a FREE and personalized APP😍 various styles of Theme💎 、Weather💖、Photo😊、Clock、Calendar to pick any widget to dress up your home sc…",
        "headline": "𝕊𝕦𝕡𝕖𝕣 𝕙𝕠𝕥 𝕨𝕚𝕕𝕘𝕖𝕥𝕤 𝕒𝕡𝕡 !",
        "description": null,
        "linkUrl": "http://play.google.com/store/apps/details?id=com.iconchanger.widget.theme.shortcut",
        "linkCaption": "play.google.com",
        "callToAction": "Install now",
        "format": "IMAGE",
        "imageUrls": [
          "https://scontent.fmem1-1.fna.fbcdn.net/v/t39.35426-6/700927950_933331229664450_6487763311056032772_n.jpg?_nc_cat=111&_nc_map=urlgen_bucketless&ccb=1-7…"
        ],
        "videoUrls": [],
        "platforms": [
          "facebook",
          "instagram"
        ],
        "startDate": "2026-05-19",
        "endDate": null,
        "isActive": true,
        "daysActive": 197,
        "variants": 1,
        "spend": null,
        "impressions": null
      },
      {
        "id": "962050096457659",
        "url": "https://www.facebook.com/ads/library/?id=962050096457659",
        "advertiser": {
          "name": "Depop",
          "pageId": "156405867784232",
          "pageUrl": "https://www.facebook.com/depop/",
          "pageLikes": 100495,
          "categories": [
            "Shopping"
          ]
        },
        "text": "Free Depop Shipping just dropped. Go find something you love.",
        "headline": "Nike Women's Jacket, LOFT Women's T-shirt, LOFT Women's Shorts, LOFT Women's Blouse, Coach Women's Hoodie",
        "description": "Download Depop - Buy & Sell Clothes by Depop Ltd on the App Store. See screenshots, ratings and reviews, user tips, and more apps like Depop - Buy & S…",
        "linkUrl": "http://itunes.apple.com/app/id518684914",
        "linkCaption": "itunes.apple.com",
        "callToAction": "Download",
        "format": "DPA",
        "imageUrls": [
          "https://scontent.fmem1-2.fna.fbcdn.net/v/t39.35426-6/706198623_1758809891778866_1474232210027622534_n.jpg?_nc_cat=105&_nc_map=urlgen_bucketless&ccb=1-…",
          "https://scontent.fmem1-1.fna.fbcdn.net/v/t39.35426-6/706538687_1471950538014143_7938086405330809751_n.jpg?_nc_cat=108&_nc_map=urlgen_bucketless&ccb=1-…"
        ],
        "videoUrls": [],
        "platforms": [
          "facebook",
          "instagram"
        ],
        "startDate": "2026-05-22",
        "endDate": null,
        "isActive": true,
        "daysActive": 194,
        "variants": 6,
        "spend": null,
        "impressions": null
      }
    ]
  },
  "credits": {
    "used": 1,
    "remaining": 99
  }
}
Reference

One GET request

Everything the endpoint accepts. The full reference, with the complete example response, is in the docs.

GET/v1/facebook/ads

Costs 1 credit per request. Only requests that return data are charged.

Parameters

NameTypeDescription
qrequired string Words the ads contain, or a brand name, up to 100 characters.
countryoptional string Two-letter code of the country where the ads ran, such as US, GB or DE. Without it: US.
statusoptional string active: ads running now. all: also ads that have stopped. One of: active, all. Default: active.
limitoptional integer How many ads to return. Default: 20. From 1 to 30.

Good to know

  • The ads are those Meta's Ad Library shows for the words, in Meta's order. Meta matches words loosely: a few ads in a result may not mention them.
  • Spend, impressions and audience figures are shown by Meta only for political and issue ads and are null for others.
  • No ads for the words answers 404 no_ads and costs nothing. When Meta refuses the request, the answer is 502 upstream_error, free and worth a retry.

Open the reference

Use cases

What people build with it

  • Competitor ad research

    See which ads a competitor runs, since when, and on which platforms.

  • Creative inspiration

    Collect the ads of a niche to study hooks, offers and formats.

  • Ad monitoring

    Check a keyword every day and catch new ads as they start.

  • Ad data for AI agents

    An agent researching a market gets its ads in one call.

Pricing

Buy credits once. Use them whenever.

This endpoint costs 1 credit per request, and a request that returns no data costs nothing. Move the slider to see what your volume costs.

5,000credits a month
5005,00050,000250,000
5,000requests at 1 credit
2,500requests at 2 credits

Each endpoint says what a request costs. Requests that return nothing are free.

Best fit
Builder pack
12,000 credits, one-time payment
$29once
  • $2.42 per 1,000 credits
  • About $12.08 a month at this pace
  • Lasts about 2.4 months at this pace
  • Credits never expire
Start with 10 free credits

See all packs and what a credit buys

FAQ

Questions and answers

Is this the official Meta API?

No. Pipefetch is an independent service and is not affiliated with Meta. It returns what Meta shows publicly to a visitor who is not signed in; you need no Meta account, only one Pipefetch API key.

Why do some ads not mention my keyword?

Meta's Ad Library matches words loosely, including text you cannot see in the ad card. Most results mention the words; a few may not.

Do I get spend and impressions?

Meta shows them only for political and issue ads; for others they are null.

What does a request cost?

One request costs 1 credit. Credit packs start at $9 for 3,000 credits, never expire, and a request that returns no data is not charged. New accounts get 10 free credits without a card.

More

More Facebook APIs

Also on the same key

Other sources

Make your first request in a minute

Sign in, copy your key and call an endpoint. Your account starts with 10 free credits.