{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper: Meta Ad Library Monitor",
    "description": "Facebook Ads Library scraper for Meta ads on Facebook and Instagram. Paste any Ad Library link or search by keyword or Page ID, filter by start date, and get ad copy, CTAs, landing pages, run dates and image and video URLs. Monitor mode returns only new ads. No login.",
    "version": "0.4",
    "x-build-id": "MoqChpiq2ixydRfcW"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/themineworks~meta-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-themineworks-meta-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/themineworks~meta-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-themineworks-meta-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/themineworks~meta-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-themineworks-meta-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": {
          "adLibraryUrls": {
            "title": "Ad Library links (optional)",
            "type": "array",
            "description": "Paste any Meta Ad Library address straight from your browser: a keyword search, an advertiser's page of ads (view_all_page_id=...) or a single ad (?id=...). The filters in the link (country, active status, ad type, media type, search type, dates, platforms, languages) are used as they are, so you get the same ads the page showed you. Filters the link leaves out come from the fields below. Example: https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&media_type=all&search_type=page&view_all_page_id=162640217636958",
            "items": {
              "type": "string"
            }
          },
          "searchTerms": {
            "title": "Search terms (keywords)",
            "type": "array",
            "description": "Keywords to search the Ad Library for, e.g. a brand or product name. Each term is searched independently. Leave empty if you are searching by Ad Library link or advertiser Page ID instead.",
            "items": {
              "type": "string"
            }
          },
          "pageIds": {
            "title": "Advertiser Page IDs (optional)",
            "type": "array",
            "description": "Facebook Page IDs to pull ALL ads from a specific advertiser. Find a Page ID inside any ad's Ad Library detail. Use this for precise competitor tracking. Takes priority over search terms, e.g. \"162640217636958\".",
            "items": {
              "type": "string"
            }
          },
          "searchType": {
            "title": "Keyword match",
            "enum": [
              "keyword_unordered",
              "keyword_exact_phrase"
            ],
            "type": "string",
            "description": "How searchTerms are matched, the same choice the Ad Library search box offers. Any words matches the words anywhere in the ad, in any order. Exact phrase matches the words together and in order. Has no effect on Page ID searches.",
            "default": "keyword_unordered"
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Two-letter country code for the Ad Library region, e.g. US, IN, GB, AE, or ALL for every country. The Ad Library is country-scoped.",
            "default": "US"
          },
          "adActiveStatus": {
            "title": "Ad status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Which ads to return: active ads still running, inactive ads that have stopped, or all ads regardless of status.",
            "default": "active"
          },
          "adType": {
            "title": "Ad type",
            "enum": [
              "all",
              "political_and_issue_ads"
            ],
            "type": "string",
            "description": "All commercial ads, or only political and issue ads (which carry extra spend and impression data).",
            "default": "all"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme"
            ],
            "type": "string",
            "description": "Filter ads by creative type, such as image, video, or image-based memes. Choose all to skip this filter.",
            "default": "all"
          },
          "startDateMin": {
            "title": "Started on or after (optional)",
            "type": "string",
            "description": "Only ads that started running on or after this date, YYYY-MM-DD. Leave empty for no lower limit. Ads outside the window are left out and never charged."
          },
          "startDateMax": {
            "title": "Started on or before (optional)",
            "type": "string",
            "description": "Only ads that started running on or before this date, YYYY-MM-DD. Leave empty for no upper limit."
          },
          "publisherPlatforms": {
            "title": "Platforms (optional)",
            "type": "array",
            "description": "Only ads shown on these platforms, using the Ad Library's own platform filter. Any of: facebook, instagram, messenger, audience_network, threads, whatsapp. Leave empty for all platforms.",
            "items": {
              "type": "string"
            }
          },
          "contentLanguages": {
            "title": "Ad languages (optional)",
            "type": "array",
            "description": "Only ads in these languages, as two letter codes such as en, es or de, using the Ad Library's own language filter. Leave empty for all languages.",
            "items": {
              "type": "string"
            }
          },
          "maxAdsPerSearch": {
            "title": "Max ads per search",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Maximum number of ads to collect for each search term or advertiser. The public Ad Library returns about 30 ads per search; add more searchTerms or pageIds to gather more.",
            "default": 10
          },
          "downloadImages": {
            "title": "Return image creative URLs",
            "type": "boolean",
            "description": "Image creative URLs are always returned in image_urls. This build never downloads media bytes, so this toggle is accepted for compatibility but has no effect.",
            "default": false
          },
          "downloadVideos": {
            "title": "Return video creative URLs",
            "type": "boolean",
            "description": "Video creative URLs are always returned in video_urls. This build never downloads media bytes, so this toggle is accepted for compatibility but has no effect.",
            "default": false
          },
          "monitorMode": {
            "title": "Monitor mode (only new ads)",
            "type": "boolean",
            "description": "Run on a schedule and deliver ONLY ads not seen in a previous run, so each run shows the ads that went live since the last one. You are charged per new ad, not for every ad each time. Ideal for daily or weekly competitor watching. Requires the same input across runs.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Apify Residential proxy is required: Meta serves datacenter IPs an anti-bot challenge, so only residential exits reach the Ad Library. Only lightweight JSON/HTML is fetched (no media), so cost per run stays low. Leave as default.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}