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

# Ask a question

> Soma's agent searches the workspace (documents and knowledge graph) as many times as it needs, then answers in markdown with `[N]` markers; `citations` gives the passage behind each N. An answer takes 10 to 120 seconds; use `stream` to follow progress.



## OpenAPI

````yaml https://staging.soma.evarist.com/v1/openapi.json post /workspaces/{workspace_id}/ask
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}/ask:
    post:
      tags:
        - Ask
      summary: Ask a question
      description: >-
        Soma's agent searches the workspace (documents and knowledge graph) as
        many times as it needs, then answers in markdown with `[N]` markers;
        `citations` gives the passage behind each N. An answer takes 10 to 120
        seconds; use `stream` to follow progress.
      operationId: ask_workspaces__workspace_id__ask_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/AskRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Answer'
        '404':
          description: Unknown workspace or thread.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Hourly question limit reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - HTTPBearer: []
components:
  schemas:
    AskRequest:
      properties:
        question:
          type: string
          maxLength: 8000
          minLength: 1
          title: Question
        thread_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Thread Id
          description: Continue this thread (from a previous answer).
        stream:
          type: boolean
          title: Stream
          description: >-
            Stream Server-Sent Events: `step` while the agent works, then
            `answer` (the same body as a non-streamed response), or `error`.
          default: false
      type: object
      required:
        - question
      title: AskRequest
    Answer:
      properties:
        thread_id:
          type: string
          title: Thread Id
        answer:
          type: string
          title: Answer
          description: Markdown, with `[N]` citation markers.
        citations:
          items:
            $ref: '#/components/schemas/Citation'
          type: array
          title: Citations
          description: The passages the answer cites.
      type: object
      required:
        - thread_id
        - answer
        - citations
      title: Answer
    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
    Citation:
      properties:
        number:
          type: integer
          title: Number
          description: The N of the `[N]` markers in the answer.
        chunk_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Chunk Id
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
        document_title:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Title
        page:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page
        source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Url
        text:
          type: string
          title: Text
          description: The cited passage (up to 1,500 characters).
      type: object
      required:
        - number
        - text
      title: Citation
    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.