---
title: "Generate patient memory context for AI assistants"
method: GET
path: "/patients/{patientId}/memory"
tags: ["patients"]
---

# Generate patient memory context for AI assistants

`GET /patients/{patientId}/memory`

## Request

- Base URL: `https://api.lumahealth.io/api/v2`
- URL: `https://api.lumahealth.io/api/v2/patients/{patientId}/memory`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/lumahealth/apis/rest-service/docs/patients/:patientId/memory/get.ts> (a function with typed inputs; its response is checked against the schema)

Returns live operational facts plus any durable PatientMemory narrative.
Used by realtime-agent-service (`generateMemory`) for voice and SMS assistants.

Live facts are queried on demand. Durable sections are the latest
memory-service rebuild, if one exists.

Scopes:
- **full**: Live referrals, appointments, calls, faxes, balance + all durable sections
- **clinical**: Live referrals and faxes + durable clinical
- **scheduling**: Live referrals needing scheduling + appointments
- **other**: Live calls and balance + durable preferences, interactions, administrative

Output:
- **json**: Structured live + durable payload
- **markdown**: Deterministic live block, then durable notes

Channel only affects date formatting in markdown:
- **voice**: `August 20, 2026`
- **sms**: `08-20-2026`

## Path parameters

- `patientId` string, required

## Query parameters

- `scope` 'full' | 'clinical' | 'scheduling' | 'other'
- `output` 'json' | 'markdown'
- `channel` 'voice' | 'sms'

## Response `200`

Patient memory generated successfully

- union
  - PatientMemoryMarkdownResponse
    - `success` boolean, required: Whether the operation was successful
    - `memory` string: Markdown with live facts first, then durable notes when present
    - `error` string
  - PatientMemoryJsonResponse
    - `success` boolean, required: Whether the operation was successful
    - `data` PatientMemoryData: Live operational snapshot plus optional durable PatientMemory narrative
      - `patient` object
        - `firstName` string
        - `lastName` string
        - `dateOfBirth` string: Display date as MM-DD-YYYY
        - `age` number
        - `contact` string: Preferred SMS contact when present
      - `referrals` PatientMemoryReferral[]
        - `id` string, required
        - `providerName` string
        - `referralType` string
        - `status` 'needsScheduling' | 'completed' | 'pendingFax', required
        - `date` string, date-time
      - `calls` PatientMemoryCall[]
        - `summary` string, required
        - `date` string, date-time
      - `appointments` PatientMemoryAppointment[]
        - `providerName` string
        - `appointmentType` string
        - `facilityName` string
        - `date` string, date-time
        - `status` string
        - `checklistIncomplete` boolean: True when the appointment is upcoming and its checklist is not completed
      - `faxes` PatientMemoryFax[]
        - `description` string
        - `status` string
        - `date` string, date-time
      - `balance` object
        - `amount` number: Balance in cents
        - `updatedAt` string, date-time, nullable
      - `durable` PatientMemoryDurable: Latest durable PatientMemory narrative written by memory-service
        - `rebuiltAt` string, date-time, nullable
        - `version` number
        - `sections` object
          - `clinical` PatientMemoryDurableSection
            - `content` string, required
            - `updatedAt` string, date-time
            - `sources` string[]: Entity ids that fed the last rebuild of this section
          - `preferences` PatientMemoryDurableSection
            - `content` string, required
            - `updatedAt` string, date-time
            - `sources` string[]: Entity ids that fed the last rebuild of this section
          - `interactions` PatientMemoryDurableSection
            - `content` string, required
            - `updatedAt` string, date-time
            - `sources` string[]: Entity ids that fed the last rebuild of this section
          - `administrative` PatientMemoryDurableSection
            - `content` string, required
            - `updatedAt` string, date-time
            - `sources` string[]: Entity ids that fed the last rebuild of this section
    - `error` string

## Other responses

- `401`: Not authenticated
- `403`: Access token does not have the required scope
- `404`: Patient not found
- `500`: Internal server error

## Changes

- **2026-10-17** `f19aeba84a26`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/lumahealth/apis/rest-service/changes/patients/:patientId/memory/get.md)

---

[API](https://skmtc.dev/lumahealth/apis/rest-service.md) - [All operations](https://skmtc.dev/lumahealth/apis/rest-service/llms.txt) - [OpenAPI document](https://skmtc.dev/lumahealth/apis/rest-service/revisions/f19aeba84a26?raw)
