---
title: "Facebook Ad Library Search API"
method: GET
path: "/v1/ad-library/facebook/search"
tags: ["Facebook Ad Library"]
---

# Facebook Ad Library Search API

`GET /v1/ad-library/facebook/search`

## Request

- Base URL: `https://api.captapi.com`
- URL: `https://api.captapi.com/v1/ad-library/facebook/search`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Search Meta Ad Library by keyword — active/inactive, media type, date range, platforms, cursor, and spend/impressions when Meta publishes them.

Search Meta's Ad Library and get competitor creatives as clean JSON — filters: status (default ACTIVE), media_type, platforms, ad_type, search_type (exact phrase), sort_by (total_impressions|relevancy_monthly_grouped), start_date/end_date, cursor, trim. One call reads Meta's first result page (~30 ads); a limit above 30 also scrolls the library for more, up to ~70–80 ads per call (those calls take ~45–60s instead of ~25s). Cursor pages that fetched batch via nextCursor (not Meta's multi-thousand POST cursor). hasMore is true only when nextCursor is present; when that batch is spent but Meta reports more ads past it, hasMore is null and truncatedReason is library-page — never a false no-more-ads (truncatedReason is null otherwise). searchResultsCount is Meta's upstream match count (can be thousands); retrievableCount is how many ads this cursor walk can actually return (the fetched HTML batch, typically ~30–50) — publish both; the big number is not walkable. Same advertiser id collapses to one name within a response (name normalisation, not dedup). Collation siblings share collationId and each consume a limit slot — group on that key if you want one row per creative; collationId is always keyed (null when Meta omits it) and siblings in one collated_results group inherit a missing id. Each ad: text/headline/cta/ctaType/landingUrl, media[] (canonical URL list) plus typed images/videos + cards[], isActive, publisherPlatforms (not a platforms twin), pageLikeCount/pageCategories/pageEntityType, politicalCountries, reachEstimate, spend/impressions when Meta publishes them. Meta publishes spend, impressions, reach, and the paid-for-by extras (byline, disclaimerLabel, brandedContent, pageEntityType, totalActiveTime) only for political and issue ads in regions that require disclosure; commercial advertisers omit them — politicalCountries: [] is the signal, not a scrape miss. DCO creatives substitute cards[0] when text/headline/linkDescription are {{product.*}} tokens and set textIsFromCard (leftover tokens keep isTemplated). images[]/videos[] are filled from cards when Meta leaves the typed arrays empty. mediaUrlsExpireAt is the earliest Meta CDN oe= stamp (~5 days). variantCount is always keyed (null when Meta omits it). advertiser is {id,name,url,logo,location,profileId?} — id is the Ad Library page id; profileId is the facebook.com/{digits} namespace when it differs; identical pageId/advertiserId aliases are not emitted. advertiser.location is null in practice on search: Meta's search results carry no advertiser location (the key stays for the shared ad-library schema). firstShown/lastShown are calendar days (YYYY-MM-DD) in Pacific — Meta's date, not an 8 a.m. UTC instant. Row-level country is omitted when Meta does not publish a per-ad market (the envelope country is the query). Envelope fetchMs / parseMs / totalMs survive the customer-trace strip so a ~13s call is attributable. Native fetch is capped at 110s. Flat 2 credits on the native path.

Docs: https://captapi.com/apis/facebook-ad-library-search

## Query parameters

- `q` string, required
- `country` string
- `limit` integer
- `status` 'ALL' | 'ACTIVE' | 'INACTIVE'
- `media_type` 'ALL' | 'IMAGE' | 'VIDEO' | 'MEME' | 'IMAGE_AND_MEME' | 'NONE'
- `platforms` string
- `ad_type` 'all' | 'political_and_issue_ads'
- `search_type` 'keyword_unordered' | 'keyword_exact_phrase'
- `sort_by` 'total_impressions' | 'relevancy_monthly_grouped'
- `start_date` string
- `end_date` string
- `cursor` string
- `trim` boolean
- `cache` boolean

## Response `200`

Success. The data object for this endpoint.

- object
  - `success` unknown, required
  - `data` object, required
    - `query` string: Keyword you searched.
    - `country` string: ISO market you queried (e.g. US, BD). Envelope only — not each ad's delivery country, and not a popular-creators feed market.
    - `totalReturned` integer: Ads on this page (length of ads[]).
    - `ads` object[]
      - `platform` string: Platform identifier for this response (matches the endpoint's platform).
      - `id` string: Id of this ads item.
      - `url` string: Canonical URL of the item.
      - `text` string: Body copy of the creative. DCO {{product.*}} tokens fall back to cards[0].text when that card has real copy.
      - `headline` string: Ad headline / title when Meta exposes it. Not a profile headline. DCO tokens fall back to cards[0] (see textIsFromCard).
      - `cta` string: Call-to-action label (e.g. Learn more).
      - `landingUrl` string: Click-through URL from the creative.
      - `adFormat` string: Creative format Meta labelled (IMAGE, VIDEO, …).
      - `firstShown` string: Meta delivery-start date as YYYY-MM-DD (Pacific calendar day) — not an 8 a.m. UTC instant.
      - `lastShown` string: Meta delivery-end date as YYYY-MM-DD (Pacific calendar day) — not an 8 a.m. UTC instant.
      - `impressions` string: Impression band when Meta publishes it. Commercial usually null — see platformNote.
      - `spend` string: Spend band when Meta publishes it (political/issue ads). Commercial usually null — see platformNote.
      - `country` string: ISO market you queried (e.g. US, BD). Envelope only — not each ad's delivery country, and not a popular-creators feed market.
      - `advertiser` object: Advertiser running the ad.
        - `id` string: Id of this ads item.
        - `name` string
        - `url` string: Canonical URL of the item.
        - `logo` string
      - `media` string[]: Canonical URL list — one primary asset per creative, including DCO cards. resizedUrl / posters live on images[] / videos[].

## Other responses

- `400`: Bad request: wrong platform URL, unknown endpoint, or an invalid parameter value. Not billed.
- `401`: Missing, invalid or revoked API key. Not billed.
- `402`: Not enough credits for this request. Not billed.
- `404`: The resource does not exist or is not public. Not billed.
- `422`: A required parameter is missing or has the wrong type. Not billed.
- `429`: Rate limit reached. Wait for Retry-After seconds. Not billed.
- `502`: The platform could not be reached or returned nothing usable. Retryable, not billed. 503 and 504 use the same envelope.

---

[API](https://skmtc.dev/captapi/apis/captapi-api.md) · [All operations](https://skmtc.dev/captapi/apis/captapi-api/llms.txt) · [OpenAPI document](https://skmtc.dev/captapi/apis/captapi-api/revisions/c9b9ac5ff1bd?raw)
