{
  "openapi": "3.0.1",
  "info": {
    "title": "Bing Ads Library Scraper - Microsoft Ads Transparency",
    "description": "See every Bing ad any advertiser runs. Scrape the Microsoft Ad Library by keyword or advertiser: ad copy, landing pages, images, verified advertiser identity & new-ad monitoring. The Bing side of your Google/Meta ads transparency stack.",
    "version": "0.1",
    "x-build-id": "8bvMGihXlHT7J8qqZ"
  },
  "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\". Each query returns up to ~1,000 ads.",
            "items": {
              "type": "string"
            }
          },
          "advertiserNames": {
            "title": "Advertiser names",
            "type": "array",
            "description": "Company/advertiser names — each is resolved in the library's advertiser register (up to 5 matching advertisers) and ALL of their ads are scraped. E.g. \"Booking.com\", \"Zalando\".",
            "items": {
              "type": "string"
            }
          },
          "advertiserIds": {
            "title": "Advertiser IDs",
            "type": "array",
            "description": "Exact Microsoft Ad Library advertiser IDs (the number in adlibrary.ads.microsoft.com/advertiser/… URLs) — scrapes all their ads directly.",
            "items": {
              "type": "string"
            }
          },
          "advertiserSearchQueries": {
            "title": "Advertiser directory search",
            "type": "array",
            "description": "Search the ADVERTISER register instead of ads — emits one advertiser record per match (name, country, verified status, ads count, sample ad titles). Great for building lists of companies actively advertising on Bing.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Microsoft Ad Library URLs — ad pages (…/ad/123), advertiser pages (…/advertiser/456), or search URLs (…/?searchText=shoes). Auto-detected and scraped.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries (EU/EEA)",
            "type": "array",
            "description": "Only ads served in these countries. ISO codes or names — e.g. \"DE\", \"France\", \"Netherlands\". Empty = all EU/EEA countries.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "Served from date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Only ads served on/after this date (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "Served to date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Only ads served on/before this date (YYYY-MM-DD)."
          },
          "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).",
            "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).",
            "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) to return. 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-query cap. 0 = no per-query cap (the library itself allows at most ~1,023 ads per query — use narrower queries or filters to go deeper).",
            "default": 0
          },
          "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}