{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scrapenest-dev/json-schema/scrapenest-dev-search-request-schema.json",
  "title": "SearchRequest",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scrapenest-dev-openapi.json#/components/schemas/SearchRequest",
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 400,
      "minLength": 1,
      "title": "Query"
    },
    "num_results": {
      "type": "integer",
      "maximum": 50.0,
      "minimum": 1.0,
      "title": "Num Results",
      "default": 10
    },
    "timeout_seconds": {
      "type": "number",
      "maximum": 20.0,
      "minimum": 0.1,
      "title": "Timeout Seconds",
      "description": "Total search retrieval budget, shared by engine lanes and retries; on /v1/search it is 6 at depth thorough and stealth, and 10 when engines is only google, when left unset; exhaustive cold renders do not block the response. When it runs out before any engine answers, the response is 200 with no results, partial=true, error=search_deadline_exceeded and nothing billed.",
      "default": 5.0
    },
    "language": {
      "type": "string",
      "maxLength": 24,
      "minLength": 2,
      "pattern": "^[A-Za-z]{2,3}(?:[-_][A-Za-z0-9]{1,8}){0,3}$",
      "title": "Language",
      "description": "IETF BCP 47 language tag (e.g. 'en', 'pt-BR', 'zh-Hans', 'es-419', 'sr-Latn-RS'). Case and '_' are accepted, deprecated codes (iw, in, no, tl) are resolved, and a script is searched in the region the engines know for it (zh-Hans as zh-CN, zh-Hant as zh-TW). An unrecognized language is searched in English and `note` says so.",
      "default": "en"
    },
    "time_range": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "day",
            "week",
            "month",
            "year"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Time Range"
    },
    "categories": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 80
        },
        {
          "type": "null"
        }
      ],
      "title": "Categories",
      "description": "Comma-separated category filter. Supported: general, news, science, it, images. Most callers should use `topic` instead — it maps to these and is validated per endpoint."
    },
    "cache_ttl_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 86400.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Cache Ttl Seconds"
    },
    "include_domains": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 15
        },
        {
          "type": "null"
        }
      ],
      "title": "Include Domains",
      "description": "Only return results from these domains (e.g. ['nytimes.com', 'bbc.co.uk']). Max 15; Google/Bing reject queries with more `site:` clauses than that."
    },
    "exclude_domains": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 15
        },
        {
          "type": "null"
        }
      ],
      "title": "Exclude Domains",
      "description": "Filter out results from these domains. Max 15."
    },
    "topic": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "general",
            "news",
            "research",
            "code"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Topic",
      "description": "Vertical to search. Omit it to search the whole web with news intent auto-detected from the query (e.g. 'why are chip stocks selling off today'): news-vertical results are then ranked together with the general web results and hold at most half of the result slots. 'general' searches the whole web and never auto-routes to news. 'news' pins the news vertical (dated, current articles). 'research' searches academic literature (Crossref, OpenAlex, PubMed) and returns papers with DOIs rather than web pages. 'code' adds developer sources (GitHub, Stack Overflow, Hacker News, MDN) to the general web engines, so official documentation stays in reach. An explicit `engines` list or `categories` also turns auto-routing off."
    },
    "engines": {
      "anyOf": [
        {
          "items": {
            "type": "string",
            "enum": [
              "google",
              "duckduckgo",
              "bing",
              "brave",
              "bing news",
              "duckduckgo news",
              "crossref",
              "openalex",
              "pubmed",
              "github",
              "stackoverflow",
              "hackernews",
              "mdn"
            ]
          },
          "type": "array",
          "maxItems": 8,
          "minItems": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Engines",
      "description": "Pick which engines to query. Default is a curated mix tuned to the request (Bing is the most reliable scraper-friendly engine; DuckDuckGo carries `site:` filters; Brave is a second independent index; Bing+Google+DuckDuckGo together for higher num_results; 'bing news'/'duckduckgo news' query the news vertical directly; crossref/openalex/pubmed are the `research` vertical and github/stackoverflow/hackernews/mdn the `code` one). Omit (or set to null) to use the default. An explicit list is honoured exactly: no other engine is added or retried in its place, only rows those engines returned are kept, and when it returns fewer results than asked for, `note` names each requested engine that came back empty or failed. An empty list ([]) is rejected; pass `null` if you want defaults."
    },
    "depth": {
      "type": "string",
      "enum": [
        "fast",
        "balanced",
        "thorough",
        "stealth"
      ],
      "title": "Depth",
      "description": "Speed/coverage tier. On /v1/search: 'fast' queries Bing only (typically ~0.5s, and the lowest coverage — it can return fewer results than you asked for); 'balanced' (default) queries Bing + DuckDuckGo + Brave and, when they return a thin result set on a cold query, waits a few extra seconds for the freshest engine data instead of returning 2-3 results; 'thorough' and 'stealth' add Google and wait for it on a cold query (the first search of a topic can take a few extra seconds; repeat searches are cached and fast; 'thorough' and 'stealth' are equivalent here). On /v1/search/deep it sets how hard page fetches try: 'fast' (~2.5s/page) and 'balanced' (~3.5s/page, default) fetch every page with no anti-bot escalation — blocked pages fall back to their SERP snippet; 'thorough' (~6s/page) and 'stealth' (~12s/page) escalate blocked pages through a real-browser bypass; 'stealth' has the highest coverage on heavily-protected targets. Easy pages still return in a couple seconds; the budget only applies to pages needing the bypass. On /v1/search/answer it sets the same page-fetch effort for the sources the answer is grounded in — 'fast' (~2.5s/page, no escalation), 'balanced' (~6s/page, default), 'thorough' (~9s/page) and 'stealth' (~12s/page) — so raising it is the lever when an answer comes back grounded in snippets instead of page text.",
      "default": "balanced"
    },
    "page": {
      "type": "integer",
      "maximum": 20.0,
      "minimum": 1.0,
      "title": "Page",
      "description": "Result page (1-based) on /v1/search. page=2 returns the next num_results results without repeating page 1. The engines return at most 50 results for one query, so a page past them is empty and not billed. /v1/search/deep and /v1/search/answer always read the first page.",
      "default": 1
    },
    "country": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 4,
          "pattern": "^[a-zA-Z]{2}$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Country",
      "description": "ISO 3166-1 alpha-2 country code (e.g. 'us', 'de', 'jp') to bias results toward that region."
    },
    "start_date": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Start Date",
      "description": "Only return results published on or after this date (YYYY-MM-DD)."
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        {
          "type": "null"
        }
      ],
      "title": "End Date",
      "description": "Only return results published on or before this date (YYYY-MM-DD)."
    },
    "include_images": {
      "type": "boolean",
      "title": "Include Images",
      "description": "If true, also return a list of image results in an `images` field.",
      "default": false
    },
    "include_image_descriptions": {
      "type": "boolean",
      "title": "Include Image Descriptions",
      "description": "If true and include_images is true, include alt-text/captions when available.",
      "default": false
    },
    "image_sources": {
      "anyOf": [
        {
          "items": {
            "type": "string",
            "enum": [
              "bing",
              "brave"
            ]
          },
          "type": "array",
          "maxItems": 2
        },
        {
          "type": "null"
        }
      ],
      "title": "Image Sources",
      "description": "Which image sources to query when include_images=true. Defaults to ['bing'] (fast, 5 credits). Adding 'brave' fetches a second wider catalogue rendered in a real browser (~8s, +40 credits). Image sources run alongside the web search; Brave has its own 12s budget, so a request with 'brave' can take up to 12s whatever timeout_seconds is. A source is billed only when it returns images. Order doesn't matter; results are merged."
    },
    "include_usage": {
      "type": "boolean",
      "title": "Include Usage",
      "description": "If true, include a `usage` block in the response with credit totals.",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "query"
  ]
}