Download an ad media file
Stream an ad's actual video or image bytes, using a url taken from an asset returned by /ad-media. Only Facebook and Instagram CDN hosts are accepted. HTTP Range requests are supported, so video seeking works. This is a GET with query parameters, not a JSON POST, and it bills as one request.
/media Media https://api.fetchlayer.dev/facebook-ad-library/media Headers
Authorization string required Bearer token — your FetchLayer API key.
Parameters
url string required Facebook or Instagram CDN media URL, as returned on an ad asset. Passed as a query parameter.
filename string optional Content-Disposition filename to serve the file as (max 200 characters).
Range string optional Standard HTTP Range request header, for example bytes=0-65535. Sent as a header, not a query parameter.
Response Fields
media
Download an ad media file
(body) binary The file itself. 200 for the whole file, 206 for a requested byte range.
Content-Type header Media type of the file, e.g. video/mp4 or image/jpeg.
Content-Range header Byte range served, on a 206 response.
Accept-Ranges header Present when the file supports range requests.
Request
curl -X GET "https://api.fetchlayer.dev/facebook-ad-library/media?url=https%3A%2F%2Fvideo.xx.fbcdn.net%2Fv%2Ft42...%2Fad.mp4&filename=acme-ad.mp4" \
-H "Authorization: Bearer ss-your-key"Response
{
"note": "Binary file streamed back with Content-Type, Content-Length and Accept-Ranges headers."
}