---
updatedAt: 2025-11-11T23:19:20.000Z
agentTools:
  projectIndex: https://docs.photon.health/llms.txt
---

# Prescription Events

## photon:prescription:created

A prescription is created

#### Schema

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Param
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        id
      </td>

      <td>
        string
      </td>

      <td>
        Internal Photon ID for the prescription
      </td>
    </tr>

    <tr>
      <td>
        externalId
      </td>

      <td>
        string (optional)
      </td>

      <td>
        External ID passed in during prescription creation
      </td>
    </tr>

    <tr>
      <td>
        dispenseQuantity
      </td>

      <td>
        number
      </td>

      <td>
        Amount of a dispenseUnit per fill
      </td>
    </tr>

    <tr>
      <td>
        dispenseUnit
      </td>

      <td>
        string
      </td>

      <td>
        Unit to dispense medication in
      </td>
    </tr>

    <tr>
      <td>
        dispenseAsWritten
      </td>

      <td>
        boolean
      </td>

      <td>
        True if substitutes are not allowed at the pharmacy
      </td>
    </tr>

    <tr>
      <td>
        refillsAllowed
      </td>

      <td>
        number
      </td>

      <td>
        Number of refills allowed before expiration of script
      </td>
    </tr>

    <tr>
      <td>
        daysSupply
      </td>

      <td>
        number
      </td>

      <td>
        Number of days a single fill lasts
      </td>
    </tr>

    <tr>
      <td>
        instructions
      </td>

      <td>
        string
      </td>

      <td>
        Prescriber instructions for patient
      </td>
    </tr>

    <tr>
      <td>
        notes
      </td>

      <td>
        string
      </td>

      <td>
        Prescriber notes, available to pharmacist
      </td>
    </tr>

    <tr>
      <td>
        effectiveDate
      </td>

      <td>
        string
      </td>

      <td>
        Date when the script is first valid
      </td>
    </tr>

    <tr>
      <td>
        expirationDate
      </td>

      <td>
        string
      </td>

      <td>
        Date when the script is no longer valid
      </td>
    </tr>

    <tr>
      <td>
        prescriberId
      </td>

      <td>
        string
      </td>

      <td>
        ID of the
      </td>
    </tr>

    <tr>
      <td>
        medicationId
      </td>

      <td>
        string
      </td>

      <td>
        ID of the medication being prescribed
      </td>
    </tr>

    <tr>
      <td>
        patientId
      </td>

      <td>
        string
      </td>

      <td>
        ID of the patient that this prescription belongs to
      </td>
    </tr>

    <tr>
      <td>
        patient
      </td>

      <td>
        Object
      </td>

      <td>
        Object containing the Photon ID and the external id of the patient
      </td>
    </tr>
  </tbody>
</Table>

#### Sample Event

```json
{
    "id": "01G8C1TNGH2F03021F23C95261",
    "type": "photon:prescription:created",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "rx_01G8C1TNF8TZ5N9DAJN66H9KSH",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "rx_01G8C1TNF8TZ5N9DAJN66H9KSH",
        "externalId": "1234",
        "dispenseQuantity": 30,
        "dispenseAsWritten": true,
        "dispenseUnit": "EA",
        "refillsAllowed": 12,
        "daysSupply": 30,
        "instructions": "Take once daily",
        "notes": "",
        "effectiveDate": "2022-01-01",
        "expirationDate": "2023-01-01",
        "prescriberId": "usr_wUofzqEvcA2JCwJ4",
        "medicationId": "med_01G7T2NB6",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        },
    }
}
```

***

## photon:prescription:depleted

All refills for this prescription have been used

#### Schema

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Param
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        id
      </td>

      <td>
        string
      </td>

      <td>
        Internal Photon ID for the prescription
      </td>
    </tr>

    <tr>
      <td>
        externalId
      </td>

      <td>
        string (optional)
      </td>

      <td>
        External ID passed in during prescription creation
      </td>
    </tr>

    <tr>
      <td>
        patient
      </td>

      <td>
        Object
      </td>

      <td>
        Object containing the Photon ID and the external id of the patient
      </td>
    </tr>
  </tbody>
</Table>

#### Sample Event

```json
{
    "id": "01G8AHJBT081QQWM89X3SVV31F",
    "type": "photon:prescription:depleted",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "rx_01G8AGBC91W1042CDRB19545EC",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "rx_01G8AGBC91W1042CDRB19545EC",
        "externalId": "1234",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }
}
```

***

## photon:prescription:expired

The prescription has expired

#### Schema

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Param
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        id
      </td>

      <td>
        string
      </td>

      <td>
        Internal Photon ID for the prescription
      </td>
    </tr>

    <tr>
      <td>
        externalId
      </td>

      <td>
        string (optional)
      </td>

      <td>
        External ID passed in during prescription creation
      </td>
    </tr>

    <tr>
      <td>
        patient
      </td>

      <td>
        Object
      </td>

      <td>
        Object containing the Photon ID and the external id of the patient
      </td>
    </tr>
  </tbody>
</Table>

#### Sample Event

```json
{
    "id": "01G8AHJBT081QQWM89X3SVV31F",
    "type": "photon:prescription:depleted",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "rx_01G8AGBC91W1042CDRB19545EC",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "rx_01G8AGBC91W1042CDRB19545EC",
        "externalId": "1234",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }
}
```