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

# Create a new patient



## OpenAPI

````yaml /openapi/ext-api-v1.json post /patients
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 for pulling clinical notes (with transcript and patient
    context).
servers:
  - url: https://api.healos.ai/ext-api/v1
    description: Production
  - url: http://localhost:8787/ext-api/v1
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /patients:
    post:
      tags:
        - Patients
      summary: Create a new patient
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePatientBody'
      responses:
        '201':
          description: Patient created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/PatientDetail'
                required:
                  - data
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: external_id already in use within this organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
components:
  schemas:
    CreatePatientBody:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: >-
            Patient display name. If omitted, first_name and/or last_name are
            used.
          example: Maria Santos
        first_name:
          type: string
          minLength: 1
          description: Patient first name
          example: Maria
        last_name:
          type: string
          minLength: 1
          description: Patient last name
          example: Santos
        date_of_birth:
          type: string
          minLength: 1
          description: Date of birth (YYYY-MM-DD)
          example: '1990-03-15'
        gender:
          type: string
          minLength: 1
          description: Patient gender
          example: female
        phone:
          type: string
          minLength: 1
          description: Patient phone number
          example: '+14155550123'
        email:
          type: string
          format: email
          description: Patient email
          example: maria@example.com
        address:
          nullable: true
          description: Structured address JSON
        mrn:
          type: string
          nullable: true
          maxLength: 64
          description: >-
            Medical record number (optional). Omit, or send null/empty when the
            patient has no MRN.
          example: MRN-12345
        external_id:
          type: string
          minLength: 1
          maxLength: 255
          description: >-
            Optional caller-supplied identifier. Unique per organization;
            immutable once set. Duplicate values return 409 with the existing
            record.
          example: PARTNER-12345
        provider_id:
          type: string
          minLength: 1
          description: >-
            Optional internal provider id (see GET /providers) to assign this
            patient to. Must be a provider in your organization. Defaults to the
            provider that owns the API key.
          example: aaaaaaa1-0000-0000-0000-000000000001
      anyOf:
        - required:
            - name
        - required:
            - first_name
        - required:
            - last_name
    PatientDetail:
      type: object
      properties:
        id:
          type: string
          description: Unique patient identifier
          example: '481926357104938271'
        name:
          type: string
          description: Patient name
          example: Maria Santos
        first_name:
          type: string
          nullable: true
          description: Patient first name
          example: Maria
        last_name:
          type: string
          nullable: true
          description: Patient last name
          example: Santos
        date_of_birth:
          type: string
          nullable: true
          description: Date of birth (YYYY-MM-DD)
          example: '1990-03-15'
        gender:
          type: string
          nullable: true
          description: Patient gender
          example: female
        phone:
          type: string
          nullable: true
          description: Patient phone number
          example: '+14155550123'
        email:
          type: string
          nullable: true
          description: Patient email
          example: maria@example.com
        address:
          nullable: true
          description: Structured address JSON, if recorded
        mrn:
          type: string
          nullable: true
          description: Medical record number
          example: MRN-12345
        created_at:
          type: string
          description: Creation timestamp (ISO 8601)
          example: '2026-03-15T09:30:00.000Z'
        pronouns:
          type: string
          nullable: true
          description: Pronouns
          example: she/her
        notes:
          type: string
          nullable: true
          description: Clinical notes or context about this patient
          example: >-
            History of generalized anxiety disorder. Currently on sertraline
            50mg.
        consent:
          type: boolean
          description: Whether the patient has consented to treatment documentation
          example: true
        external_id:
          type: string
          nullable: true
          description: Caller-supplied external identifier (immutable once set)
          example: PARTNER-12345
        provider_id:
          type: string
          nullable: true
          description: >-
            Internal id of the provider this patient is assigned to (see GET
            /providers).
          example: aaaaaaa1-0000-0000-0000-000000000001
      required:
        - id
        - name
        - first_name
        - last_name
        - date_of_birth
        - gender
        - phone
        - email
        - mrn
        - created_at
        - pronouns
        - notes
        - consent
        - external_id
        - provider_id
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    ConflictResponse:
      type: object
      properties:
        error:
          type: string
          example: external_id already in use
        existing:
          type: object
          properties:
            id:
              type: string
              description: HealOS internal ID of the existing record
            external_id:
              type: string
              description: The conflicting external_id
          required:
            - id
            - external_id
      required:
        - error
        - existing
    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

````