Create or update a patient
Find-or-create a patient from your own master index.
Keeps Medos's patient record in step with your own master patient index. It is one of the Developer API's clinical writes, beside recording vitals and replacing a medical history.
API-key only, gated on devapi_patients_upsert. Send
X-Acting-User-Id to attribute the change to a
staff member. Without it, the change is attributed to the workspace admin.
How a request is matched
idpresent: updates that patient. Always200.- No
id,mrnNumberpresent: if this clinic already has a patient with that MRN it is updated (200); otherwise one is created (201). - Neither: treated as a create (
201), but Medos still matches on phone, so a patient who already booked through the widget becomes the same record, not a duplicate.
Patients created by your sync and patients created by a widget booking go through the same find-or-create, so one person is one record.
The status is advisory; the body is the truth
Create-or-update is decided before the write, by id or MRN. If two requests
for the same new MRN race, both can be answered 201. Either way the body is
what Medos stored, so key your local record on the returned id.
Parameters
Query parameters
addressIdintegerExample: 1The location to register the patient at.
Headers
x-api-keystringrequiredExample: mk_…Your Developer API key. Server-side only.
X-Acting-User-IdstringExample: MDU_A1B2C3D4E5F6The staff member the call is attributed to, as an MDU_… id. Omit it to attribute the call to the workspace admin.
Content-TypestringrequiredExample: application/jsonThe body is JSON. Anything else is a 415.
Body
idintegerExample: 4821Medos patient id. Send it to update a patient you already synced.
mrnNumberstringExample: MRN-0774Your MRN at this clinic. Makes a retry an update, not a second create.
firstNamestringExample: AshaOne of id, firstName or phoneNumber is required.
middleNamestringlastNamestringExample: MenoncountryCodestringExample: +91E.g. +91.
phoneNumberstringExample: 9811100001National number, without the country code.
emailstringExample: asha@example.comMust be a valid address.
gender"MALE" | "FEMALE" | "OTHER"enumdobdateExample: 1990-04-12YYYY-MM-DD.
bloodGroupstringExample: O+patientAddressobjectExample: {"addressLine1":"12 MG Road","city":"Pune"}addressLine1, city, state, zipcode, country.
The body is a JSON object. At least one of id, firstName or phoneNumber is required.
Do not send workspaceId. The workspace is always your key's own.
Responses
201 Created with a Location: /v1/patients/{id} header, or 200 OK for an
update. The body is the stored patient,
read back after the write, so it reflects normalised names, a generated MRN or a
merged record rather than echoing your request.
HTTP/1.1 201 Created
Location: /v1/patients/4821
Content-Type: application/json