{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper — Meta Ad Library, No Login",
    "description": "Scrape Facebook & Instagram ads from the Meta Ad Library by keyword, brand name, page, Instagram account or Ad Library link. Get ad copy, creatives, CTA, landing page, days running, EU reach and advertiser contacts. No login. Limits that hold, empty results are free. $0.60 per 1,000 ads.",
    "version": "0.1",
    "x-build-id": "uZjgsb15rf2W0Eb7e"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/anuarbakty~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-anuarbakty-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/anuarbakty~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-anuarbakty-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/anuarbakty~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-anuarbakty-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": {
          "startUrls": {
            "title": "Links: Ad Library search, Facebook page, Instagram account, or one ad",
            "type": "array",
            "description": "One per line:<br>• an <b>Ad Library link</b> copied from the address bar, with any filters set there (<code>facebook.com/ads/library/?…</code>)<br>• a <b>Facebook page link</b> (<code>facebook.com/nike</code>) → all ads of that page<br>• an <b>Instagram account link</b> (<code>instagram.com/aspendental</code>) → all ads of the page behind it<br>• a link to <b>one ad</b> (<code>facebook.com/ads/library/?id=…</code>)<br>Filters in a link win; the fields below fill in what the link does not set. The field is also read under the name <code>urls</code>.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searchTerms": {
            "title": "Keywords",
            "type": "array",
            "description": "Words or phrases to search the library for, one per line. Each keyword is a separate source with its own limit.",
            "items": {
              "type": "string"
            }
          },
          "pageNames": {
            "title": "Brand or page names",
            "type": "array",
            "description": "Names of advertisers as they are written on their pages, one per line. The Actor finds the page whose name is exactly this and collects its ads; when no page matches, a free notice row lists the closest ones with their Page IDs.",
            "items": {
              "type": "string"
            }
          },
          "instagramHandles": {
            "title": "Instagram accounts",
            "type": "array",
            "description": "Instagram account names (<code>@aspendental</code>) or account links, one per line. The Actor finds the page that advertises for the account and collects its ads.",
            "items": {
              "type": "string"
            }
          },
          "pageIds": {
            "title": "Page IDs",
            "type": "array",
            "description": "Numeric Facebook Page IDs of advertisers, one per line. A page link above works too: the Actor finds the ID itself.",
            "items": {
              "type": "string"
            }
          },
          "adIds": {
            "title": "Library IDs of single ads",
            "type": "array",
            "description": "The \"Library ID\" shown on an ad in the Ad Library, one per line. Each gives one row, or a free notice row when the library no longer shows the ad.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Two-letter country code (US, DE, BR…) or ALL for every country. Ads are matched by where they are delivered.",
            "default": "ALL"
          },
          "countries": {
            "title": "Several countries",
            "type": "array",
            "description": "Optional. Every keyword and page is collected once per country listed here, each with its own limit and its own count. Replaces the single country above.",
            "items": {
              "type": "string"
            }
          },
          "activeStatus": {
            "title": "Active status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Active ads are running now. Inactive ads have stopped but are still kept in the library.",
            "default": "active"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Keep only ads with this kind of creative.",
            "default": "all"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "financial_products_and_services_ads"
            ],
            "type": "string",
            "description": "The library's special categories. Spend, impressions and \"paid for by\" are published only for the political category.",
            "default": "all"
          },
          "publisherPlatforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Keep only ads delivered on these platforms. Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "audience_network",
                "messenger",
                "threads",
                "whatsapp"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Audience Network",
                "Messenger",
                "Threads",
                "WhatsApp"
              ]
            }
          },
          "contentLanguages": {
            "title": "Languages",
            "type": "array",
            "description": "Keep only ads in these languages, as two-letter codes: en, es, de, fr, pt, ru… Empty = all.",
            "items": {
              "type": "string"
            }
          },
          "exactPhrase": {
            "title": "Keywords as an exact phrase",
            "type": "boolean",
            "description": "On: an ad must contain the keyword words together, in this order. Off: the words in any order.",
            "default": false
          },
          "sortBy": {
            "title": "Order",
            "enum": [
              "default",
              "impressions",
              "newest"
            ],
            "type": "string",
            "description": "The order of the first 30 ads of every source. Beyond 30 the Actor reads a source from its newest ads down, whichever order is chosen here.",
            "default": "default"
          },
          "startedAfter": {
            "title": "Started on or after",
            "type": "string",
            "description": "Keep only ads whose start date is this day or later. A date, or a span back from today such as \"7 days\" or \"3 months\"."
          },
          "startedBefore": {
            "title": "Started before",
            "type": "string",
            "description": "Keep only ads that started before this day."
          },
          "activeSince": {
            "title": "Still running on or after",
            "type": "string",
            "description": "Keep only ads that were still being shown on this day or later, whenever they started. For active ads this changes nothing; for inactive ads it cuts off those that ended earlier."
          },
          "minDaysRunning": {
            "title": "Running for at least this many days",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only ads that have been running this long: ads that survive for weeks are usually the ones that pay off. 0 = no filter. Younger ads are left out before they are read, so they cost nothing.",
            "default": 0
          },
          "maxAdsPerSource": {
            "title": "Ads per source",
            "minimum": 0,
            "type": "integer",
            "description": "How many ads to collect from each link, keyword, page and country. 0 = as many as the library gives. Also read as resultsLimit and limitPerSource.",
            "default": 100
          },
          "maxItems": {
            "title": "Ads per run",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many ads in total. 0 = no total limit. Also read as count, maxAds, maxResults and limit. The run never spends more than the cost limit set in Apify either.",
            "default": 0
          },
          "countOnly": {
            "title": "Only count the ads",
            "type": "boolean",
            "description": "One free row per source with the number of ads the library holds for it, and no ads. A quick way to see what a run would cost before running it.",
            "default": false
          },
          "deepSearch": {
            "title": "Deep search on keywords",
            "type": "boolean",
            "description": "The library shows a visitor only the top ads of each day. On: when a keyword source needs more than that, the Actor also reads every advertiser it finds for the keyword on its own, which reaches most of what the screens hide. It makes more requests, not more charges: you still pay per ad. Off: only the date walk.",
            "default": true
          },
          "includeAdDetails": {
            "title": "Ad details: EU and UK reach, who paid, advertiser's Instagram",
            "type": "boolean",
            "description": "Opens the details of every ad: the payer and the beneficiary, EU and UK reach with a breakdown by country, age and gender, the targeting the advertiser chose, and the advertiser's page with its Instagram account and follower count. Reach exists only for ads delivered in the EU or UK. One more request per ad, at no extra price.",
            "default": false
          },
          "includePageInfo": {
            "title": "Advertiser page: website, phone, email, address",
            "type": "boolean",
            "description": "Reads the page of every advertiser once per run and adds what its card shows a visitor: categories, website, phone, email, address with coordinates, rating, price range, the confirmed owner, the linked Instagram account and the follower count. Also read as includeAboutPage. Pages that show no card to visitors come with the reason.",
            "default": false
          },
          "saveMedia": {
            "title": "Save creatives to storage",
            "enum": [
              "none",
              "images",
              "all"
            ],
            "type": "string",
            "description": "Meta's links to images and videos expire in a few days. This copies the files into the key-value store of the run and adds their lasting links to every row (<code>mediaFiles</code>). Videos can be large.",
            "default": "none"
          },
          "mediaStoreName": {
            "title": "Storage name for saved creatives",
            "type": "string",
            "description": "Optional. A named key-value store keeps the files for as long as you want; without a name they go to the run's own store and live as long as the run's data does on your plan. Letters, digits and hyphens."
          },
          "longRunningDays": {
            "title": "Long-running from this many days",
            "minimum": 0,
            "type": "integer",
            "description": "Every row carries <code>isLongRunning</code>: whether the ad has run at least this many days. 0 turns the flag off. The <code>winnerScore</code> field (0–100) is always there.",
            "default": 30
          },
          "includeRaw": {
            "title": "Add Meta's original object",
            "type": "boolean",
            "description": "Adds a \"raw\" field with the ad exactly as the library returns it, next to the flat fields.",
            "default": false
          },
          "runTag": {
            "title": "Run tag",
            "type": "string",
            "description": "Any text; it is copied into the runTag field of every row, to tell runs apart after merging datasets."
          },
          "onlyNew": {
            "title": "Only ads not delivered before",
            "type": "boolean",
            "description": "The Actor remembers the ads of this input and delivers only new ones on the next runs.",
            "default": false
          },
          "monitoringName": {
            "title": "Monitoring memory name",
            "type": "string",
            "description": "Optional. By default each set of sources and filters has its own memory. A name lets several schedules share one memory, or start a fresh one on purpose."
          },
          "resetMonitoring": {
            "title": "Forget what was delivered",
            "type": "boolean",
            "description": "Clears the monitoring memory of this input before the run, so everything is delivered again.",
            "default": false
          },
          "trackChanges": {
            "title": "Also deliver changed and stopped ads",
            "type": "boolean",
            "description": "Every run delivers what is different from the run before: new ads, ads whose text, landing page or number of versions changed, and ads that stopped. Each row says which in <code>change</code> and <code>changedFields</code>. Ads that did not change are skipped for free.",
            "default": false
          },
          "webhookUrl": {
            "title": "Webhook address",
            "type": "string",
            "description": "A Slack or Discord incoming-webhook link gets a short message with the first ads; any other address gets a JSON body with the counts per source, the first ads and the dataset link. Also read as slackWebhookUrl."
          },
          "notifyWhen": {
            "title": "When to notify",
            "enum": [
              "newAds",
              "always"
            ],
            "type": "string",
            "description": "With monitoring on, \"only when the run delivered ads\" means: only when there is something new.",
            "default": "newAds"
          },
          "diagnosticRows": {
            "title": "Notice rows in the dataset",
            "type": "boolean",
            "description": "A free row for every source that gave nothing or less than asked, with the reason: no ads, page not found, ad removed, or only part of the ads reachable. Off: the reasons stay in the log and in the SUMMARY record.",
            "default": true
          },
          "deduplicate": {
            "title": "One row per ad in a run",
            "type": "boolean",
            "description": "On: an ad found by several sources of one run (two keywords, or the same page in two countries) is delivered and charged once, under the source that found it first. Off: every source delivers all of its ads, so the same ad can come several times with different inputs.",
            "default": true
          },
          "pageNameMatch": {
            "title": "When several pages carry the same name",
            "enum": [
              "top",
              "all"
            ],
            "type": "string",
            "description": "A brand name can belong to several pages: the brand itself, its regional pages, or unrelated businesses. Either way the SUMMARY record lists every page that carried the name.",
            "default": "top"
          },
          "strictInput": {
            "title": "Stop on unknown input fields",
            "type": "boolean",
            "description": "On: an input field the Actor does not know stops the run before the first request, so a mistyped limit cannot lead to an unexpected bill; the run ends with a free notice row that names the field. Off: unknown fields are ignored with a warning.",
            "default": true
          },
          "failIfAllInputsFail": {
            "title": "Fail the run when every source gives a notice",
            "type": "boolean",
            "description": "Off: a source that gives nothing comes as a free notice row with the reason (no ads, page not found, ad removed, a link or date that cannot be read, an unknown input field, or the library not readable after all retries), and the run finishes as succeeded even when every source ended that way, so an automation that sends one page per run keeps going. On: the run fails when nothing was collected and every source ended with a notice, so an automation can catch it by the run status.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Leave empty: the Actor uses Apify datacenter proxies and switches a failing request to residential ones by itself. Set your own only if you need to."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}