{
  "openapi": "3.0.1",
  "info": {
    "title": "📢 Facebook Ads Library Scraper [From 💰$0.45/1K]",
    "description": "[From $0.45/1K] Extract active & inactive ads from the Meta / Facebook Ad Library by keyword, advertiser Page ID, or Ad Library URL — HD video MP4s, images, carousel cards, unwrapped landing pages, UTMs & days running.",
    "version": "0.0",
    "x-build-id": "ICUmGm1jdQoFnmZg5"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/misterkhan~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-misterkhan-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/misterkhan~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-misterkhan-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/misterkhan~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-misterkhan-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": "🔗 Facebook Ad Library URLs or Facebook Page URLs (Optional)",
            "type": "array",
            "description": "Paste one or more Facebook Ad Library search URLs (e.g., https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=shopify) or Facebook Page URLs.",
            "default": [
              {
                "url": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=shopify&search_type=keyword_unordered&media_type=all"
              }
            ],
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searchQueries": {
            "title": "🔍 Search Keywords / Competitor Brands (Optional)",
            "type": "array",
            "description": "Enter keywords, product niches, or brand names to search directly in the Meta Ad Library (e.g., [\"medspa\", \"creatine gummies\", \"gymshark\"]). Works alongside or instead of startUrls.",
            "items": {
              "type": "string"
            }
          },
          "pageIds": {
            "title": "🏢 Advertiser Facebook Page IDs (Optional)",
            "type": "array",
            "description": "Enter numeric Facebook Page IDs (`view_all_page_id`) to extract all ads run by specific advertisers (e.g., [\"359717073888008\"]).",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "🌍 Target Country Code (ISO-2 or ALL)",
            "type": "string",
            "description": "Two-letter ISO country code for the Ad Library search (e.g., US, GB, CA, AU, DE, FR, AE, IN, BR, or ALL).",
            "default": "US"
          },
          "activeStatus": {
            "title": "🟢 Ad Delivery Status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Filter by active delivery status: 'active' (currently running ads), 'inactive' (paused/ended ads), or 'all' (both active and inactive).",
            "default": "active"
          },
          "mediaType": {
            "title": "🎬 Creative Media Format Filter",
            "enum": [
              "all",
              "video",
              "image",
              "meme",
              "none"
            ],
            "type": "string",
            "description": "Filter ads by creative format: all formats, video ads only, image ads only, or meme/text ads.",
            "default": "all"
          },
          "platforms": {
            "title": "📱 Publisher Platforms (Optional)",
            "type": "array",
            "description": "Filter by Meta publisher placement (e.g., [\"FACEBOOK\", \"INSTAGRAM\", \"MESSENGER\", \"AUDIENCE_NETWORK\", \"THREADS\"]). Leave empty for all placements.",
            "items": {
              "type": "string"
            }
          },
          "minDaysRunning": {
            "title": "🏆 Winning Ad Filter — Minimum Days Active (Optional)",
            "minimum": 0,
            "type": "integer",
            "description": "Only output ads that have been running continuously for at least this many days (e.g., set to 14 or 30 to isolate proven, profitable evergreen ads). Set to 0 to include all ads.",
            "default": 0
          },
          "startDateMin": {
            "title": "📅 Start Date From (YYYY-MM-DD, Optional)",
            "type": "string",
            "description": "Filter ads launched on or after this date (format: YYYY-MM-DD)."
          },
          "startDateMax": {
            "title": "📅 Start Date To (YYYY-MM-DD, Optional)",
            "type": "string",
            "description": "Filter ads launched on or before this date (format: YYYY-MM-DD)."
          },
          "maxItems": {
            "title": "🔢 Max Ads to Extract",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of unique ads to extract across your search targets. Free plan runs are capped at 40 items per run; paid Apify plans support unlimited extraction.",
            "default": 40
          },
          "scrapeContacts": {
            "title": "📧 Landing Page Contacts Enrichment",
            "type": "boolean",
            "description": "When an ad has a website landing page, crawl that domain for emails, phones, and social profile links. Deduped per unique domain across ads. Bills `website-contacts` only on success (once per domain). Off by default.",
            "default": false
          },
          "scrapeTechStack": {
            "title": "🧩 Landing Page Tech Stack Scan",
            "type": "boolean",
            "description": "When an ad has a website landing page, detect CMS, analytics, pixels, and frameworks. Deduped per unique domain. Bills `tech-stack` only on success (once per domain). Off by default.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}