{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ad Library Scraper - Meta Ads Intelligence",
    "description": "Scrape the Facebook & Instagram Ad Library for any advertiser or keyword. Creatives, spend, dates, reach. Pay only for ads delivered, never over your cap.",
    "version": "0.1",
    "x-build-id": "cHw4zfKPf3OWZdRSk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/top_mythos~ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-top_mythos-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/top_mythos~ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-top_mythos-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/top_mythos~ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-top_mythos-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",
        "required": [
          "platforms"
        ],
        "properties": {
          "platforms": {
            "title": "Ad libraries to search",
            "type": "array",
            "description": "Which ad libraries to query. Currently Meta (Facebook and Instagram). Google Ads and TikTok support is coming soon.",
            "items": {
              "type": "string",
              "enum": [
                "meta"
              ],
              "enumTitles": [
                "Meta (Facebook / Instagram)"
              ]
            },
            "default": [
              "meta"
            ]
          },
          "searchMode": {
            "title": "Search mode",
            "enum": [
              "keyword",
              "advertiser",
              "domain",
              "advertiserId"
            ],
            "type": "string",
            "description": "How to find ads. 'keyword' searches ad text (Meta and TikTok only, Google has no free-text search). 'advertiser' searches by brand/page name. 'domain' finds a brand by website (best for Google). 'advertiserId' uses exact platform IDs or profile URLs.",
            "default": "advertiser"
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords, advertiser names, or brands to search for. One run can cover several.",
            "items": {
              "type": "string"
            }
          },
          "advertiserIdsOrUrls": {
            "title": "Advertiser IDs or profile URLs",
            "type": "array",
            "description": "Precise page IDs, advertiser IDs (e.g. Google AR... ids), or ad-library profile URLs, used when searchMode is 'advertiserId'.",
            "items": {
              "type": "string"
            }
          },
          "domains": {
            "title": "Advertiser domains",
            "type": "array",
            "description": "Website domains to resolve to advertisers (e.g. nike.com). Best for Google, which is advertiser/domain-centric.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "ISO-3166 alpha-2 country codes to search within, also used to geo-target the proxy. TikTok and EU-commercial coverage require EEA/UK codes.",
            "default": [
              "US"
            ],
            "items": {
              "type": "string"
            }
          },
          "adStatus": {
            "title": "Ad status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Return active ads, inactive/stopped ads, or all.",
            "default": "all"
          },
          "adCategory": {
            "title": "Ad category",
            "enum": [
              "all",
              "commercial",
              "political"
            ],
            "type": "string",
            "description": "'political' unlocks spend and impression ranges where the platform publishes them (varies by region and law). 'commercial' restricts to commercial ads.",
            "default": "all"
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "Only ads first shown on or after this date (YYYY-MM-DD). Leave empty for no lower bound."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Only ads first shown on or before this date (YYYY-MM-DD). Leave empty for no upper bound."
          },
          "mediaTypes": {
            "title": "Media types",
            "type": "array",
            "description": "Restrict to certain creative formats.",
            "items": {
              "type": "string",
              "enum": [
                "image",
                "video",
                "carousel",
                "text"
              ],
              "enumTitles": [
                "Image",
                "Video",
                "Carousel",
                "Text"
              ]
            },
            "default": [
              "image",
              "video",
              "carousel",
              "text"
            ]
          },
          "maxResultsPerPlatform": {
            "title": "Max results per platform",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Hard cap on ads returned per platform. This limit is strictly enforced, the run will never exceed it or charge you beyond it.",
            "default": 1000
          },
          "downloadMedia": {
            "title": "Download creatives to storage",
            "type": "boolean",
            "description": "Host each ad's image/video/carousel as a downloadable file in the run's key-value store, instead of only expiring URLs. Billed as a separate media-download event.",
            "default": false
          },
          "includeTransparency": {
            "title": "Include transparency data",
            "type": "boolean",
            "description": "Pull EU/DSA reach and targeting, and political spend/impression ranges, where the platform exposes them. Billed as a separate enrichment event only when extra requests are made.",
            "default": true
          },
          "monitoringEnabled": {
            "title": "Monitoring mode (only new ads)",
            "type": "boolean",
            "description": "Return only ads not seen in previous runs of this monitoring set. Ideal for scheduled competitor tracking.",
            "default": false
          },
          "monitoringStateStore": {
            "title": "Monitoring state store name",
            "type": "string",
            "description": "Named key-value store that persists seen ad IDs across scheduled runs. Reuse the same name to keep a continuous watch.",
            "default": "ads-intel-seen"
          },
          "estimateOnly": {
            "title": "Cost preview only (no paid scrape)",
            "type": "boolean",
            "description": "Return an estimated ad count and price for these inputs without running a paid scrape. Use this to preview cost before committing.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Ad libraries block datacenter IPs. Residential proxies, geo-matched to your countries, are strongly recommended.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}