Connecting a patient
Create a patient, send them to the connect URL, learn that they approved, read the connection and revoke it.
You will create a patient, send them to approve the connection, follow the result, and end the connection when you need to.
Creating a patient, reading a patient, reading a connection and revoking a connection all need the patient:write scope. That scope needs a signed BAA. See BAA handling.
Create a patient#
POST /care/v1/patient/create/document creates a patient, or connects to the patient's existing Nurish'd account, and starts a connection with them. Nothing can be booked for a patient until they approve.
| Field | Required | Notes |
|---|---|---|
external_id | Yes | Your own id for the patient, 1 to 200 characters. |
email | Yes | The approval page sends its code to the address on the patient's Nurish'd account. |
first_name | Yes | At most 100 characters. |
last_name | Yes | At most 100 characters. |
date_of_birth | Yes | YYYY-MM-DD, in the past. |
address | Yes | line1, city, state, postal_code and country, and line2 if there is one. See below. |
return_url | No | Where the patient goes after the approval page. Must be one of your registered return URLs, otherwise the call answers validation_error. |
The address is required: a call without one answers 422 validation_error. A dietitian must be licensed where the patient lives, and a visit cannot be booked for a patient with no address. The address is saved only on a new Nurish'd account. An existing account is never changed. state is the province. state and country are two capital letters.
curl -X POST https://api.dev.nurishd.ca/care/v1/patient/create/document \
-H "X-Partner-API-Key: $NURISHD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"external_id": "patient-1001",
"email": "ada.lovelace@example.com",
"first_name": "Ada",
"last_name": "Lovelace",
"date_of_birth": "1990-12-10",
"address": {
"line1": "1 Example Street",
"city": "Vancouver",
"state": "BC",
"postal_code": "V6B 1A1",
"country": "CA"
},
"return_url": "https://clinic.example.com/nurishd/return"
}'const res = await fetch(
'https://api.dev.nurishd.ca/care/v1/patient/create/document',
{
method: 'POST',
headers: {
'X-Partner-API-Key': process.env.NURISHD_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
external_id: 'patient-1001',
email: 'ada.lovelace@example.com',
first_name: 'Ada',
last_name: 'Lovelace',
date_of_birth: '1990-12-10',
address: {
line1: '1 Example Street',
city: 'Vancouver',
state: 'BC',
postal_code: 'V6B 1A1',
country: 'CA',
},
return_url: 'https://clinic.example.com/nurishd/return',
}),
},
);
const patient = await res.json();import os
import requests
res = requests.post(
"https://api.dev.nurishd.ca/care/v1/patient/create/document",
headers={"X-Partner-API-Key": os.environ["NURISHD_API_KEY"]},
json={
"external_id": "patient-1001",
"email": "ada.lovelace@example.com",
"first_name": "Ada",
"last_name": "Lovelace",
"date_of_birth": "1990-12-10",
"address": {
"line1": "1 Example Street",
"city": "Vancouver",
"state": "BC",
"postal_code": "V6B 1A1",
"country": "CA",
},
"return_url": "https://clinic.example.com/nurishd/return",
},
)
patient = res.json()The answer:
{
"user": "6f1c0d2e-0000-4000-8000-000000000101",
"connection": {
"connection_id": "connection-0001",
"company_id": "company-0001",
"user": "6f1c0d2e-0000-4000-8000-000000000101",
"external_id": "patient-1001",
"status": "pending",
"scopes": ["care.bookings", "care.reports"],
"created_at": "2026-11-30T15:04:05Z",
"approved_at": null,
"revoked_at": null,
"revoked_by": null
},
"connect_url": "https://app.nurishd.ca/connect/abc123",
"connect_url_expires_at": "2026-12-01T15:04:05Z"
}The patient is asked to allow every care permission your key can use: care.bookings when it holds booking:write, care.reports when it holds report:read, and care.health-profile when it holds health-profile:read or health-profile:write. A key with none of those is refused with 403 scope_not_granted. Only the scopes your key may ask for are listed in scopes.
The patient's id is user. Use it as patient_id in the patient routes and as user when you book. The connection's id is connection.connection_id.
Calling create again with the same external_id returns the same patient and a fresh link. The answer never says whether the email already had a Nurish'd account, and it never repeats the patient's name, email, date of birth or address.
A patient is known to your company under one external_id. Two requests are refused with 409 and create nothing:
| Code | When |
|---|---|
external_id_conflict | The external_id already belongs to a patient with a different email. |
person_already_connected | The email is already connected under a different external_id. |
To change the id you use for a patient, keep using the first one.
What the patient does#
Send the patient to connect_url as a full page or a new tab. Never open it in a frame or a web view. The link is valid for 24 hours and works once.
On the Nurish'd page the patient:
- Enters a code sent to the email on their Nurish'd account, never to an address you supply.
- Signs the health privacy agreement and the telehealth consent, if they are not signed yet.
- Approves or declines.
If the email had no account, Nurish'd creates one. If it had one, Nurish'd reuses it and changes nothing on it.
In the Sandbox, no email is sent. The connect page accepts the fixed code 424242. See Environments.
Follow the connection#
The return URL carries connection_id and status. Use it only to know which connection to look at. Then do one of these:
- Wait for the
connection.approvedevent, orconnection.declinedif the patient declined. See Events. - Read the connection with
GET /care/v1/connection/{connection_id}/get/document:
curl https://api.dev.nurishd.ca/care/v1/connection/connection-0001/get/document \
-H "X-Partner-API-Key: $NURISHD_API_KEY"const res = await fetch(
'https://api.dev.nurishd.ca/care/v1/connection/connection-0001/get/document',
{
headers: { 'X-Partner-API-Key': process.env.NURISHD_API_KEY },
},
);
const connection = await res.json();import os
import requests
res = requests.get(
"https://api.dev.nurishd.ca/care/v1/connection/connection-0001/get/document",
headers={"X-Partner-API-Key": os.environ["NURISHD_API_KEY"]},
)
connection = res.json(){
"connection_id": "connection-0001",
"company_id": "company-0001",
"user": "6f1c0d2e-0000-4000-8000-000000000101",
"external_id": "patient-1001",
"status": "active",
"scopes": ["care.bookings", "care.reports"],
"created_at": "2026-11-30T15:04:05Z",
"approved_at": "2026-11-30T15:10:12Z",
"revoked_at": null,
"revoked_by": null
}The status is brought up to date when you read it. A connection that does not exist, is not a care connection, or belongs to another company or environment answers 404 not_found.
| Status | Meaning |
|---|---|
pending | The patient has not decided. Nothing can be booked. |
active | The patient approved. You can book. |
declined | The patient declined. Create again for a fresh link. |
revoked | The connection ended. revoked_at says when, and revoked_by is patient, partner or admin. |
GET /care/v1/patient/{patient_id}/get/document returns the patient and the connection, with the status brought up to date. Its connect_url and connect_url_expires_at are always null. Call create again for a fresh link.
Revoke the connection#
PUT /care/v1/connection/{connection_id}/revoke/document ends the connection. It raises a connection.revoked event. A connection that is already revoked or declined answers 409 connection_not_active.
curl -X PUT https://api.dev.nurishd.ca/care/v1/connection/connection-0001/revoke/document \
-H "X-Partner-API-Key: $NURISHD_API_KEY"const res = await fetch(
'https://api.dev.nurishd.ca/care/v1/connection/connection-0001/revoke/document',
{
method: 'PUT',
headers: { 'X-Partner-API-Key': process.env.NURISHD_API_KEY },
},
);
const connection = await res.json();import os
import requests
res = requests.put(
"https://api.dev.nurishd.ca/care/v1/connection/connection-0001/revoke/document",
headers={"X-Partner-API-Key": os.environ["NURISHD_API_KEY"]},
)
connection = res.json()The answer is the connection with status set to revoked, revoked_at set and revoked_by set to partner. Visits already booked stay booked, but you can no longer read or change them with your key. The patient and Nurish'd can revoke too.
To connect again, call create with the same external_id and send the patient to the new connect_url.
Next#
- Connections: statuses, scopes and return URLs.
- Saving a card: the next step. A card must be on file before a visit can be booked.
- Booking a visit: book once a card is saved.
- BAA handling: what care needs.
Something wrong on this page? Email hello@nurishd.io with the page address.