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.

POST/v1/run/facebook.ads_search
Uptime
91.83%
30d · 759 calls
Requests
759
30d · weekly, last 12 wks
Response
2.7s
median · 30d

Try it

Make your first request

Open in
Get a free key
Sample response
Free runs return only the first 3 results. Fund a key to get the full response.
{
  "data": {
    "ads": [
      {
        "active": true,
        "adCount": 12500,
        "ctaText": "A short example description of this item.",
        "ctaType": "general",
        "displayFormat": "example",
        "endDate": 42,
        "id": "a1b2c3d4",
        "linkUrl": "https://example.com/page",
        "media": [
          {
            "height": 42,
            "type": "general",
            "url": "https://example.com/page",
            "videoUrl": "https://example.com/page",
            "width": 1024
          }
        ],
        "pageId": "a1b2c3d4",
        "pageName": "Example title",
        "pageProfilePicture": "https://example.com/image.jpg",
        "platforms": [
          "example"
        ],
        "sourceUrl": "https://example.com/page",
        "startDate": 42,
        "text": "A short example description of this item.",
        "title": "Example title"
      }
    ],
    "nextCursor": "example",
    "totalResults": 12500
  },
  "found": true
}
Response interface
interface FacebookAdsSearchResponse {
  data: {
    ads: {
      active: boolean;
      adCount: number;
      ctaText: string;
      ctaType: string;
      displayFormat: string;
      endDate: number;
      id: string;
      linkUrl: string;
      media?: {
        height?: number;
        type: string;
        url: string;
        videoUrl?: string;
        width?: number;
      }[];
      pageId: string;
      pageName: string;
      pageProfilePicture?: string;
      platforms: string[];
      sourceUrl: string;
      startDate: number;
      text: string;
      title: string;
    }[];
    nextCursor: string | null;
    totalResults: number;
  } | null;
  found: boolean;
}

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

Reference

Request, response, and price

Last verified 2026-09-16 · uptime and latency measured over 30d
POST /v1/run/facebook.ads_search
curl -X POST https://api.getanyapi.com/v1/run/facebook.ads_search \
  -H "Authorization: Bearer $ANYAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"country":"US","query":"nike","searchType":"keyword_exact_phrase"}'
FieldTypeExample value
Request body
querystring"nike"Keyword to search the Meta Ad Library for (e.g. "protein powder").
adTypeenumRestrict to all ads (default) or only political and issue ads.
countrystring"US"Two-letter country code to scope results. Omit for all countries.
cursorstringOpaque pagination cursor from a previous response's nextCursor.
endDatestringFilter to ads with impressions on or before this date, in YYYY-MM-DD format.
mediaTypeenumCreative media type filter.
searchTypeenum"keyword_exact_phrase"Match mode for the query: loose keyword match (keyword_unordered, the default) or exact phrase (keyword_exact_phrase).
sortByenumSort order: impressions (highest first, the default) or recent (most recent).
startDatestringFilter to ads with impressions on or after this date, in YYYY-MM-DD format.
statusenumAd status filter.
Response
dataobject
data.adsobject[]
data.ads[].activeboolean
data.ads[].adCountintegerNumber of ads in this campaign (collation count).
data.ads[].ctaTextstringPopulated whenever the provider has data for the entity.
data.ads[].ctaTypestringPopulated whenever the provider has data for the entity.
data.ads[].displayFormatstringPopulated whenever the provider has data for the entity.
data.ads[].endDateintegerEpoch seconds.
data.ads[].idstringAd Library archive ID. Populated whenever the provider has data for the entity.
data.ads[].linkUrlstringPopulated whenever the provider has data for the entity.
data.ads[].mediaobject[]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.
data.ads[].media[].heightintegerPixel height of the media item, when the lane reports it.
data.ads[].media[].typestringOne of photo, video, or gif.
data.ads[].media[].urlstringImage URL. For a video or GIF this is the poster/thumbnail frame.
data.ads[].media[].videoUrlstringPlayable video file URL. Present only for video and gif items.
data.ads[].media[].widthintegerPixel width of the media item, when the lane reports it.
data.ads[].pageIdstringPopulated whenever the provider has data for the entity.
data.ads[].pageNamestringPopulated whenever the provider has data for the entity.
data.ads[].pageProfilePicturestringProfile picture of the advertising page. This is the advertiser's identity image, not ad creative.
data.ads[].platformsstring[]Populated whenever the provider has data for the entity.
data.ads[].sourceUrlstringInspectable Meta Ad Library URL for this ad. Populated whenever the provider has data for the entity.
data.ads[].startDateintegerEpoch seconds. Populated whenever the provider has data for the entity.
data.ads[].textstringAd body text. Populated whenever the provider has data for the entity.
data.ads[].titlestringPopulated whenever the provider has data for the entity.
data.nextCursorstringOpaque cursor for the next page of ads, or null when this lane has no more. Pass it back as cursor to continue.
data.totalResultsinteger
foundboolean
Price
Price per requestUSD$0.0012
Price /1k reqUSD$1.20

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 2 sources and falls back automatically when one fails. It costs from $1.20 per 1,000 requests, in US dollars with no subscription and no monthly minimum. Over the last 30 days, 91.8% of Facebook ads search calls through AnyAPI succeeded, with a median response time of 2.7 seconds across 759 measured calls.

It costs from $1.20 per 1,000 requests, in US dollars with no subscription and no monthly minimum. You fund one USD wallet, each call draws it down, and a failed request costs $0.

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, 91.8% of Facebook ads search calls through AnyAPI succeeded, with a median response time of 2.7 seconds across 759 measured calls. These are AnyAPI's own measurements of traffic through the gateway, recomputed continuously, not a published service-level target.