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

# Create a patient

> Create a patient from the same identity fields used by set-consultation-context. Returns the patient with its stable public id.



## OpenAPI

````yaml /scribe-api/openapi.json post /v1/patients
openapi: 3.1.0
info:
  title: Scribe Public API
  description: >-
    External-facing REST API for integrating with the Telepatia platform.
    Authenticate with API keys, set consultation context, and look up scribe
    sessions.
  version: 0.1.0
servers:
  - url: https://scribe-api.telepatia.ai
    description: Production
security:
  - BearerAuth: []
paths:
  /v1/patients:
    post:
      tags:
        - Patients
      summary: Create a patient
      description: >-
        Create a patient from the same identity fields used by
        set-consultation-context. Returns the patient with its stable public id.
      operationId: api_patient_create_v1_patients_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatientCreateRequest'
            example:
              idCountry: COLOMBIA
              idType: CC
              idValue: '1024567890'
              name: John Doe
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientResponse'
              example:
                createdAt: '2026-07-01T12:00:00.000Z'
                id: sp_a1b2c3d4e5f6g7h8
                idCountry: COLOMBIA
                idType: CC
                idValue: '1024567890'
                name: John Doe
        '400':
          description: >-
            Bad Request — invalid parameters, validation failures, or missing
            fields.
          content:
            application/json:
              examples:
                parameter_missing:
                  summary: Missing required field
                  value:
                    error:
                      type: invalid_request_error
                      code: parameter_missing
                      message: name is required.
                      param: name
                parameter_invalid:
                  summary: Invalid field value
                  value:
                    error:
                      type: invalid_request_error
                      code: parameter_invalid
                      message: >-
                        idCountry must be a valid country name, ISO alpha-2, or
                        ISO alpha-3 code.
                      param: idCountry
                account_invalid:
                  summary: Invalid account
                  value:
                    error:
                      type: invalid_request_error
                      code: account_invalid
                      message: Account has no valid authId.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized — missing or invalid API key.
          content:
            application/json:
              examples:
                authentication_required:
                  summary: Invalid or missing API key
                  value:
                    error:
                      type: authentication_error
                      code: authentication_required
                      message: Invalid API key.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflict — resource already exists or is in a conflicting state.
          content:
            application/json:
              examples:
                resource_conflict:
                  summary: Resource conflict
                  value:
                    error:
                      type: invalid_request_error
                      code: resource_conflict
                      message: >-
                        consultationInternalId is already in use by a different
                        consultation.
                      param: consultationInternalId
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service Unavailable — an external dependency is down.
          content:
            application/json:
              examples:
                service_unavailable:
                  summary: External service unavailable
                  value:
                    error:
                      type: api_error
                      code: service_unavailable
                      message: >-
                        Unable to generate verification code. Please try again
                        later.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    PatientCreateRequest:
      properties:
        name:
          type: string
          maxLength: 500
          minLength: 1
          title: Name
          examples:
            - John Doe
        idCountry:
          $ref: '#/components/schemas/IdCountry'
          examples:
            - CO
        idType:
          $ref: '#/components/schemas/IdType'
          examples:
            - CC
        idValue:
          type: string
          maxLength: 50
          minLength: 1
          title: Idvalue
          examples:
            - '1024567890'
      type: object
      required:
        - name
        - idCountry
        - idType
        - idValue
      title: PatientCreateRequest
      description: |-
        Request body for creating a patient.

        Mirrors the identity fields of set-consultation-context.
      examples:
        - idCountry: COLOMBIA
          idType: CC
          idValue: '1024567890'
          name: John Doe
    PatientResponse:
      properties:
        id:
          type: string
          title: Id
          description: Stable public identifier.
          examples:
            - sp_a1b2c3d4e5f6g7h8
        name:
          type: string
          title: Name
          examples:
            - John Doe
        idCountry:
          anyOf:
            - type: string
            - type: 'null'
          title: Idcountry
          examples:
            - COLOMBIA
        idType:
          anyOf:
            - type: string
            - type: 'null'
          title: Idtype
          examples:
            - CC
        idValue:
          anyOf:
            - type: string
            - type: 'null'
          title: Idvalue
          examples:
            - '1024567890'
        createdAt:
          type: string
          title: Createdat
          description: ISO-8601 timestamp when the patient was created.
      type: object
      required:
        - id
        - name
        - createdAt
      title: PatientResponse
      description: A single patient. `id` is the stable public id (sp_...).
      examples:
        - createdAt: '2026-07-01T12:00:00.000Z'
          id: sp_a1b2c3d4e5f6g7h8
          idCountry: COLOMBIA
          idType: CC
          idValue: '1024567890'
          name: John Doe
    ErrorResponse:
      description: Standardized error response envelope.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      title: ErrorResponse
      type: object
    IdCountry:
      type: string
      enum:
        - AF
        - AX
        - AL
        - DZ
        - AS
        - AD
        - AO
        - AI
        - AQ
        - AG
        - AR
        - AM
        - AW
        - AU
        - AT
        - AZ
        - BS
        - BH
        - BD
        - BB
        - BY
        - BE
        - BZ
        - BJ
        - BM
        - BT
        - BO
        - BQ
        - BA
        - BW
        - BV
        - BR
        - IO
        - BN
        - BG
        - BF
        - BI
        - KH
        - CM
        - CA
        - CV
        - KY
        - CF
        - TD
        - CL
        - CX
        - CC
        - CO
        - KM
        - CK
        - CR
        - CI
        - HR
        - CU
        - CW
        - CY
        - CZ
        - CD
        - DK
        - DJ
        - DM
        - DO
        - EC
        - EG
        - SV
        - GQ
        - ER
        - EE
        - SZ
        - ET
        - FK
        - FO
        - FJ
        - FI
        - FR
        - GF
        - PF
        - TF
        - GA
        - GE
        - DE
        - GH
        - GI
        - GR
        - GL
        - GD
        - GP
        - GU
        - GT
        - GG
        - GN
        - GW
        - GY
        - HT
        - HM
        - VA
        - HN
        - HK
        - HU
        - IS
        - IN
        - ID
        - IQ
        - IE
        - IR
        - IM
        - IL
        - IT
        - JM
        - JP
        - JE
        - JO
        - KZ
        - KE
        - KI
        - XK
        - KW
        - KG
        - LA
        - LV
        - LB
        - LS
        - LR
        - LY
        - LI
        - LT
        - LU
        - MO
        - MG
        - MW
        - MY
        - MV
        - ML
        - MT
        - MH
        - MQ
        - MR
        - MU
        - YT
        - MX
        - FM
        - MD
        - MC
        - MN
        - ME
        - MS
        - MA
        - MZ
        - MM
        - NA
        - NR
        - NP
        - NL
        - NC
        - NZ
        - NI
        - NE
        - NG
        - NU
        - NF
        - KP
        - MP
        - 'NO'
        - OM
        - PK
        - PW
        - PA
        - PG
        - PY
        - CN
        - PE
        - PH
        - PN
        - PL
        - PT
        - PR
        - QA
        - CG
        - GM
        - RE
        - RO
        - RU
        - RW
        - BL
        - SH
        - KN
        - LC
        - MF
        - PM
        - VC
        - WS
        - SM
        - ST
        - SA
        - SN
        - RS
        - SC
        - SL
        - SG
        - SX
        - SK
        - SI
        - SB
        - SO
        - ZA
        - GS
        - KR
        - SS
        - ES
        - LK
        - PS
        - SD
        - SR
        - SJ
        - SE
        - CH
        - SY
        - TW
        - TJ
        - TH
        - MK
        - TL
        - TG
        - TK
        - TO
        - TT
        - TN
        - TR
        - TM
        - TC
        - TV
        - UG
        - UA
        - AE
        - GB
        - TZ
        - UM
        - US
        - UY
        - UZ
        - VU
        - VE
        - VN
        - VG
        - VI
        - WF
        - EH
        - YE
        - ZM
        - ZW
      title: IdCountry
      description: ISO 3166-1 alpha-2 country codes. Mirrors tanjiro's CountryCodes enum.
    IdType:
      type: string
      enum:
        - CC
        - TI
        - CE
        - RC
        - PASSPORT
        - RG
        - CPF
        - OTHER_DOC
      title: IdType
      description: Supported patient identification document types.
    ErrorDetail:
      description: Error detail with machine-readable codes and human-readable message.
      properties:
        type:
          description: Broad error category for high-level handling.
          examples:
            - invalid_request_error
          title: Type
          type: string
        code:
          description: Machine-readable error code. Clients should switch on this value.
          examples:
            - parameter_invalid
          title: Code
          type: string
        message:
          description: Human-readable error message ending with a period.
          examples:
            - >-
              idCountry must be a valid country name, ISO alpha-2, or ISO
              alpha-3 code.
          title: Message
          type: string
        param:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: The request field that caused the error, if applicable.
          examples:
            - idCountry
          title: Param
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          description: Optional structured, machine-readable context for the error.
          examples:
            - pendingConsultations:
                - sessionId: abc123
                  url: https://...
          title: Details
      required:
        - type
        - code
        - message
      title: ErrorDetail
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key passed as a Bearer token

````