Referral Letter

POST /api/v1/referralReturns a Referral Letter in string format. This endpoint requires both a transcript and a summary from a consultation to generate a referral letter. Optional parameters include template for custom formatting and patientData for additional patient context. Critical information needed in the referral letter that is unable to be sourced from the summary or transcript is enclosed within square brackets.HEADER PARAMETERS
REQUIREDX-Scrubs-Clinic-Codestring
Clinic code or identifier of the clinic making the API request.
REQUIREDX-Scrubs-Clinic-Providerstring
Provider ID associated with your EHR application.
REQUIREDX-Scrubs-<any-other-header>any
Other required headers depending on your organisation's provider ID.
BODY PARAMETERS
REQUIREDtranscriptstring
A consultation transcription. It does not need to follow the format of transcription endpoint.
REQUIREDsummarystring
A consultation summary. It does not need to follow the format of summaries from the summary endpoint but should resemble a SOAP note.
OPTIONALtemplatestring
An optional template for the referral letter. If provided, Scrubs will use this template structure and fill in the content within curly braces.
OPTIONALpatientDataobject
An optional object containing structured patient data that will be incorporated into the output to provide additional context. This can include past medical history, medications, allergies, previous examination findings, or other relevant patient information.
Error Codes5 cases
Endpoint validation
400Transcript or summary is missing or invalid.The endpoint requires consultation inputs before it can generate a referral letter.
Common HCI and authentication errors
400Provider 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.
401Authentication 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.
429Usage limit reached.Free-tier usage is exhausted, or a non-root paid API key has expired.
Common runtime errors
500Unexpected server or upstream failure.Unhandled JSON/form parsing errors, AI provider failures, transcription provider failures, database errors, or unexpected response parsing failures.
Domain
BASE URL
1https://usescrubs.com
Sample Request
CURL
NodeJS
Python
Go
CURL
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}'
Sample Response
JSON
1{
2    "referral": "Dear [Name of Doctor], I am referring Mr. John [Patient's Last Name], ..."
3}
Contact us: support@usescrubs.com