# Facebook Ad Library Search

> Facebook Ad Library Search is a paid API for AI agents from api.socialfetch.dev, paid per call via x402, $0.014/call, status unknown (last checked 2026-09-15).

Search Facebook Ad Library ads by keyword, with filters for ad type, status, country, date range, media type, and sort order.

## Facts

- Endpoint: GET https://api.socialfetch.dev/v1/facebook/ad-library/ads/search
- Price: $0.014/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/facebook-ad-library-search-6ec10a40
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_T0QZ5CuRHEb7Tkw7MByYo

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability facebook-ad-library-search-6ec10a40
```

Example prompt: Search the Facebook Ad Library for active ads about 'electric vehicles' in the US, sorted by impressions, starting from January 1 2024 — only show image ads and trim the response.

## When to prefer this

Use this endpoint when you need to search and discover ads in the Facebook Ad Library by keyword or topic, especially for competitive intelligence, political ad research, or ad creative analysis. Prefer this over general web scraping when you need structured ad metadata including impressions, dates, and media type filters.

## Known failure modes

- Missing required 'query' parameter returns a validation error
- Invalid country code returns no results or an error
- Invalid date format (not YYYY-MM-DD) causes a validation error
- Expired or invalid pagination cursor breaks pagination
- Rate limiting or quota exhaustion returns a payment/authorization error
- Very broad queries may return truncated or paginated large result sets

## How this service works

Search Facebook Ad Library ads by keyword and filters.

## Output

Returns a list of Facebook Ad Library ad results matching the query and filters, including ad creative details, impression data, status, and an opaque pagination cursor for fetching subsequent pages.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "query"
     ],
     "properties": {
      "trim": {
       "type": "boolean",
       "description": "When true, returns a smaller response with fewer fields."
      },
      "query": {
       "type": "string",
       "maxLength": 4096,
       "minLength": 1,
       "description": "Search query text for Facebook Ad Library ads."
      },
      "adType": {
       "enum": [
        "all",
        "political-and-issue"
       ],
       "type": "string",
       "description": "Optional filter for all ads or political and issue ads."
      },
      "cursor": {
       "type": "string",
       "minLength": 1,
       "description": "Opaque pagination cursor from a previous response."
      },
      "sortBy": {
       "enum": [
        "impressions",
        "most-recent"
       ],
       "type": "string",
       "description": "Optional sort order for returned ads."
      },
      "status": {
       "enum": [
        "all",
        "active",
        "inactive"
       ],
       "type": "string",
       "description": "Optional ad status filter."
      },
      "country": {
       "type": "string",
       "maxLength": 3,
       "minLength": 2,
       "description": "Optional country code filter. Use ALL to search all countries."
      },
      "endDate": {
       "type": "string",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
       "description": "Optional end date filter in YYYY-MM-DD format."
      },
      "mediaType": {
       "enum": [
        "all",
        "image",
        "video",
        "meme",
        "image-and-meme",
        "none"
       ],
       "type": "string",
       "description": "Optional creative media filter."
      },
      "startDate": {
       "type": "string",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
       "description": "Optional start date filter in YYYY-MM-DD format."
      },
      "searchType": {
       "enum": [
        "keyword-unordered",
        "exact-phrase"
       ],
       "type": "string",
       "description": "Optional keyword matching mode for the search query."
      }
     }
    }
  
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/facebook-ad-library-search-6ec10a40/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.socialfetch.dev](https://www.zero.xyz/host/api.socialfetch.dev/llms.txt)
