{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ad Library Scraper: Ads, Spend & Reach, $0.49/1K",
    "description": "$0.49/1K ads, no start fee. Big searches read several ways at once, up to 4x faster. No login. Meta Ad Library ads by keyword, advertiser, page URL or Ad Library URL: text, images, videos, spend, EU reach, payer. Country, status, media, platform, date filters. Exact maxItems.",
    "version": "0.2",
    "x-build-id": "rLoUv8NgB9oYy2UXo"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/laptime~facebook-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-laptime-facebook-ad-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/laptime~facebook-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-laptime-facebook-ad-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/laptime~facebook-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-laptime-facebook-ad-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "searchQueries": {
            "title": "Search keywords",
            "type": "array",
            "description": "Keywords to search the Meta Ad Library for (ads on Facebook, Instagram, Messenger, Threads and Audience Network). Each keyword is a separate search. Use \"Exact phrase\" for phrase matching. Keywords, Advertisers and Start URLs are separate lists, not filters of each other: all of them run. For an advertiser's ads that mention a word, use Advertisers with \"Ad text must contain\".",
            "items": {
              "type": "string"
            }
          },
          "advertisers": {
            "title": "Advertisers (names, page URLs or page IDs)",
            "type": "array",
            "description": "Optional. A separate list, not a filter of Search keywords: all ads of these advertisers. A brand name (\"Nike\": we look up the advertiser in the Ad Library, verified pages first), a Facebook page URL (https://www.facebook.com/nike) or a numeric page ID (15087023444). Filters below apply (country, active status, media type, dates).",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Start URLs (Ad Library searches, ads, pages)",
            "type": "array",
            "description": "Optional. A separate list, not a filter: Ad Library links, one per row. A search (https://www.facebook.com/ads/library/?q=nike&country=US...) runs with every filter in the URL (the URL wins over the filters below); an ad link (?id=123...) returns that ad; a page link (view_all_page_id=... or facebook.com/brand) returns the advertiser's ads. Also read from \"urls\" (curious_coder) and \"startUrls\" (apify).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "maxItems": {
            "title": "Max ads (whole run)",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on ads delivered (and charged) by the whole run, never exceeded, even with many searches running at once. Also read from \"count\" (curious_coder) and \"resultsLimit\" (apify).",
            "default": 100
          },
          "maxItemsPerSource": {
            "title": "Max ads per keyword, advertiser or URL",
            "minimum": 0,
            "type": "integer",
            "description": "Cap per search. 0 (default) = only the run-wide Max ads applies. Also read from \"limitPerSource\" (curious_coder).",
            "default": 0
          },
          "country": {
            "title": "Country",
            "enum": [
              "ALL",
              "US",
              "GB",
              "CA",
              "AU",
              "DE",
              "FR",
              "NL",
              "ES",
              "IT",
              "BE",
              "AT",
              "IE",
              "SE",
              "DK",
              "FI",
              "NO",
              "PL",
              "PT",
              "CZ",
              "RO",
              "GR",
              "HU",
              "CH",
              "BR",
              "MX",
              "AR",
              "CO",
              "CL",
              "IN",
              "ID",
              "PH",
              "SG",
              "MY",
              "TH",
              "VN",
              "JP",
              "KR",
              "TW",
              "HK",
              "AE",
              "SA",
              "IL",
              "TR",
              "ZA",
              "NG",
              "KE",
              "EG",
              "NZ",
              "UA"
            ],
            "type": "string",
            "description": "Ads shown in this country: a two-letter code (US, GB, CA, AU, DE, FR, NL…) or ALL. EU countries carry EU transparency data with \"Include ad details\". Applies to keywords and advertisers, not to pasted Ad Library URLs. The form starts on US; an API call or task without \"country\" searches ALL.",
            "default": "ALL"
          },
          "countries": {
            "title": "Several countries",
            "type": "array",
            "description": "Run every keyword and advertiser once per country, e.g. [\"US\", \"GB\", \"DE\"]; any two-letter code, or EU for the 27 member states. An ad shown in several of them is delivered once (with the first country). Empty = the single Country above.",
            "items": {
              "type": "string"
            }
          },
          "activeStatus": {
            "title": "Active status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "active = ads running now (default), inactive = ads that stopped, all = both.",
            "default": "active"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "credit_ads",
              "financial_products_and_services_ads"
            ],
            "type": "string",
            "description": "all (default) = every ad; political_and_issue_ads = ads about social issues, elections or politics (these carry spend and impression ranges, kept for 7 years); housing_ads, employment_ads, credit_ads, financial_products_and_services_ads = the special categories Meta lists separately.",
            "default": "all"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Meta's own media filter: all, image, video, meme (image with text), image_and_meme, or none (text only). Dynamic (DCO) ads that contain a video or image match too; their mediaType column says \"dynamic\" and videoUrls or imageUrls hold the media.",
            "default": "all"
          },
          "exactPhrase": {
            "title": "Exact phrase",
            "type": "boolean",
            "description": "true = keywords match as an exact phrase (\"running shoes\" in that order); false (default) = all words in any order.",
            "default": false
          },
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Only ads that ran on these platforms: facebook, instagram, messenger, threads, audience_network, whatsapp. Empty = all platforms.",
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "messenger",
                "threads",
                "audience_network",
                "whatsapp"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Messenger",
                "Threads",
                "Audience Network",
                "WhatsApp"
              ]
            }
          },
          "languages": {
            "title": "Ad languages",
            "type": "array",
            "description": "Only ads in these languages, as two-letter codes (en, de, es). Empty = all languages.",
            "items": {
              "type": "string"
            }
          },
          "ranFrom": {
            "title": "Ran on or after",
            "type": "string",
            "description": "Meta's date filter: ads that ran (had impressions) on or after this day. A date (2026-10-01) or a relative time (\"30 days\"). Empty = no limit."
          },
          "ranTo": {
            "title": "Ran on or before",
            "type": "string",
            "description": "Meta's date filter: ads that ran on or before this day. A date or a relative time. Empty = up to today."
          },
          "startedAfter": {
            "title": "Only ads started after",
            "type": "string",
            "description": "Keep only ads whose start date (ad launch) is on or after this: a date (2026-11-01) or relative (\"7 days\"). Use it to find new creatives; ads left out are not charged. Also read from apify's \"onlyAdsNewerThan\"."
          },
          "startedBefore": {
            "title": "Only ads started before",
            "type": "string",
            "description": "Keep only ads that started on or before this date or relative time (e.g. \"90 days\" for long-running ads). Ads left out are not charged."
          },
          "sortBy": {
            "title": "Sort",
            "enum": [
              "relevance",
              "impressions",
              "most_recent"
            ],
            "type": "string",
            "description": "relevance (Meta's default order), impressions (most impressions first: the ads with the biggest reach), or most_recent (newest first).",
            "default": "relevance"
          },
          "includeKeywords": {
            "title": "Ad text must contain",
            "type": "array",
            "description": "Keep only ads whose text (advertiser, headline, body, cards) contains at least one of these words. Case-insensitive. Ads left out are not charged.",
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Ad text must not contain",
            "type": "array",
            "description": "Drop ads whose text contains any of these words. Ads left out are not charged.",
            "items": {
              "type": "string"
            }
          },
          "minDaysActive": {
            "title": "Running for at least (days)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only ads that ran at least this many days (launch to last day shown; today for active ads). 30 = long-running ads, usually the winners. 0 (default) = no limit. Ads left out are not charged.",
            "default": 0
          },
          "minCollationCount": {
            "title": "Creative used in at least (ads)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only creatives the advertiser runs as at least this many ads (Meta's \"N ads use this creative\"; collationCount). Scaled creatives are usually the proven ones. 0 or 1 (default) = no limit. Ads left out are not charged.",
            "default": 0
          },
          "excludeAdvertisers": {
            "title": "Exclude advertisers",
            "type": "array",
            "description": "Drop ads from these advertisers: page names (\"Nike\", case-insensitive, exact) or page IDs. Use it to leave your own brand or known resellers out of a keyword search. Ads left out are not charged.",
            "items": {
              "type": "string"
            }
          },
          "includeAdDetails": {
            "title": "Include ad details (EU transparency, advertiser info)",
            "type": "boolean",
            "description": "Adds, per ad: EU total reach, reach by country, age and gender, targeted ages, gender and locations, payer and beneficiary (ads shown in the EU), UK reach, and the advertiser's about text, category, verification, Instagram username and followers. One extra request per ad; charged as ad-details. Also read from \"scrapeAdDetails\" and \"isDetailsPerAd\".",
            "default": false
          },
          "expandCollations": {
            "title": "Every ad of each creative group",
            "type": "boolean",
            "description": "Meta lists one ad per creative group (\"N ads use this creative and text\"; collationCount). true = also deliver every other ad of each group (each charged as an ad; maxItems applies), like the Ad Library's \"See summary details\". false (default) = one row per creative. Also read from \"expandVariants\".",
            "default": false
          },
          "onlyNew": {
            "title": "Only new ads (monitoring)",
            "type": "boolean",
            "description": "Skip ads this monitor delivered in earlier runs, so a scheduled run returns only new ads. A run with nothing new costs nothing. The memory is per Monitor name (or per task / set of inputs).",
            "default": false
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Names the \"Only new ads\" memory, e.g. \"competitors-weekly\". Runs with the same name share it. Empty = one memory per task or input."
          },
          "continueFromLastRun": {
            "title": "Continue from last run",
            "type": "boolean",
            "description": "true = if the last run with exactly this input was cut short (timeout, abort, platform restart, your maximum cost, or a search that failed), deliver only the ads it missed: its ads are skipped and not charged, and maxItems counts them. Those earlier ads stay in that run's dataset. If the last run finished normally, everything is scraped again. false (default) = a full run.",
            "default": false
          },
          "countOnly": {
            "title": "Count only",
            "type": "boolean",
            "description": "One row per keyword, advertiser or URL with the number of ads Meta reports (totalResults), instead of the ads. Each count row is charged as one ad. Also read from apify's \"onlyTotal\".",
            "default": false
          },
          "runTag": {
            "title": "Run tag",
            "type": "string",
            "description": "Optional label copied to every row as runTag, e.g. \"q4-competitors\", to tell runs apart in one sheet or database. Also curious_coder's field name."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "laptime",
              "curious_coder",
              "apify"
            ],
            "type": "string",
            "description": "laptime (default) = flat documented rows. curious_coder = Meta's own snake_case objects as curious_coder's Actor returns them (ad_archive_id, snapshot.body.text...). apify = the same in camelCase with adArchiveID, pageID and inputUrl, like apify/facebook-ads-scraper.",
            "default": "laptime"
          },
          "fastMode": {
            "title": "Fast mode for big searches",
            "type": "boolean",
            "description": "true (default) = a search asked for more than 120 ads is also read under Meta's other sort orders and media types at once and de-duplicated: up to 4× faster. false = one list in Meta's exact order (slower for big jobs).",
            "default": true
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 32,
            "type": "integer",
            "description": "Requests in parallel (IPs used at once). 8 is fast and gentle; up to 32.",
            "default": 8
          },
          "aiAnalysis": {
            "title": "AI creative analysis",
            "type": "boolean",
            "description": "Adds per ad: ad category, offer type, hook, hook type, persuasion angle, offer, target audience, funnel stage, tone, product category, language and a one-line summary (aiStatus \"ok\"). Charged as ai-creative-analysis per analysed ad; ads without text are skipped and not charged. Off by default.",
            "default": false
          },
          "aiCustomLabels": {
            "title": "Custom AI questions",
            "type": "array",
            "description": "Your own questions per ad, as \"name: question\" (e.g. \"usesUgc: yes/no: the creative is user-generated content style\", \"competitor: the competitor brand named, or none\"). Starting with yes/no gives true/false. Answers land in aiLabels. Up to 10.",
            "items": {
              "type": "string"
            }
          },
          "aiContext": {
            "title": "AI context",
            "type": "string",
            "description": "Optional context for the AI, e.g. \"We sell running shoes; label competitor ads by angle\". Up to 500 characters."
          },
          "aiApiKey": {
            "title": "Your own LLM API key (optional)",
            "type": "string",
            "description": "Optional: an OpenRouter (sk-or-), OpenAI, Anthropic (sk-ant-) or Gemini (AIza) key. With your own key AI analysis is not charged by us. Empty = our hosted model."
          },
          "aiModel": {
            "title": "AI model (with your own key)",
            "type": "string",
            "description": "Model name for your own key, e.g. gpt-4.1-mini or anthropic/claude-haiku-5.5. Empty = a sensible default for the key."
          },
          "telemetry": {
            "title": "Anonymous error reports",
            "type": "boolean",
            "description": "Sends the Actor's author an anonymous report when a run hits an error (error type, failing step, HTTP status, counts). Never your input, results, URLs or account. Untick to turn it off.",
            "default": true
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}