Skip to content

How to scrape the Meta Ad Library: search ads and pull creatives

Updated · 2 steps

As of Nov 2026, Meta's official Ad Library API is built around ads about social issues, elections or politics. For commercial ads, the creative research most marketers need, Fetchproof reads the public Ad Library and returns the same cards as JSON.

Search by keyword to see who is advertising on a term, then open any single ad by its Library ID to get the full creative.

01

Search ads by keyword

Filter with country, language, status, media_type, ad_type, and a start_date and end_date for impressions. search_type=keyword_exact_phrase matches the phrase exactly as written.

Results are one card per creative group, as the Ad Library shows them. Each has ad_archive_id, page_name, is_active, publisher_platform, collation_count, start and end dates, and a snapshot with body text, images, videos, cards and cta_text.

GET /v1/facebook/adLibrary/search/ads 1 credit per call

cURL

curl --request GET 'https://api.fetchproof.com/v1/facebook/adLibrary/search/ads?query=running+shoes&country=US&media_type=VIDEO' \
  --header 'x-api-key: YOUR_API_KEY'

JavaScript

const response = await fetch("https://api.fetchproof.com/v1/facebook/adLibrary/search/ads?query=running+shoes&country=US&media_type=VIDEO", {
  method: 'GET',
  headers: {
    'x-api-key': process.env.FETCHPROOF_API_KEY,
  },
});
const data = await response.json();
console.log(data);

Python

import os
import requests

response = requests.get(
    "https://api.fetchproof.com/v1/facebook/adLibrary/search/ads?query=running+shoes&country=US&media_type=VIDEO",
    headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
print(response.json())

Go

package main

import (
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  req, _ := http.NewRequest("GET", "https://api.fetchproof.com/v1/facebook/adLibrary/search/ads?query=running+shoes&country=US&media_type=VIDEO", nil)
  req.Header.Set("x-api-key", os.Getenv("FETCHPROOF_API_KEY"))
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}

PHP

<?php
$ch = curl_init("https://api.fetchproof.com/v1/facebook/adLibrary/search/ads?query=running+shoes&country=US&media_type=VIDEO");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    'x-api-key: ' . getenv('FETCHPROOF_API_KEY'),
  ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Excerpt of published sample response Full response →
{
  "success": true,
  "credits_remaining": 100,
  "credits_charged": 1,
  "searchResults": [
    {
      "ad_archive_id": "953573607005202",
      "ad_id": null,
      "categories": [
        "UNKNOWN"
      ],
      "collation_count": null,
      "collation_id": null,
      "contains_digital_created_media": false,
      "contains_sensitive_content": false,
      "currency": "",
      "end_date": 1794816000,
      "fev_info": null,
      "gated_type": "ELIGIBLE",
      "has_user_reported": false,
      "…": "21 more fields"
    }
  ],
  "searchResultsCount": 50001,
  "cursor": "eyJuIjoyLCJzIjpudWxsLCJ1IjoiYTMwMWFjMzktNjYzOC00ZDg5LTlhNDUtYTcxM2FhYjI1YmExIiwiYyI6IkFRSF…"
}
02

Get one ad by its Library ID

Pass the Library ID as id, or a facebook.com/ads/library/?id= URL as url. Active and inactive ads both work. You get adArchiveID, pageName, isActive, startDate, endDate, publisherPlatform, the advertiser's pageInfo, and the snapshot with copy, cards, images, videos, display_format, link_url and cta_text. Ads shown in the EU also carry aaa_info audience data.

GET /v1/facebook/adLibrary/ad 1 credit per call

cURL

curl --request GET 'https://api.fetchproof.com/v1/facebook/adLibrary/ad?id=1016451784037642' \
  --header 'x-api-key: YOUR_API_KEY'

JavaScript

const response = await fetch("https://api.fetchproof.com/v1/facebook/adLibrary/ad?id=1016451784037642", {
  method: 'GET',
  headers: {
    'x-api-key': process.env.FETCHPROOF_API_KEY,
  },
});
const data = await response.json();
console.log(data);

Python

import os
import requests

response = requests.get(
    "https://api.fetchproof.com/v1/facebook/adLibrary/ad?id=1016451784037642",
    headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
print(response.json())

Go

package main

import (
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  req, _ := http.NewRequest("GET", "https://api.fetchproof.com/v1/facebook/adLibrary/ad?id=1016451784037642", nil)
  req.Header.Set("x-api-key", os.Getenv("FETCHPROOF_API_KEY"))
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}

PHP

<?php
$ch = curl_init("https://api.fetchproof.com/v1/facebook/adLibrary/ad?id=1016451784037642");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    'x-api-key: ' . getenv('FETCHPROOF_API_KEY'),
  ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Excerpt of published sample response Full response →
{
  "success": true,
  "credits_remaining": 100,
  "credits_charged": 1,
  "adid": null,
  "adArchiveID": "1016451784037642",
  "categories": [
    0
  ],
  "containsDigitallyCreatedMedia": false,
  "containsSensitiveContent": false,
  "collationCount": null,
  "collationID": null,
  "currency": "",
  "endDate": 1756364400,
  "…": "24 more fields"
}

Paging

The first page of a search holds up to 30 results, and later pages about 10. Send cursor with the same filters to page. From page 2 on, a cursor is tied to a short-lived session. If it has expired, the response says so, and you start again without a cursor.

Limits and cost

Each call costs 1 credit, and errors cost 0. An ad that's no longer in the library returns a 404. There's no built-in video transcription: get_transcript=true returns 400, so download the files in snapshot.videos and transcribe them yourself. Ids are strings, so don't parse them as numbers.

Try it with 100 free credits

Sign up with an email address, no card. Credits never expire. Errors cost 0 credits, and each endpoint page lists exactly what it charges.