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

# Assign a patient to a session

> Files the session and its notes under a patient in your organization. Use it for a session created without patient_id, or to correct a session's patient. A NOTE_UPDATED webhook fires for each of the session's notes. Refused with 409 when a note of this session was already sent to an EHR. Requires notes:write.



## OpenAPI

````yaml /openapi/ext-api-v1.json patch /sessions/{sessionId}
openapi: 3.0.0
info:
  title: Healos External API
  version: 1.0.0
  description: >-
    External API for managing patients, documents, and appointments, listing
    providers and note templates, pulling clinical notes (with transcript and
    patient context), and running insurance eligibility checks.
servers:
  - url: https://api.healos.ai/ext-api/v1
    description: Production
  - url: http://localhost:8787/ext-api/v1
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /sessions/{sessionId}:
    patch:
      tags:
        - Notes
      summary: Assign a patient to a session
      description: >-
        Files the session and its notes under a patient in your organization.
        Use it for a session created without patient_id, or to correct a
        session's patient. A NOTE_UPDATED webhook fires for each of the
        session's notes. Refused with 409 when a note of this session was
        already sent to an EHR. Requires notes:write.
      parameters:
        - schema:
            type: string
            description: Session UUID
            example: f47ac10b-58cc-4372-a567-0e02b2c3d479
          required: true
          name: sessionId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionAssignPatientBody'
      responses:
        '200':
          description: Patient assigned
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      session_id:
                        type: string
                      patient_id:
                        type: string
                      patient_changed:
                        type: boolean
                    required:
                      - session_id
                      - patient_id
                      - patient_changed
                required:
                  - data
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Session or patient not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: A note of this session was already sent to an EHR
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
components:
  schemas:
    SessionAssignPatientBody:
      type: object
      properties:
        patient_id:
          type: string
          pattern: ^\d+$
          example: '481926357104938271'
      required:
        - patient_id
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    RateLimitError:
      type: object
      properties:
        error:
          type: string
          example: Rate limit exceeded. Please retry after the window resets.
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key obtained from /api/v1/ext-api-keys

````

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