Facebook API

Facebook Ads search API

Search the Meta Ad Library by keyword and get matching ads (advertiser, creative text, CTA, platforms, and run dates) with cursor pagination.

$1.10/1k req, pay per request, no subscription.

What the API returnedads[0]
{
"id": "705513298640217",
"sourceUrl": "https://www.facebook.com/ads/library/?id=705513298640217",
"pageId": "398201744920331",
"pageName": "Vantage Nutrition",
"active": true,
"startDate": 1756512000,
"endDate": 1758758400,
"text": "20g of grass fed whey, 1g of sugar, zero fillers. Vantage protein powder mixes clean and tastes like an actual milkshake.",
... 18 more fields
}
Uptime
98.13%
30d · 154,101 calls
Requests
158,186
30d · weekly, last 12 wks
Response
1.6s
median · 30d

Pricing and providers

Facebook Ads search API pricing: one API, 4 interchangeable providers

The cheapest provider serves first. If it fails, the next one takes over in the same call.

You pay
$11.00
$1.10/1k req, only for what you use. No monthly plan.
Your first 90 requests are free with the $0.10 starting balance.

Try it

Get Facebook ads search in one request

requireFieldsarray
Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `totalResults`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on an ad that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.
Open in
Get a free key
Sample response
Free runs return only the first 3 results. Fund a key to get the full response.

This sample shows 35 of 46 fields. See every field

{
  "found": true,
  "data": {
    "totalResults": 214,
    "nextCursor": "AQHRZ9d3f2k7m1x8c",
    "ads": [
      {
        "id": "705513298640217",
        "sourceUrl": "https://www.facebook.com/ads/library/?id=705513298640217",
        "pageId": "398201744920331",
        "pageName": "Vantage Nutrition",
        "active": true,
        "startDate": 1756512000,
        "endDate": 1758758400,
        "text": "20g of grass fed whey, 1g of sugar, zero fillers. Vantage protein powder mixes clean and tastes like an actual milkshake.",
        "title": "Protein that doesn't taste like chalk",
        "ctaText": "Shop Now",
        "ctaType": "SHOP_NOW",
        "linkUrl": "https://vantagenutrition.com/protein",
        "displayFormat": "IMAGE",
        "platforms": [
          "facebook",
          "instagram"
        ],
        "adCount": 3,
        "pageProfilePicture": "https://scontent.fbcdn.net/vantage-profile.jpg",
        "media": [
          {
            "type": "photo",
            "url": "https://scontent.xx.fbcdn.net/v/t45.1600-4/vantage-protein-tub.jpg",
            "width": 1080,
            "height": 1080
          }
        ],
        "caption": "vantagenutrition.com",
        "linkDescription": "Subscribe and save 20%. Cancel anytime.",
        "pageUrl": "https://www.facebook.com/vantagenutrition",
        "pageCategories": [
          "Product/service",
          "Health/beauty"
        ],
        "pageLikes": 61300,
        "isReshared": false,
        "pageDeleted": false,
        "categories": [
          "Uncategorized"
        ]
      },
      {
        "id": "592047718834105",
        "sourceUrl": "https://www.facebook.com/ads/library/?id=592047718834105",
        "pageId": "711029384710556",
        "pageName": "PureForm Labs",
        "active": true,
        "startDate": 1757203200,
        "endDate": 1759363200,
        "text": "Plant based protein powder with 25g per scoop and no bloating. Third party tested, banned substance free.",
        "title": "25g of plant protein, zero bloat",
        "ctaText": "Learn More",
        "ctaType": "LEARN_MORE",
        "linkUrl": "https://pureformlabs.com/plant-protein",
        "displayFormat": "VIDEO",
        "platforms": [
          "facebook",
          "instagram",
          "messenger"
        ],
        "adCount": 1,
        "pageProfilePicture": "https://scontent.fbcdn.net/pureform-profile.jpg",
        "media": [
          {
            "type": "video",
            "url": "https://scontent.xx.fbcdn.net/v/t42.1790-2/pureform-protein-poster.jpg",
            "videoUrl": "https://video.xx.fbcdn.net/v/t42.9040-2/pureform-protein-ad.mp4",
            "width": 1080,
            "height": 1350
          }
        ],
        "caption": "pureformlabs.com",
        "linkDescription": "Free shipping on orders over $40.",
        "pageUrl": "https://www.facebook.com/pureformlabs",
        "pageCategories": [
          "Product/service",
          "Health/beauty"
        ],
        "pageLikes": 18900,
        "isReshared": false,
        "pageDeleted": false,
        "categories": [
          "Uncategorized"
        ]
      }
    ]
  }
}

Full parameter and response reference - every field, type, and example for this endpoint.

Reference

One request, one response shape.

Every field you send and every field you get back, each with a real example.

Last verified 2026-10-31 · uptime and latency measured over 30d

Request body

JSON, posted to this endpoint.

  • querystring

    protein powder

    Keyword to search the Meta Ad Library for (e.g. "protein powder").

  • adTypeenum

    Restrict to all ads (default) or only political and issue ads.

  • countrystring

    US

    Two-letter country code to scope results. Omit for all countries.

  • cursorstring

    Opaque pagination cursor from a previous response's nextCursor.

  • endDatestring

    Filter to ads with impressions on or before this date, in YYYY-MM-DD format.

  • mediaTypeenum

    Creative media type filter.

  • requireFieldsarray

    Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `totalResults`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on an ad that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.

  • searchTypeenum

    keyword_exact_phrase

    Match mode for the query: loose keyword match (keyword_unordered, the default) or exact phrase (keyword_exact_phrase).

  • sortByenum

    Sort order: impressions (highest first, the default) or recent (most recent).

  • startDatestring

    Filter to ads with impressions on or after this date, in YYYY-MM-DD format.

  • statusenum

    Ad status filter.

You send. A small JSON body. The values shown are examples to replace with your own.

Response

JSON, one example value per field.

each addata.ads[]
  • activeboolean

    true

  • adCountinteger

    3

    Number of ads in this campaign (collation count). Null when the source does not report it.

  • captionstring

    vantagenutrition.com

    Caption line of the ad creative, usually the advertiser's display domain.

  • categoriesstring[]

    Ad Library categories the ad is filed under.

  • ctaTextstring

    Shop Now

    Populated whenever the provider has data for the entity.

  • ctaTypestring

    SHOP_NOW

    Populated whenever the provider has data for the entity.

  • displayFormatstring

    IMAGE

    Populated whenever the provider has data for the entity.

  • endDateinteger

    1758758400

    Epoch seconds.

  • idstring

    705513298640217

    Ad Library archive ID. Populated whenever the provider has data for the entity.

  • isResharedboolean

    false

    Whether the ad creative is a reshare of another post.

  • linkDescriptionstring

    Subscribe and save 20%. Cancel anytime.

    Description text shown under the ad's link.

  • linkUrlstring

    https://vantagenutrition.com/protein

    Populated whenever the provider has data for the entity.

  • pageCategoriesstring[]

    Categories Facebook lists the advertising page under.

  • pageDeletedboolean

    false

    Whether the advertising page has been deleted.

  • pageIdstring

    398201744920331

    Populated whenever the provider has data for the entity.

  • pageLikesinteger

    61300

    Like count of the advertising page.

  • pageNamestring

    Vantage Nutrition

    Populated whenever the provider has data for the entity.

  • pageProfilePicturestring

    https://scontent.fbcdn.net/vantage-profile.jpg

    Profile picture of the advertising page. This is the advertiser's identity image, not ad creative.

  • pageUrlstring

    https://www.facebook.com/vantagenutrition

    Canonical Facebook URL of the advertising page.

  • platformsstring[]

    Populated whenever the provider has data for the entity.

  • sourceUrlstring

    https://www.facebook.com/ads/library/?id=705513298640217

    Inspectable Meta Ad Library URL for this ad. Populated whenever the provider has data for the entity.

  • startDateinteger

    1756512000

    Epoch seconds. Populated whenever the provider has data for the entity.

  • textstring

    20g of grass fed whey, 1g of sugar, zero fillers. Vantage protein powder mixes clean and tastes like an actual milkshake.

    Ad body text. Populated whenever the provider has data for the entity.

  • titlestring

    Protein that doesn't taste like chalk

    Populated whenever the provider has data for the entity.

each creativedata.ads[].creatives[]

One entry per card of a carousel, dynamic-product, or dynamic-creative ad, in the order Meta returns them, each with its own text and destination. Single-creative ads return an empty array. The same card images and videos also appear in media. Meta CDN media URLs are signed and expire.

  • bodystring

    Card body text.

  • captionstring

    Card display caption, usually the destination domain.

  • ctaTextstring

    Card call-to-action label (e.g. "Shop Now").

  • ctaTypestring

    Card call-to-action type (e.g. "SHOP_NOW").

  • imagestring

    Card image URL. For a video card this is the poster frame.

  • linkDescriptionstring

    Card secondary description line.

  • linkUrlstring

    Card destination URL.

  • titlestring

    Card headline.

  • videoUrlstring

    Card video file URL (HD when supplied, otherwise SD). Present only on video cards.

each mediadata.ads[].media[]

Creative attached to the ad: one element per image, video, or carousel card, in the order the ad presents them. Empty when the ad has none.

  • heightinteger

    1080

    Pixel height of the media item, when the lane reports it.

  • typestring

    photo

    One of photo, video, or gif.

  • urlstring

    https://scontent.xx.fbcdn.net/v/t45.1600-4/vantage-protein-tub.jpg

    Image URL. For a video or GIF this is the poster/thumbnail frame.

  • videoUrlstring

    Playable video file URL. Present only for video and gif items.

  • widthinteger

    1080

    Pixel width of the media item, when the lane reports it.

datadata
  • nextCursorstring

    AQHRZ9d3f2k7m1x8c

    Opaque cursor for the next page of ads, or null when this lane has no more. Pass it back as cursor to continue.

  • totalResultsintegercan require

    214

    Total number of ads matching the search. Null when the source cannot report an exact count.

top level
  • foundboolean

    true

  • reason"not_found"

    Present only when `found` is false, and says why there is no result. `not_found`: the source states the target does not exist, or returned nothing for it. A `found: false` answer is a successful call, not an error, and `costUsd` is what it actually cost.

You get back. Named, typed fields in the same shape whichever source answers.

Selling this API? See the full schema your endpoint must return.

FAQ

About the Facebook Ads search API

The AnyAPI Facebook Ads search API returns Facebook ads search data as normalized JSON from one POST call to /v1/run/facebook.ads_search. Search the Meta Ad Library by keyword and get matching ads (advertiser, creative text, CTA, platforms, and run dates) with cursor pagination. AnyAPI routes each request across 4 sources and falls back automatically when one fails. It costs from $1.10 per 1,000 requests, in US dollars with no subscription and no monthly minimum. Over the last 30 days, 98.1% of Facebook ads search calls through AnyAPI succeeded, with a median response time of 1.6 seconds across 154,101 measured calls.

It costs from $1.10 per 1,000 requests, in US dollars with no subscription and no monthly minimum. You fund one USD wallet and each call draws it down. Some failed wallet-funded requests incur processing charges that we pass through at cost, with no markup; the error response shows the amount charged.

Search the Meta Ad Library by keyword and get matching ads (advertiser, creative text, CTA, platforms, and run dates) with cursor pagination. The response is normalized JSON with the same envelope every AnyAPI endpoint returns, so parsing a second endpoint is a change of URL and nothing else.

Over the last 30 days, 98.1% of Facebook ads search calls through AnyAPI succeeded, with a median response time of 1.6 seconds across 154,101 measured calls. These are AnyAPI's own measurements of traffic through the gateway, recomputed continuously, not a published service-level target.

Yes. A new AnyAPI account starts with $0.10 of free balance and no card required, which covers 90 Facebook Ads search calls at $0.0011 each.

AnyAPI asks the next of its 4 sources in the same request, cheapest first, so one source going down does not fail your call.

Send a POST request to https://api.getanyapi.com/v1/run/facebook.ads_search with your AnyAPI key in an "Authorization: Bearer" header and the input as a JSON body. The same key and the same wallet work on every AnyAPI endpoint.

No. You add US dollars to one prepaid AnyAPI balance and each request draws it down. There is no monthly plan and no minimum, and the same balance pays for every AnyAPI endpoint.

Yes. Install @getanyapi/sdk from npm for TypeScript or getanyapi from pip for Python. Both call every AnyAPI endpoint with the same key, and any HTTP client works too.

Yes. An agent can connect to the AnyAPI MCP server at https://api.getanyapi.com/mcp, or create its own free-trial key with one unauthenticated POST to https://api.getanyapi.com/agent/signup and call this endpoint over HTTP.