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

# Deep links

> Send a prescriber straight to a patient, prescription or order in the Prescribe app.

A deep link opens the [Prescribe app](/docs/prescribe/app) in its own tab, with the app's navigation, on the record you name. Use one when embedding doesn't fit: a link in an email or text, or a **Prescribe in Photon** button in an internal tool.

Deep links use the same paths as the [iframe](/docs/prescribe/embed/iframe) without `/embed`.

| URL | Opens |
| - | - |
| `https://rx.neutron.health/order` | A new order. The prescriber finds or adds the patient. |
| `https://rx.neutron.health/order?patient=pat_…` | A new order for this patient |
| `https://rx.neutron.health/order?patient=pat_…&template=tmp_…&template=tmp_…` | A new order for this patient, with a prescription from each template |
| `https://rx.neutron.health/order?patient=pat_…&rx=rx_…&med=med_…` | A new order for this patient, with this draft and a new prescription for this drug |
| `https://rx.neutron.health/order/ord_…` | This order, such as one [your backend drafted](/docs/integrations/one-click-orders) |
| `https://rx.neutron.health/order/ord_…?rx=rx_…` | This order, with this draft added |
| `https://rx.neutron.health/patient/pat_…` | This patient |
| `https://rx.neutron.health/prescription/rx_…` | This prescription |
| `https://rx.neutron.health/prescription?patient=pat_…&template=tmp_…` | A new prescription for this patient from this template (or `med=med_…` for a drug) |

The prescriber signs in to Photon if they haven't already, and lands on the record. Add `org=org_…` to sign them straight in to your organization.

A link carries Photon ids only: `pat_`, `rx_`, `ord_`, `med_`, `tmp_` and `org_`. It never carries patient details, drug names or instructions, so it's safe in an email, a text or a log. Each id opens its own card:

* On an order, `rx`, `template` and `med` repeat: each one adds a card. The same `rx` twice is one card.
* A prescription takes one of `rx`, `template` or `med`. If a link has more, the first one counts.
* The record's own id can also go in the query (`/order?order=ord_…`, `/patient?patient=pat_…`, `/prescription?rx=rx_…`). Beside it, ids that would conflict are ignored: an existing order or prescription keeps its own patient.
* An id Photon doesn't have in the prescriber's organization opens as **not found** on its card, and the rest of the link still opens.
* A `template` becomes a prescription once there's a patient (`patient=`, or the one the prescriber finds). Until then, its card is empty. ⚠️ Templates aren't applied yet, so a template card shows "A treatment … is required" instead.

<Card title="Try it" icon="play" href="https://rx.neutron.health/integrate/order/link" horizontal arrow>
  Build a deep link in /integrate from the records you give it, with the code that makes it.
</Card>

## Building a link

Links are just ids, so you can write them by hand. The [JavaScript client](/docs/prescribe/embed/javascript) builds them too:

```ts theme={"dark"}
import { photon } from "@photon-rx/core";

const ph = photon({ environment: "neutron", auth: { getToken } });

ph.order.url({ patient: { id: "pat_01M3WQQHRB1T0K1469KD18BAWX" }, prescriptions: { add: [{ templateId: "YOUR_TEMPLATE_ID" }] } });
// https://rx.neutron.health/order?patient=pat_01M3WQQHRB1T0K1469KD18BAWX&template=YOUR_TEMPLATE_ID

order.url(); // a live order you already have
```

Links point to the environment's Prescribe app (`rx.neutron.health`, or `rx.new` in production). A deep link never carries a `client_id`, so you can share it with any prescriber: the app signs them in on its own. Give `photon()` your `organization`, and the link signs them straight in to it.

For the iframe, use `frame()` in place of `url()`, from a client with your Application `client_id`.

An address that isn't a Prescribe page, such as an old or mistyped link, opens a new order.

To start from details you hold, such as a patient Photon hasn't matched yet, sync them from your backend first ([patient sync](/docs/network/patient)) and link the id Photon returns. `url()` refuses anything that isn't an id.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.