{
  "openapi": "3.0.1",
  "info": {
    "title": "Bing Ads Library Scraper - Microsoft Ads Monitor (EU)",
    "description": "Track competitors' Bing ads from Microsoft's official Ad Library (EU/EEA). Search by advertiser or ad text, filter by country and date, get ONLY NEW ads since the last run, with impressions by country, targeting, paid-for-by and run dates.",
    "version": "1.0",
    "x-build-id": "RGZHehxyV03stzlsl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ivan-petrus-g~microsoft-ads-library-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ivan-petrus-g-microsoft-ads-library-monitor",
        "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/ivan-petrus-g~microsoft-ads-library-monitor/runs": {
      "post": {
        "operationId": "runs-sync-ivan-petrus-g-microsoft-ads-library-monitor",
        "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/ivan-petrus-g~microsoft-ads-library-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-ivan-petrus-g-microsoft-ads-library-monitor",
        "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": "Advertiser (account or verified legal) names, e.g. 'Booking.com B.V.'. Resolved to advertiser IDs automatically: exact matches first, otherwise the top suggestion.",
            "items": {
              "type": "string"
            }
          },
          "advertiserIds": {
            "title": "Advertiser IDs",
            "type": "array",
            "description": "Numeric Microsoft Ad Library advertiser or account IDs (e.g. 4294969411). The most precise option.",
            "items": {
              "type": "string"
            }
          },
          "searchTerms": {
            "title": "Ad text search terms",
            "type": "array",
            "description": "Find ads whose copy contains these words (e.g. 'car insurance', 'crm software'). Each term is one search.",
            "items": {
              "type": "string"
            }
          },
          "advertiserNameMatch": {
            "title": "Advertiser name matching",
            "enum": [
              "best",
              "allSimilar"
            ],
            "type": "string",
            "description": "best = all accounts with exactly this name (or the top suggestion). allSimilar = up to 5 advertisers whose name contains the text.",
            "default": "best"
          },
          "countries": {
            "title": "Countries (EU/EEA)",
            "type": "array",
            "description": "Only ads served in these countries (2-letter codes: DE, FR, NL, PL, ES, IT, SE...). Empty = all EU/EEA. The library only covers the EU/EEA. Note: Microsoft's API answers country-filtered queries slowly (20-90 s per page).",
            "items": {
              "type": "string"
            }
          },
          "lastDays": {
            "title": "Shown in the last N days",
            "minimum": 1,
            "maximum": 1200,
            "type": "integer",
            "description": "Only ads that ran within the last N days. Overrides dateFrom/dateTo. Microsoft updates the library with a 1-3 day delay."
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "YYYY-MM-DD. Ads that ran on or after this date."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "YYYY-MM-DD. Defaults to today when dateFrom is set."
          },
          "includeDetails": {
            "title": "Include ad details",
            "type": "boolean",
            "description": "One extra API call per ad: first/last shown dates, total impressions range, impression share by country, targeting types used (and excluded), paid-for-by.",
            "default": true
          },
          "maxAdsPerTarget": {
            "title": "Max ads per advertiser / search term",
            "minimum": 0,
            "maximum": 1023,
            "type": "integer",
            "description": "0 = as many as the API allows (about 1,000 per query). Tip: use a date range or countries to narrow big advertisers.",
            "default": 50
          },
          "onlyNewAds": {
            "title": "Only new ads since last run",
            "type": "boolean",
            "description": "Remember which ads were already seen (in a named key-value store) and output only new ones. Perfect for scheduled runs.",
            "default": true
          },
          "firstRunBehavior": {
            "title": "First run",
            "enum": [
              "outputAll",
              "baselineOnly"
            ],
            "type": "string",
            "description": "outputAll = the first run returns all current ads (up to the limit). baselineOnly = the first run only records current ads; later runs return what's new (cheaper).",
            "default": "outputAll"
          },
          "stateStoreName": {
            "title": "Monitor state store name",
            "type": "string",
            "description": "Named key-value store that keeps seen ad IDs. Use different names for independent monitors.",
            "default": "microsoft-ads-monitor-state"
          },
          "includeSummary": {
            "title": "Summary row per target",
            "type": "boolean",
            "description": "Adds one free summary row per advertiser / search term: ads in the library, ads fetched, new ads, top advertisers and countries.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Targets processed in parallel (each with its own proxy session).",
            "default": 2
          },
          "requestDelaySecs": {
            "title": "Delay between requests (s)",
            "minimum": 0.2,
            "maximum": 10,
            "type": "number",
            "description": "Pause between two API calls of one worker. Microsoft rate-limits unauthenticated calls.",
            "default": 1
          },
          "maxRetries": {
            "title": "Max retries per request",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Retries with backoff and proxy rotation on 429/5xx/timeouts.",
            "default": 6
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify Proxy (datacenter) spreads requests over several IPs, which avoids Microsoft's per-IP rate limits.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}