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

# Update Patient

> Updates a patient's demographic fields, preserving all other data on the resource (identifiers, contacts, links, etc.). Insurance/policy data is not accepted.

## Overview

Updates a patient's demographic fields, preserving all other data on the
resource (identifiers, contacts, links, flags, etc.). Demographics present in
the body are merged onto the existing record:

* `firstName`/`lastName` always update the name.
* `gender`, `dob`, and `address` update only when provided.
* `email` and `phone_number` replace their respective `telecom` entries while
  preserving other channels (e.g. fax).

Insurance/policy data is not accepted — a body containing a `policies` field
(or any unknown field) is rejected with a `400`.

## Authentication

JWT Bearer token from `/api/token`.

## Path Parameters

<ParamField path="patientId" type="string" required>
  External patient id. Must match the `id` in the request body.
</ParamField>

## Request Body

<ParamField body="id" type="string" required>
  External patient id (must match the path parameter).
</ParamField>

<ParamField body="first_name" type="string" required>
  Patient's first name.
</ParamField>

<ParamField body="last_name" type="string" required>
  Patient's last name.
</ParamField>

<ParamField body="name" type="string">
  Patient's full name.
</ParamField>

<ParamField body="gender" type="string">
  One of `male`, `female`, `other`, or `unknown`.
</ParamField>

<ParamField body="dob" type="string">
  Date of birth in `yyyy-MM-dd` format.
</ParamField>

<ParamField body="email" type="string">
  Patient email address.
</ParamField>

<ParamField body="phone_number" type="string">
  Patient phone number.
</ParamField>

<ParamField body="address" type="object">
  Patient address with `line1`, `line2`, `city`, `state`, `zip`, and `country`.
</ParamField>

## Example

```bash theme={null}
curl -X PUT "https://forecaster.cairhealth.com/api/patient/EXT-PAT-123" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "EXT-PAT-123",
    "first_name": "Jane",
    "last_name": "Doe",
    "phone_number": "555-9999"
  }'
```

## Response

```json theme={null}
{
  "success": true,
  "message": "Patient updated successfully",
  "data": {
    "patientId": "EXT-PAT-123",
    "patientFhirId": "fhir-patient-id"
  }
}
```

Returns `404` when no patient matches the external id.


## OpenAPI

````yaml PUT /api/patient/{patientId}
openapi: 3.1.0
info:
  title: Cair Health APIs
  description: APIs for the Cair Health platform
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://forecaster.cairhealth.com
security:
  - bearerAuth: []
paths:
  /api/patient/{patientId}:
    put:
      description: >-
        Updates a patient's demographic fields, preserving all other data on the
        resource (identifiers, contacts, links, etc.). Insurance/policy data is
        not accepted.
      parameters:
        - name: patientId
          in: path
          required: true
          schema:
            type: string
          description: External patient id (must match body `id`)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatientCrudRequest'
      responses:
        '200':
          description: Patient updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientCrudResponse'
        '400':
          description: Invalid request body or validation error
        '401':
          description: Unauthorized access or invalid organization ID
        '404':
          description: Organization or patient not found
        '500':
          description: Server error
      security:
        - bearerAuth: []
components:
  schemas:
    PatientCrudRequest:
      type: object
      description: >-
        Patient demographics. `id` is the external patient id, keyed by the Cair
        customer-patient-id naming system
        (https://fhir.cairhealth.com/fhir/identifier/customer-patient-id)
      properties:
        id:
          type: string
          description: External patient id
        first_name:
          type: string
          description: Patient's first name
        last_name:
          type: string
          description: Patient's last name
        name:
          type: string
          nullable: true
          description: Patient's full name
        gender:
          type: string
          nullable: true
          enum:
            - male
            - female
            - other
            - unknown
          description: Patient gender
        dob:
          type: string
          nullable: true
          description: Date of birth, yyyy-MM-dd
        email:
          type: string
          nullable: true
          description: Patient email address
        phone_number:
          type: string
          nullable: true
          description: Patient phone number
        address:
          type: object
          description: Patient address
          properties:
            city:
              type: string
              nullable: true
              description: City
            country:
              type: string
              nullable: true
              description: Country
            line1:
              type: string
              nullable: true
              description: Address line 1
            line2:
              type: string
              nullable: true
              description: Address line 2
            state:
              type: string
              nullable: true
              description: State
            zip:
              type: string
              nullable: true
              description: Postal code
      required:
        - id
        - first_name
        - last_name
      additionalProperties: false
    PatientCrudResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
          properties:
            patientId:
              type: string
              description: External patient id
            patientFhirId:
              type: string
              description: FHIR id of the Patient resource
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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