---
title: "Start a patient conversation or send a patient reply"
method: POST
path: "/api/sites/patient/messages"
tags: ["Messaging"]
---

# Start a patient conversation or send a patient reply

`POST /api/sites/patient/messages`

## Request

- Base URL: `https://sim.animahealth.com`
- URL: `https://sim.animahealth.com/api/sites/patient/messages`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - API key in cookie `sim_session`

Requires GP scope. Existing conversations/templates require resourceId and their latest expectedVersion. New conversations require patientId. Commands are validated by role. Mutations are attributed to the authenticated team; incoming/outgoing direction identifies the simulated role. Patient responses omit private practice information. Practice messages are queued until a delivery command marks them delivered. configure_auto_reply sets an ordered script for future successful deliveries: each delivered outgoing message consumes one step and schedules a reply after delayMinutes of simulation time. Configure before delivery, then POST /api/clock with paused:true and advanceMinutes. Reconfiguration resets the script and cancels pending replies; empty steps disable it. Manual patient replies and completing a conversation cancel pending replies without reusing consumed steps. Read the latest conversation version after clock changes. Existing generic messaging_action commands remain supported.

## Query parameters

- `world` string

## Headers

- `Idempotency-Key` string

## Request body

- PatientMessageRequest
  - `resourceId` string
  - `expectedVersion` integer
  - `patientId` string, required
  - `command` union, required
    - object
      - `kind` 'patient_create', required
      - `subject` string, required
      - `body` string, required
      - `channel` 'sms' | 'email', required
    - object
      - `kind` 'reply', required
      - `body` string, required

## Response `200`

Success

- Conversation
  - `id` string, required
  - `patientId` string
  - `kind` 'conversation', required
  - `title` string, required
  - `status` string, required
  - `owner` 'gp', required
  - `visibleTo` string[], required
  - `priority` 'routine' | 'urgent', required
  - `createdAt` number, required: Simulation Unix timestamp in milliseconds.
  - `dueAt` number: Simulation Unix timestamp in milliseconds.
  - `data` object, required: Kind-specific payload. Hospital notes, medication orders and blood-test orders use the named schemas; the full workspace payload is returned without projection.
    - `assignee` string, required
    - `allowReply` boolean, required
    - `entries` union[], required
      - union
        - object
          - `id` string, required
          - `body` string, required
          - `at` number, required
          - `actor` object, required
            - `kind` 'team' | 'operator' | 'simulation', required
            - `name` string, required
          - `direction` 'outgoing', required
          - `channel` 'sms' | 'email', required
          - `delivery` object[], required
            - `status` 'queued' | 'delivered' | 'failed', required
            - `at` number, required
            - `actor` object, required
              - …
        - object
          - `id` string, required
          - `body` string, required
          - `at` number, required
          - `actor` object, required
            - `kind` 'team' | 'operator' | 'simulation', required
            - `name` string, required
          - `direction` 'incoming', required
          - `channel` 'sms' | 'email', required
        - object
          - `id` string, required
          - `body` string, required
          - `at` number, required
          - `actor` object, required
            - `kind` 'team' | 'operator' | 'simulation', required
            - `name` string, required
          - `direction` 'internal', required
    - `autoReply` object
      - `steps` object[], required
        - `body` string, required
        - `delayMinutes` number, required
      - `nextStep` integer, required
      - `pending` object[], required
        - `entryId` string, required
        - `stepIndex` integer, required
        - `at` number, required
  - `version` integer, required
  - `provenance` object
    - `created` RecordChange, required
      - `actor` object, required
        - `kind` 'team' | 'operator' | 'simulation', required
        - `name` string, required
      - `source` string, required
      - `action` string, required
      - `time` number, required: Simulation Unix timestamp in milliseconds.
      - `version` integer, required
    - `changes` RecordChange[], required
      - `actor` object, required
        - `kind` 'team' | 'operator' | 'simulation', required
        - `name` string, required
      - `source` string, required
      - `action` string, required
      - `time` number, required: Simulation Unix timestamp in milliseconds.
      - `version` integer, required
    - `recovery` object

## Other responses

- `400`: Invalid input or unsupported workflow
- `401`: Missing or invalid credentials
- `403`: Scope, origin or operator restriction
- `404`: Unknown resource
- `409`: Stale version, invalid transition or unavailable capacity
- `413`: Request exceeds this operation's body-size limit
- `429`: Deployment has reached its 5,000-team capacity
- `500`: Internal simulation error

---

[API](https://skmtc.dev/animahealth/apis/nhs-sim-api.md) - [All operations](https://skmtc.dev/animahealth/apis/nhs-sim-api/llms.txt) - [OpenAPI document](https://skmtc.dev/animahealth/apis/nhs-sim-api/revisions/c7803d7a3e58?raw)
