Facebook Ad Library API — Parse an Ad Library URL
Documentation menu
FetchLayer FetchLayer API

Parse an Ad Library URL

Turn any Facebook Ad Library URL into the structured filters it encodes — whether it points at one ad, an advertiser, or a search, plus the country, status, media type, platform and date filters carried in its query string. Parsing a URL does not consume a credit.

POST /resolve-url Utility
https://api.fetchlayer.dev/facebook-ad-library/resolve-url
OpenAPI JSON

Headers

Authorization string required

Bearer token — your FetchLayer API key.

Parameters

url string required

Any Ad Library URL, to be parsed into structured filters.

format string optional

json or markdown, lowercase; any other value is a 400. Over MCP, markdown returns the result rendered as text; the REST API accepts it and returns JSON. (default: json)

timeoutMs integer optional

Time limit for the whole request, in milliseconds (1000–120000), counted from its arrival, time spent waiting in the queue included; a value outside that range is a 400. When it runs out, a paged request returns what it has with nextCursor and a note, billed for the pages it delivered; a request with nothing to return yet fails with a 503 you can retry, marked with the response header X-Timeout-Source: caller. Left out, the request runs as long as it needs.

Response Fields

resolve-url

Parse an Ad Library URL

kind string

What the URL points at: ad, advertiser, search, or unknown.

adArchiveId string

Present when kind is ad.

pageId string

Present when kind is advertiser.

query string

Present when kind is search.

country string

Country filter carried in the URL.

activeStatus string

Status filter carried in the URL.

publisherPlatforms string[]

Platform filters carried in the URL.

Request

curl -X POST "https://api.fetchlayer.dev/facebook-ad-library/resolve-url" \
  -H "Authorization: Bearer ss-your-key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=crm"}'

Response

{
  "kind": "search",
  "query": "crm",
  "country": "US",
  "activeStatus": "active",
  "publisherPlatforms": []
}