{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook/Meta Ads Library Scraper API - Winning Ads, Scam Check",
    "description": "Scrape the Facebook/Meta Ads Library with no login: winning ads by days running and versions, with text, button, landing page, images and videos, plus advertiser leads and a brand scam check. $0.70 per 1,000 ads, 8x less than the most-used scraper, no start fee.",
    "version": "1.0",
    "x-build-id": "zBMXywXANmx5iWBoV"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/anshumanatrey~facebook-ads-library-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-anshumanatrey-facebook-ads-library-api",
        "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/anshumanatrey~facebook-ads-library-api/runs": {
      "post": {
        "operationId": "runs-sync-anshumanatrey-facebook-ads-library-api",
        "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/anshumanatrey~facebook-ads-library-api/run-sync": {
      "post": {
        "operationId": "run-sync-anshumanatrey-facebook-ads-library-api",
        "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": {
          "mode": {
            "title": "Report type (mode)",
            "enum": [
              "ads",
              "pages",
              "advertisers",
              "impersonation"
            ],
            "type": "string",
            "description": "Pick the report type you want back. Ads for keywords: every ad that matches your words. Ads of advertisers: all ads of the Facebook pages you list. Advertiser list: the businesses advertising on your keywords right now, one row each (a lead list). Brand scam check: ads that use a brand name from pages that are not the brand's own.",
            "default": "ads"
          },
          "searchTerms": {
            "title": "Keywords (searchTerms)",
            "type": "array",
            "description": "Type the keywords to search, one per line, for example running shoes. \"protein powder, creatine\" on one line counts as two. You can also paste an Ad Library search link: its keywords, country and filters are used. For the brand scam check, type the brand, for example Nike. Technical: Ad Library q, keyword search (unordered unless Exact phrase is on).",
            "items": {
              "type": "string"
            }
          },
          "pages": {
            "title": "Advertisers (pages)",
            "type": "array",
            "description": "For Ads of advertisers: the Facebook pages to list, one per line. A page link, a page id or just the name works, for example https://www.facebook.com/nike or Gymshark. Technical: page link, numeric page id, or a name resolved through the Ad Library page search.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Where ads run (country)",
            "type": "string",
            "description": "Pick where ads run: a country, or Worldwide (ALL). You can also type a name such as India or a code such as IN. Technical: Ad Library country filter, ISO 3166-1 alpha-2.",
            "default": "ALL"
          },
          "maxAds": {
            "title": "Ads per search (maxAds)",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Set the most ads per search to save for each keyword or advertiser. For the Advertiser list, the number of ads read to find advertisers. Technical: per-search cap; a spending limit also stops the run cleanly.",
            "default": 100
          },
          "status": {
            "title": "Ad status (status)",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Pick the ad status: only ads running now (the default), only ads that stopped, or both. Technical: active_status.",
            "default": "active"
          },
          "adType": {
            "title": "Ad category (adType)",
            "enum": [
              "all",
              "political",
              "housing",
              "employment",
              "credit"
            ],
            "type": "string",
            "description": "Pick the ad category: all ads, or one of Meta's special categories. Political and issue ads carry spend and impressions ranges. Technical: ad_type.",
            "default": "all"
          },
          "mediaType": {
            "title": "Media type (mediaType)",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "none"
            ],
            "type": "string",
            "description": "Pick the media type to keep: only ads with this kind of creative. Technical: media type, checked on the returned creatives.",
            "default": "all"
          },
          "minDaysRunning": {
            "title": "Min days live (minDaysRunning)",
            "minimum": 0,
            "maximum": 3650,
            "type": "integer",
            "description": "Keep only ads that have run at least this many days, for example 30. Ads that run for weeks are usually the ones that make money. Technical: days from delivery start to stop, or to today while active.",
            "default": 0
          },
          "exactPhrase": {
            "title": "Exact phrase (exactPhrase)",
            "type": "boolean",
            "description": "Match the keywords as one exact phrase instead of any order. Technical: KEYWORD_EXACT_PHRASE.",
            "default": false
          },
          "groupVersions": {
            "title": "Merge versions (groupVersions)",
            "type": "boolean",
            "description": "Keep one ad per group of versions (Meta groups the A/B variants of one ad). The versions column still says how many there are. Technical: one row per collation_id.",
            "default": false
          },
          "sortBy": {
            "title": "Order (sortBy)",
            "enum": [
              "impressions",
              "relevance"
            ],
            "type": "string",
            "description": "Pick the order the ads come in, which decides the ones you get when Ads per search stops the list. Technical: SORT_BY_TOTAL_IMPRESSIONS or relevancy.",
            "default": "impressions"
          },
          "officialPages": {
            "title": "Official pages (officialPages)",
            "type": "array",
            "description": "For the brand scam check: the brand's own Facebook pages, whose ads are skipped. Leave empty and the actor picks the pages whose name is the brand (listed in the run summary). Technical: page links, ids or names.",
            "default": [],
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}