> ## 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.

# Network

> Photon's prescribing API: three upserts over GraphQL or MCP, and webhooks for what happens after an order is sent.

Network is the API underneath everything in Photon. It has three upserts, `patient`, `prescription` and `order`, two ways to call them, and webhooks to hear what happens next:

<CardGroup cols={3}>
  <Card title="GraphQL" icon="code" href="/docs/network/graphql">
    For your backend: sync patients and draft prescriptions and orders with a machine token.
  </Card>

  <Card title="MCP" icon="robot" href="/docs/network/mcp">
    For agents: take intake, search drugs and draft prescriptions as tools. In private preview.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/docs/network/webhooks">
    For your backend: get notified as orders are sent, filled, shipped and picked up.
  </Card>
</CardGroup>

## Three upserts

Network has no queries. Each record has one mutation, and how you call it decides what it does:

| | Send | Photon |
| - | - | - |
| **Get** | `{ id }` | Returns the record. Nothing changes. |
| **Sync** | What you know, with or without an `id` | Finds, matches, creates or updates the record. Photon decides which. |
| **Update** | `{ id, …fields }` | Changes only the fields you sent. |

| Mutation | Record | Reference |
| - | - | - |
| `patient(patient:, metadata:)` | Patient `pat_…` | [Patient](/docs/network/patient) |
| `prescription(prescription:, metadata:)` | Prescription `rx_…` | [Prescription](/docs/network/prescription) |
| `order(order:, metadata:)` | Order `ord_…` | [Order](/docs/network/order) |

## Photon decides, then tells you

Send what you know, and Photon does the matching, resolution and screening, so your code doesn't have to. Each response reports what Photon did:

* **The record**, as saved.
* **`appliedChanges`**: what was written.
* **`unappliedChanges`**: what wasn't, and why. When Photon isn't sure, this lists the options to pick from.

See [Changes and choices](/docs/network/changes).

## Where Network stops

A machine token can do everything except sign. Signing and sending need a signed-in prescriber, which is what [Prescribe](/docs/prescribe/overview) is for. Typically, your backend syncs patients and drafts prescriptions and orders. A prescriber then opens the draft in Prescribe, signs it and sends it. See [Authentication](/docs/authentication).


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