Developers

Search the docs

Search guides and headings.

Connecting a patient

Create a patient, send them to the connect URL, learn that they approved, read the connection and revoke it.

View as Markdown

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.

FieldRequiredNotes
external_idYesYour own id for the patient, 1 to 200 characters.
emailYesThe approval page sends its code to the address on the patient's Nurish'd account.
first_nameYesAt most 100 characters.
last_nameYesAt most 100 characters.
date_of_birthYesYYYY-MM-DD, in the past.
addressYesline1, city, state, postal_code and country, and line2 if there is one. See below.
return_urlNoWhere 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.

bash
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"
  }'

The answer:

json
{
	"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:

CodeWhen
external_id_conflictThe external_id already belongs to a patient with a different email.
person_already_connectedThe 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:

  1. Enters a code sent to the email on their Nurish'd account, never to an address you supply.
  2. Signs the health privacy agreement and the telehealth consent, if they are not signed yet.
  3. 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.approved event, or connection.declined if the patient declined. See Events.
  • Read the connection with GET /care/v1/connection/{connection_id}/get/document:
bash
curl https://api.dev.nurishd.ca/care/v1/connection/connection-0001/get/document \
  -H "X-Partner-API-Key: $NURISHD_API_KEY"

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.

StatusMeaning
pendingThe patient has not decided. Nothing can be booked.
activeThe patient approved. You can book.
declinedThe patient declined. Create again for a fresh link.
revokedThe 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.

bash
curl -X PUT https://api.dev.nurishd.ca/care/v1/connection/connection-0001/revoke/document \
  -H "X-Partner-API-Key: $NURISHD_API_KEY"

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#