{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Political Ad Spend Report Exporter",
    "description": "Export Meta Ad Library Report totals, advertiser spending, regional spend and top search keywords for political and issue ads, without login.",
    "version": "1.0",
    "x-build-id": "MAF88N8BTa3JyGGoT"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/xyrelith-data~fb-ad-library-spend-report/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-xyrelith-data-fb-ad-library-spend-report",
        "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/xyrelith-data~fb-ad-library-spend-report/runs": {
      "post": {
        "operationId": "runs-sync-xyrelith-data-fb-ad-library-spend-report",
        "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/xyrelith-data~fb-ad-library-spend-report/run-sync": {
      "post": {
        "operationId": "run-sync-xyrelith-data-fb-ad-library-spend-report",
        "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": "Mode",
            "enum": [
              "report",
              "totals",
              "advertisers",
              "regions",
              "keywords",
              "spendTracker"
            ],
            "type": "string",
            "description": "`report` returns the sections you select. `totals` returns only lifetime spend and ad totals, `advertisers` the spending leaderboard, `regions` spending by state/region with optional top spenders, `keywords` the week's top Ad Library searches, and `spendTracker` compares named advertisers over 30 or 90 days.",
            "default": "report"
          },
          "countries": {
            "title": "Countries",
            "uniqueItems": true,
            "type": "array",
            "description": "One or more countries Meta publishes the Ad Library Report for. Each country returns its own totals, advertisers, regions and keywords.",
            "items": {
              "type": "string",
              "enum": [
                "AD",
                "AE",
                "AG",
                "AI",
                "AL",
                "AM",
                "AO",
                "AQ",
                "AR",
                "AT",
                "AU",
                "AZ",
                "BA",
                "BB",
                "BD",
                "BE",
                "BF",
                "BG",
                "BH",
                "BI",
                "BJ",
                "BM",
                "BN",
                "BO",
                "BR",
                "BS",
                "BT",
                "BV",
                "BW",
                "BY",
                "BZ",
                "CA",
                "CD",
                "CF",
                "CG",
                "CH",
                "CI",
                "CL",
                "CM",
                "CO",
                "CR",
                "CV",
                "CY",
                "CZ",
                "DE",
                "DJ",
                "DK",
                "DM",
                "DO",
                "DZ",
                "EC",
                "EE",
                "EG",
                "ER",
                "ES",
                "ET",
                "FI",
                "FJ",
                "FK",
                "FM",
                "FR",
                "GA",
                "GB",
                "GD",
                "GE",
                "GG",
                "GH",
                "GI",
                "GM",
                "GN",
                "GQ",
                "GR",
                "GS",
                "GT",
                "GW",
                "GY",
                "HN",
                "HR",
                "HT",
                "HU",
                "ID",
                "IE",
                "IL",
                "IM",
                "IN",
                "IO",
                "IQ",
                "IS",
                "IT",
                "JE",
                "JM",
                "JO",
                "JP",
                "KE",
                "KG",
                "KH",
                "KI",
                "KM",
                "KN",
                "KW",
                "KY",
                "KZ",
                "LA",
                "LB",
                "LC",
                "LI",
                "LK",
                "LR",
                "LS",
                "LT",
                "LU",
                "LV",
                "LY",
                "MA",
                "MC",
                "MD",
                "ME",
                "MG",
                "MH",
                "MK",
                "ML",
                "MM",
                "MN",
                "MR",
                "MS",
                "MT",
                "MU",
                "MV",
                "MW",
                "MX",
                "MY",
                "MZ",
                "NA",
                "NE",
                "NG",
                "NI",
                "NL",
                "NO",
                "NP",
                "NR",
                "NZ",
                "OM",
                "PA",
                "PE",
                "PG",
                "PH",
                "PK",
                "PL",
                "PN",
                "PS",
                "PT",
                "PW",
                "PY",
                "QA",
                "RO",
                "RS",
                "RW",
                "SA",
                "SB",
                "SC",
                "SE",
                "SG",
                "SH",
                "SI",
                "SK",
                "SL",
                "SM",
                "SN",
                "SO",
                "SR",
                "SS",
                "ST",
                "SV",
                "SZ",
                "TC",
                "TD",
                "TG",
                "TH",
                "TJ",
                "TL",
                "TM",
                "TN",
                "TO",
                "TR",
                "TT",
                "TV",
                "TW",
                "TZ",
                "UA",
                "UG",
                "US",
                "UY",
                "UZ",
                "VA",
                "VC",
                "VE",
                "VG",
                "VN",
                "VU",
                "WS",
                "XK",
                "YE",
                "ZA",
                "ZM",
                "ZW"
              ],
              "enumTitles": [
                "Andorra",
                "United Arab Emirates",
                "Antigua",
                "Anguilla",
                "Albania",
                "Armenia",
                "Angola",
                "Antarctica",
                "Argentina",
                "Austria",
                "Australia",
                "Azerbaijan",
                "Bosnia and Herzegovina",
                "Barbados",
                "Bangladesh",
                "Belgium",
                "Burkina Faso",
                "Bulgaria",
                "Bahrain",
                "Burundi",
                "Benin",
                "Bermuda",
                "Brunei",
                "Bolivia",
                "Brazil",
                "The Bahamas",
                "Bhutan",
                "Bouvet Island",
                "Botswana",
                "Belarus",
                "Belize",
                "Canada",
                "Democratic Republic of the Congo",
                "Central African Republic",
                "Republic of the Congo",
                "Switzerland",
                "Côte d'Ivoire",
                "Chile",
                "Cameroon",
                "Colombia",
                "Costa Rica",
                "Cape Verde",
                "Cyprus",
                "Czech Republic",
                "Germany",
                "Djibouti",
                "Denmark",
                "Dominica",
                "Dominican Republic",
                "Algeria",
                "Ecuador",
                "Estonia",
                "Egypt",
                "Eritrea",
                "Spain",
                "Ethiopia",
                "Finland",
                "Fiji",
                "Falkland Islands",
                "Federated States of Micronesia",
                "France",
                "Gabon",
                "United Kingdom",
                "Grenada",
                "Georgia",
                "Guernsey",
                "Ghana",
                "Gibraltar",
                "The Gambia",
                "Guinea",
                "Equatorial Guinea",
                "Greece",
                "South Georgia and the South Sandwich Islands",
                "Guatemala",
                "Guinea-Bissau",
                "Guyana",
                "Honduras",
                "Croatia",
                "Haiti",
                "Hungary",
                "Indonesia",
                "Ireland",
                "Israel",
                "Isle of Man",
                "India",
                "British Indian Ocean Territory",
                "Iraq",
                "Iceland",
                "Italy",
                "Jersey",
                "Jamaica",
                "Jordan",
                "Japan",
                "Kenya",
                "Kyrgyzstan",
                "Cambodia",
                "Kiribati",
                "Comoros",
                "Saint Kitts and Nevis",
                "Kuwait",
                "Cayman Islands",
                "Kazakhstan",
                "Laos",
                "Lebanon",
                "St. Lucia",
                "Liechtenstein",
                "Sri Lanka",
                "Liberia",
                "Lesotho",
                "Lithuania",
                "Luxembourg",
                "Latvia",
                "Libya",
                "Morocco",
                "Monaco",
                "Moldova",
                "Montenegro",
                "Madagascar",
                "Marshall Islands",
                "Macedonia",
                "Mali",
                "Myanmar (Burma)",
                "Mongolia",
                "Mauritania",
                "Montserrat",
                "Malta",
                "Mauritius",
                "Maldives",
                "Malawi",
                "Mexico",
                "Malaysia",
                "Mozambique",
                "Namibia",
                "Niger",
                "Nigeria",
                "Nicaragua",
                "Netherlands",
                "Norway",
                "Nepal",
                "Nauru",
                "New Zealand",
                "Oman",
                "Panama",
                "Peru",
                "Papua New Guinea",
                "Philippines",
                "Pakistan",
                "Poland",
                "Pitcairn",
                "Palestine",
                "Portugal",
                "Palau",
                "Paraguay",
                "Qatar",
                "Romania",
                "Serbia",
                "Rwanda",
                "Saudi Arabia",
                "Solomon Islands",
                "Seychelles",
                "Sweden",
                "Singapore",
                "Saint Helena",
                "Slovenia",
                "Slovakia",
                "Sierra Leone",
                "San Marino",
                "Senegal",
                "Somalia",
                "Suriname",
                "South Sudan",
                "São Tomé and Príncipe",
                "El Salvador",
                "Eswatini",
                "Turks and Caicos Islands",
                "Chad",
                "Togo",
                "Thailand",
                "Tajikistan",
                "Timor-Leste",
                "Turkmenistan",
                "Tunisia",
                "Tonga",
                "Türkiye",
                "Trinidad and Tobago",
                "Tuvalu",
                "Taiwan",
                "Tanzania",
                "Ukraine",
                "Uganda",
                "United States",
                "Uruguay",
                "Uzbekistan",
                "Vatican City",
                "Saint Vincent and the Grenadines",
                "Venezuela",
                "British Virgin Islands",
                "Vietnam",
                "Vanuatu",
                "Samoa",
                "Kosovo",
                "Yemen",
                "South Africa",
                "Zambia",
                "Zimbabwe"
              ]
            },
            "default": [
              "US"
            ]
          },
          "timeWindow": {
            "title": "Date window",
            "enum": [
              "last_day",
              "last_7_days",
              "last_30_days",
              "last_90_days",
              "all_dates"
            ],
            "type": "string",
            "description": "Reporting window ending on the latest published day. Some EU countries publish only `all_dates`; the actor then uses that longer window and marks the row with `windowFallback`.",
            "default": "last_day"
          },
          "reportEndDate": {
            "title": "Report end date",
            "type": "string",
            "description": "Optional `YYYY-MM-DD` end date. Meta keeps only the seven most recent report dates; leave blank for the latest published date.",
            "default": ""
          },
          "sections": {
            "title": "Sections (mode=report)",
            "uniqueItems": true,
            "type": "array",
            "description": "Which report sections to return. Ignored by the focused modes, except that `regions` can add top spenders through `includeRegionSpenders`.",
            "items": {
              "type": "string",
              "enum": [
                "totals",
                "advertisers",
                "regions",
                "regionSpenders",
                "keywords"
              ],
              "enumTitles": [
                "Country totals",
                "Advertisers",
                "Spending by region",
                "Top spenders per region",
                "Top search keywords"
              ]
            },
            "default": [
              "totals",
              "advertisers",
              "regions",
              "regionSpenders",
              "keywords"
            ]
          },
          "advertiserFilter": {
            "title": "Advertiser name filter",
            "type": "string",
            "description": "Only return advertisers whose Page name or disclaimer contains this text. Applies to advertiser and region-spender rows; leave blank for all advertisers.",
            "default": ""
          },
          "sortBy": {
            "title": "Sort advertisers by",
            "enum": [
              "spend",
              "ads",
              "page_name"
            ],
            "type": "string",
            "description": "Order of the advertiser leaderboard. `spend` uses Meta's amount spent, `ads` its number of ads in the Library.",
            "default": "spend"
          },
          "sortOrder": {
            "title": "Sort direction",
            "enum": [
              "desc",
              "asc"
            ],
            "type": "string",
            "description": "Descending puts the biggest spenders first; ascending reverses the order.",
            "default": "desc"
          },
          "maxItems": {
            "title": "Max rows per country per section",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap for each section in each country. Meta publishes about 2,800 US advertisers for a single day and tens of thousands for all dates, so pagination stops at this cap.",
            "default": 5000
          },
          "regionSpenderLimit": {
            "title": "Top spenders per region",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "How many of each region's highest-spending advertisers to return when the `regionSpenders` section is enabled.",
            "default": 10
          },
          "includeDeletedAdvertisers": {
            "title": "Include deleted Pages",
            "type": "boolean",
            "description": "Keep advertisers whose Facebook Page has been deleted. The `isDeletedPage` field marks them.",
            "default": true
          },
          "includeRegionSpenders": {
            "title": "Include top spenders per region (mode=regions)",
            "type": "boolean",
            "description": "When mode is `regions`, also return the highest-spending advertisers in each region.",
            "default": true
          },
          "advertiserPageIds": {
            "title": "Advertiser Page IDs (mode=spendTracker)",
            "type": "array",
            "description": "Page IDs, Page URLs or Ad Library URLs to compare. Each row returns the advertiser's spend for the selected tracker window.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "spendTrackerWindow": {
            "title": "Spend tracker window (mode=spendTracker)",
            "enum": [
              "last_30_days",
              "last_90_days"
            ],
            "type": "string",
            "description": "Comparison window used by the report's spending tracker.",
            "default": "last_90_days"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}