Facebook Ad Library API — Download Ad Video & Images
Documentation menu
FetchLayer FetchLayer API

Get an ad's videos and images

Resolve an ad's creative files into downloadable asset URLs — videos, images and thumbnails, at high quality or watermarked, across every creative variation. Optionally probe each asset to confirm it is still available and report its size and content type.

POST /ad-media Media
https://api.fetchlayer.dev/facebook-ad-library/ad-media
OpenAPI JSON

Headers

Authorization string required

Bearer token — your FetchLayer API key.

Parameters

ad string required

Ad archive id, or an Ad Library URL containing one.

country string optional

Two-letter country code, or ALL.

kinds string[] optional

video, image, and/or thumbnail. (default: all three)

preferHighQuality boolean optional

Pick HD video and original images. (default: true)

watermarked boolean optional

Prefer Facebook's watermarked copies.

includeVariations boolean optional

Include media from every creative version of the ad.

probe boolean optional

Confirm each asset is still downloadable and report its size and content type.

inline boolean optional

Return the bytes base64-encoded in the response. Refused for assets over the inline size limit.

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

ad-media

Get an ad's videos and images

assets object[]

The ad’s media assets.

assets[].kind string

video, image, or thumbnail.

assets[].url string

Facebook’s own signed link, which expires within hours.

assets[].downloadUrl string

A link on api.fetchlayer.dev that keeps working after Facebook’s link expires; it streams the file through GET /media.

assets[].quality string

Which rendition was picked.

assets[].contentType string

MIME type, when probed.

assets[].contentLength integer

Size in bytes, when probed.

assetCount integer

Number of assets in this response.

Request

curl -X POST "https://api.fetchlayer.dev/facebook-ad-library/ad-media" \
  -H "Authorization: Bearer ss-your-key" \
  -H "Content-Type: application/json" \
  -d '{"ad":"1702938977100376","kinds":["video","image"],"preferHighQuality":true,"probe":true}'

Response

{
  "assetCount": 2,
  "assets": [
    {
      "kind": "video",
      "quality": "hd",
      "contentType": "video/mp4",
      "contentLength": 4182773,
      "url": "https://video.xx.fbcdn.net/..."
    }
  ]
}