{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper & API: Export Meta Ads",
    "description": "Scrape the public Meta Ad Library (Facebook and Instagram ads) without login: every ad of an advertiser or keyword with ad text, headline, button, landing page, image and HD video links, dates, platforms, spend and impressions of political ads. Alerts for new competitor ads.",
    "version": "0.1",
    "x-build-id": "Do3V6Yv8lhkTHfd8h"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/s_actors~meta-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-s_actors-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/s_actors~meta-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-s_actors-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/s_actors~meta-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-s_actors-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": "🔍 Keywords",
            "type": "array",
            "description": "One per line (\"running shoes\", \"crm software\", \"black friday\"). Every advertiser that runs ads with these words, like the Ad Library's own search box. Add a country below: a keyword search across all countries has tens of thousands of ads.",
            "items": {
              "type": "string"
            }
          },
          "pages": {
            "title": "🏷️ Advertisers (Pages)",
            "type": "array",
            "description": "One per line: a Page ID (the number after view_all_page_id= in an Ad Library link), a facebook.com/<page> link, or the Page username (\"zara\", \"nike\"). Returns every ad of that Page, active and past.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "🔗 Ad Library links",
            "type": "array",
            "description": "Optional. Links copied from your browser: an Ad Library search or advertiser page (facebook.com/ads/library/?...). A link keeps its own filters (country, dates, status). A facebook.com/<page> link also works.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "enum": [
              "ALL",
              "US",
              "GB",
              "CA",
              "AU",
              "NZ",
              "IE",
              "DE",
              "FR",
              "IT",
              "ES",
              "PT",
              "NL",
              "BE",
              "LU",
              "CH",
              "AT",
              "SE",
              "NO",
              "DK",
              "FI",
              "IS",
              "PL",
              "CZ",
              "SK",
              "HU",
              "RO",
              "BG",
              "GR",
              "HR",
              "SI",
              "RS",
              "UA",
              "LT",
              "LV",
              "EE",
              "CY",
              "MT",
              "TR",
              "IL",
              "AE",
              "SA",
              "EG",
              "ZA",
              "NG",
              "KE",
              "IN",
              "PK",
              "BD",
              "ID",
              "PH",
              "TH",
              "VN",
              "MY",
              "SG",
              "JP",
              "KR",
              "HK",
              "TW",
              "MX",
              "BR",
              "AR",
              "CL",
              "CO",
              "PE"
            ],
            "type": "string",
            "description": "Ads shown in this country (ISO code), or ALL. In EU countries and for political ads the Ad Library shows more fields.",
            "default": "ALL"
          },
          "activeStatus": {
            "title": "Status",
            "enum": [
              "all",
              "active",
              "inactive"
            ],
            "type": "string",
            "description": "All = every ad the Page ever ran, active and stopped.",
            "default": "all"
          },
          "adType": {
            "title": "Ad type",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "credit_ads"
            ],
            "type": "string",
            "description": "Political and issue ads come with spend and impressions ranges.",
            "default": "all"
          },
          "mediaType": {
            "title": "Format",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "none"
            ],
            "type": "string",
            "description": "Only ads with this kind of creative.",
            "default": "all"
          },
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Only ads shown on these platforms. Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "audience_network",
                "messenger",
                "whatsapp",
                "threads"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Audience Network",
                "Messenger",
                "WhatsApp",
                "Threads"
              ]
            }
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "Optional ISO codes of the ad language, one per line (\"en\", \"de\", \"es\").",
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "Running from",
            "type": "string",
            "description": "Only ads that were running on or after this day (YYYY-MM-DD)."
          },
          "endDate": {
            "title": "Running until",
            "type": "string",
            "description": "Only ads that started on or before this day (YYYY-MM-DD)."
          },
          "sortBy": {
            "title": "Order",
            "enum": [
              "relevancy",
              "impressions"
            ],
            "type": "string",
            "description": "Impression order applies to ads that show impressions (political, EU).",
            "default": "relevancy"
          },
          "maxAdsPerSource": {
            "title": "Max ads per source",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Per keyword, per Page and per link. 100 for a quick first run; raise it (50,000+ works). An ad found twice is returned once.",
            "default": 100
          },
          "maxConcurrency": {
            "title": "Parallel searches",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many keywords / Pages are read at the same time.",
            "default": 4
          },
          "onlyNew": {
            "title": "🔔 Only new ads",
            "type": "boolean",
            "description": "Return only ads this input has not returned before. The first run returns everything and remembers it. Every row has isNew and firstSeenAt either way.",
            "default": false
          },
          "debugLog": {
            "title": "Debug log",
            "type": "boolean",
            "description": "Log every request attempt (for support).",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}