{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ad Library Scraper - Ads & Advertisers",
    "description": "Scrape Facebook Ad Library ads and advertiser signals for competitive research and creative monitoring. Export structured ad metadata without building browser automation from scratch.",
    "version": "0.6",
    "x-build-id": "DyqhtaWiZznCk0uKd"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/lentic_clockss~facebook-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-lentic_clockss-facebook-ad-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/lentic_clockss~facebook-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-lentic_clockss-facebook-ad-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/lentic_clockss~facebook-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-lentic_clockss-facebook-ad-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": {
          "searchQuery": {
            "title": "Search Query",
            "type": "string",
            "description": "Keyword to search (optional if searchQueries / pageIds / pageUrls provided). Empty Store auto-tests use this default.",
            "default": "shopify"
          },
          "searchQueries": {
            "title": "Search Queries (batch)",
            "type": "array",
            "description": "Run multiple keyword searches in one Actor run. Each ad is tagged with searchQuery.",
            "items": {
              "type": "string"
            }
          },
          "pageIds": {
            "title": "Page IDs",
            "type": "array",
            "description": "Meta Page IDs to search (search_type=PAGE). Overrides keyword for those jobs.",
            "items": {
              "type": "string"
            }
          },
          "pageUrls": {
            "title": "Page URLs",
            "type": "array",
            "description": "Facebook Page profile URLs; resolved to page IDs via typeahead before search.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "ISO country code to filter ads by reach country. Use 'ALL' for all countries.",
            "default": "US"
          },
          "adType": {
            "title": "Ad Type",
            "enum": [
              "all",
              "political_and_issue_ads"
            ],
            "type": "string",
            "description": "Type of ads: 'all' or 'political_and_issue_ads'.",
            "default": "all"
          },
          "activeStatus": {
            "title": "Active Status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Filter by ad status.",
            "default": "active"
          },
          "mediaType": {
            "title": "Media Type",
            "enum": [
              "all",
              "image",
              "video"
            ],
            "type": "string",
            "description": "Filter creatives by media. Carousel ads are not a separate mediaType — use displayFormat after scrape.",
            "default": "all"
          },
          "sortBy": {
            "title": "Sort By",
            "enum": [
              "relevancy",
              "newest",
              "impressions"
            ],
            "type": "string",
            "description": "Result ordering. 'relevancy' omits sortData; 'newest' uses monthly-grouped relevancy; 'impressions' sorts by total impressions.",
            "default": "relevancy"
          },
          "startDateFrom": {
            "title": "Start date from",
            "type": "string",
            "description": "Keep ads whose startDate is on/after this ISO date (YYYY-MM-DD or full ISO)."
          },
          "startDateTo": {
            "title": "Start date to",
            "type": "string",
            "description": "Keep ads whose startDate is on/before this ISO date."
          },
          "maxResults": {
            "title": "Max Results (per search job; free users capped at 1,000/run)",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum ads per keyword/page job (1–5,000). Free Apify plan users are limited to 1,000 ads per run and 10 total runs of this Actor — limits set by the Actor developer.",
            "default": 100
          },
          "enrichDetails": {
            "title": "Enrich ad details",
            "type": "boolean",
            "description": "Call AdLibraryAdDetailsV2Query per ad for EU aaa_info / extra disclosure fields (slower, more proxy traffic).",
            "default": false
          },
          "maxDetails": {
            "title": "Max detail enrichments",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Cap how many ads get detail enrichment in one run (0 = all collected).",
            "default": 25
          },
          "expandCollations": {
            "title": "Expand collation variants",
            "type": "boolean",
            "description": "When collationCount > 1, fetch sibling creatives via /ads/library/async/collation/.",
            "default": false
          },
          "downloadAssets": {
            "title": "Download creative assets",
            "type": "boolean",
            "description": "Download first image/video per ad into Key-Value Store (keys under assets/).",
            "default": false
          },
          "incremental": {
            "title": "Incremental mode",
            "type": "boolean",
            "description": "Skip adArchiveIds already seen in this Actor's checkpoint; only push new ads and update the checkpoint.",
            "default": false
          },
          "chargeResults": {
            "title": "Charge per result",
            "type": "boolean",
            "description": "Call Actor.charge('result-item') for each pushed dataset item. Requires the event to be configured in Actor monetization; leave false until then.",
            "default": false
          },
          "proxy": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Proxy configuration. Used when the Actor mints Apify RESIDENTIAL. Ignored when Actor env WORKER_PROVIDES_PROXY=1 (worker uses its own PROXY_URL)."
          },
          "workerBaseUrl": {
            "title": "Worker base URL (optional)",
            "type": "string",
            "description": "Override the Cloud Run worker origin for this run. Defaults to Actor env WORKER_BASE_URL. Use when testing a staging worker; production migrations should update WORKER_BASE_URL in Actor settings (no code change)."
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}