Discover/Facebook API
live

Facebook APIfacebook.com

Search and retrieve Meta Ad Library data across Facebook, Instagram, and Messenger. Get ad creatives, spend ranges, impressions, and political transparency info.

Endpoint health
verified 2h ago
search_page_ads
search_ads
get_ad_details
3/3 passing latest checkself-healing
Endpoints
3
Updated
3h ago

What is the Facebook API?

This API exposes 3 endpoints for querying Meta's Ad Library, covering ads running across Facebook, Instagram, Messenger, and Audience Network. The search_ads endpoint accepts keyword or advertiser name queries and returns up to ~30 ads per request with creative details, spend ranges, and funding entity disclosures. Individual ad lookup and page-level ad enumeration are also available, making it straightforward to pull structured data for any advertiser or ad ID.

Try it
Keyword or advertiser name to search for in the Ad Library.
Category of ads to search.
ISO 2-letter country code for the ad library region (e.g. US, GB, DE, BR).
Filter by media type. Accepted values: all, image, meme, video, none.
Type of search matching. Accepted values: keyword_unordered, keyword_exact_phrase.
Filter by ad active status.
api.parse.bot/scraper/d992d152-9f1b-493e-80a4-5aec30d9b03c/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/d992d152-9f1b-493e-80a4-5aec30d9b03c/search_ads?query=nike&ad_type=all&country=US&media_type=all&search_type=keyword_unordered&active_status=active' \
  -H 'X-API-Key: $PARSE_API_KEY'
Python SDK · recommended

Typed, relational, agent-ready

A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.

  • Fully typed · autocompletes
  • Objects link to objects
  • Typed errors & pagination

Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:

uv add parse-sdk
uv run parse init
uv run parse add --marketplace facebook-com-api

uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.

"""Walkthrough: Facebook Ad Library SDK - search ads, drill into pages, fetch details."""
from parse_apis.facebook_com_api import AdLibrary, AdType, ActiveStatus, AdNotFound

client = AdLibrary()

# Search for ads by keyword, limit total items fetched
for ad in client.ads.search(query="nike", ad_type=AdType.ALL, limit=3):
    print(ad.page_name, ad.display_format, ad.body_text[:60])

# Drill into a specific advertiser's page to list their ads
page = client.page(page_id="15087023444")
for ad in page.ads.list(active_status=ActiveStatus.ACTIVE, limit=3):
    print(ad.ad_archive_id, ad.title, ad.publisher_platforms)

# Fetch a single ad by ID with full details
first_ad = client.ads.search(query="election", ad_type=AdType.POLITICAL_AND_ISSUE, limit=1).first()
if first_ad:
    try:
        detail = client.ads.get(ad_id=first_ad.ad_archive_id)
        print(detail.page_name, detail.spend, detail.impressions)
        if detail.funding_entity:
            print(detail.funding_entity.fec_committee_id, detail.funding_entity.address)
    except AdNotFound as exc:
        print(f"Ad removed: {exc.ad_id}")

print("exercised: ads.search / page.ads.list / ads.get (with AdNotFound handling)")
All endpoints · 3 totalmissing one? ·

Search the Facebook Ad Library by keyword or advertiser name. Returns up to ~30 ads per request matching the query, sorted by total impressions descending. For political/issue ads, results include spend ranges, impression counts, and funding entity disclosures. Results are auto-iterated; pass limit to cap total items fetched.

Input
ParamTypeDescription
queryrequiredstringKeyword or advertiser name to search for in the Ad Library.
ad_typestringCategory of ads to search.
countrystringISO 2-letter country code for the ad library region (e.g. US, GB, DE, BR).
media_typestringFilter by media type. Accepted values: all, image, meme, video, none.
search_typestringType of search matching. Accepted values: keyword_unordered, keyword_exact_phrase.
active_statusstringFilter by ad active status.
Response
{
  "type": "object",
  "fields": {
    "ads": "array of ad objects with creative details, spend, and transparency data",
    "page_info": "object with end_cursor and has_next_page",
    "total_count": "integer"
  },
  "sample": {
    "data": {
      "ads": [
        {
          "spend": null,
          "title": "Nike: Shoes, Apparel, Stories",
          "byline": null,
          "images": [
            "https://scontent.fbcdn.net/example.jpg"
          ],
          "videos": [],
          "caption": "itunes.apple.com",
          "page_id": "15087023444",
          "cta_text": "Install now",
          "currency": null,
          "end_date": 1782284400,
          "link_url": "http://itunes.apple.com/app/id1095459556",
          "body_text": "Celebra tu cumpleanos con Nike",
          "is_active": true,
          "page_name": "Nike",
          "categories": [
            "UNKNOWN"
          ],
          "start_date": 1773730800,
          "impressions": null,
          "ad_archive_id": "1869276447125570",
          "display_format": "DPA",
          "reach_estimate": null,
          "page_categories": [
            "Sportswear"
          ],
          "disclaimer_label": null,
          "page_profile_uri": "https://www.facebook.com/nike/",
          "publisher_platforms": [
            "FACEBOOK",
            "INSTAGRAM",
            "AUDIENCE_NETWORK"
          ],
          "page_profile_picture_url": "https://scontent.fbcdn.net/example_60x60.jpg",
          "contains_digital_created_media": false
        }
      ],
      "page_info": {
        "end_cursor": "AQHSNHmtWwCCS",
        "has_next_page": true
      },
      "total_count": 50001
    },
    "status": "success"
  }
}

About the Facebook API

What the API Covers

The API surfaces data from Meta's public Ad Library, which tracks ads running on Facebook, Instagram, Messenger, and Audience Network. All three endpoints return ad objects containing creative content (images, videos, captions, titles), CTA text, landing page URLs, page IDs, and platform distribution. For political and issue ads, results also include spend ranges (e.g. $125K – $150K), impression counts, and funding entity disclosures required by Meta's political ad transparency rules.

Endpoints and Parameters

search_ads accepts a required query string and optional filters: ad_type, country (ISO 2-letter code), media_type (all, image, meme, video, none), search_type (keyword_unordered or keyword_exact_phrase), and active_status. Results are sorted by total impressions descending and paginated via a page_info object that includes end_cursor and has_next_page. search_page_ads works identically but scopes results to a specific Facebook page using a numeric page_id. get_ad_details takes a single ad_id and returns the full ad object for that specific creative, including end_date as a Unix epoch timestamp and currency.

Coverage and Limitations

Spend and impression figures are only populated for political and issue ads — Meta does not expose spend data for standard commercial ads in its public Ad Library. The country parameter controls which regional Ad Library is queried; not all ad types or transparency fields are available in every country. Pagination is cursor-based: use end_cursor from page_info to fetch subsequent pages of results.

Reliability & maintenanceVerified

The Facebook API is a managed, monitored endpoint for facebook.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when facebook.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.

This isn't an official facebook.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.

Last verified
2h ago
Latest check
3/3 endpoints passing
Maintenance
Monitored & self-healing
Will this API break when the source site changes?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • Monitor a competitor's active Facebook and Instagram ad creatives by querying their page ID with search_page_ads
  • Track political ad spending by filtering search_ads with ad_type=political_and_issue_ads to surface spend ranges and funding disclosures
  • Build an ad creative library by collecting images, videos, captions, and CTA text from search_ads results
  • Audit a specific ad by ID using get_ad_details to retrieve its full creative content, link URL, and impression data
  • Research advertiser activity in a specific country by passing a country code to any endpoint
  • Detect new ad launches for a brand by polling search_page_ads with active_status=active for a given page ID
  • Analyze media format trends by filtering search_ads with the media_type parameter across a keyword set
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 req/min

One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.

Frequently asked questions
Does Meta have an official developer API for the Ad Library?+
Yes. Meta provides an official Ad Library API at https://www.facebook.com/ads/library/api/ — it requires a Facebook developer account and approved access. The Parse API covers the same public Ad Library data without requiring Meta developer credentials.
Does `search_ads` return spend data for all ads?+
No. Spend ranges and impression counts are only populated for political and issue ads, which Meta is required to disclose publicly. For standard commercial ads, the spend field returns null. The ad_type parameter lets you filter specifically for political_and_issue_ads to retrieve results where spend data is present.
Does the API return audience targeting details — age, gender, or geographic targeting used for a specific ad?+
Not currently. The endpoints return creative fields (images, videos, captions, CTA), spend ranges for political ads, and page/funding entity information. Audience targeting breakdowns are not included in the current response schema. You can fork this API on Parse and revise it to add an endpoint that surfaces targeting data where Meta makes it publicly available.
How does pagination work across endpoints?+
All three endpoints return a page_info object containing end_cursor (a string) and has_next_page (boolean). When has_next_page is true, pass the end_cursor value as a cursor parameter in the next request to retrieve the following batch of results. Each batch contains up to ~30 ads.
Is Ad Library data available for all countries?+
The country parameter is supported by all three endpoints and accepts any ISO 2-letter country code. However, Meta's Ad Library coverage and the fields populated — particularly transparency data — vary by region. Political ad disclosures, for example, are most complete for US (US) and EU member states. Some ad categories or disclosure fields may be absent for less-covered regions.
Page content last updated . Spec covers 3 endpoints from facebook.com.
Related APIs in Social MediaSee all →
library.tiktok.com API
Search TikTok's Commercial Content Library to discover ads by company name or keyword, then view detailed information like creative format, scheduling dates, audience targeting, and video thumbnails. Monitor competitor advertising strategies and track ad campaigns across supported regions.
facebook.com Ad Library API
Search and retrieve detailed information about ads running on Facebook, including creative content, audience targeting parameters, and transparency metrics. Access comprehensive ad data across multiple campaigns to monitor advertising trends and competitive activity.
threads.com API
Search for posts and users on Threads by keyword to discover content, view engagement metrics like likes and replies, and explore user profiles with their media. Find trending discussions and connect with creators all in one search experience.
tiktok.com API
Retrieve detailed information about any public TikTok video including captions, media URLs, view counts, likes, and shares, plus access all comments posted on that video. Perfect for analyzing trending content, monitoring video performance, or building applications that need TikTok video data.
threads.net API
Search for posts and user accounts on Threads by keyword to discover relevant content and creators. Find specific discussions, hashtags, and profiles that match your interests on the platform.
modash.io API
Find and analyze influencers across Instagram, TikTok, and YouTube by filtering for location, follower count, engagement rates, and other key metrics to identify the perfect creators for your campaigns. Access detailed influencer reports, contact information, and use AI-powered search to discover creators that match your specific needs.
patreon.com API
Search for Patreon creators and discover their membership tiers, pricing, patron counts, and detailed profile information. Find the creators you want to support or research with comprehensive details about their offerings and community size.
hypeauditor.com API
Find and analyze influencer profiles across Instagram and other platforms with detailed engagement metrics, contact information, and linked social accounts. Search by keyword or location, retrieve profile analytics, and identify top-performing creators to inform influencer marketing decisions.