Black Friday: double credits on your first month, any plan · ends Sunday, Nov 29Cyber Monday extension: double credits on your first month, any plan · ends tonightBlack Friday: 2x creditsCyber Monday: 2x creditsSee plans
ScraperCity logo

Facebook Ads Library API Documentation

Facebook Ads Library

Search the Facebook Ads Library by keyword: ad id and link, active or not, start and end dates, advertiser page name, link, likes and category, ad text, headline, call to action, landing page, platforms, format, and image or video link.

$0.0006 per adPOST /api/v1/scrape/facebook-ads

Parameters

NameTypeRequiredDescription
keywordsstring[]OptionalWhat the ads say, as people would search the Ads Library (up to 200)Example: ["roofing", "teeth whitening"]
countrystringOptionalTwo-letter country code the ads are shown in, or ALL (default US)Default: USExample: US
activeStatusstringOptionalactive, inactive or all (default active)Default: activeExample: active
maxResultsnumberOptionalThe most ads to return in all (default 100, up to 5,000)Default: 100Example: 100

Examples

Roofing ads running in the US

curl -X POST https://app.scrapercity.com/api/v1/scrape/facebook-ads \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "keywords": [
      "roofing"
    ],
    "country": "US",
    "maxResults": 200
  }'

Check status and download

curl -X GET https://app.scrapercity.com/api/v1/scrape/status/{runId} \
  -H "Authorization: Bearer YOUR_API_KEY"

# When status is SUCCEEDED, download the CSV
curl -L https://app.scrapercity.com/api/downloads/{runId} -o facebook-ads.csv

Use Cases

  • •Find businesses spending on Facebook and Instagram ads right now
  • •Competitor ad research: copy, offers, landing pages
  • •Agency prospecting by niche

Best Practices

  • •Charged per ad returned; a search is charged at least what it cost to run, shown as a minimum charge
  • •Most searches finish in 1-5 minutes
  • •The Ads Library lists some ads for a country that are written in another language; filter on ad_text if needed
  • •CSV columns: keyword, ad_id, ad_url, active, started, ended, page_name, page_url, page_likes, page_category, ad_text, headline, call_to_action, link_url, platforms, format, image_url, video_url

Every scrape returns a runId. Poll GET /api/v1/scrape/status/{runId} until it completes, then download via GET /api/downloads/{runId}?format=csv.

Authenticate every request with Authorization: Bearer YOUR_API_KEY. See the full API reference for authentication, rate limits and error codes.