{
  "openapi": "3.0.1",
  "info": {
    "title": "Microsoft Ad Library Scraper — Bing Ads Transparency (DSA)",
    "description": "Scrape the Microsoft Advertising Ad Library (Bing ads shown in the EU/EEA): ad text, landing pages, images, who paid, delivery dates, impressions and share per country, targeting types. Splits searches automatically past the 1,000-result limit.",
    "version": "0.1",
    "x-build-id": "6w1xVuzfozkTBzSKY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/rastriq~microsoft-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-rastriq-microsoft-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/rastriq~microsoft-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-rastriq-microsoft-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/rastriq~microsoft-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-rastriq-microsoft-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": {
          "advertisers": {
            "title": "🏢 Advertisers",
            "type": "array",
            "description": "Advertiser names or Microsoft advertiser ids (the number in <code>adlibrary.ads.microsoft.com/advertiser/&lt;id&gt;</code>).<br><br>A name is looked up in the library; every account whose name contains it as a whole word is scraped (e.g. <code>Decathlon</code> → Decathlon France, Spain, Germany…). Use <b>Advertiser name match</b> to change that.",
            "items": {
              "type": "string"
            }
          },
          "searchTerms": {
            "title": "🔍 Search terms",
            "type": "array",
            "description": "Words that appear in the ad text, for any advertiser (e.g. <code>zapatillas</code>, <code>vpn</code>). Combine with <b>Countries</b> to keep it focused.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "💯 Max ads",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum ads in the dataset for the whole run. 0 = no limit.",
            "default": 1000
          },
          "startDate": {
            "title": "📅 From",
            "type": "string",
            "description": "Ads <b>active at any time</b> in the period, including ads that started earlier. Absolute (<code>2026-01-01</code>) or relative (<code>30 days</code>).",
            "default": "30 days"
          },
          "endDate": {
            "title": "📅 To",
            "type": "string",
            "description": "End of the period. Empty = today."
          },
          "countries": {
            "title": "🌍 Countries",
            "uniqueItems": true,
            "type": "array",
            "description": "Countries where the ads were shown (EU + Iceland, Liechtenstein, Norway). Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "AT",
                "BE",
                "BG",
                "HR",
                "CY",
                "CZ",
                "DK",
                "EE",
                "FI",
                "FR",
                "DE",
                "GR",
                "HU",
                "IE",
                "IT",
                "LV",
                "LT",
                "LU",
                "MT",
                "NL",
                "PL",
                "PT",
                "RO",
                "SK",
                "SI",
                "ES",
                "SE",
                "IS",
                "LI",
                "NO"
              ],
              "enumTitles": [
                "🇦🇹 Austria",
                "🇧🇪 Belgium",
                "🇧🇬 Bulgaria",
                "🇭🇷 Croatia",
                "🇨🇾 Cyprus",
                "🇨🇿 Czechia",
                "🇩🇰 Denmark",
                "🇪🇪 Estonia",
                "🇫🇮 Finland",
                "🇫🇷 France",
                "🇩🇪 Germany",
                "🇬🇷 Greece",
                "🇭🇺 Hungary",
                "🇮🇪 Ireland",
                "🇮🇹 Italy",
                "🇱🇻 Latvia",
                "🇱🇹 Lithuania",
                "🇱🇺 Luxembourg",
                "🇲🇹 Malta",
                "🇳🇱 Netherlands",
                "🇵🇱 Poland",
                "🇵🇹 Portugal",
                "🇷🇴 Romania",
                "🇸🇰 Slovakia",
                "🇸🇮 Slovenia",
                "🇪🇸 Spain",
                "🇸🇪 Sweden",
                "🇮🇸 Iceland",
                "🇱🇮 Liechtenstein",
                "🇳🇴 Norway"
              ]
            }
          },
          "fetchDetails": {
            "title": "🧾 Fetch details",
            "type": "boolean",
            "description": "Add <b>paid for by</b>, start/end date, total impressions range, impression share per country and targeting types. One extra request per ad; Microsoft allows about <b>3–5 per minute</b>, so 100 ads with details take ~20–35 min. Charged per ad with details.<br><br>Turn off for a fast list of ads (text, landing page, images).",
            "default": true
          },
          "maxDetails": {
            "title": "Max ads with details",
            "minimum": 0,
            "type": "integer",
            "description": "Fetch details for the first N ads only; the rest are delivered without them (flag <code>details_skipped_limit</code>). 0 = all.",
            "default": 0
          },
          "advertiserMatch": {
            "title": "Advertiser name match",
            "enum": [
              "word",
              "contains",
              "exact",
              "any"
            ],
            "type": "string",
            "description": "How a name in <b>Advertisers</b> is matched against the library's accounts. <b>Whole word</b> keeps <i>Nike - EMEA</i> for <code>Nike</code> but not <i>…Steinike</i>.",
            "default": "word"
          },
          "splitLargeQueries": {
            "title": "Split searches over 1,000 ads",
            "type": "boolean",
            "description": "Microsoft returns at most 1,000 ads per search. When a search hits that limit it is split by country, then by date down to single days. A slice still over 1,000 is flagged <code>slice_truncated_at_1000</code>. Off = take the first 1,000 only.",
            "default": true
          },
          "outputFormat": {
            "title": "📄 Output format",
            "enum": [
              "flat",
              "nested"
            ],
            "type": "string",
            "description": "<b>Flat</b> (default): every value in its own column — lists become comma-separated text, reach per country becomes <code>reach_min_DE</code> / <code>reach_max_DE</code> columns, and art. 39 coverage becomes <code>art39_ratio</code> / <code>art39_missing</code>.<br><br><b>Nested</b>: keeps the source's original objects and lists (e.g. the full per-language variations or per-country breakdown) for programmatic use.",
            "default": "flat"
          },
          "hashPersonalNames": {
            "title": "🔒 Pseudonymise personal names",
            "type": "boolean",
            "description": "Some advertisers are private individuals (sole traders). Every such row is flagged <code>is_natural_person_suspected</code>; turn this on to replace those names with a stable SHA-256 pseudonym.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "🔒 Proxy",
            "type": "object",
            "description": "Not needed normally."
          },
          "listIntervalSec": {
            "title": "⏱️ Pause between list requests",
            "minimum": 2,
            "maximum": 30,
            "type": "integer",
            "description": "Raised automatically after a block (Azure Front Door), lowered again after successes.",
            "default": 3
          },
          "detailIntervalSec": {
            "title": "⏱️ Pause between detail requests",
            "minimum": 6,
            "maximum": 90,
            "type": "integer",
            "description": "Microsoft blocks bursts of detail requests; 12 s keeps a run steady. Adjusted automatically.",
            "default": 12
          },
          "maxRetries": {
            "title": "Max retries",
            "minimum": 0,
            "maximum": 8,
            "type": "integer",
            "description": "Retries after a block or a 5xx, with exponential backoff (15–90 s).",
            "default": 5
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}