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

# Create conversation thread

> Creates a new conversation thread for AI-powered interactions (chat or clinical extraction). Initializes a stateful conversation session with the AI assistant. The thread maintains context across multiple interactions and is required before executing any conversation runs.




## OpenAPI

````yaml /openapi/openapi.yaml post /v1/lang-graph/threads
openapi: 3.0.3
info:
  title: Sofia Clinical Documentation API
  version: 1.0.0
  description: >
    Comprehensive AI-powered clinical documentation platform that includes
    ICD-10 medical coding, transcription management, AI conversation threads,
    and clinical note generation with support for various clinical templates
    (SOAP, BIRP, etc.).
servers:
  - url: https://{your-prod-endpoint}
    description: Production (provided after deployment)
  - url: https://{your-dev-endpoint}
    description: Development (provided upon request)
security:
  - bearerAuth: []
paths:
  /v1/lang-graph/threads:
    post:
      summary: Create conversation thread
      description: >
        Creates a new conversation thread for AI-powered interactions (chat or
        clinical extraction). Initializes a stateful conversation session with
        the AI assistant. The thread maintains context across multiple
        interactions and is required before executing any conversation runs.
      operationId: createThread
      parameters:
        - in: header
          name: x-doctor
          schema:
            type: string
          required: true
          description: Doctor identifier for tracking and auditing
          example: dr_123
        - in: header
          name: x-patient
          schema:
            type: string
          required: false
          description: Patient identifier for tracking and auditing
          example: pt_456
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties: {}
      responses:
        '201':
          description: Thread created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadCreateResponse'
              example:
                thread_id: thread-abc123
                created_at: '2023-10-09T10:00:00.000Z'
                status: active
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ThreadCreateResponse:
      type: object
      required:
        - thread_id
        - created_at
        - status
      properties:
        thread_id:
          type: string
          description: Unique thread identifier
          example: thread-abc123
        created_at:
          type: string
          format: date-time
          description: Timestamp when thread was created
          example: '2023-10-09T10:00:00.000Z'
        status:
          type: string
          enum:
            - active
            - closed
          description: Current status of the thread
          example: active
    Error:
      type: object
      required:
        - success
        - error
        - details
      properties:
        success:
          type: boolean
          enum:
            - false
          description: Always false for error responses
        error:
          type: string
          description: Error name/type
          example: Bad Request
        details:
          type: string
          description: Detailed error message
          example: Either medical_note or pdf_file must be provided
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token for API authentication

````