{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper | Meta Ad Library API",
    "description": "Export Facebook Ads Library ads by keyword, advertiser or link. Get Facebook and Instagram creatives, ad copy, landing pages and run dates from the Meta Ad Library. Filter by country, platform and date, then schedule a feed of new competitor ads. CSV, JSON and API.",
    "version": "0.1",
    "x-build-id": "pbzum9bZq4a1M61Bk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automatic~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automatic-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/automatic~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-automatic-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/automatic~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-automatic-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": {
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords to search ad text for, as you would type them in the Ads Library search box. Each term is one search. An input with no search terms, page IDs or links (and no limit) runs a small example: up to 10 ads for running shoes. Example: [\"running shoes\"]. An empty list is treated as omitted. With all three source lists empty and no explicit limits, the run collects the same small paid running-shoes sample as {}. Nonempty sources retain their own searches.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "pageIds": {
            "title": "Advertiser page IDs",
            "type": "array",
            "description": "Advertiser page IDs, exact page names, or facebook.com/name, fb.com/name and instagram.com/name profile links. Ambiguous or unknown names are skipped. Example: Nike or https://www.facebook.com/nike.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "adLibraryUrls": {
            "title": "Ads Library search links",
            "type": "array",
            "description": "Search or advertiser links from facebook.com/ads/library. Supported filters include country, ad status, media type, date, exact phrase and platforms. A link with an unsupported filter is skipped with a reason. With no sources or limits, the run collects the small paid running-shoes sample.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Two-letter country code where the ads were shown (US, GB, DE, BR...), or ALL for every country. Example: \"US\". If empty, uses \"US\".",
            "default": "US"
          },
          "activeStatus": {
            "title": "Ad status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Only ads running now, only ads that have stopped, or both. Example: \"active\". If empty, uses \"active\".",
            "default": "active"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Limit results to ads with this kind of media. Example: \"all\". If empty, uses \"all\".",
            "default": "all"
          },
          "adCategory": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "credit_ads"
            ],
            "type": "string",
            "description": "All ads, or only one of the Ads Library's special categories: political and issue ads (these carry spend, impressions and the paid-for-by line), housing, employment, or financial products and services. Applied to search terms and advertiser pages; a pasted link keeps its own ad_type. Example: \"political_and_issue_ads\". If empty, uses \"all\".",
            "default": "all"
          },
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Find ads that run on any selected Meta platform. Leave empty for all platforms. Example: [\"instagram\"]. A pasted Ads Library link with its own platform selection uses that selection.",
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "messenger",
                "audience_network",
                "threads",
                "whatsapp"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Messenger",
                "Audience Network",
                "Threads",
                "WhatsApp"
              ]
            }
          },
          "keywordMatch": {
            "title": "Keyword match",
            "enum": [
              "any_words",
              "exact_phrase"
            ],
            "type": "string",
            "description": "How search terms match ad text: any of the words (the Ads Library default) or the exact phrase. A pasted link keeps its own search_type. Example: \"exact_phrase\". If empty, uses \"any_words\".",
            "default": "any_words"
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "impressions",
              "newest"
            ],
            "type": "string",
            "description": "Result order, as the Ads Library's own sort: most impressions first, or newest first (most recently started ads first, grouped by month). With a limit, the order decides which ads you get. Leave empty for most impressions; with \"Only new ads since the last run\" on, empty means newest first. Example: \"newest\"."
          },
          "dateFrom": {
            "title": "Shown on or after",
            "type": "string",
            "description": "Only ads that were running on or after this day: YYYY-MM-DD, or a period before today such as \"7 days\", \"2 weeks\" or \"1 month\" (handy for schedules). An ad that started earlier and was still running counts, as on the Ads Library site. Leave empty for no start limit. Example: \"30 days\"."
          },
          "dateTo": {
            "title": "Shown on or before",
            "type": "string",
            "description": "Only ads that started running on or before this day: YYYY-MM-DD or a period before today such as \"7 days\". Leave empty for no end limit. Example: \"2026-10-31\"."
          },
          "onlyNewSinceLastRun": {
            "title": "Only new ads since the last run",
            "type": "boolean",
            "description": "Return only ads this actor has not delivered for the same search before. Schedule the same input daily or weekly and each run returns just the ads that appeared since the previous one; ads you already have are skipped and not charged. The first run returns everything up to your limit. Example: true.",
            "default": false
          },
          "monitorName": {
            "title": "Feed name",
            "type": "string",
            "description": "Optional name that keeps a separate new-ads history, for example one per client or project. Runs with the same searches and the same name share one history. Letters, digits, dots, dashes and underscores. Example: \"client-a\"."
          },
          "includeEuDetails": {
            "title": "Add EU transparency details",
            "type": "boolean",
            "description": "Also get each ad's EU transparency data from the Ads Library's \"See ad details\": total EU reach, reach by country, age and gender, the audience it targeted (locations, age, gender), and who paid for it and who benefits. UK data is added when Meta publishes it. Ads not shown in the EU get a short note instead. Runs take longer: one extra lookup per ad. Example: true.",
            "default": false
          },
          "downloadMedia": {
            "title": "Save the ad media files",
            "enum": [
              "off",
              "images",
              "images_and_videos"
            ],
            "type": "string",
            "description": "Copy each delivered ad's media into the run's key-value store, so you keep the creatives after the Ads Library's links expire: images and video thumbnails with \"images\", plus the videos themselves with \"images_and_videos\" (files up to 20 MB each). Each row lists its saved files in mediaFiles. Included at no extra charge for now. Example: \"images\"."
          },
          "maxItems": {
            "title": "Maximum ads per run",
            "minimum": 1,
            "type": "integer",
            "description": "Optional total ad limit across all searches. Leave empty for no extra run-wide limit. Rows beyond this limit are not charged. Example: 1. Omitting this field applies no additional run-wide ad limit. A cleared form value is treated as omitted."
          },
          "maxItemsPerSearch": {
            "title": "Maximum ads per search",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop each search after this many ads. Ads already returned by an earlier search in the same run are not repeated. Example: 50. Omitting this field uses 100 ads per search, or 10 for the bare-input sample. A cleared form value is treated as omitted."
          },
          "maxAdsPerAdvertiser": {
            "title": "Maximum ads per advertiser",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Keep at most this many ads from one advertiser page in each search, so a keyword search shows the whole market instead of one advertiser filling every row. Ads beyond the limit are skipped and not charged; if the Ads Library keeps serving only ads beyond it, the search stops early with stopReason \"advertiserLimit\" and the rest stays unknown. Example: 3. Omitting this field applies no per-advertiser limit. A cleared form value is treated as omitted."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}