---
title: Connections
description: A connection is a customer's or patient's consent for your company to act for them; learn its statuses, scopes and return URLs.
section: Core concepts
order: 7
---

# Connections

You will understand how a customer or patient agrees that your company may act for them, and how to follow that agreement safely.

## The connection is the consent

Your company cannot act for a person until they say so. The person approves on a Nurish'd page, not on yours. The record of that approval is a connection.

1. You create the customer (meals) or patient (care). The answer holds a `connect_url`.
2. You send the person to the `connect_url` as a full page or a new tab. Never open it in a frame or a web view. The page refuses to render inside another site.
3. The person approves or declines on the Nurish'd page.
4. Nurish'd sends them back to your return URL, if you gave one.
5. You learn the result from an event or by reading the connection.

The `connect_url` is valid for 24 hours and works once. Create again with the same `external_id` to get a fresh link.

## Statuses

| Status     | Meaning                                                                                                                                                                 |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pending`  | Waiting for the person to decide. Nothing can be done for them yet.                                                                                                     |
| `active`   | The person approved.                                                                                                                                                    |
| `declined` | The person declined. Start again with a fresh link.                                                                                                                     |
| `revoked`  | The connection ended. The person, your company or Nurish'd can revoke. `revoked_by` says who: `patient` (the customer or patient), `partner` (your company) or `admin`. |

A connection that is not `active` refuses actions with `409 connection_not_active`. A care connection and a meals connection have the same shape. `user` is the id of the customer or patient.

```json
{
	"connection_id": "connection-0001",
	"company_id": "company-0001",
	"user": "6f1c0d2e-0000-4000-8000-000000000101",
	"external_id": "customer-1001",
	"status": "active",
	"scopes": ["meals.orders"],
	"created_at": "2026-11-30T15:04:05Z",
	"approved_at": "2026-11-30T15:10:12Z",
	"revoked_at": null,
	"revoked_by": null
}
```

## Connection scopes

A connection carries what the person approved.

| Connection scope      | What the person approves                             | Company scope it needs                          |
| --------------------- | ---------------------------------------------------- | ----------------------------------------------- |
| `meals.orders`        | Place meal orders for them and see the orders placed | `order:write`                                   |
| `care.bookings`       | Book and manage visits                               | `booking:write`                                 |
| `care.reports`        | Receive reports of visits you book                   | `report:read`                                   |
| `care.health-profile` | Read and update the health profile                   | `health-profile:read` or `health-profile:write` |

If a call needs a connection scope the person did not approve, it answers `403 connection_scope_not_granted`. For care, the patient is asked to allow every care scope your key can use when you create the patient.

Care scopes need a signed BAA on your company, and the patient signs the health privacy agreement and the telehealth consent on the connect page. See [BAA handling](/docs/care/baa).

## Return URLs

You can pass a `return_url` when you create a customer or a patient. The person goes there after the approval page.

- Return URLs must be allowlisted in the console. Owners and admins manage them. See [Company settings](/docs/console/company-settings).
- A `return_url` that is not on the list answers `422 validation_error`.
- The return URL carries `connection_id` and `status`.

> **Warning.** Never trust the `status` in the return URL. Anyone can edit a URL. Trust the `connection.approved` event, or read the connection with `GET /meals/v1/connection/{connection_id}/get/document` (meals) or `GET /care/v1/connection/{connection_id}/get/document` (care).

```text
https://shop.example.com/nurishd/return?connection_id=connection-0001&status=approved
```

## One external id per person

A customer or patient is known to your company under one `external_id`. Create refuses two requests with `409` and creates nothing: `external_id_conflict` when the `external_id` already belongs to someone with a different email, and `person_already_connected` when the email is already connected under a different `external_id`. Keep using the first id.

## Asking for more scopes later

Create again with the same `external_id` and a scope the connection does not hold. The connection goes back to `pending` with the old and new scopes together, and you get a fresh link. Nothing works for that person until they approve again.

## Events

| Event                 | When                  |
| --------------------- | --------------------- |
| `connection.approved` | The person approved.  |
| `connection.declined` | The person declined.  |
| `connection.revoked`  | The connection ended. |

Each event carries the connection id. See [Events](/docs/events/events).

## Revoke

Your company revokes a connection with `PUT /meals/v1/connection/{connection_id}/revoke/document` (meals) or `PUT /care/v1/connection/{connection_id}/revoke/document` (care). The person can revoke in their Nurish'd account. Revoking raises `connection.revoked`.

## Next

- [Customers](/docs/meals/customers): create a customer and follow the connection.
- [Connecting a patient](/docs/care/connecting-a-patient): the same flow for care.
- [Events](/docs/events/events): react to connection events.
- [Company settings](/docs/console/company-settings): register return URLs.
