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

# Update a patient

> Updates demographics. A blank submitted value NEVER clears a populated EHR value. When a non-blank value conflicts with the stored chart, `conflictPolicy` decides: `reject` (default, 400 listing the conflicting fields), `overwrite`, or `skip`. The default is deliberate — this is a public booking form writing to a clinical record, so silent overwrite is the wrong behaviour.



## OpenAPI

````yaml /openapi-v3.json patch /patients/{id}
openapi: 3.0.0
info:
  title: Max AI Public API
  description: API for third-party marketplace apps
  version: '3.0'
  contact: {}
servers:
  - url: https://api.maxcare.ai/v3
security: []
tags: []
paths:
  /patients/{id}:
    patch:
      tags:
        - Patients
      summary: Update a patient
      description: >-
        Updates demographics. A blank submitted value NEVER clears a populated
        EHR value. When a non-blank value conflicts with the stored chart,
        `conflictPolicy` decides: `reject` (default, 400 listing the conflicting
        fields), `overwrite`, or `skip`. The default is deliberate — this is a
        public booking form writing to a clinical record, so silent overwrite is
        the wrong behaviour.
      operationId: PatientsPublicController_updatePatient
      parameters:
        - name: id
          required: true
          in: path
          description: Patient ID
          schema:
            type: string
        - name: X-Organization-Id
          in: header
          required: true
          schema:
            type: string
          description: Target clinic organization ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePatientBody'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdatePatientSuccessResponse'
        '400':
          description: Missing or invalid request parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiBadRequestResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiUnauthorizedResponse'
        '403':
          description: Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiForbiddenResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiNotFoundResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitResponse'
        '502':
          description: EHR sync failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiBadGatewayResponse'
        '503':
          description: EHR integration unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiServiceUnavailableResponse'
      security:
        - api-key: []
components:
  schemas:
    UpdatePatientBody:
      type: object
      properties:
        firstName:
          type: string
          example: Jane
        middleName:
          type: string
          example: Marie
        lastName:
          type: string
          example: Doe
        dateOfBirth:
          type: string
          description: YYYY-MM-DD
          example: '1984-02-11'
        sex:
          type: string
          example: FEMALE
        email:
          type: string
          example: jane@example.com
        phones:
          description: >-
            Contact points to write. Each is merged into the chart BY TYPE, so a
            submitted cell number never touches a stored home or work number. A
            phone-typed value must contain at least 7 digits or the request is
            rejected. NOTE: phone values are NOT covered by `conflictPolicy` — a
            submitted number replaces the stored number OF THE SAME TYPE. We
            hold one untyped 'preferred' number per chart, so a typed submission
            cannot be compared against it without rejecting the ordinary case of
            a patient confirming their mobile. An `EMAIL_ADDRESS` entry here
            writes the chart's single email field and IS covered by
            `conflictPolicy`.
          type: array
          items:
            $ref: '#/components/schemas/PatientContactPointBody'
        address:
          $ref: '#/components/schemas/PatientAddressBody'
        conflictPolicy:
          type: string
          description: >-
            What to do when a submitted value differs from the stored one.
            `reject` (default) fails the whole update and reports the
            conflicting fields; `overwrite` replaces them; `skip` keeps the
            stored value and applies the rest. Blank submitted values NEVER
            clear a populated EHR value under any policy — this is a public
            booking form writing to a clinical record, so silent overwrite is
            not the default. Applies to the named demographic fields and to an
            email sent via `phones[]`; see `phones` for why phone VALUES are
            exempt.
          enum:
            - reject
            - overwrite
            - skip
          example: reject
    UpdatePatientSuccessResponse:
      type: object
      properties:
        code:
          type: string
          description: Response code
          example: success
        data:
          $ref: '#/components/schemas/UpdatePatientData'
      required:
        - code
        - data
    PublicApiBadRequestResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: bad_request
        message:
          type: string
          description: Human-readable error message
          example: '''id'' must be a valid UUID'
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiUnauthorizedResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: unauthorized
        message:
          type: string
          description: Human-readable error message
          example: Invalid or missing API key
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiForbiddenResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: forbidden
        message:
          type: string
          description: Human-readable error message
          example: Insufficient scope
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiNotFoundResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: not_found
        message:
          type: string
          description: Human-readable error message
          example: Resource not found
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiRateLimitResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: rate_limit_exceeded
        message:
          type: string
          description: Human-readable error message
          example: Rate limit exceeded. Maximum 1000 requests per 60 seconds.
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiBadGatewayResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: unexpected_integration_error
        message:
          type: string
          description: Human-readable error message
          example: EHR sync failed
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiServiceUnavailableResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: server_unresponsive
        message:
          type: string
          description: Human-readable error message
          example: EHR integration is not available for this note
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PatientContactPointBody:
      type: object
      properties:
        type:
          type: string
          description: Contact point type — the same enum the EHR adapter layer uses
          enum:
            - CELL_PHONE
            - HOME_PHONE
            - WORK_PHONE
            - EMAIL_ADDRESS
          example: CELL_PHONE
        value:
          type: string
          example: '+13135550123'
        preferred:
          type: boolean
          description: >-
            Unsupported. Omit this field; preferred-contact updates are not
            available.
          deprecated: true
      required:
        - type
        - value
    PatientAddressBody:
      type: object
      properties:
        line1:
          type: string
          example: 1200 Miller Rd
        line2:
          type: string
          example: Apt 4
        city:
          type: string
          example: Flint
        state:
          type: string
          description: >-
            Two-letter state code. The adapters translate to each vendor's form
            (EZDerm `FLORIDA`, ModMed `FL`).
          example: MI
        zip:
          type: string
          example: '48507'
        country:
          type: string
          example: US
      required:
        - line1
        - city
        - state
        - zip
    UpdatePatientData:
      type: object
      properties:
        id:
          type: string
          example: pat_c56103bcd39c46d39f3138dd2b5e05f6
        updatedFields:
          description: >-
            Fields written to the EHR, named as the EHR groups them — not as
            they were submitted. An email or phone update reports as
            `contactPoints`, never as `email` or `phones`. Note `skippedFields`
            DOES use the submitted name (`email`), so the same logical field is
            named differently across the two arrays.
          example:
            - contactPoints
            - address
          type: array
          items:
            type: string
        skippedFields:
          description: >-
            Fields left alone because the submitted value conflicted and
            `conflictPolicy` was `skip`
          example: []
          type: array
          items:
            type: string
      required:
        - id
        - updatedFields
        - skippedFields
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Marketplace API key

````