How-to

How to Download Facebook Ad Creatives (Images and Videos)

The Ad Library shows every creative a brand is running, but it has no download button and its media links stop working after a few days. This guide shows where the files of an ad really are, how to save one ad by hand, and how to download every image, video and carousel card of a search or an advertiser with a short Python or JavaScript script.

Published 7 min read

Why people download ad creatives

A swipe file is the oldest tool in advertising: a folder of ads that worked, kept to study hooks, layouts, offers and formats. Media buyers keep one per niche, agencies build one per client to show what competitors are running, and creative teams use it as a brief ("make something in this format, but ours"). The Ad Library is the best source for it because it shows every active ad, not only the ones that someone decided to share.

Watching ads in the library is not enough for that job. The library lists ads in an infinite scroll, ads disappear from it when they stop (unless they are political or were delivered in the EU), and the media files behind them are served from Meta's CDN with addresses that expire. If you want to compare last month's creatives with this month's, you need your own copy of the files.

Where the media of an ad lives

Every ad returned by the ads search API and the page ads API carries its media in three lists. They follow the format of the ad (format is image, video, carousel, dco, dpa, text or other):

FieldWhat it holdsTypical formats
imagesThe images of the ad: url is the original file, preview_url a resized copySingle image ads, dynamic creative
videosThe videos: url is the HD file (SD when there is no HD), sd_url the SD file, preview_url the poster frameVideo ads, Reels placements
cardsThe cards of a carousel, each with its own title, body, link_url, cta and an image or a videoCarousels, catalog ads

Each file object has an expires_at timestamp, and the response itself has media_expires_at, the earliest expiry of all the files it contains. A shortened ad with one video looks like this (illustrative values):

{
  "id": "1550534860016399",
  "format": "video",
  "images": [],
  "videos": [
    {
      "type": "video",
      "url": "https://video.fbcdn.net/v/t42.1790-2/example_hd.mp4?oe=6752A1B0",
      "preview_url": "https://scontent.fbcdn.net/v/t15.5256-10/example_poster.jpg",
      "sd_url": "https://video.fbcdn.net/v/t42.1790-2/example_sd.mp4?oe=6752A1B0",
      "expires_at": "2026-12-03T18:00:00Z"
    }
  ],
  "cards": [],
  "variants_count": 3
}

Why the links expire

Meta signs its CDN addresses: the oe parameter in the URL is an expiry time, after which the address answers 403. In our measurements the median lifetime of an Ad Library media link is a little over four days, sometimes much longer. We return the links exactly as Meta publishes them, with expires_at already decoded for you, instead of copying the files to our own storage: the creatives belong to the advertisers. The practical rule is simple: download what you want to keep on the day you fetch it, and store the ad id next to the file so you can fetch fresh links later.

The manual way: one ad in the browser

For a single ad you do not need any code. Open the ad in the Ad Library (or in our free Ad Library search), then:

  1. For an image, right-click it and choose "Open image in new tab": the address that opens is the file on Meta's CDN, which you can save.
  2. For a video, start it, right-click and choose "Open video in new tab" or "Save video as". Some browsers hide the menu on the player; the developer tools (Network tab, filter "media") always show the file.
  3. For a carousel, repeat for each card: each one has its own image or video.
  4. Write down the Library ID shown on the ad (it is also the id= in the ad's URL) so you know where the file came from.

This takes a minute per ad. It is the right method for a presentation or a quick reference, and the wrong one for a weekly swipe file of 20 competitors. The search tips guide explains how to find the ads worth saving in the first place.

Download every creative of a search with a script

The script below asks for the active ads of a keyword in one country, follows the cursor for a few pages (30 ads and one credit per call) and saves every image, video and carousel card to a folder, one sub-folder per ad, named by the ad id. Get a key by creating a free account (65 free calls a month) and put it in the SCRAPEADLIBRARY_API_KEY environment variable.

First, a quick look at the URLs with cURL and jq:

# The image and video files of the first 10 active ads for "skincare" in the UK
curl -s "https://api.scrapeadlibrary.com/v1/ads/search?q=skincare&country=GB&limit=10" \
  -H "X-API-Key: $SCRAPEADLIBRARY_API_KEY" \
  | jq -r '.data[] | .id as $id | (.images[].url, .videos[].url, (.cards[] | .image.url?, .video.url?)) | select(. != null) | "\($id) \(.)"'

# Save one of them
curl -s -o 1550534860016399.mp4 "https://video.fbcdn.net/...the url printed above..."

Then the full downloader:

import os
import pathlib
import requests

API = "https://api.scrapeadlibrary.com"
HEADERS = {"X-API-Key": os.environ["SCRAPEADLIBRARY_API_KEY"]}
OUT = pathlib.Path("creatives")


def media_of(ad):
    """Every (name, url) pair of an ad: images, videos (HD first) and carousel cards."""
    files = []
    for i, image in enumerate(ad["images"]):
        files.append((f"image-{i}.jpg", image["url"] or image["preview_url"]))
    for i, video in enumerate(ad["videos"]):
        files.append((f"video-{i}.mp4", video["url"] or video["sd_url"]))
        if video["preview_url"]:
            files.append((f"video-{i}-poster.jpg", video["preview_url"]))
    for i, card in enumerate(ad["cards"]):
        if card.get("image"):
            files.append((f"card-{i}.jpg", card["image"]["url"]))
        if card.get("video"):
            files.append((f"card-{i}.mp4", card["video"]["url"]))
    return [(name, url) for name, url in files if url]


def download(ad):
    folder = OUT / ad["id"]
    folder.mkdir(parents=True, exist_ok=True)
    for name, url in media_of(ad):
        target = folder / name
        if target.exists():
            continue
        response = requests.get(url, timeout=120)
        if response.ok:
            target.write_bytes(response.content)


params = {"q": "skincare", "country": "GB", "status": "active"}
cursor = None
for _ in range(3):  # 3 pages = 3 credits
    page_params = {**params, "cursor": cursor} if cursor else params
    page = requests.get(API + "/v1/ads/search", params=page_params, headers=HEADERS, timeout=60).json()
    for ad in page["data"]:
        download(ad)
    if not page["has_more"]:
        break
    cursor = page["next_cursor"]

Variations that are worth knowing

  • One advertiser instead of a keyword. Replace the search with GET /v1/pages/{page_id}/ads: the same filters and the same response, limited to one page. The advertiser search gives you the page id from a brand name.
  • Only videos. Add media_type=video to skip image ads entirely, or media_type=image for statics.
  • Only the creatives that last. Add min_days_active=30 to keep ads that have been running for a month or more: the winning ads guide explains why longevity is the best public signal of an ad that works.
  • One file per creative, not per variant. variants_count tells you how many ads share the same creative. Advertisers often run the same video in many ads; deduplicate on the file before you fill your disk.

The creatives in the Ad Library are public, but they are not free to reuse. Each image and video is a copyrighted work of the advertiser (and often of the photographers, actors and music in it). Keeping copies for research is a common and generally accepted practice: studying a competitor's messaging, showing a client what the market looks like, training your own team. Republishing them is a different matter.

  • Do not run a competitor's creative, or a lightly edited copy of it, as your own ad.
  • Do not publish downloaded videos on a website or a social account without permission.
  • Quote ads in reports and presentations the way you would quote an article: a screenshot, the advertiser's name and the Library ID, for commentary.
  • Delete what you no longer need, especially creatives showing identifiable people.

This is not legal advice, and the rules differ by country. The guide to the legal side of scraping the Ad Library covers terms of service, data protection and copyright in more depth.

Troubleshooting downloads

  • 403 from the CDN. The link has expired: fetch the ad again (GET /v1/ads/{ad_id}, one credit) to get fresh addresses.
  • Empty `images` and `videos`. Text-only ads (format: "text") have no media, and dynamic product ads may carry their images in cards. Check the format field first.
  • A video saves as a tiny file. You probably saved an HTML error page: check the response status and the content type before writing the file, as the script does with response.ok.
  • API errors. Branch on the error code of the body: 429 rate_limit_exceeded means wait for Retry-After, 503 upstream_unavailable means try again shortly. They are never billed; the error reference lists every code.

Frequently asked questions

Can I download Facebook ad videos in HD?
Yes, when Meta publishes an HD version. The url field of a video is the HD file and falls back to SD when there is none; sd_url is always the SD file and preview_url the poster image.
How long do the media links stay valid?
Usually around four days, sometimes longer. Every file has expires_at and every response media_expires_at, so you know exactly when to download by. After that, fetch the ad again to get fresh links.
Do you store the creatives?
No. The API returns the links Meta publishes, as they are, and never copies the files: the creatives belong to the advertisers. Download the ones you need for your research while the links are valid.
Can I download the creatives of ads that are no longer running?
Only while the Ad Library still shows them: inactive ads stay listed when they are political or were delivered in the EU. Search with status=inactive or status=all to include them.
Is it legal to reuse downloaded ads?
Keeping copies for research and analysis is common practice; running or republishing another brand's creatives is not allowed without permission, since they are copyrighted works. Check the rules of your country.

Related guides

← All guides

Try it on your own competitors

Create a free account and get 65 free calls every month, no credit card. One API key works on every endpoint.