{
  "openapi": "3.0.1",
  "info": {
    "title": "Microsoft Ads Library Scraper: Bing Ads & Impressions",
    "description": "Scrape the Microsoft (Bing) Ads Library: every Bing search ad an advertiser ran in the EU/EEA, with ad copy, URLs, images and optional details (first/last shown, impressions range, impressions by country, targeting). Official public API, no login. $1.50 per 1,000 ads. Unofficial.",
    "version": "0.1",
    "x-build-id": "dYtZ0CXXGbqDRubEk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kyungminlee~microsoft-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kyungminlee-microsoft-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/kyungminlee~microsoft-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-kyungminlee-microsoft-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/kyungminlee~microsoft-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-kyungminlee-microsoft-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": {
          "advertiserNames": {
            "title": "Advertiser names",
            "type": "array",
            "description": "Brand or company names, like the advertiser search on adlibrary.ads.microsoft.com (`Nike`, `Zalando`, `Booking.com`). Each name is resolved to the best-matching advertiser account(s); the log and the `SUMMARY` record show exactly which advertiser was matched. Microsoft's search also returns unrelated names that merely contain the text (\"nike\" inside \"Kliniken\") - those are ignored. You can also paste advertiser IDs or advertiser page URLs here.",
            "items": {
              "type": "string"
            }
          },
          "maxAdvertisersPerName": {
            "title": "Advertisers per name",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many matching advertiser accounts to scrape for each advertiser name, best match first. Big brands often have several accounts (for example a regional \"Nike - EMEA\" account plus local ones); raise this to include them.",
            "default": 1
          },
          "advertiserIds": {
            "title": "Advertiser IDs",
            "type": "array",
            "description": "Microsoft advertiser IDs (digits, e.g. `4295000966`) or advertiser page URLs such as `https://adlibrary.ads.microsoft.com/advertiser/4295000966`. Use these when a name is ambiguous.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries (EU/EEA)",
            "type": "array",
            "description": "Only ads shown in these countries. Country names (`Germany`), ISO codes (`DE`, `FR`, `NL`) or Microsoft's numeric codes (`72`). The library covers the 27 EU countries plus Iceland, Liechtenstein and Norway; other countries are skipped with a warning. Empty = all EU/EEA countries. With only countries (no advertiser), the Actor lists ads from all advertisers shown there.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "Shown from",
            "type": "string",
            "description": "Only ads shown on or after this date: `YYYY-MM-DD`, or a relative value such as `30 days` or `3 months` (that long before the run). The library starts in June 2023."
          },
          "dateTo": {
            "title": "Shown until",
            "type": "string",
            "description": "Only ads shown on or before this date: `YYYY-MM-DD` or a relative value such as `7 days`. Microsoft updates the library with a 1-3 day delay."
          },
          "maxAdsPerQuery": {
            "title": "Max ads per advertiser",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of ads to save for each advertiser (or keyword / country query). Microsoft returns at most 1,000 ads for one query; above that the Actor automatically splits the query by country and date range and merges the deduplicated results, which takes longer.",
            "default": 100
          },
          "includeAdDetails": {
            "title": "Include ad details (impressions, dates, targeting)",
            "type": "boolean",
            "description": "Fetch each ad's detail record: first and last shown date, total impressions range (with numeric min/max), impression share by country, targeting types used, who paid for the ad and any restriction reason. One extra request per ad (about 2 s each, Microsoft rate-limits detail calls), charged as `ad-details` instead of `ad`. Ads whose details cannot be fetched are still saved and charged as `ad`.",
            "default": false
          },
          "keywords": {
            "title": "Keywords in ad copy (experimental)",
            "type": "array",
            "description": "Search ad text across all advertisers. Experimental: Microsoft's keyword search currently fails on their side (HTTP 500), so the Actor tries it once, logs a warning and skips keywords without charging. It will start working automatically when Microsoft fixes it.",
            "items": {
              "type": "string"
            }
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Not needed for normal use: Microsoft's API is public and the Actor already paces requests (1-2 s apart, automatic back-off on rate limits). Enable Apify Proxy only if you keep seeing \"rate-limited\" messages; the Actor then switches IP after repeated 429 responses.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}