> ## Documentation Index
> Fetch the complete documentation index at: https://api.vitarelay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Referring patients to the IDN

> A flow within the VitaClinic API: refer patients to the Internal Doctor Network from your own site. You refer; an IDN doctor prescribes.

Referring patients to the Internal Doctor Network is a flow **within the VitaClinic API** — not a separate API. If your organization has joined the **Internal Doctor Network (IDN)**, you can refer patients for evaluation and prescribing directly from your own website, using the same VitaClinic API key and base URL as the rest of the API. It's the same "Push to Prescriber" flow available in the VitaRelay app.

<Info>
  **You refer; an IDN doctor evaluates and prescribes.** You never prescribe. Referrals require your org to be IDN-activated by VitaRelay, and a VitaClinic API key carrying the `rx:read` / `rx:write` scopes.
</Info>

## The flow

<Steps>
  <Step title="Add the patient">
    Add the patient you're referring with `POST /patients` — patients are
    routed under the Internal Doctor Network automatically. (There is no
    "practice" to create; that model is retired.)
  </Step>

  <Step title="Send an intake">
    Send an intake link the **patient** completes. Referral is blocked until they submit it.

    <Info>
      Live keys create real intakes and referrals; test keys run in sandbox.
    </Info>
  </Step>

  <Step title="Refer to the IDN">
    Push the patient to the IDN. An IDN doctor evaluates the intake and prescribes.
  </Step>

  <Step title="Track the request">
    Poll the patient's Rx requests, or cancel a pending one.
  </Step>
</Steps>

## Is this a separate API?

No. The referral endpoints (`/rx/...`) are **part of the VitaClinic API** — same base URL, same key. There are only two public APIs, depending on who prescribes:

| API                | Base URL                  | For                                                                                                                                     | Who prescribes                                     |
| ------------------ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| **VitaClinic API** | `/api/public/v1`          | Clinics, affiliates, and reps running on VitaRelay's infrastructure — including referring patients to the IDN (the `/rx/...` endpoints) | An **IDN doctor** prescribes. You never prescribe. |
| **Practice API**   | `/api/public/practice/v1` | Practices prescribing with their **own** licensed providers                                                                             | **Your own provider** prescribes.                  |

<Info>
  Referring to the IDN uses the **VitaClinic API** — one key, one base URL (`https://vitarelay.com/api/public/v1`). The `/rx/...` endpoints are just the referral part of that API.
</Info>

## Access & scopes

| Scope      | Grants                                                        |
| ---------- | ------------------------------------------------------------- |
| `rx:read`  | List patients, read Rx request status, IDN status             |
| `rx:write` | Add patients, send intakes, refer to the IDN, cancel requests |

Both also require your org to be **IDN-activated**. If it isn't, endpoints return `403 idn_not_joined`. Joining the IDN is arranged with VitaRelay — the API reports status but does not self-join.

<Note>
  Base URL `https://vitarelay.com/api/public/v1`. See the **API Reference** in this section for every endpoint, request, and response.
</Note>
