{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/serpkite-com/json-schema/serpkite-com-answer-request-schema.json",
  "title": "AnswerRequest",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/serpkite-com-openapi.yaml#/components/schemas/AnswerRequest",
  "type": "object",
  "required": [
    "q"
  ],
  "properties": {
    "q": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
    },
    "depth": {
      "type": "string",
      "enum": [
        "fast",
        "standard"
      ],
      "default": "standard",
      "description": "`fast` answers from the result page (1 + 2 credits); `standard` also reads the top `num_sources` pages (1 + 1 per page + 4 credits)"
    },
    "num_sources": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5,
      "default": 3,
      "description": "Pages read (depth=standard only)"
    },
    "stream": {
      "type": "boolean",
      "default": false,
      "description": "Send Server-Sent Events (`results`, `delta`…, `done` | `error`) instead of one JSON body"
    },
    "output_schema": {
      "type": "object",
      "additionalProperties": true,
      "description": "A JSON Schema (at most 16 KB). The answer becomes a JSON value in `output`. Not with stream"
    },
    "country": {
      "type": "string",
      "default": "us"
    },
    "language": {
      "type": "string",
      "default": "en"
    },
    "location": {
      "type": "string"
    },
    "uule": {
      "type": "string"
    },
    "time": {
      "type": "string",
      "enum": [
        "hour",
        "day",
        "week",
        "month",
        "year"
      ]
    },
    "tbs": {
      "type": "string"
    },
    "device": {
      "type": "string",
      "enum": [
        "desktop",
        "mobile"
      ],
      "default": "desktop"
    },
    "safe": {
      "type": "string",
      "enum": [
        "active",
        false
      ],
      "default": false
    },
    "autocorrect": {
      "type": "boolean",
      "default": true
    },
    "max_age": {
      "type": "integer",
      "minimum": 0,
      "description": "Accept a cached search up to this many seconds old"
    },
    "engine": {
      "$ref": "#/$defs/EngineParam"
    },
    "include_domains": {
      "$ref": "#/$defs/DomainList"
    },
    "exclude_domains": {
      "$ref": "#/$defs/DomainList"
    },
    "boost_domains": {
      "$ref": "#/$defs/DomainList"
    },
    "start_date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "type": "string",
      "format": "date"
    }
  },
  "$defs": {
    "DomainList": {
      "description": "Domains as an array or a comma-separated string, at most 20: a host (`example.com`, subdomains match), a host with a path prefix (`github.com/org`) or a TLD (`.gov`).",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "EngineParam": {
      "description": "Which search providers may answer. `google` (the default) is Google only; Google requests are retried internally before failing. `auto` allows falling back to other enabled providers, in route order, when Google is blocked or times out. A single other provider (`brave`) or a list (`[\"google\",\"brave\"]`, or `google,brave` in a query string) restricts the request to those providers. `meta.engine` always names the provider that answered and credits follow that provider's price. A key with \"Allow fallback to other search engines\" on treats a request without `engine` as `auto`. `consensus` (`/v1/search` only; 400 elsewhere, and it can't be combined with other names) queries several independent search indexes in parallel (at most one Bing-backed provider, so Yahoo or DuckDuckGo never count as agreeing with Bing), merges the results by URL and ranks them by how many providers returned each one. Each result lists its `sources`; `meta.engine` is `consensus` and `meta.route` lists every provider attempt. Up to three providers answer: a provider that fails or comes back empty hands its turn to the next one in the route. It stops once `num` unique results are in hand or after a few seconds, and costs the sum of one page at each provider that returned results (providers that failed, came back empty or were never started are free). `yandex` serves `/v1/search` from Yandex web search (no `time` filter or `safe: active`: a request naming it gets a 400 with them) and `/v1/maps`, `/v1/places` and `/v1/place` from Yandex Maps, where the deployment enables it (otherwise a 503 `unavailable`, not charged); with `auto` it is the last fallback there.",
      "oneOf": [
        {
          "type": "string",
          "default": "google"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Provider"
          },
          "minItems": 1
        }
      ]
    },
    "Provider": {
      "type": "string",
      "description": "A search provider (docs/providers). Which verticals each serves depends on the deployment.",
      "enum": [
        "google",
        "brave",
        "bing",
        "yahoo",
        "duckduckgo",
        "mojeek",
        "wikipedia",
        "yandex"
      ]
    }
  }
}