Get an ad's videos and images
Resolve the video, image and thumbnail files on an ad, including the YouTube video where there is one. Each asset carries a downloadUrl served by this API, which is the reliable way to fetch a video: Google's own video URLs are signed, expire, and only play back from the address they were issued to. Set probe to confirm each asset is still downloadable and report its size and content type, or inline to get the bytes base64-encoded — which is refused for assets over the inline size limit.
/ad-media Media https://api.fetchlayer.dev/google-ad-library/ad-media Headers
Authorization string required Bearer token — your FetchLayer API key.
Parameters
ad string required Ad id, or an Ad Library ad URL.
advertiser string optional The ad’s advertiser. Required unless ad is a full Ad Library ad URL.
region string optional Two-letter country code.
kinds string[] optional image, video, and/or thumbnail. (default: all three)
probe boolean optional Confirm each asset is still downloadable and report its size and content type.
inline boolean optional Return the bytes base64-encoded. Refused for assets over the inline size limit — use downloadUrl for anything large.
Response Fields
ad-media
Get an ad's videos and images
assets object[] The ad’s media assets.
assets[].kind string image, video, or thumbnail.
assets[].url string Google’s own URL. A video URL is signed, expires, and only plays back from the address it was issued to.
assets[].downloadUrl string Serves the same file through this API without the expiry — pass it to GET /media to stream the bytes.
assets[].quality string original, snapshot, or preview.
assets[].variationIndex number Which creative version the asset belongs to.
assets[].youtubeVideoId string Set when the video is hosted on YouTube.
assets[].watchUrl string Page a human can watch the video on.
assets[].contentType string MIME type. Populated only when probe or inline was set.
assets[].contentLength number Size in bytes. Populated only when probe or inline was set.
assets[].base64 string The bytes themselves. Populated only when inline was set.
assetCount number Number of assets in this response.
notes string[] Caveats about this particular result, such as an asset that could not be resolved.
Request
curl -X POST "https://api.fetchlayer.dev/google-ad-library/ad-media" \
-H "Authorization: Bearer ss-your-key" \
-H "Content-Type: application/json" \
-d '{"ad":"CR01234567890123456789","advertiser":"AR01234567890123456789","kinds":["video","image"],"probe":true}'Response
{
"adId": "CR01234567890123456789",
"assetCount": 2,
"assets": [
{
"kind": "video",
"quality": "original",
"youtubeVideoId": "dQw4w9WgXcQ",
"watchUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"contentType": "video/mp4",
"contentLength": 4182773
}
],
"notes": []
}