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

# Patients

> Create a patient once, then create visits for them.

A patient in the API is a patient in RxNote — the same record **Add patient** creates in the app. Create it once and
use its `id` for every visit.

## Creating a patient

`name` is the only required field. Send what the note needs: `age` or `date_of_birth`, and `sex`, help the note;
`phone`, `email` and `medical_record_number` are optional.

```bash theme={null}
curl -X POST "$RXNOTE_API/patients" \
  -H "Authorization: Bearer $RXNOTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Test Patient", "age": 42, "sex": "female", "medical_record_number": "MRN-1001", "external_id": "P-1001" }'
```

The patient belongs to the key's clinician and, in an organization, is shared with the organization — as when a
clinician adds a patient in the app.

## Your own ids

Two optional fields connect RxNote patients to your system:

| Field | Use |
| - | - |
| `medical_record_number` | Your MRN or UHID. Shown in the app and searchable with `GET /patients?medical_record_number=`. |
| `external_id` | Your system's patient id. **Creating a patient with an `external_id` that already exists returns that patient (200) instead of a duplicate**, so you can send "create" every time and never store RxNote's id. Look up with `GET /patients?external_id=`. |

Without either, every `POST /patients` creates a new patient — keep the returned `id`.

## Finding patients

`GET /patients` lists the patients the clinician can see, newest first. `search` matches name, phone, email and MRN,
like the search box in the app.

```bash theme={null}
curl "$RXNOTE_API/patients?search=MRN-1001" -H "Authorization: Bearer $RXNOTE_API_KEY"
```


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