{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Ads Library Scraper (Optimized for Developers)",
    "description": "Scrape ads from Facebook Ad Library without cookies or authentication. Search by keywords or page names, filter by country, ad status, ad type, and media type. Extracts ad text, page info, media URLs, dates, CTA, landing page links, and more.",
    "version": "1.2",
    "x-build-id": "XGgrkIW77yCXNtyxD"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/w3crawler~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-w3crawler-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/w3crawler~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-w3crawler-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/w3crawler~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-w3crawler-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": {
          "query": {
            "title": "Search Query",
            "maxLength": 200,
            "type": "string",
            "description": "One public keyword or advertiser search term. Use this, queries, or startUrls.",
            "default": "Nike"
          },
          "queries": {
            "title": "Search Queries",
            "maxItems": 10,
            "uniqueItems": true,
            "type": "array",
            "description": "Optional additional public keyword or advertiser searches. At most 10 searches are run with the shared maxItems limit.",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "startUrls": {
            "title": "Ad Library URLs",
            "maxItems": 10,
            "uniqueItems": true,
            "type": "array",
            "description": "Optional existing public facebook.com/ads/library URLs. Only Meta Ad Library URLs are accepted; no external detail or private URLs are followed.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "title": "Public Ad Library URL",
                  "type": "string",
                  "description": "Public facebook.com/ads/library URL."
                }
              },
              "required": [
                "url"
              ],
              "additionalProperties": false
            }
          },
          "country": {
            "title": "Country Code",
            "pattern": "^[A-Za-z]{2}$",
            "type": "string",
            "description": "Two-letter ISO 3166-1 country code used by the public Ad Library search.",
            "default": "US"
          },
          "maxItems": {
            "title": "Max Items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of unique public ad records across all queries or URLs.",
            "default": 50
          },
          "maxPages": {
            "title": "Max Pages",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Maximum number of bounded list/load-more passes per search page.",
            "default": 10
          },
          "activeStatus": {
            "title": "Active Status",
            "enum": [
              "all",
              "active",
              "inactive"
            ],
            "type": "string",
            "description": "Public Ad Library status filter.",
            "default": "all"
          },
          "adType": {
            "title": "Ad Type",
            "enum": [
              "all",
              "political",
              "commercial"
            ],
            "type": "string",
            "description": "Public Ad Library ad-type filter.",
            "default": "all"
          },
          "mediaType": {
            "title": "Media Type",
            "enum": [
              "all",
              "image",
              "video"
            ],
            "type": "string",
            "description": "Public Ad Library media filter.",
            "default": "all"
          },
          "platform": {
            "title": "Publisher Platform",
            "enum": [
              "all",
              "facebook",
              "instagram",
              "audience_network",
              "messenger"
            ],
            "type": "string",
            "description": "Public publisher-platform filter used by the Ad Library URL.",
            "default": "all"
          },
          "includeDetails": {
            "title": "Include Ad Details",
            "type": "boolean",
            "description": "Include public page metadata, categories, carousel cards, transparency fields, and other detail fields when exposed.",
            "default": true
          },
          "includeMedia": {
            "title": "Include Media URLs",
            "type": "boolean",
            "description": "Include public image, video, preview, and media URL fields exposed in the page response.",
            "default": true
          },
          "includeRatings": {
            "title": "Include Ratings",
            "type": "boolean",
            "description": "Read public rating/review fields only if Meta exposes them in the current Ad Library response; absent fields are omitted.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "Maximum number of public search pages processed at once.",
            "default": 1
          },
          "delayMs": {
            "title": "Pacing Delay (ms)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Bounded delay after page settling and list advancement.",
            "default": 1500
          },
          "maxRequestRetries": {
            "title": "Max Request Retries",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Bounded Crawlee retries for a public page request. Access-denial pages are stopped, not retried to bypass the restriction.",
            "default": 2
          },
          "navigationTimeoutSecs": {
            "title": "Navigation Timeout (s)",
            "minimum": 30,
            "maximum": 180,
            "type": "integer",
            "description": "Maximum public page navigation time in seconds.",
            "default": 120
          },
          "requestHandlerTimeoutSecs": {
            "title": "Page Timeout (s)",
            "minimum": 60,
            "maximum": 900,
            "type": "integer",
            "description": "Maximum time allowed for one bounded public page handler.",
            "default": 600
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Optional Apify proxy configuration for permitted public traffic. A proxy is never used to bypass an access challenge; challenged pages fail closed.",
            "default": {},
            "additionalProperties": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}