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

# Search documents

> Hybrid (semantic + keyword) search. Returns the most relevant chunks, best first.



## OpenAPI

````yaml https://staging.soma.evarist.com/v1/openapi.json post /workspaces/{workspace_id}/search
openapi: 3.1.0
info:
  title: Soma API
  summary: 'Your organization''s knowledge: documents, search, knowledge graph, answers.'
  description: >-
    Authenticate with `Authorization: Bearer <token>`: an OAuth access token
    (the Soma CLI and MCP clients get one by signing in) or an API key created
    in Soma under Account settings.
  version: 1.0.0
servers:
  - url: https://staging.soma.evarist.com/v1
security: []
paths:
  /workspaces/{workspace_id}/search:
    post:
      tags:
        - Search
      summary: Search documents
      description: >-
        Hybrid (semantic + keyword) search. Returns the most relevant chunks,
        best first.
      operationId: search_workspaces__workspace_id__search_post
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResults'
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SearchRequest:
      properties:
        query:
          type: string
          maxLength: 2000
          minLength: 1
          title: Query
        limit:
          type: integer
          maximum: 20
          minimum: 1
          title: Limit
          description: Number of chunks to return.
          default: 10
        scope:
          anyOf:
            - type: string
            - type: 'null'
          title: Scope
          description: Name of a sub-scope of the workspace to search in (see /scopes).
        entity_ids:
          items:
            type: string
          type: array
          title: Entity Ids
          description: >-
            Only return chunks that mention one of these knowledge-graph
            entities.
      type: object
      required:
        - query
      title: SearchRequest
    SearchResults:
      properties:
        query:
          type: string
          title: Query
        data:
          items:
            $ref: '#/components/schemas/Chunk'
          type: array
          title: Data
      type: object
      required:
        - query
        - data
      title: SearchResults
    Error:
      properties:
        error:
          $ref: '#/components/schemas/Body'
      type: object
      required:
        - error
      title: Error
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Chunk:
      properties:
        id:
          type: string
          title: Id
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
        document_title:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Title
        text:
          type: string
          title: Text
        type:
          type: string
          title: Type
          description: text, table or figure.
          default: text
        page:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page
        source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Url
          description: Link to the original, when it has one.
      type: object
      required:
        - id
        - text
      title: Chunk
    Body:
      properties:
        type:
          type: string
          title: Type
        message:
          type: string
          title: Message
      type: object
      required:
        - type
        - message
      title: Body
    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:
    HTTPBearer:
      type: http
      description: An OAuth access token (`soma_at_…`) or an API key (`scribe_mcp_…`).
      scheme: bearer

````

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