{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Ads Library Scraper (Pay per Event)",
    "description": "Scrape Meta Ad Library by keyword or Facebook page URL. Get ad text, CTA, headlines, platforms, languages, targeting, reach data, and delivery dates. Supports all countries, languages, and filters. Works with any Ad Library search URL. Lightning fast, structured JSON output.",
    "version": "0.0",
    "x-build-id": "tMgZeki4FzIptHDS2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/eiv~meta-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-eiv-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/eiv~meta-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-eiv-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/eiv~meta-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-eiv-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": {
          "searchQueries": {
            "title": "Search Queries / Keywords",
            "type": "array",
            "description": "Enter search keywords (e.g. 'Loop Earplugs', 'Nike') or full Ad Library URLs with filters. Keywords are searched in ad text, images, and CTA buttons.",
            "items": {
              "type": "string"
            }
          },
          "pageUrls": {
            "title": "Page URLs",
            "maxItems": 10,
            "type": "array",
            "description": "Facebook page URLs to scrape all ads from (max 10). The page ID is automatically resolved.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Maximum number of ads to return (across all URLs combined).",
            "default": 50
          },
          "onlyTotalCount": {
            "title": "Only Total Count",
            "type": "boolean",
            "description": "If enabled, only the total number of matching ads is returned — no ad data is fetched. Useful for estimating result size before a full scrape.",
            "default": false
          },
          "searchType": {
            "title": "Keyword Match Type",
            "enum": [
              "KEYWORD_UNORDERED",
              "KEYWORD_EXACT_PHRASE"
            ],
            "type": "string",
            "description": "How to match search keywords. 'Unordered' finds ads containing all words in any order. 'Exact phrase' only matches the exact phrase — separate multiple phrases with commas.",
            "default": "KEYWORD_UNORDERED"
          },
          "adDeliveryDateMin": {
            "title": "Delivery Date From",
            "type": "string",
            "description": "Only return ads delivered after this date (inclusive). Format: YYYY-MM-DD"
          },
          "adDeliveryDateMax": {
            "title": "Delivery Date To",
            "type": "string",
            "description": "Only return ads delivered before this date (inclusive). Format: YYYY-MM-DD"
          },
          "publisherPlatforms": {
            "title": "Publisher Platforms",
            "type": "array",
            "description": "Filter ads by the Meta platform(s) they appear on. Leave empty for all platforms.",
            "items": {
              "type": "string",
              "enum": [
                "FACEBOOK",
                "INSTAGRAM",
                "AUDIENCE_NETWORK",
                "MESSENGER",
                "WHATSAPP",
                "OCULUS",
                "THREADS"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Audience Network",
                "Messenger",
                "WhatsApp",
                "Oculus",
                "Threads"
              ]
            },
            "default": []
          },
          "activeStatus": {
            "title": "Active Status",
            "enum": [
              "ALL",
              "ACTIVE",
              "INACTIVE"
            ],
            "type": "string",
            "description": "Filter ads by their delivery status. Only applied when not already specified in the Ad Library URL.",
            "default": "ALL"
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "Filter by countries where ads were delivered. Select one or more.",
            "items": {
              "type": "string",
              "enum": [
                "US",
                "GB",
                "CA",
                "AU",
                "DE",
                "FR",
                "ES",
                "IT",
                "NL",
                "BR",
                "IN",
                "JP",
                "KR",
                "MX",
                "PL",
                "SE",
                "NO",
                "DK",
                "FI",
                "AT",
                "BE",
                "CH",
                "IE",
                "NZ",
                "PT",
                "IL",
                "AE",
                "SA",
                "SG",
                "HK",
                "TW",
                "PH",
                "TH",
                "ID",
                "MY",
                "VN",
                "AR",
                "CL",
                "CO",
                "PE",
                "ZA",
                "NG",
                "EG",
                "KE",
                "GH",
                "TR",
                "RU",
                "UA",
                "CZ",
                "RO",
                "HU",
                "BG",
                "HR",
                "RS",
                "SK",
                "SI",
                "LT",
                "LV",
                "EE",
                "IS",
                "LU",
                "MT",
                "CY",
                "GE",
                "AZ",
                "KZ",
                "UZ",
                "PK",
                "BD",
                "LK",
                "NP",
                "KH",
                "MM",
                "JO",
                "KW",
                "LB",
                "QA",
                "BH",
                "OM",
                "IQ",
                "DZ",
                "MA",
                "TN",
                "LY",
                "SN",
                "CM",
                "CI",
                "GN",
                "ML",
                "BF",
                "TG",
                "BJ",
                "NE",
                "GA",
                "CG",
                "CD",
                "AO",
                "MZ",
                "ET",
                "TZ",
                "UG",
                "RW",
                "ZM",
                "ZW",
                "BW",
                "NA",
                "MW",
                "MG",
                "MU",
                "SC",
                "DJ",
                "ER",
                "SO",
                "SS",
                "CF",
                "TD",
                "BI",
                "SL",
                "LR",
                "GQ",
                "ST",
                "CV",
                "GW",
                "KM",
                "MR",
                "GM",
                "GD",
                "LC",
                "VC",
                "KN",
                "DM",
                "AG",
                "BB",
                "BS",
                "JM",
                "TT",
                "GY",
                "SR",
                "BZ",
                "HN",
                "GT",
                "SV",
                "NI",
                "CR",
                "PA",
                "DO",
                "HT",
                "PR",
                "EC",
                "BO",
                "PY",
                "UY",
                "VE",
                "PF",
                "NC",
                "FJ",
                "PG",
                "SB",
                "VU",
                "WS",
                "TO",
                "KI",
                "MH",
                "FM",
                "PW",
                "TV",
                "NR",
                "TL",
                "BN",
                "MO",
                "MN",
                "BT",
                "LA",
                "MV",
                "AF",
                "TJ",
                "KG",
                "TM",
                "YE",
                "PS",
                "BA",
                "MK",
                "AL",
                "ME",
                "MD",
                "BY",
                "AM",
                "AD",
                "MC",
                "LI",
                "SM",
                "VA",
                "GI",
                "FO",
                "GL",
                "AX",
                "JE",
                "GG",
                "IM",
                "BM",
                "KY",
                "VG",
                "VI",
                "TC",
                "AI",
                "MS",
                "AW",
                "CW",
                "SX",
                "BQ",
                "MQ",
                "GP",
                "GF",
                "RE",
                "YT",
                "PM",
                "BL",
                "MF",
                "SH",
                "FK",
                "GS",
                "BV",
                "HM",
                "IO",
                "CX",
                "CC",
                "CK",
                "NU",
                "NF",
                "PN",
                "TK",
                "UM",
                "WF",
                "EH",
                "SJ",
                "AQ",
                "AN",
                "XK",
                "SY",
                "AS",
                "GU",
                "MP"
              ]
            },
            "default": [
              "US"
            ]
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "Filter ads by language. Leave empty for all languages.",
            "items": {
              "type": "string",
              "enum": [
                "English",
                "Spanish",
                "French",
                "German",
                "Portuguese",
                "Italian",
                "Dutch",
                "Russian",
                "Japanese",
                "Korean",
                "Chinese (Mandarin)",
                "Chinese (Cantonese)",
                "Arabic",
                "Hindi",
                "Bengali",
                "Turkish",
                "Polish",
                "Ukrainian",
                "Romanian",
                "Czech",
                "Swedish",
                "Norwegian",
                "Danish",
                "Finnish",
                "Greek",
                "Hungarian",
                "Thai",
                "Vietnamese",
                "Indonesian",
                "Malay",
                "Filipino",
                "Hebrew",
                "Persian",
                "Urdu",
                "Swahili",
                "Tamil",
                "Telugu",
                "Marathi",
                "Gujarati",
                "Kannada",
                "Malayalam",
                "Punjabi",
                "Burmese",
                "Khmer",
                "Lao",
                "Amharic",
                "Somali",
                "Hausa",
                "Yoruba",
                "Igbo",
                "Zulu",
                "Afrikaans",
                "Croatian",
                "Serbian",
                "Bosnian",
                "Slovak",
                "Slovenian",
                "Lithuanian",
                "Latvian",
                "Estonian",
                "Bulgarian",
                "Albanian",
                "Macedonian",
                "Montenegrin",
                "Georgian",
                "Armenian",
                "Azerbaijani",
                "Kazakh",
                "Uzbek",
                "Kyrgyz",
                "Turkmen",
                "Tajik",
                "Mongolian",
                "Nepali",
                "Sinhala",
                "Catalan",
                "Galician",
                "Basque",
                "Welsh",
                "Irish",
                "Icelandic",
                "Maltese",
                "Luxembourgish",
                "Malagasy"
              ],
              "enumTitles": [
                "English",
                "Spanish",
                "French",
                "German",
                "Portuguese",
                "Italian",
                "Dutch",
                "Russian",
                "Japanese",
                "Korean",
                "Chinese (Mandarin)",
                "Chinese (Cantonese)",
                "Arabic",
                "Hindi",
                "Bengali",
                "Turkish",
                "Polish",
                "Ukrainian",
                "Romanian",
                "Czech",
                "Swedish",
                "Norwegian",
                "Danish",
                "Finnish",
                "Greek",
                "Hungarian",
                "Thai",
                "Vietnamese",
                "Indonesian",
                "Malay",
                "Filipino",
                "Hebrew",
                "Persian",
                "Urdu",
                "Swahili",
                "Tamil",
                "Telugu",
                "Marathi",
                "Gujarati",
                "Kannada",
                "Malayalam",
                "Punjabi",
                "Burmese",
                "Khmer",
                "Lao",
                "Amharic",
                "Somali",
                "Hausa",
                "Yoruba",
                "Igbo",
                "Zulu",
                "Afrikaans",
                "Croatian",
                "Serbian",
                "Bosnian",
                "Slovak",
                "Slovenian",
                "Lithuanian",
                "Latvian",
                "Estonian",
                "Bulgarian",
                "Albanian",
                "Macedonian",
                "Montenegrin",
                "Georgian",
                "Armenian",
                "Azerbaijani",
                "Kazakh",
                "Uzbek",
                "Kyrgyz",
                "Turkmen",
                "Tajik",
                "Mongolian",
                "Nepali",
                "Sinhala",
                "Catalan",
                "Galician",
                "Basque",
                "Welsh",
                "Irish",
                "Icelandic",
                "Maltese",
                "Luxembourgish",
                "Malagasy"
              ]
            },
            "default": []
          },
          "proxyConfig": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Optional proxy configuration."
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}