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

# Clinical Documentation

> POST /DocumentReference

## POST /DocumentReference

Writes back a conversation summary against a patient's chart. This is the same write a live Emma phone call makes after a patient conversation, included here so you can inspect and replay that payload shape without placing a live call.

### Request body

```json theme={null}
{
  "resourceType": "DocumentReference",
  "status": "current",
  "subject": { "reference": "Patient/pat-1001" },
  "content": [
    {
      "attachment": {
        "contentType": "text/plain",
        "data": "base64-encoded-note-here"
      }
    }
  ],
  "extension": [
    { "url": "escalateToClinicalTeam", "valueBoolean": false },
    { "url": "requestExternalRecords", "valueBoolean": false }
  ]
}
```

`subject.reference` must start with `Patient/`. Any other value, or a missing `subject.reference`, returns 400.

### Response

200 OK, echoes back the created DocumentReference resource in the same shape.

### Example request

```bash theme={null}
curl -X POST "https://your-emma-domain/api/DocumentReference" \
  -H "Authorization: Bearer <jwt>" \
  -H "Content-Type: application/json" \
  -d '{"resourceType":"DocumentReference","status":"current","subject":{"reference":"Patient/pat-1001"},"content":[{"attachment":{"contentType":"text/plain","data":"Tm90ZSB0ZXh0"}}]}'
```
