> ## 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.

# Quickstart

> Create an API key, a patient and a visit, and read the note.

**1. Create an API key**

In RxNote, open **Settings → API** (for yourself) or **Organization → API** (for a system many clinicians use)
and create a key with the scopes `patients:write`, `visits:write` and `visits:read`. Copy the secret — it is
shown once.

```bash theme={null}
export RXNOTE_API_KEY="rxn_test_..."
export RXNOTE_API="https://dev.rxnote.ai/api/v1"   # or http://localhost:3000/api/v1
```

**2. Create the patient**

```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", "external_id": "P-1001" }'
```

```json Response (201) theme={null}
{ "id": 4821, "name": "Test Patient", "age": 42, "sex": "female", "external_id": "P-1001", "...": "..." }
```

Keep `id`. With `external_id`, sending the same patient again returns this one instead of a duplicate, so you
never need to store RxNote's id if you'd rather look patients up by your own.

> [!NOTE]
>
> Using an **organization** key? Add `"clinician_email"` — the RxNote member creating the patient.

**3. Create a visit from a transcript**

```bash cURL theme={null}
curl -X POST "$RXNOTE_API/visits" \
  -H "Authorization: Bearer $RXNOTE_API_KEY" \
  -H "Idempotency-Key: quickstart-0001" \
  -H "Content-Type: application/json" \
  -d '{
    "patient_id": 4821,
    "language": "en",
    "transcript": "Doctor: What brings you in today? Patient: A sore throat for three days..."
  }'
```

```javascript Node.js theme={null}
const res = await fetch(`${process.env.RXNOTE_API}/visits`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RXNOTE_API_KEY}`,
    "Idempotency-Key": "quickstart-0001",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    patient_id: 4821,
    language: "en",
    transcript: "Doctor: What brings you in today? Patient: A sore throat for three days...",
  }),
});
const visit = await res.json();
```

```python Python theme={null}
import os, requests

visit = requests.post(
    f"{os.environ['RXNOTE_API']}/visits",
    headers={
        "Authorization": f"Bearer {os.environ['RXNOTE_API_KEY']}",
        "Idempotency-Key": "quickstart-0001",
    },
    json={
        "patient_id": 4821,
        "language": "en",
        "transcript": "Doctor: What brings you in today? Patient: A sore throat for three days...",
    },
).json()
```

```json Response (201) theme={null}
{ "id": 90211, "patient_id": 4821, "status": "processing", "...": "..." }
```

**4. Get the note**

Poll until `status` is `completed` (most notes take one to three minutes). [Webhooks](/webhooks.md) are coming soon.

```bash theme={null}
curl "$RXNOTE_API/visits/90211" -H "Authorization: Bearer $RXNOTE_API_KEY"
```

The `note` holds the template's sections and fields in order, plus `html` for display. See
[the note format](/visits.md#the-note).

## With a recording

A recording takes one more step: you upload the file straight to storage, then ask RxNote to process it — the same
upload-then-process sequence the app's recorder uses.

**1. Create the visit with audio details**

```bash theme={null}
curl -X POST "$RXNOTE_API/visits" \
  -H "Authorization: Bearer $RXNOTE_API_KEY" \
  -H "Idempotency-Key: quickstart-audio-0001" \
  -H "Content-Type: application/json" \
  -d '{
    "patient_id": 4821,
    "language": "en",
    "audio": { "content_type": "audio/webm", "size_bytes": 4812733 }
  }'
```

The response has `status: "recording"` and an `upload` object.

**2. Upload the file**

PUT the file to `upload.url` with exactly the headers in `upload.headers`. No API key on this request.

```bash theme={null}
curl -X PUT "<upload.url>" -H "Content-Type: audio/webm" --data-binary @consultation.webm
```

**3. Process**

```bash theme={null}
curl -X POST "$RXNOTE_API/visits/90212/process" -H "Authorization: Bearer $RXNOTE_API_KEY"
```

The visit moves to `processing`, then `transcribing`, `generating-soap` and `completed`.


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