{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper",
    "description": "[💰 $0.99 / 1K ads] Every Facebook, Instagram, Messenger and Threads ad by keyword, advertiser or Ad Library link · complete rows: creatives, EU reach by age and gender, payer, page owner, Instagram followers · only new ads · No account, no proxy. Export JSON, CSV or Excel.",
    "version": "0.0",
    "x-build-id": "7R8lWkzIBHCBMO7VN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sleepmodesystems~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sleepmodesystems-facebook-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/sleepmodesystems~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-sleepmodesystems-facebook-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/sleepmodesystems~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-sleepmodesystems-facebook-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": {
          "searches": {
            "title": "Search words or Ad Library links",
            "type": "array",
            "description": "Words as you would type them in the Ad Library (\"running shoes\"; put a phrase in quotes for the exact phrase), or any Ad Library link: a search, an advertiser's ads, or one ad (facebook.com/ads/library/?id=...).",
            "items": {
              "type": "string"
            }
          },
          "pages": {
            "title": "Advertisers (Facebook pages)",
            "type": "array",
            "description": "Every ad of an advertiser: its Facebook page link (facebook.com/nike), its page name as in that link (nike, @nike), its page id (15087023444) or its Ad Library link. A page whose link has no name (profile.php?id=..., people/Name/id) works too.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Where the ads ran: a country name or its code (France, FR, United States, US), or ALL. Facebook shows EU reach and audience for ads delivered in the EU.",
            "default": "ALL"
          },
          "activeStatus": {
            "title": "Ad status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Active ads is what the Ad Library shows by default. All ads includes an advertiser's whole history.",
            "default": "active"
          },
          "exactPhrase": {
            "title": "Exact phrase",
            "type": "boolean",
            "description": "Match the search words as one exact phrase.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "relevance",
              "impressions",
              "newest"
            ],
            "type": "string",
            "description": "The order of the Ad Library's own sort options.",
            "default": "relevance"
          },
          "adCategory": {
            "title": "Ad category",
            "enum": [
              "all",
              "political"
            ],
            "type": "string",
            "description": "Political ads come with their spend range, impressions and who paid for them.",
            "default": "all"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Only ads with this kind of media.",
            "default": "all"
          },
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Only ads shown on these: facebook, instagram, messenger, audience_network, threads, whatsapp. Empty means all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "languages": {
            "title": "Ad languages",
            "type": "array",
            "description": "Two-letter language codes of the ad text (en, fr, de). Empty means all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "startedAfter": {
            "title": "Ran after",
            "type": "string",
            "description": "Only ads that ran on or after this day: a date (2026-10-01) or a time ago (30 days). Facebook counts an ad that was running during the period."
          },
          "startedBefore": {
            "title": "Ran before",
            "type": "string",
            "description": "Only ads that ran on or before this day: a date (2026-10-31) or a time ago (7 days)."
          },
          "maxAds": {
            "title": "Max ads per search or advertiser",
            "minimum": 1,
            "type": "integer",
            "description": "Never more than this many ads from each search or advertiser, and never charged beyond it.",
            "default": 200
          },
          "completeRows": {
            "title": "Complete rows",
            "type": "boolean",
            "description": "Each ad with its advertiser (Instagram followers, page likes, about, the page's confirmed owner, creation date, name changes and admin countries), EU reach by country, age and gender, the audience targeted, and who paid. Off: the ad's own fields only, at the lower essentials price.",
            "default": true
          },
          "includeRawData": {
            "title": "Raw Facebook data",
            "type": "boolean",
            "description": "Also add each ad's data exactly as Facebook sends it, with its original field names (ad_archive_id, snapshot, aaa_info...), in a <code>raw</code> field. For pipelines built on Facebook's own names.",
            "default": false
          },
          "countOnly": {
            "title": "Counts only",
            "type": "boolean",
            "description": "Only how many ads Facebook shows for each search or advertiser (Nike: about 14,000), in seconds. No ads are read and nothing is charged. The counts are in the run's status and its COUNTS record.",
            "default": false
          },
          "onlyNew": {
            "title": "Only new ads",
            "type": "boolean",
            "description": "Skip ads this monitor already delivered in earlier runs (they are not charged again). Schedule the run to get each new ad once.",
            "default": false
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Optional. Runs with the same name share one list of delivered ads, even when the searches change. Empty: the list belongs to these exact searches and filters."
          },
          "maxItems": {
            "title": "Max ads in total",
            "minimum": 1,
            "type": "integer",
            "description": "Stops the run after this many ads in total, across all searches."
          },
          "minItems": {
            "title": "Fail below this many ads",
            "minimum": 0,
            "type": "integer",
            "description": "For monitoring: the run fails when it gets fewer ads than this, so an alert fires."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}