# Microsoft Ad Library (`avakode/microsoft-ad-library`) Actor

Ads shown on Bing in the EU and EEA, from Microsoft's own Ad Library API: advertiser, text, links, and optionally dates, reach and payer. The registry limits requests, so a run may stop early with the ads it has read.

- **URL**: https://apify.com/avakode/microsoft-ad-library.md
- **Developed by:** [Tigran Avakov](https://apify.com/avakode) (community)
- **Categories:** Marketing, Lead generation, MCP servers
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.69 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Microsoft Ad Library

Search the Microsoft Advertising Ad Library, the public registry of ads shown on Bing in the EU and EEA, by words or by advertiser, and get clean records: advertiser, ad text, links and, if you ask for it, dates, reach range, payer, country split and targeting.

### What it does

It reads the registry's own open API (`adlibrary.api.bingads.microsoft.com`). No login, no key, no proxy and no browser: plain HTTP, paced to the rate the registry allows (about one request every 3 seconds). Each search term or advertiser id is one target; the tool pages through it 24 ads at a time.

**Request limit of the registry.** The registry limits requests per address and does not publish the limit. In our checks on 2026-11-10 it varied from run to run: some runs were stopped by HTTP 429 after 4, 8 or 17 requests in a row, others made 16 and 31 requests without a stop. One request returns up to 24 ads; with details on, each ad costs one more request. When the limit is reached the run stops, the ads already written are kept, and the run ends normally.

### Use cases

- See what ads a competitor or a brand shows on Bing in Europe, and where they link.
- Watch a topic for ads you have not seen before (the "only new" option).
- Compliance and research work that needs advertiser, payer and reach range per ad (details option).

### Input

| Field | Type | Description |
|---|---|---|
| `queries` | array | Search terms, one per line. All words must match; use double quotes for a phrase. |
| `advertiserIds` | array | Numeric advertiser ids from the registry (the `advertiser_id` of an earlier result). |
| `countries` | array | EU/EEA countries as names (`Germany`) or codes (`DE`). Empty = all. |
| `startDate`, `endDate` | string | Only ads shown in this window, `YYYY-MM-DD`. |
| `includeDetails` | boolean | One extra request per ad for dates, reach, payer, country shares, targeting. Because of the registry's request limit, a run with details reaches far fewer ads. Default off. |
| `onlyNew` | boolean | Only ads not delivered by an earlier run with the same searches and filters. Every page already delivered still costs a request before new ads are reached. |
| `maxResults` | integer | Stop after this many ads in total (default 100). The registry's request limit may stop a run earlier. |

Give at least one search term or advertiser id.

Example:

```json
{ "queries": ["london hotels"], "countries": ["Germany", "FR"], "maxResults": 100 }
```

### Output

One record per ad. Missing values are `null`, dates are ISO 8601, `url` is the ad's address in the registry API. An ad found by two targets is delivered once per run.

| Field | Description |
|---|---|
| `url`, `source_id` | Address and id of the ad in the registry. |
| `advertiser_id`, `advertiser_name` | The advertiser (account or verified legal name). |
| `title`, `description` | Ad copy; for dynamic ads a recent representative version. |
| `display_url`, `destination_url` | Address shown in the ad and where it links. |
| `asset_urls` | Image addresses; empty for text ads. |
| `started_at`, `ended_at` | First and last run in the EU/EEA, only with `includeDetails`, otherwise `null`. |
| `impressions_range` | Total impressions as a range, e.g. `500K - 1M` (details only). |
| `paid_for_by` | Payer, when the registry names one different from the account owner (details only). |
| `impressions_by_country` | Share of impressions per country in percent (details only). |
| `targeting` | Targeting types used, with whether also used for exclusion (details only). |
| `source` | The search term or `advertiser:<id>` that found the ad. |

Example record (details off):

```json
{ "url": "https://adlibrary.api.bingads.microsoft.com/api/v1/Ads/71056068045307", "source_id": "71056068045307",
  "advertiser_id": "4295000447", "advertiser_name": "TripAdvisor Inc", "title": "…", "description": "…",
  "display_url": "www.tripadvisor.nl", "destination_url": "https://www.tripadvisor.nl/…", "asset_urls": [],
  "started_at": null, "ended_at": null, "impressions_range": null, "paid_for_by": null,
  "impressions_by_country": null, "targeting": null, "source": "hotels" }
```

### Pricing

Pay per result: you pay for each ad in the dataset, plus a tiny start fee per run. Set "Maximum cost per run" and the tool stops cleanly when it is reached. With details on, the price per ad is the same, but each ad needs one extra request, so far fewer ads fit in a run. If the details of an ad cannot be read (the ad vanished, HTTP 404, or the answer has a different format), the record is still written and paid for, without details; after 3 such failures in a row details are switched off for the rest of the run.

### Errors

- **Invalid input** — the message names the field to fix (an unknown country, a bad date, no search term at all).
- **An advertiser id that is not digits** is skipped with a warning in the log; the other targets are still read. If every target is skipped, the run ends normally with no ads and a status line that names the first skipped target and the reason. An advertiser id the registry does not know simply returns no ads.
- **No answer from the registry** — a request that times out is reported as "site unavailable"; the ads already written are kept.
- **The site changed its format** — the tool needs an update; please open an issue.
- **The site blocked access** — the registry refused the request (HTTP 403 or 429 after the waiting time). The tool stops at once and does not try to get around it; ads already written stay in the dataset and the run ends normally. HTTP 429 is the registry's ordinary request limit and is reported as such.

### Limitations

- **Request limit: not published and not constant.** In our checks on 2026-11-10 some runs were stopped by HTTP 429 after 4, 8 or 17 requests in a row, others made 16 and 31 requests without a stop (one request returns up to 24 ads). The tool does not try to get around it.
- **Source limit: one search reaches about 1,000 ads at most** (the registry allows 24 ads per request and a skip of at most 999). Split broad topics into narrower searches, by words, advertiser id, country or date window.
- The registry covers only ads shown in the EU/EEA; most records are text ads, and some carry images.
- The registry does not sort by date. "Only new" therefore returns ads not delivered before, not the freshest ads. A page of ads that were all delivered earlier does not end the target, but it costs a request like any page: the more was delivered before, the more requests a run spends before it reaches new ads, and the registry's request limit may stop it first. A run stopped by the limit before it has any new ad ends as failed with that message, and no result is charged.
- Dates, reach range, payer, country shares and targeting come from the per-ad detail page; without `includeDetails` they are `null`. The registry records impressions since June 2023 and lags 1-3 days.
- The registry publishes no spend figures.
- Pace and burst limit: the registry answers 429 when requests come faster than about one per 3 seconds, and it also stops a series of requests from one address after a number that varied in our checks (see the request limit above). The tool waits 3 seconds between requests, makes one more try after a short pause, and on a second 429 stops without retrying; ads already written stay in the dataset and the run ends normally. With details on, one request goes to each ad, so a run reaches far fewer ads before the registry pushes back.
- Two "only new" runs with the same targets cannot work at the same time: the second one stops with a message before it reads anything.
- At most one batch may be written again if a write was still on its way when the run was stopped.
- If a run is killed while it writes a batch and is not resurrected, the next "only new" run may skip that batch.

### Support

Open an issue in the Issues tab with the run link.

# Actor input Schema

## `queries` (type: `array`):

Words in the ad text or the advertiser name, one search per line. All words must match; put a phrase in double quotes. Each search reaches about 1,000 ads at most, so split broad topics into narrower searches.

## `advertiserIds` (type: `array`):

Numeric advertiser ids from the registry (the AdvertiserId of an earlier result). One id per line. An id that is not digits is skipped with a warning. Use together with or instead of search terms.

## `countries` (type: `array`):

Only ads shown in these EU/EEA countries, as names (Germany) or two-letter codes (DE). Empty means all countries the registry covers.

## `startDate` (type: `string`):

Only ads shown on or after this date, format 2026-01-31. Leave empty for no limit.

## `endDate` (type: `string`):

Only ads shown on or before this date, format 2026-01-31. Leave empty for no limit.

## `includeDetails` (type: `boolean`):

Reads one extra page per ad to fill start and end date, reach range, payer, share of impressions by country and targeting. Each ad then costs one more request and the registry limits requests, so a run with details reaches far fewer ads. If the details of an ad cannot be read, the ad is still written without them.

## `onlyNew` (type: `boolean`):

Return only ads not delivered by an earlier run with the same searches and filters. The registry cannot sort by date, so this returns what was not delivered before, not necessarily the freshest ads. Every page already delivered still costs a request before new ads are reached; if the registry's request limit comes first, the run stops there. Do not start two runs with the same targets at the same time.

## `maxResults` (type: `integer`):

Stop after this many ads in total. The registry's request limit may stop a run earlier; the ads already written are kept.

## Actor input object example

```json
{
  "queries": [
    "london hotels"
  ],
  "advertiserIds": [
    "4295000447"
  ],
  "countries": [
    "Germany",
    "FR"
  ],
  "startDate": "2026-01-01",
  "endDate": "2026-06-30",
  "includeDetails": false,
  "onlyNew": false,
  "maxResults": 100
}
```

# Actor output Schema

## `results` (type: `string`):

All records written by the run (the default dataset).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        "london hotels"
    ],
    "advertiserIds": [],
    "countries": [],
    "includeDetails": false,
    "onlyNew": false,
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("avakode/microsoft-ad-library").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "queries": ["london hotels"],
    "advertiserIds": [],
    "countries": [],
    "includeDetails": False,
    "onlyNew": False,
    "maxResults": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("avakode/microsoft-ad-library").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    "london hotels"
  ],
  "advertiserIds": [],
  "countries": [],
  "includeDetails": false,
  "onlyNew": false,
  "maxResults": 100
}' |
apify call avakode/microsoft-ad-library --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,avakode/microsoft-ad-library"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/mBo7Dttj7clgG1gs3/builds/ZuJiDAe2tefhL9vCf/openapi.json
