{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper · No Login · $0.3/1k",
    "description": "Search Meta ads by keyword, page or URL. Export copy, creatives, CTA, dates, platforms and optional EU reach to CSV, Excel or JSON. Core fields align with Apify's official scraper. $0.30/1k ads on Business or $0.45/1k on Free; no start fee or platform charge.",
    "version": "0.0",
    "x-build-id": "Gcahn8HAfQTuc9ue7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alfalfa~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alfalfa-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/alfalfa~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-alfalfa-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/alfalfa~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-alfalfa-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": "Keywords",
            "type": "array",
            "description": "Words or phrases to search for in ad texts and advertiser names, one per line, e.g. <code>running shoes</code> or <code>Nike</code>. Each keyword is one search. Combine with <b>Country</b> and the filters below.",
            "items": {
              "type": "string"
            }
          },
          "pageIds": {
            "title": "Advertiser page IDs",
            "type": "array",
            "description": "Numeric Facebook page IDs of advertisers whose ads you want, e.g. <code>15087023444</code> (Nike). Find the ID in the Ad Library URL after <code>view_all_page_id=</code>. Returns every ad of the page in the selected country.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Ad Library URLs",
            "type": "array",
            "description": "URLs copied from the Facebook Ad Library, in the same form the official Facebook Ads Scraper takes: a keyword search (<code>...?q=nike&country=US...</code>), an advertiser page (<code>...?view_all_page_id=15087023444...</code>) or a single ad (<code>...?id=1785179045778580</code>). Filters in the URL (country, active status, media type, dates, platforms, languages, sorting) override the fields below. Plain Facebook page URLs work too: <code>https://www.facebook.com/Nike</code> returns every ad of that page.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Country of the audience: two-letter ISO code such as <code>US</code>, <code>GB</code> or <code>TH</code>, the English country name (<code>Thailand</code>), or <code>ALL</code> for every country.",
            "default": "ALL"
          },
          "activeStatus": {
            "title": "Ad status",
            "enum": [
              "all",
              "active",
              "inactive"
            ],
            "type": "string",
            "description": "<b>All</b> ads, only ads that are <b>Active</b> now, or only <b>Inactive</b> ones.",
            "default": "all"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Only ads with this kind of creative.",
            "default": "all"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "credit_ads"
            ],
            "type": "string",
            "description": "All ads, or only the special categories Facebook keeps for years: political and issue ads, housing, employment or credit ads.",
            "default": "all"
          },
          "publisherPlatforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Only ads shown on these Meta platforms. Empty = all platforms.",
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "audience_network",
                "messenger",
                "whatsapp",
                "threads"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Audience Network",
                "Messenger",
                "WhatsApp",
                "Threads"
              ]
            },
            "default": []
          },
          "searchType": {
            "title": "Keyword matching",
            "enum": [
              "keyword_unordered",
              "keyword_exact_phrase"
            ],
            "type": "string",
            "description": "<b>Unordered</b> finds ads containing all the words in any order (Facebook's default); <b>Exact phrase</b> needs the words together, in order.",
            "default": "keyword_unordered"
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "date",
              "impressions"
            ],
            "type": "string",
            "description": "<b>Date</b> puts the newest ads first (the Ad Library's \"Most recent\" order, by the month the ad started). <b>Impressions</b> puts the most viewed ads first (the Ad Library's \"Impressions: high to low\"); Facebook publishes impression ranges only for issue, election and political ads, so combine it with that ad category.",
            "default": "date"
          },
          "contentLanguages": {
            "title": "Ad languages",
            "type": "array",
            "description": "Only ads whose text is in these languages: two-letter ISO 639-1 codes such as <code>de</code>, <code>fr</code> or <code>pt</code>, one per line. Empty = any language.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "startDateMin": {
            "title": "Shown after",
            "type": "string",
            "description": "Only ads that were shown on or after this date (the Ad Library's <i>Impressions by date</i> filter; an ad that started earlier but was still running counts). A date <code>YYYY-MM-DD</code>, or a period before the run: <code>7d</code>, <code>30 days</code>, <code>3 weeks</code>, <code>2 months</code>, <code>1 year</code>, <code>today</code>, <code>yesterday</code>."
          },
          "startDateMax": {
            "title": "Shown before",
            "type": "string",
            "description": "Only ads that were shown on or before this date. Same forms as <b>Shown after</b>: <code>YYYY-MM-DD</code>, <code>yesterday</code>, <code>7d</code> and so on."
          },
          "maxAds": {
            "title": "Max ads per search",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of ads per keyword, page or URL. Each ad is one record; you pay only for records written.",
            "default": 100
          },
          "scrapeAdDetails": {
            "title": "Include ad details",
            "type": "boolean",
            "description": "Add the <code>ad_details</code> block to every ad: advertiser page info (About text, likes, Instagram followers, verification), payer and beneficiary, EU transparency with total reach and the reach by country, age and gender, plus spending for political advertisers. Slower (one extra lookup per ad), no surcharge.",
            "default": false
          },
          "watchlistId": {
            "title": "Watchlist name",
            "type": "string",
            "description": "Name of a watchlist that remembers every ad this run delivers, e.g. <code>nike-us</code>. The IDs are kept in a key-value store called <code>watchlist-&lt;name&gt;</code> in your account and updated after each run. Use the same name in every run of a schedule; leave empty to keep nothing."
          },
          "newAdsOnly": {
            "title": "New ads only",
            "type": "boolean",
            "description": "Skip ads that an earlier run with the same <b>Watchlist name</b> already delivered. They are neither written to the dataset nor charged; the log says how many were skipped. With <b>Date</b> sorting, each search is read to the end once a day and the runs in between read only the newest ads. Needs a watchlist name.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many keywords, pages or URLs are searched in parallel (default 5). Results of one search are always read in order.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Residential proxies are included in the price per ad. Leave the default unless you want to route the traffic through your own proxy servers.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}