{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Ad Reach & Political Ad Spend ($0.50/1k)",
    "description": "⚡ Fast & Cheap ($0.50/1k): Scrape Facebook & Meta EU DSA ad reach, UK reach, age & gender data & political ad spend. Payer, beneficiary & impression ranges.",
    "version": "1.0",
    "x-build-id": "JHcXimtieTcUgY2Of"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/unitbytes~facebook-ad-reach-spend-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-unitbytes-facebook-ad-reach-spend-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/unitbytes~facebook-ad-reach-spend-scraper/runs": {
      "post": {
        "operationId": "runs-sync-unitbytes-facebook-ad-reach-spend-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/unitbytes~facebook-ad-reach-spend-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-unitbytes-facebook-ad-reach-spend-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": {
          "queries": {
            "title": "Search Keywords, Brand Names, or Issue Topics",
            "maxItems": 50,
            "type": "array",
            "description": "Search commercial brands in EU/UK markets (e.g. `Zalando`, `Shopify`) for EU DSA / UK reach & demographics, or civic/election topics (`senate`, `climate`) for political spend & impressions (up to 50 queries per run).",
            "items": {
              "type": "string"
            }
          },
          "urls": {
            "title": "Facebook Page URLs or Ad Library URLs (Optional)",
            "maxItems": 25,
            "type": "array",
            "description": "Paste Facebook Page URLs (`https://www.facebook.com/nike`), Instagram URLs, or Meta Ad Library URLs (`facebook.com/ads/library/?...`), up to 25 URLs per run.",
            "items": {
              "type": "string"
            }
          },
          "adIds": {
            "title": "Direct Ad Archive IDs (Optional)",
            "maxItems": 50,
            "type": "array",
            "description": "Specific Meta Ad Archive IDs to inspect reach, payer/beneficiary, or spend disclosures (up to 50 queries/IDs per run).",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Jurisdiction / Country Code",
            "type": "string",
            "description": "Use EU member-state ISO codes (`DE`, `FR`, `NL`, `ES`, `IT`, `AT`, `PL`, `SE`, `IE`) or `GB` (`UK`) for total reach & age/gender breakdowns, or `US` / `GB` / `BR` with `adType: political_and_issue_ads` for political spend.",
            "default": "DE"
          },
          "adType": {
            "title": "Transparency Category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "credit_ads"
            ],
            "type": "string",
            "description": "Select 'All Ads' in EU countries for DSA commercial reach disclosures, or 'Issues, Elections or Politics' for spend & impression ranges.",
            "default": "all"
          },
          "activeStatus": {
            "title": "Ad Delivery Status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Include active ads, historical ended ads, or both.",
            "default": "active"
          },
          "sortBy": {
            "title": "Sort Order",
            "enum": [
              "default",
              "impressions",
              "relevancy"
            ],
            "type": "string",
            "description": "Sort by highest impressions/reach first or default order.",
            "default": "impressions"
          },
          "startDateMin": {
            "title": "Active Window From (YYYY-MM-DD)",
            "type": "string",
            "description": "Matches Meta Ad Library's native date filter (`start_date[min]`): returns ads active on or after this date (e.g. `2026-01-01`)."
          },
          "startDateMax": {
            "title": "Active Window Until (YYYY-MM-DD)",
            "type": "string",
            "description": "Matches Meta Ad Library's native date filter (`start_date[max]`): returns ads started on or before this date (e.g. `2026-12-31`)."
          },
          "scrapeAdDetails": {
            "title": "Extract Per-Ad EU DSA Reach, Demographics & Payer Disclosures",
            "type": "boolean",
            "description": "Fetches full EU DSA reach totals, per-country age & gender reach breakdowns, payer/beneficiary entities, and advertiser page spend.",
            "default": true
          },
          "maxItems": {
            "title": "Maximum Ads to Scrape",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Maximum total ads to return.",
            "default": 20
          },
          "resumptionToken": {
            "title": "Resumption Token",
            "type": "string",
            "description": "Paste `resumptionToken` from `RESUMPTION_TOKEN` in Key-Value Store to continue multi-batch archival runs without duplicates."
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Apify Residential Proxy is automatically configured on cloud runs.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}