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

# Web Search

> Search the live web and get back ranked results with snippets.

Two engines sit behind this: the native engine is tried first and Tavily is the
fallback, so a single engine outage does not fail your request. Pin one with
`provider` when you need reproducibility — pinning disables that failover.

Shape results with `max_results` (1–20), `include_domains` / `exclude_domains`, and
`search_depth` (`advanced` costs more and only affects Tavily; the native engine
ignores it). The response says which engine answered.

`model` exists only to name the native engine explicitly. It is not a model
selector — the native engine has no model concept — and an unrecognised value is
rejected with a 422 rather than silently ignored.



## OpenAPI

````yaml /api/openapi.json post /v1/web/search
openapi: 3.1.0
info:
  title: MeshAPI
  description: One key, all AI models.
  version: 0.1.0
servers:
  - url: https://api.meshapi.ai
security:
  - BearerAuth: []
paths:
  /v1/web/search:
    post:
      tags:
        - Web Search
      summary: Web Search
      description: >-
        Search the live web and get back ranked results with snippets.


        Two engines sit behind this: the native engine is tried first and Tavily
        is the

        fallback, so a single engine outage does not fail your request. Pin one
        with

        `provider` when you need reproducibility — pinning disables that
        failover.


        Shape results with `max_results` (1–20), `include_domains` /
        `exclude_domains`, and

        `search_depth` (`advanced` costs more and only affects Tavily; the
        native engine

        ignores it). The response says which engine answered.


        `model` exists only to name the native engine explicitly. It is not a
        model

        selector — the native engine has no model concept — and an unrecognised
        value is

        rejected with a 422 rather than silently ignored.
      operationId: web_search
      parameters:
        - in: header
          name: X-Mesh-Version
          required: false
          schema:
            type: string
            enum:
              - 2026-08
            default: 2026-08
          example: 2026-08
          description: >-
            Dated version of the API contract to pin this request to. Omit it
            and the request is served under `2026-08` — the oldest supported
            version, so an existing integration is never moved by a release. A
            malformed or unsupported value is rejected with `400
            invalid_api_version` rather than falling back silently. The version
            actually served is echoed as `X-Mesh-Version` on every response,
            including errors.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebSearchRequest'
            examples:
              default:
                summary: Example request
                value:
                  query: latest James Webb telescope discoveries
                  model: perplexity/sonar
                  max_results: 5
                  include_answer: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebSearchResponse'
              examples:
                default:
                  summary: Example response
                  value:
                    query: latest James Webb telescope discoveries
                    answer: >-
                      Recent JWST observations include early-galaxy candidates
                      and new exoplanet atmosphere measurements.
                    results:
                      - title: JWST spots an early galaxy candidate
                        url: https://example.com/jwst
                        content: >-
                          Astronomers using JWST reported a distant galaxy
                          candidate...
                        score: 0.93
                    provider: native
                    request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    WebSearchRequest:
      properties:
        query:
          type: string
          maxLength: 2000
          minLength: 1
          title: Query
          description: The search query.
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Native engine model id. Defaults to the server's configured model.
          examples:
            - perplexity/sonar
            - perplexity/sonar-pro
        provider:
          anyOf:
            - type: string
              enum:
                - native
                - tavily
            - type: 'null'
          title: Provider
          description: >-
            Pin a specific engine. Omit to use native-first with Tavily
            fallback.
        max_results:
          type: integer
          maximum: 20
          minimum: 1
          title: Max Results
          description: Maximum results to return.
          default: 5
        search_depth:
          type: string
          enum:
            - basic
            - advanced
          title: Search Depth
          description: Tavily search depth; ignored by the native engine.
          default: basic
        include_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Include Domains
          description: Restrict results to these domains.
        exclude_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Exclude Domains
          description: Drop results from these domains.
        include_answer:
          type: boolean
          title: Include Answer
          description: Ask the engine for a synthesized answer alongside results.
          default: false
      type: object
      required:
        - query
      title: WebSearchRequest
      example:
        max_results: 5
        query: latest James Webb telescope discoveries
        search_depth: basic
    WebSearchResponse:
      properties:
        query:
          type: string
          title: Query
        answer:
          anyOf:
            - type: string
            - type: 'null'
          title: Answer
        results:
          items:
            $ref: '#/components/schemas/WebSearchResultItem'
          type: array
          title: Results
        provider:
          type: string
          enum:
            - native
            - tavily
          title: Provider
        request_id:
          type: string
          title: Request Id
          default: ''
      type: object
      required:
        - query
        - provider
      title: WebSearchResponse
      example:
        provider: native
        query: latest James Webb telescope discoveries
        request_id: req_01J…
        results:
          - content: Astronomers using the James Webb Space Telescope…
            score: 0.93
            title: JWST spots earliest known galaxy
            url: https://example.com/jwst
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WebSearchResultItem:
      properties:
        title:
          type: string
          title: Title
        url:
          type: string
          title: Url
        content:
          type: string
          title: Content
          default: ''
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
        published_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Published Date
      type: object
      required:
        - title
        - url
      title: WebSearchResultItem
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter your MeshAPI key (`rsk_...`) — sent as `Authorization: Bearer
        <key>`.

````