> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nimbleway.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search

> **WebRouter is in closed beta.** It's available to selected accounts, and the API may still change. To get access, [talk to the Nimble team](https://nimbleway.com/contact-general/).

Search the web: ranked results with their titles, links, descriptions and, as `search_depth` asks, page text. Answers within seconds and costs little, so call it freely, and again with a better query. Use it to find pages you have no URLs for; use `POST /v2/web-router/extract` to read a page you have the URL of, and `POST /v2/web-router/research` only for a question a handful of searches cannot settle. Nimble picks the provider: your own keys first. `optimized_for` sets what Nimble favors when it picks the provider. Answers `{meta, result}`: the tool, and the search's own answer.



## OpenAPI

````yaml /api-reference/web-router-openapi.json post /v2/web-router/search
openapi: 3.1.0
info:
  title: WebRouter API
  version: 1.0.0
  description: >-
    Closed beta. One API to search, extract, research and browse the web, on
    Nimble or any provider your account may use. `route` picks the tool and
    provider for a query and runs it in one call. Search and extract answer
    within the call. Research and browse are jobs: start one, then poll it by
    `job_id` until `state` is `completed`, `failed` or `cancelled`. Authenticate
    with `Authorization: Bearer YOUR_API_KEY`.
servers:
  - url: https://sdk.nimbleway.com
security: []
paths:
  /v2/web-router/search:
    post:
      tags:
        - WebRouter
      summary: Search
      description: >-
        **WebRouter is in closed beta.** It's available to selected accounts,
        and the API may still change. To get access, [talk to the Nimble
        team](https://nimbleway.com/contact-general/).


        Search the web: ranked results with their titles, links, descriptions
        and, as `search_depth` asks, page text. Answers within seconds and costs
        little, so call it freely, and again with a better query. Use it to find
        pages you have no URLs for; use `POST /v2/web-router/extract` to read a
        page you have the URL of, and `POST /v2/web-router/research` only for a
        question a handful of searches cannot settle. Nimble picks the provider:
        your own keys first. `optimized_for` sets what Nimble favors when it
        picks the provider. Answers `{meta, result}`: the tool, and the search's
        own answer.
      operationId: search
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchToolResponse'
        '401':
          description: Missing or invalid API key, or Nimble refused your account.
        '402':
          description: 'Nimble refused your account: out of credits.'
        '403':
          description: Nimble refused your account, or WebRouter is not enabled for it.
        '422':
          description: The request is invalid, or the provider cannot serve it as asked.
        '502':
          description: The provider failed to serve the request.
        '504':
          description: No provider answered in time.
      security:
        - BearerAuth: []
components:
  schemas:
    SearchRequest:
      properties:
        max_results:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 1
            - type: 'null'
          title: Max Results
          description: Upper bound on results returned. Unset is 10.
        search_depth:
          anyOf:
            - type: string
              enum:
                - lite
                - fast
                - deep
            - type: 'null'
          title: Search Depth
          description: >-
            How much page content to retrieve: 'lite' is links and descriptions,
            'fast' a truncated body, 'deep' the full page, so its results are
            large. Unset is the provider's own default.
        include_domains:
          anyOf:
            - items:
                type: string
                pattern: ^[^\x00]*$
              type: array
              maxItems: 50
            - type: 'null'
          title: Include Domains
          description: Restrict results to these domains.
        exclude_domains:
          anyOf:
            - items:
                type: string
                pattern: ^[^\x00]*$
              type: array
              maxItems: 50
            - type: 'null'
          title: Exclude Domains
          description: Drop results from these domains.
        country:
          anyOf:
            - type: string
              pattern: ^[^\x00]*$
            - type: 'null'
          title: Country
          description: Country code for geo-targeting, e.g. 'US'.
        locale:
          anyOf:
            - type: string
              pattern: ^[^\x00]*$
            - type: 'null'
          title: Locale
          description: Language code, e.g. 'en'.
        include_answer:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Answer
          description: >-
            Also return an answer to the query. Only Nimble answers: a search
            another provider serves comes back without one.
        optimized_for:
          anyOf:
            - $ref: '#/components/schemas/OptimizedFor'
            - type: 'null'
          description: >-
            What to favour: speed, cost or coverage. Unset or empty is
            `balanced`.
        query:
          type: string
          pattern: >-
            [^\s\x00-\x1f\x7f-\x9f\xad\u0600-\u0605\u061c\u06dd\u070f\u0890\u0891\u08e2\u180e\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff\ufff9-\ufffb]
          title: Query
          description: The search query.
          examples:
            - Jensen Huang
      additionalProperties: false
      type: object
      required:
        - query
      title: SearchRequest
      description: A search request.
      examples:
        - query: Jensen Huang
    SearchToolResponse:
      properties:
        meta:
          $ref: '#/components/schemas/ToolMeta'
          description: The tool that ran.
        result:
          $ref: '#/components/schemas/SearchResponse'
          description: The search's own answer.
      type: object
      required:
        - meta
        - result
      title: SearchToolResponse
    OptimizedFor:
      type: string
      enum:
        - speed
        - cost
        - coverage
        - balanced
      title: OptimizedFor
      description: '`balanced` is what a request that sends no `optimized_for` asks for.'
    ToolMeta:
      properties:
        tool:
          $ref: '#/components/schemas/Tool'
          description: The tool that ran.
      type: object
      required:
        - tool
      title: ToolMeta
    SearchResponse:
      properties:
        provider:
          type: string
          title: Provider
          description: >-
            `nimble_selection` when Nimble picked and served the call. The
            provider's name when your own key served it, with `byok` true.
          examples:
            - nimble_selection
        byok:
          type: boolean
          title: Byok
          description: Whether your own provider key served the call.
        query:
          type: string
          title: Query
        results:
          items:
            $ref: '#/components/schemas/SearchResult'
          type: array
          title: Results
        answer:
          anyOf:
            - type: string
            - type: 'null'
          title: Answer
          description: Synthesized answer, when the provider returned one.
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
          description: The provider's own id. Only when your own key served the call.
      additionalProperties: false
      type: object
      required:
        - provider
        - byok
        - query
      title: SearchResponse
      description: The result of one search, tagged with the provider that served it.
    Tool:
      type: string
      enum:
        - search
        - extract
        - extract_template
        - browse
        - research
        - answer
      title: Tool
    SearchResult:
      properties:
        url:
          type: string
          title: Url
        title:
          type: string
          title: Title
          default: ''
        description:
          type: string
          title: Description
          description: >-
            A snippet-length summary: the provider's own when it gives one,
            otherwise the head of the page body so the field means the same
            thing everywhere.
          default: ''
        content:
          type: string
          title: Content
          description: >-
            The fullest text available for this result: the page body when the
            provider returned one, otherwise the description. Empty only when
            there is no text at all.
          default: ''
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
          description: Provider relevance score, when one is given.
        published_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Published Date
        extra:
          additionalProperties: true
          type: object
          title: Extra
          description: Provider-specific fields with no normalized equivalent.
      additionalProperties: false
      type: object
      required:
        - url
      title: SearchResult
      description: A single result, normalized across providers.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.