{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper API",
    "description": "Scrape Facebook Ad Library: Extract ad data, copy & creatives from FB & Instagram. Powerful Facebook Ads Scraper for competitor research & ad intelligence. Search by keyword or Page ID. Export JSON, CSV, or Excel. Fast, reliable, and cheap Facebook Ad Library API.",
    "version": "0.0",
    "x-build-id": "hTu1AaWik2iWwu2Ud"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/api_creators~facebook-ads-library-scraper-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-api_creators-facebook-ads-library-scraper-api",
        "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/api_creators~facebook-ads-library-scraper-api/runs": {
      "post": {
        "operationId": "runs-sync-api_creators-facebook-ads-library-scraper-api",
        "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/api_creators~facebook-ads-library-scraper-api/run-sync": {
      "post": {
        "operationId": "run-sync-api_creators-facebook-ads-library-scraper-api",
        "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": [
          "start_urls"
        ],
        "properties": {
          "start_urls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Facebook Ads Library URLs to scrape (e.g., https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=UA&media_type=all&q=blender&search_type=keyword_unordered)",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "max_results_per_url": {
            "title": "Max Results Per URL",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of ads to scrape per start URL. Set to 0 for unlimited.",
            "default": 100
          },
          "total_max_results": {
            "title": "Total Max Results",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum total number of ads to scrape across all URLs. Set to 0 for unlimited.",
            "default": 500
          },
          "proxy_country": {
            "title": "Scrape as in a country filter",
            "enum": [
              "",
              "ad",
              "ae",
              "af",
              "ag",
              "ai",
              "al",
              "am",
              "ao",
              "ar",
              "at",
              "au",
              "aw",
              "az",
              "ba",
              "bb",
              "bd",
              "be",
              "bf",
              "bg",
              "bh",
              "bi",
              "bj",
              "bm",
              "bn",
              "bo",
              "bq",
              "br",
              "bs",
              "bt",
              "bw",
              "by",
              "bz",
              "ca",
              "cd",
              "cg",
              "ch",
              "ci",
              "cl",
              "cm",
              "cn",
              "co",
              "cr",
              "cu",
              "cv",
              "cw",
              "cy",
              "cz",
              "de",
              "dj",
              "dk",
              "dm",
              "do",
              "dz",
              "ec",
              "ee",
              "eg",
              "er",
              "es",
              "et",
              "fi",
              "fj",
              "fk",
              "fm",
              "fo",
              "fr",
              "ga",
              "gb",
              "gd",
              "ge",
              "gf",
              "gg",
              "gh",
              "gi",
              "gl",
              "gm",
              "gn",
              "gp",
              "gq",
              "gr",
              "gt",
              "gu",
              "gw",
              "gy",
              "hk",
              "hn",
              "hr",
              "ht",
              "hu",
              "id",
              "ie",
              "il",
              "im",
              "in",
              "iq",
              "ir",
              "is",
              "it",
              "je",
              "jm",
              "jo",
              "jp",
              "ke",
              "kg",
              "kh",
              "ki",
              "km",
              "kn",
              "kp",
              "kr",
              "kw",
              "ky",
              "kz",
              "la",
              "lb",
              "lc",
              "li",
              "lk",
              "lr",
              "ls",
              "lt",
              "lu",
              "lv",
              "ly",
              "ma",
              "mc",
              "md",
              "me",
              "mf",
              "mg",
              "mh",
              "mk",
              "ml",
              "mm",
              "mn",
              "mo",
              "mp",
              "mq",
              "mr",
              "ms",
              "mt",
              "mu",
              "mv",
              "mw",
              "mx",
              "my",
              "mz",
              "na",
              "nc",
              "ne",
              "nf",
              "ng",
              "ni",
              "nl",
              "no",
              "np",
              "nr",
              "nu",
              "nz",
              "om",
              "pa",
              "pe",
              "pf",
              "pg",
              "ph",
              "pk",
              "pl",
              "pm",
              "pn",
              "pr",
              "ps",
              "pt",
              "pw",
              "py",
              "qa",
              "re",
              "ro",
              "rs",
              "ru",
              "rw",
              "sa",
              "sb",
              "sc",
              "sd",
              "se",
              "sg",
              "sh",
              "si",
              "sk",
              "sl",
              "sm",
              "sn",
              "so",
              "sr",
              "ss",
              "st",
              "sv",
              "sx",
              "sy",
              "sz",
              "tc",
              "td",
              "tg",
              "th",
              "tj",
              "tk",
              "tl",
              "tm",
              "tn",
              "to",
              "tr",
              "tt",
              "tv",
              "tw",
              "tz",
              "ua",
              "ug",
              "um",
              "us",
              "uy",
              "uz",
              "va",
              "vc",
              "ve",
              "vg",
              "vi",
              "vn",
              "vu",
              "wf",
              "ws",
              "ye",
              "yt",
              "za",
              "zm",
              "zw"
            ],
            "type": "string",
            "description": "By selecting a proxy country, the Actor will use residential proxy group to get country-specific data. Note that using country-specific proxies might slow down your runs.",
            "default": ""
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}