> ## 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.

# Vector Search

> Search your uploaded files and get back the matching passages.

Hybrid retrieval: dense (embedding) and sparse (keyword) matches are fused with
reciprocal rank fusion, so exact terms and paraphrases both work. Results are
chunks, each with its `file_id`, score and stored metadata — ready to drop into a
prompt as context.

Narrow the search with `file_ids`, a `filter` on the metadata you supplied at
upload, or a `date_from` / `date_to` window. `top_k` defaults to 5 (max 50).

Only files uploaded with `embed` are searchable. **Each call embeds your query, so
it is a billed request** — it counts against your rate limits and spend caps like
any inference call.



## OpenAPI

````yaml /api/openapi.json post /v1/files/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/files/search:
    post:
      tags:
        - RAG
      summary: Vector Search
      description: >-
        Search your uploaded files and get back the matching passages.


        Hybrid retrieval: dense (embedding) and sparse (keyword) matches are
        fused with

        reciprocal rank fusion, so exact terms and paraphrases both work.
        Results are

        chunks, each with its `file_id`, score and stored metadata — ready to
        drop into a

        prompt as context.


        Narrow the search with `file_ids`, a `filter` on the metadata you
        supplied at

        upload, or a `date_from` / `date_to` window. `top_k` defaults to 5 (max
        50).


        Only files uploaded with `embed` are searchable. **Each call embeds your
        query, so

        it is a billed request** — it counts against your rate limits and spend
        caps like

        any inference call.
      operationId: vector_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/SearchRequest'
            examples:
              default:
                summary: Example request
                value:
                  query: What are the project milestones?
                  top_k: 5
                  file_ids:
                    - file_01JZ0S3N6M8ZQ8DGK9VY1R2H3T
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
              examples:
                default:
                  summary: Example response
                  value:
                    results:
                      - file_id: file_01JZ0S3N6M8ZQ8DGK9VY1R2H3T
                        file_name: project_proposal.pdf
                        file_type: pdf
                        mime_type: application/pdf
                        chunk_index: 3
                        created_at: 1783001227
                        score: 0.92
                        text: >-
                          Milestone 1 is the design review, followed by
                          implementation.
                        parent_text: >-
                          The project milestones are design review,
                          implementation, and launch.
                        metadata:
                          page: 2
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    SearchRequest:
      properties:
        query:
          type: string
          title: Query
        top_k:
          type: integer
          maximum: 50
          minimum: 1
          title: Top K
          default: 5
        file_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: File Ids
          description: Restrict to these file IDs
        filter:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Filter
          description: Match on any metadata key/value pairs
        date_from:
          anyOf:
            - type: integer
            - type: 'null'
          title: Date From
          description: Unix timestamp — only chunks created after this
        date_to:
          anyOf:
            - type: integer
            - type: 'null'
          title: Date To
          description: Unix timestamp — only chunks created before this
      type: object
      required:
        - query
      title: SearchRequest
      example:
        query: climate change impact on agriculture
    SearchResponse:
      properties:
        results:
          items:
            $ref: '#/components/schemas/SearchResult'
          type: array
          title: Results
      type: object
      required:
        - results
      title: SearchResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchResult:
      properties:
        score:
          type: number
          title: Score
        text:
          type: string
          title: Text
        parent_text:
          type: string
          title: Parent Text
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: File Id
        file_name:
          anyOf:
            - type: string
            - type: 'null'
          title: File Name
        file_type:
          anyOf:
            - type: string
            - type: 'null'
          title: File Type
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        chunk_index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunk Index
        created_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created At
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
      type: object
      required:
        - score
        - text
        - parent_text
        - file_id
        - file_name
        - file_type
        - mime_type
        - chunk_index
        - created_at
        - metadata
      title: SearchResult
    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>`.

````