{
  "openapi": "3.0.1",
  "info": {
    "title": "Ad Library Scraper for Bing Ads - Microsoft Ads Transparency",
    "description": "See the Bing ads any advertiser runs in the EU/EEA. Scrape the Microsoft Ad Library by keyword, advertiser or link: ad copy, landing pages, images, verified advertiser identity, country & date filters, new-ad monitoring. Independent tool, not affiliated with Microsoft.",
    "version": "0.1",
    "x-build-id": "KxezEoLQ69iFLcS4c"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~bing-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-bing-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/scrapesage~bing-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-bing-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/scrapesage~bing-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-bing-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": {
          "searchQueries": {
            "title": "Search queries (keywords)",
            "type": "array",
            "description": "Keywords or brand terms to search ads for (matches ad titles & copy) - e.g. \"nike\", \"car insurance\", \"crm software\". The library returns up to ~1,000 ads per search. The form's example \"nike\" is skipped automatically if you only fill in advertisers or links and leave it untouched.",
            "items": {
              "type": "string"
            }
          },
          "advertiserNames": {
            "title": "Advertiser names",
            "type": "array",
            "description": "Company/advertiser names - each is matched in the library's advertiser register (up to 5 advertisers whose registered name contains every word you type, e.g. \"Booking.com\" or \"Foot Locker\") and their ads are scraped. Names that match nothing are reported on the run card and never replaced by a different company.",
            "items": {
              "type": "string"
            }
          },
          "advertiserIds": {
            "title": "Advertiser IDs",
            "type": "array",
            "description": "Exact Microsoft Ad Library advertiser IDs (the number in adlibrary.ads.microsoft.com/advertiser/… links) - scrapes their ads directly.",
            "items": {
              "type": "string"
            }
          },
          "advertiserSearchQueries": {
            "title": "Advertiser directory search",
            "type": "array",
            "description": "Search the ADVERTISER register instead of ads - one advertiser record per match (name, country, verified status, ads count, sample ad titles). Great for lists of companies actively advertising on Bing. With Countries or dates set, the ads count covers only that scope and advertisers with no ads in it are left out.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Links copied from adlibrary.ads.microsoft.com: an ad page (…/ad/123), an advertiser page (…/advertiser/456, including its \"Ad content\" search), or a search link. A search link returns what its tab shows: from the Ads tab (the link contains t=ads) the ads; right after searching the site shows the Advertisers tab, so that link returns advertisers. A link's own country and date filters are applied to that link. Bare advertiser IDs work too.",
            "items": {
              "type": "string"
            }
          },
          "urlsFromFile": {
            "title": "Import URLs from a file",
            "type": "string",
            "description": "Paste a list of URLs (one per line), OR one link to a .txt/.csv file, Google Sheet or Google Drive file containing them. Lets you import many Start URLs at once instead of typing each. Google Sheet/Drive share links are handled automatically."
          },
          "countries": {
            "title": "Countries (EU/EEA)",
            "type": "array",
            "description": "Only ads served in these countries. Pick from the list or type ISO codes / English names (\"DE\", \"France\"). The library covers the 27 EU countries plus Iceland, Liechtenstein and Norway; any other value stops the run before anything is charged. Empty = all of them.",
            "items": {
              "type": "string",
              "enumSuggestedValues": [
                "AT",
                "BE",
                "BG",
                "HR",
                "CY",
                "CZ",
                "DK",
                "EE",
                "FI",
                "FR",
                "DE",
                "GR",
                "HU",
                "IS",
                "IE",
                "IT",
                "LV",
                "LI",
                "LT",
                "LU",
                "MT",
                "NL",
                "NO",
                "PL",
                "PT",
                "RO",
                "SK",
                "SI",
                "ES",
                "SE"
              ],
              "enumTitles": [
                "Austria (AT)",
                "Belgium (BE)",
                "Bulgaria (BG)",
                "Croatia (HR)",
                "Cyprus (CY)",
                "Czech Republic (CZ)",
                "Denmark (DK)",
                "Estonia (EE)",
                "Finland (FI)",
                "France (FR)",
                "Germany (DE)",
                "Greece (GR)",
                "Hungary (HU)",
                "Iceland (IS)",
                "Ireland (IE)",
                "Italy (IT)",
                "Latvia (LV)",
                "Liechtenstein (LI)",
                "Lithuania (LT)",
                "Luxembourg (LU)",
                "Malta (MT)",
                "Netherlands (NL)",
                "Norway (NO)",
                "Poland (PL)",
                "Portugal (PT)",
                "Romania (RO)",
                "Slovakia (SK)",
                "Slovenia (SI)",
                "Spain (ES)",
                "Sweden (SE)"
              ]
            }
          },
          "dateFrom": {
            "title": "Served from date",
            "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^(\\d+)\\s*(day|week|month|year)s?$",
            "type": "string",
            "description": "Only ads served on/after this date: a date (YYYY-MM-DD) or a relative period such as \"30 days\" or \"3 months\" (counted back from the day of the run, so a schedule always looks at the latest period). Older ranges than the library website offers (12 months) still return ads."
          },
          "dateTo": {
            "title": "Served to date",
            "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^(\\d+)\\s*(day|week|month|year)s?$",
            "type": "string",
            "description": "Only ads served on/before this date: a date (YYYY-MM-DD) or a relative period such as \"7 days\" (that many days before the run)."
          },
          "adFormat": {
            "title": "Ad format",
            "enum": [
              "all",
              "text",
              "image"
            ],
            "type": "string",
            "description": "Keep all ads, only classic text search ads, or only ads with image assets (audience/shopping formats). Ads removed by this filter are never charged.",
            "default": "all"
          },
          "includeAdvertiserDetails": {
            "title": "Enrich ads with advertiser details",
            "type": "boolean",
            "description": "Add the advertiser's registered country and identity-verification status to every ad (one cached lookup per unique advertiser).",
            "default": true
          },
          "includeAdvertiserAdStats": {
            "title": "Advertiser directory: include ad stats",
            "type": "boolean",
            "description": "In advertiser-directory mode, probe each advertiser's ads to add adsCount + 3 sample ad titles (one extra request per advertiser). Always on when Countries or dates are set, because that check decides which advertisers are in scope.",
            "default": true
          },
          "emitAdvertiserRecords": {
            "title": "Also emit advertiser records",
            "type": "boolean",
            "description": "When scraping by advertiser name/ID, additionally output one advertiser summary record (type: \"advertiser\") next to the ads.",
            "default": false
          },
          "maxResults": {
            "title": "Max results (total)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum records (ads + advertisers) for the whole run, shared fairly between your searches, advertisers and links (anything one of them leaves unused passes to the next). 0 = no limit (explicit opt-in; pair with a run timeout).",
            "default": 100
          },
          "maxAdsPerQuery": {
            "title": "Max ads per query",
            "minimum": 0,
            "type": "integer",
            "description": "Per-search / per-advertiser cap. 0 = no per-query cap.",
            "default": 0
          },
          "splitByCountry": {
            "title": "Go past the ~1,000-ads-per-search limit",
            "type": "boolean",
            "description": "The library returns at most ~1,000 ads for any one search. When a search hits that limit and you asked for more (Max results above ~1,000 or 0), repeat it once per country to reach ads beyond it (duplicates removed). Larger runs, so off by default; ignored when Countries is set.",
            "default": false
          },
          "monitorMode": {
            "title": "Monitor mode (only new / changed ads)",
            "type": "boolean",
            "description": "Track ads across runs in a key-value store and only output ads that are new or changed since the last run - perfect on an Apify Schedule for competitor new-ad alerts. Works alongside (not instead of) Apify Schedules. Best with advertiser-scoped inputs and maxResults 0 (the full ad set is compared each run); broad keyword queries capped far below their ~1,000 results sample a different slice each run and will look 'new'.",
            "default": false
          },
          "monitorStoreName": {
            "title": "Monitor store name",
            "type": "string",
            "description": "Named key-value store holding monitor state (lowercase letters, digits, hyphens). Use a different name per schedule if you run several monitors.",
            "default": "bing-ads-library-monitor"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "The library API is an open Microsoft endpoint - default datacenter proxies work and are the cheapest. Switch to RESIDENTIAL only if you ever see blocked requests.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}