| 400 | Transcript or summary is missing or invalid. | The endpoint requires consultation inputs before it can generate a referral letter. |
| 400 | Provider or HCI configuration is invalid. | Missing or unknown provider ID, no consultation method/auth flow configured for the provider, missing or malformed clinic code, invalid CA origin, or the provider clinic limit is reached. |
| 401 | Authentication failed. | API key credentials are missing or invalid, a root clinic/key cannot be found, or no API key is linked to the authenticated clinic. |
| 429 | Usage limit reached. | Free-tier usage is exhausted, or a non-root paid API key has expired. |
| 500 | Unexpected server or upstream failure. | Unhandled JSON/form parsing errors, AI provider failures, transcription provider failures, database errors, or unexpected response parsing failures. |
1https://usescrubs.com



1curl --location 'https://usescrubs.com/api/v1/referral' \
2--header 'X-Scrubs-Clinic-Code: 00A123' \
3--header 'X-Scrubs-Clinic-Provider: SAMPLE_EHR_1' \
4--header 'Content-Type: application/json' \
5--data '{
6 "transcript":"Hi, doctor, I have been having a headache for the past 1 week ...",
7 "summary":"Patient reports having a headache for the past week ...",
8 "template":"Dear {recipient}, ...",
9 "patientData": {
10 "name": "John Doe",
11 "age": 45,
12 "gender": "Male",
13 "medicalHistory": ["Hypertension", "Diabetes"],
14 "medications": ["Metformin", "Lisinopril"]
15 }
16}'1{
2 "referral": "Dear [Name of Doctor], I am referring Mr. John [Patient's Last Name], ..."
3}