{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Ad Library Scraper — Facebook & Instagram Ads API No Login",
    "description": "Bulk Meta Ad Library scraper — every Facebook & Instagram ad, creative, landing URL. $0.0015/ad. No login, no Graph API approval. Raw JSON passthrough. Perfect for creative and competitor research.",
    "version": "2.0",
    "x-build-id": "O8RrPF8CZn5u6RNhs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/affiliatescope~meta-ads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-affiliatescope-meta-ads-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/affiliatescope~meta-ads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-affiliatescope-meta-ads-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/affiliatescope~meta-ads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-affiliatescope-meta-ads-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": {
          "urls": {
            "title": "Ad Library URLs",
            "type": "array",
            "description": "Paste one URL per line. Filter parameters are read from each URL's query string, so whatever you see in the Ad Library UI is what you get. Supports search-result URLs, single-Page views (?view_all_page_id=...), and single-ad pages (?id=...).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searchQueries": {
            "title": "Search queries (keywords)",
            "type": "array",
            "description": "Free-text search terms, one per line. Example: `nike`, `black friday`, `home insurance quote`. Each query runs against every country in the Countries filter below.",
            "items": {
              "type": "string"
            }
          },
          "pageIds": {
            "title": "Facebook Page IDs",
            "type": "array",
            "description": "Numeric Page IDs, one per line. Returns every currently-indexed ad from each Page. Find the ID in any Page's Ad Library URL: `facebook.com/ads/library/?view_all_page_id=<THIS_NUMBER>`.",
            "items": {
              "type": "string"
            }
          },
          "adIds": {
            "title": "Specific Ad archive IDs",
            "type": "array",
            "description": "Numeric ad_archive_id values, one per line. Useful for re-fetching a specific ad (e.g. `1191898553123641`). Lightweight — one ad in, one ad out.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "ISO-3166 alpha-2 country codes, e.g. `US`, `GB`, `DE`. Defaults to `['US']`. Use `['ALL']` to scrape ads globally (no country filter).",
            "default": [
              "US"
            ],
            "items": {
              "type": "string"
            }
          },
          "activeStatus": {
            "title": "Active status",
            "enum": [
              "ALL",
              "ACTIVE",
              "INACTIVE"
            ],
            "type": "string",
            "description": "`Active only` = ads currently running. `Inactive only` = ads that stopped running. `All` = both.",
            "default": "ALL"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "ALL",
              "POLITICAL_AND_ISSUE_ADS",
              "HOUSING_ADS",
              "EMPLOYMENT_ADS",
              "CREDIT_ADS"
            ],
            "type": "string",
            "description": "Filter by Meta's ad category. `Political & social-issue` is the only category that exposes spend, impressions, and byline fields. `Credit` maps to Meta's `Financial products and services`.",
            "default": "ALL"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "ALL",
              "IMAGE",
              "MEME",
              "VIDEO",
              "NONE"
            ],
            "type": "string",
            "description": "Filter by ad creative type. `Meme` = image with overlay text. `No media` = text-only ads.",
            "default": "ALL"
          },
          "publisherPlatforms": {
            "title": "Publisher platforms",
            "type": "array",
            "description": "Leave empty for all platforms. Otherwise any subset of `FACEBOOK`, `INSTAGRAM`, `MESSENGER`, `AUDIENCE_NETWORK`.",
            "items": {
              "type": "string"
            }
          },
          "contentLanguages": {
            "title": "Content languages",
            "type": "array",
            "description": "ISO-639 language codes, one per line (e.g. `en`, `de`, `es`). Empty = any language.",
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "From date",
            "type": "string",
            "description": "Earliest ad delivery date, `YYYY-MM-DD`. Leave empty for no lower bound."
          },
          "endDate": {
            "title": "To date",
            "type": "string",
            "description": "Latest ad delivery date, `YYYY-MM-DD`. Leave empty for no upper bound."
          },
          "sortBy": {
            "title": "Sort results",
            "enum": [
              "TOTAL_IMPRESSIONS_DESC",
              "MOST_RECENT"
            ],
            "type": "string",
            "description": "Order of returned ads. `Total impressions` surfaces highest-reach ads first and matches the Ad Library UI's default.",
            "default": "TOTAL_IMPRESSIONS_DESC"
          },
          "isTargetedCountry": {
            "title": "Only ads targeting the selected country",
            "type": "boolean",
            "description": "If on, filter out ads that merely reached the country without specifically targeting it. Off = include broadly-targeted ads that happened to appear in the country.",
            "default": false
          },
          "maxAdsPerSource": {
            "title": "Max ads per source",
            "minimum": 0,
            "type": "integer",
            "description": "Per-URL / per-query / per-Page / per-Ad-ID cap. `0` = no limit, scrape every indexed ad. A single query can return 10,000+ ads in popular verticals — set this to protect your budget and dataset size.",
            "default": 0
          },
          "maxAds": {
            "title": "Max ads total (hard cap)",
            "minimum": 0,
            "type": "integer",
            "description": "Hard cap across ALL sources combined. `0` = no global cap (only per-source caps apply).",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Number of sources processed in parallel. **Only helps with multiple sources** — within one source, pagination is serial (each page needs the previous page's cursor), so concurrency above 1 gets automatically capped at your source count. Example: with 1 URL, effective concurrency = 1 regardless of this setting. With 10 keywords, set 5–10 to parallelize. Bumping above 10 also needs memory raised to 1 GB via the Console's Memory dropdown.",
            "default": 3
          },
          "proxy": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Residential proxy is strongly recommended — Meta aggressively rate-limits datacenter IPs. Apify RESIDENTIAL returns the highest success rate. Leave at the default unless you have a specific reason to change it.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          },
          "runTag": {
            "title": "Run tag",
            "type": "string",
            "description": "Custom label copied to every record's `__metadata.runTag`. Useful when you run the scraper on a schedule and want to group or filter dataset rows by run."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}