{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper: Meta Ads by Keyword or Page",
    "description": "Meta Ad Library ads by keyword, Page or Ad Library link, with text, images, videos and dates. $0.25 per 1,000 ads. Carousel cards, platforms and political spend.",
    "version": "0.1",
    "x-build-id": "xzKWfuxmE9eNchpJs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/luzivanlt~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-luzivanlt-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/luzivanlt~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-luzivanlt-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/luzivanlt~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-luzivanlt-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": {
          "searchQueries": {
            "title": "Searches",
            "type": "array",
            "description": "Words to search the Ad Library for, one search per line, as you would type them in its search box. Every ad that mentions them, from any advertiser. Up to 200 characters a search; a link goes under Links instead. Each search reads up to Max ads per search. Example: running shoes",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Links",
            "type": "array",
            "description": "Facebook Page links (https://www.facebook.com/nike, profile.php?id=…, /people/…, /pages/…, /p/…, also on m. or fb.com), a Page's name alone as in its link (nike or @nike), Page ids as the Ad Library shows them (view_all_page_id), or Ad Library links (a search, or a Page’s ads) with any filters you picked there. A Page gives every ad that Page runs, and each of its ads also carries the Page's About tab: owner and address, admin countries, name history, spend and Instagram. An Ad Library link keeps its own filters; the filters below fill in what it leaves out. A single ad's link is not a search. Example: https://www.facebook.com/amazon",
            "items": {
              "type": "string"
            }
          },
          "maxAdsPerSearch": {
            "title": "Max ads per search",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Stop each search, Page or link after this many ads, in the Ad Library’s order. From 1 to 10,000; 100 if left empty. You pay $0.25 per 1,000 ads saved, so this caps what each search, Page or link can cost: 100 ads cost at most $0.025.",
            "default": 100
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Ads shown in this country, as a two-letter code such as \"US\", \"GB\" or \"VN\", or \"ALL\" for every country. Upper or lower case both work. Left empty, every country (ALL). A pasted Ad Library link keeps its own country. Example: US",
            "default": "ALL"
          },
          "activeStatus": {
            "title": "Active or not",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Ads running now, ads that have stopped, or both. Active is the default; pick All to get an advertiser's past ads too. A pasted Ad Library link keeps its own choice. Example: all",
            "default": "active"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads"
            ],
            "type": "string",
            "description": "All ads, or only ads about social issues, elections or politics (these carry spend, impressions, reach and who paid for them). Other ads leave spend, impressions and reach empty. All ads is the default. Example: political_and_issue_ads",
            "default": "all"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "meme",
              "image_and_meme",
              "video",
              "none"
            ],
            "type": "string",
            "description": "Keep only ads with this kind of media: images, memes, images and memes, videos, or ads with no image or video. All is the default and keeps every ad. A pasted Ad Library link keeps its own choice. Example: video",
            "default": "all"
          },
          "exactPhrase": {
            "title": "Exact phrase",
            "type": "boolean",
            "description": "Match the search words as one exact phrase, in order. Off by default: an ad matches when it holds the words in any order. It applies to word searches, not to a Page's ads; a pasted Ad Library link keeps its own choice.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "relevance",
              "most_recent",
              "impressions_high_to_low",
              "impressions_low_to_high"
            ],
            "type": "string",
            "description": "The Ad Library’s order, the most recently started ads first, or, for issue, election and political ads only, impressions high to low or low to high (Meta shows impressions for those ads only, so with Ad category All ads an impressions order is refused). Relevance is the default. With Max ads per search set, this decides which ads you get. A pasted Ad Library link keeps its own order. Example: most_recent",
            "default": "relevance"
          },
          "startDate": {
            "title": "Shown from",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2}|\\d{1,4}\\s*[A-Za-z]+(\\s+[Aa][Gg][Oo])?)$",
            "type": "string",
            "description": "Keep only ads shown on or after this day: a date (YYYY-MM-DD) or how long before the run starts, such as \"7 days\", \"2 weeks\", \"2 months\" or \"1 year\". Leave empty for no start limit. It cannot be after Shown until. A pasted Ad Library link keeps its own dates. Example: 2 months"
          },
          "endDate": {
            "title": "Shown until",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2}|\\d{1,4}\\s*[A-Za-z]+(\\s+[Aa][Gg][Oo])?)$",
            "type": "string",
            "description": "Keep only ads shown on or before this day: a date (YYYY-MM-DD) or how long before the run starts, such as \"7 days\", \"2 weeks\", \"2 months\" or \"1 year\". Leave empty for no end limit. It cannot be before Shown from. A pasted Ad Library link keeps its own dates. Example: 2026-06-30"
          },
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Keep only ads shown on any of these platforms: Facebook, Instagram, Audience Network, Messenger, Threads or WhatsApp. Leave empty for every platform. A pasted Ad Library link keeps its own platforms. Example: instagram",
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "audience_network",
                "messenger",
                "threads",
                "whatsapp"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Audience Network",
                "Messenger",
                "Threads",
                "WhatsApp"
              ]
            }
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "Keep only ads in these languages, as two-letter codes such as \"en\" or \"es\". Leave empty for every language. Upper or lower case both work. A pasted Ad Library link keeps its own languages. Example: en",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}