{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper [$0.13/1K💰] | Meta & IG Ad Spy",
    "description": "Spy on any brand's Facebook & Instagram ads with no login or Meta API token. Scrape ad copy, creatives, CTA, landing pages, run dates and EU reach into 46-field JSON rows — and track new, edited and ended ads on a schedule.",
    "version": "0.1",
    "x-build-id": "GGbhc97MCnkJCya2D"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ahmed_jasarevic~meta-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ahmed_jasarevic-meta-ads-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/ahmed_jasarevic~meta-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-ahmed_jasarevic-meta-ads-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/ahmed_jasarevic~meta-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-ahmed_jasarevic-meta-ads-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": {
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Paste full Meta Ad Library URLs (with any filters) or Facebook Page URLs. This mode supports every Ad Library filter: country, media type, status, keyword/phrase, date range, political/housing/employment/credit category, publisher platform and language. Example: <code>https://www.facebook.com/ads/library/?active_status=active&amp;ad_type=all&amp;country=US&amp;media_type=all&amp;q=nike&amp;search_type=keyword_unordered</code> — or a page URL like <code>https://www.facebook.com/Nike</code>.",
            "items": {
              "type": "string"
            }
          },
          "advertisers": {
            "title": "Advertiser Page IDs",
            "type": "array",
            "description": "Scrape every ad from specific advertisers. Enter one or more Facebook <b>Page IDs</b> (the numeric id, e.g. <code>103582046420186</code>), paste an Ad Library URL containing <code>view_all_page_id=…</code>, or a Facebook Page URL. Each advertiser's ads are returned in full. Works on its own or alongside the URL and keyword inputs.",
            "items": {
              "type": "string"
            }
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords or brand names to look up in the Meta Ad Library — e.g. <code>nike</code>, <code>weight loss</code>, <code>black friday</code>. Each term is searched separately against every country below. Leave empty if you are pasting URLs above.",
            "items": {
              "type": "string"
            }
          },
          "searchCountries": {
            "title": "Countries (ISO 2-letter codes)",
            "type": "array",
            "description": "Two-letter country codes (<code>US</code>, <code>GB</code>, <code>DE</code> …) or <code>ALL</code> for worldwide. Each country is queried separately per search term. Defaults to <code>US</code>.",
            "items": {
              "type": "string"
            }
          },
          "adDetailIds": {
            "title": "Ad archive IDs (single ads)",
            "type": "array",
            "description": "Fetch one or more specific ads by Ad Library archive id, or by a pasted <code>https://www.facebook.com/ads/library/?id=…</code> link. Use this to re-fetch an ad you already know.",
            "items": {
              "type": "string"
            }
          },
          "adActiveStatus": {
            "title": "Ad status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Filter by whether ads are currently running.",
            "default": "active"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video"
            ],
            "type": "string",
            "description": "Filter ads by creative media type.",
            "default": "all"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "credit_ads",
              "financial_products_and_services_ads"
            ],
            "type": "string",
            "description": "<b>All ads</b> covers every commercial ad. The special categories are the regulated transparency categories — those carry impression and reach data.",
            "default": "all"
          },
          "publisherPlatforms": {
            "title": "Publisher platforms",
            "type": "array",
            "description": "Only return ads shown on these platforms. Valid values: <code>facebook</code>, <code>instagram</code>, <code>messenger</code>, <code>audience_network</code>. Leave empty for all platforms.",
            "items": {
              "type": "string"
            }
          },
          "contentLanguages": {
            "title": "Content languages (ISO codes)",
            "type": "array",
            "description": "Only return ads whose creative is in these languages. Use ISO 639-1 two-letter codes (<code>en</code>, <code>es</code>, <code>de</code> …). Leave empty for all languages.",
            "items": {
              "type": "string"
            }
          },
          "searchMode": {
            "title": "Keyword match",
            "enum": [
              "keyword_unordered",
              "keyword_exact_phrase"
            ],
            "type": "string",
            "description": "<b>Broad</b> matches any of the words; <b>Exact phrase</b> matches the words together.",
            "default": "keyword_unordered"
          },
          "sortBy": {
            "title": "Sort ads by",
            "enum": [
              "",
              "total_impressions"
            ],
            "type": "string",
            "description": "Default keeps Facebook's own ranking. <b>Most impressions first</b> sorts by total impressions (works best for page searches and EU-transparency ads).",
            "default": ""
          },
          "startDateMin": {
            "title": "Started on or after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include ads that started running on or after this date. Leave empty to skip.",
            "default": ""
          },
          "startDateMax": {
            "title": "Started on or before (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include ads that started running on or before this date. Leave empty to skip.",
            "default": ""
          },
          "categories": {
            "title": "Filter ads by categories",
            "type": "array",
            "description": "Keep only ads whose Facebook category or page category matches one of these values (case-insensitive), e.g. <code>Software</code>, <code>UNKNOWN</code>. One value per line.",
            "items": {
              "type": "string"
            }
          },
          "includeAdReach": {
            "title": "Include Ad Reach and EU transparency in output",
            "type": "boolean",
            "description": "Keep <code>data_reach</code>, <code>reach_estimate</code> and impression fields on every row. When off, those bulky fields are dropped.",
            "default": false
          },
          "scrapeAdDetails": {
            "title": "Scrape ad details (EU + UK + BR transparency)",
            "type": "boolean",
            "description": "Issue one extra GraphQL query per ad to attach <code>advertiser</code>, <code>aaa_info</code> and the full <code>transparency_by_location</code> (EU, UK and BR reach with age/gender/country breakdowns). Implies includeAdReach. Adds one request per ad and bills the <code>additional_data</code> event.",
            "default": false
          },
          "includeTotalActiveAds": {
            "title": "Include total active ads count per page",
            "type": "boolean",
            "description": "Ask Meta for the advertiser's total active ad count alongside each result.",
            "default": false
          },
          "filterDuplicatePageIds": {
            "title": "Filter duplicate page IDs",
            "type": "boolean",
            "description": "If enabled, only one ad per unique page_id is kept (first occurrence).",
            "default": false
          },
          "watchlistId": {
            "title": "Watchlist ID",
            "type": "string",
            "description": "Named memory that remembers which ads (by <code>ad_archive_id</code>) this run already delivered. Use the same id on a schedule (for example <code>nike-daily</code>) and later runs leave them out, so a monitored advertiser or keyword bills only the ads that are new. Letters, numbers, hyphens, underscores.",
            "default": ""
          },
          "newAdsOnly": {
            "title": "Only new ads",
            "type": "boolean",
            "description": "Ads already stored on the Watchlist ID are left out of the dataset and not charged. The search itself still runs in full. Requires <code>watchlistId</code>.",
            "default": false
          },
          "trackChanges": {
            "title": "Track created / edited / ended ads",
            "type": "boolean",
            "description": "Every row gains a <code>change_type</code> of <code>new</code>, <code>edited</code> or <code>unchanged</code>, and ads that disappeared from the search since the last run are emitted with <code>change_type: \"ended\"</code>. Requires <code>watchlistId</code>. This is how you detect a competitor rewriting a creative.",
            "default": false
          },
          "emitEndedAds": {
            "title": "Emit ended ads",
            "type": "boolean",
            "description": "Also emit rows for ads that stopped running since the previous watchlist run. Implies nothing on its own — combine with <code>trackChanges</code>. Requires <code>watchlistId</code>.",
            "default": false
          },
          "raw": {
            "title": "Raw output only",
            "type": "boolean",
            "description": "Emit only the untouched Meta ad node, without the derived fields (ad link, website, running days, position, query tag).",
            "default": false
          },
          "maxItems": {
            "title": "Maximum items per crawl",
            "type": "integer",
            "description": "Maximum number of ads scraped per run. On a free Apify plan a run is capped at 30 ads and to ONE search target — the first start URL, search-term/country pair or advertiser the input builds. Paying Apify accounts remove both caps.",
            "default": 10000
          },
          "detailsConcurrency": {
            "title": "Details concurrency",
            "type": "integer",
            "description": "How many per-ad detail queries run at once when <code>scrapeAdDetails</code> is on.",
            "default": 15
          },
          "minDelay": {
            "title": "Min delay between API calls (seconds)",
            "type": "number",
            "description": "Lower bound of a randomized pause after every GraphQL page. Default 0 — pacing is adaptive: the scraper only backs off when Meta throttles.",
            "default": 0
          },
          "maxDelay": {
            "title": "Max delay between API calls (seconds)",
            "type": "number",
            "description": "Upper bound of the randomized pause after every GraphQL page.",
            "default": 1
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "type": "integer",
            "description": "Maximum number of search targets processed at the same time.",
            "default": 10
          },
          "maxRequestRetries": {
            "title": "Max Request Retries",
            "type": "integer",
            "description": "Retries with exponential backoff before a search target is given up on. Throttled requests also trigger a proxy rotation.",
            "default": 8
          },
          "proxy": {
            "title": "Proxy configuration (optional override)",
            "type": "object",
            "description": "Leave empty — the scraper routes traffic through Apify Residential proxies and rotates to a fresh IP whenever Meta throttles. Set this only to use your own proxies."
          },
          "debug": {
            "title": "Enable Debug Logging",
            "type": "boolean",
            "description": "Emit detailed logs including session tokens, chosen doc_ids and pagination progress.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}