PatchRx Connect API (1.2.3)

Download OpenAPI specification:

License: License TBA

Overview

While we do not expect many changes to this API, it is subject to change with notice.

The PatchRx Connect API can be used to integrate prescription adherence data generated by PatchRx devices into many applications.

We highly recommend reading through our integration guide(s). There are two of them, so the best place to start is here.

Integration Paths

Integrating PatchRx technology can look a different depending on the intended application, so PatchRx offers two suggested paths to API integration.

Below is a chart detailing the main feature differences between the two pathways. For more detail on each path and tips for choosing between them, see each path's respective section:

PatchRx API Paths

If you're unsure which path is best, we are happy to advise!


PatchRx Connect Integration Guide Light Path

In this pathway, the integrating partner only needs to activate and deactivate devices. After activation, the devices begin recording data that can be simply queried using device identifiers. If desired, the integrating partner can still leverage PatchRx's native inventory management system, device management, and ordering capabilities. This is the fastest way to integrate.

Consider choosing this path if some or all of the following apply...

  • You need to integrate quickly
  • Your application already has, or doesn't require, a robust patient/prescription data model
  • Your application already has, or doesn't require, a robust frontend and UI for managing and monitoring patients and their adherence data
  • Your application already has, or doesn't require, code completion tracking (typically only needed in fee-for-service applications)

Below is a high-level overview of how you might implement the PatchRx API (Light Path) in a production environment. Think of this as a typical workflow; you can adjust to your specific use-case or constraints.

Before reading through the guide's steps, it's helpful to familiarize yourself with PatchRx's data model.

Light Data Model

Organizationally, PatchRx customers are Partners, and each partner can have 1:N Health Entity Locations (HELs). These HELs are used to represent different sites in a multi-site implementation. For the light integration, having more than 1 is optional. They are only necessary if you intend to leverage PatchRx's inventory management system. If not, it's acceptable to create a single monolithic HEL.

In this integration path, the only other objects invoved are the Devices, Gateways and PatchCaps, which are associated with HELs after shipment.

PatchRx Light Data Model

1. API & Webapp Authentication

  1. Obtain API key(s) and PatchRx webapp access
    Reach out to your PatchRx representative to get your API keys and webapp access. Your API requests must include the custom header:

    x-api-key: <YOUR_KEY_HERE>
    
  2. Login to the webapp
    Login to the PatchRx webapp and familiarize yourself. In the Light integration path, the only relevant parts of the webapp are the Inventory and Locations tabs, as you won't be working with patients/prescriptions & billing. Here is a quick-use guide that explains how to use the webapp.

  3. Test your key(s)
    You can verify that your API key is working by testing any GET endpoint with your key.

    For example, GET /all_health_entity_locations:

    curl --location 'https://external.patchrx.io/all_health_entity_locations' --header 'x-api-key: <your API key>'
    

    You should get a 200 response and a list of HELs for your partner account.

2. Ordering Devices & Managing Inventory

A. Inventory Management System setup (optional)

If your implementation doesn't require multi-site inventory managment, skip to section B below.

PatchRx's software has a built-in inventory management system. This system enables partners to monitor inventory levels across their health entity locations, track distribution rates, and conduct periodic audits and updates.

The IMS is built around health entity locations (HELs). Inventory flows as follows:

  • Devices are added to an HEL's inventory account upon shipment
  • Devices are removed from an HEL's inventory account upon activation
  • Devices are re-added to the HEL's inventory account upon deactivation, unless they are marked as lost
    • note: this only applies to Gateways, as PatchCaps are disposable and are never added back to HEL inventory

System setup

If you plan to leverage this system, you'll need to create health entity locations for each site where you'd like to track inventory.

Managing and viewing inventory

In the event that you transfer inventory between health entity locations, or if inventory is lost/destroyed, you'll need to use API calls to keep the PatchRx IMS up to date.

(calls to view and manage inventory coming soon)

B. Order inventory

Inventory can be ordered via the PatchRx webapp inventory tab.

  1. Click "Order demo units" in the "Actions" block
  2. Complete the modal, select shipping & payment method, and place the order

Note: If the actions block is not visible, reach out to your PatchRx representative to enable & configure ordering for your account.

In production, users will instead use the "Order inventory" button to place orders for cases of inventory rather than individual demo units.

3. Activating & Using Devices

Once you have devices, all that's needed to begin receiving data from them is activation via the API and physical setup.

  • Gateways must be activated and deactivated via API upon enrollment and discontinuation respectively in order to properly manage costs
  • PatchCaps do not require API activation (only physical setup/activation)

To get devices online and request their data, simply follow steps 1-4 below.

  1. Activate the Gateway upon distribution: PUT /activate_gateway (coming soon, see note)
  2. (if using IMS) Mark PatchCap as distributed upon distribution: PUT /patchcap_distributed (coming soon, see note)
  3. Setup the devices when ready: device instructions here
  4. Retrieve PatchCap data after using devices: GET /patchcap_data (coming soon, see note)

Note: These endpoints are not yet live, but can be brought online in short order if you are interested in the Light integration path.

4. Deactivating & Reusing Devices

To discontinue connectivity-related billing, Gateways must be deactivated when they are no longer used. However, they are reusable, provided that the patient returns them with their accessories and they are in clean, working order.

  • If the patient returns a reusable Gateway, call PUT /deactivate_gateway with returned = true, which will:
    • Deactivate the Gateway, disabling its SIM and related billing
    • Add the Gateway back to the original HEL's inventory account (only applicable if using PatchRx IMS)
  • If the patient does NOT return a reusable device, call PUT /deactivate_gateway with returned = false, which will:
    • Deactivate the Gateway, disabling its SIM and related billing
    • Mark the Gateway as lost (only applicable if using PatchRx IMS)

If a patient returns a device that is not reusable (missing accessories, etc.), PatchRx has a recycling & rebate program. Reach out to your PatchRx representative for more information.

Note: These endpoints are not yet live, but can be brought online in short order if you are interested in the Light integration path.


PatchRx Connect Integration Guide Full Path

In this pathway, the integrating partner will create patients and prescriptions in the PatchRx environment before associating and assigning devices to them. This is a more involved integration pathway, but enables use of the PatchRx webapp for monitoring and managing patients and their devices. Additionally, it allows for automated code completion tracking.

Consider choosing this path if some or all of the following apply...

  • You have more time for integration
  • You would like the ability to manage patients via the PatchRx Webapp
  • You would like to be able to monitor patient's prescription adherence and related metrics via the PatchRx Webapp
  • Your application requires devices/data to be associated with patients/prescriptions in the PatchRx environment, i.e.
    • You'd like to have parallel patient and prescription objects in PatchRx to mirror your application, OR
    • Your application doesn't have these objects at all & needs PatchRx to be source of truth for them

Below is a high-level overview of how you might implement the PatchRx API in a production environment. Think of this as a typical workflow; you can adjust to your specific use-case or constraints. Before reading through the guide's steps, it's helpful to familiarize yourself with PatchRx's data model.

Full Data Model

Organizationally, PatchRx customers are Partners, and each partner can have 1:N Health Entity Locations (HELs). These HELs are used to represent different sites in a multi-site implementation. Patients are organized underneath HELs, as each HEL can have 0:N patients. Patients themselves can have 0:N Prescriptions and 0:N Devices (PatchCaps & Gateways). Gateways are associated with the Patient, while PatchCaps are assigned to the Patient's Prescriptions.

PatchRx Full Data Model

1. API & Webapp Authentication

  1. Obtain API key(s) and PatchRx webapp access
    Reach out to your PatchRx representative to get your API keys and webapp access. Your API requests must include the custom header:

    x-api-key: <YOUR_KEY_HERE>
    
  2. Login to the webapp
    Login to the PatchRx webapp and familiarize yourself. Here is a quick-use guide that explains how to use it.

  3. Test your key(s)
    You can verify that your API key is working by testing any GET endpoint using cURL.

    For example, GET /all_health_entity_locations:

    curl --location 'https://external.patchrx.io/all_health_entity_locations' --header 'x-api-key: <your API key>'
    

    You should get a 200 response and a list of HELs for your partner account.

2. Organization & Inventory

Health entity locations are the key organizational block in PatchRx's data model. Patients and inventory are organized underneath them, and webapp user permissions are scoped by association with them (for more on permissions, see here).

For multi-site implementations, we recommend creating health entity locations for each physical site, as it makes managing patient populations easier and facilitates the use of PatchRx's inventory management system. The inventory management system enables partners to monitor inventory levels across their health entity locations, track distribution rates, and conduct periodic audits and updates.

Inventory flows as follows:

  • Devices are added to an HEL's inventory account upon shipment
  • Devices are removed from an HEL's inventory account upon activation
  • Devices are re-added to the HEL's inventory account upon deactivation, unless they are marked as lost
    • note: this only applies to Gateways, as PatchCaps are disposable and are never added back to HEL inventory

If you plan to leverage this system, or would like to cleanly segment patient populations by location, you'll need to create health entity locations for each respective location. For your integration, you can manage this manually or setup a trigger to create new locations in PatchRx upon creation in your application.

If you don't wish to leverage the benefits of multiple HELs, you can proceed with a single default HEL for organizing all patients and inventory.

A. Create health entity locations (if needed)

B. Order inventory

Inventory can be ordered via the PatchRx webapp inventory tab.

  1. Click "Order demo units" in the "Actions" block
  2. Complete the modal, select shipping & payment method, and place the order

Note: If the actions block is not visible, reach out to your PatchRx representative to enable & configure ordering for your account.

When your integration is in production, users will instead use the "Order inventory" button to place orders for cases of inventory rather than individual demo units.

C. Viewing & managing inventory

In the event that you transfer inventory between health entity locations, or if inventory is lost/destroyed, you'll need to use API calls to keep the PatchRx IMS up to date.

(calls to view and manage inventory coming soon)

Once you have set up your health entity locations, ordered inventory, and that inventory has shipped, the inventory chart on the inventory tab should be updated to reflect that those units are now in stock and ready to be associated with patients / assigned to prescriptions.

3. Setting Up Patients & Devices

PatchRx has two types of devices: PatchCaps and Gateways.

Gateways are relay devices that sync data from PatchCaps and send it to the cloud via cellular connection. It is required to associate Gateways with patients, as it enables the device's SIM. If it's not associated with a patient, the device is inert and will not sync data.

PatchCaps are the sensors responsible for actually measuring the bottle openings and closings. To support polypharmacy situations, they are assigned to patient's prescriptions.

To get a patient set up for monitoring, you'll need to do the following in order:

  1. Create their patient record (requires: name, dob, health entity location, timezone)
  2. Create their prescription record(s) (requires: RxCUI or NDC) or DIN)*
  3. Associate Gateway with patient (requires: Gateway serial number)
  4. Assign PatchCap to prescription (requires: PatchCap serial number)

Because PatchCaps are disposable and have a limited lifespan (>120 days), it will be necessary to repeat step 4 each time they get a replacement. If their prescription changes, it will be necessary to repeat steps 2 and 4.

We typically recommend completing steps 1-4 all at once upon patient enrollment in your application, but in some cases partners may make the calls separately.

Note: throughout these docs, we use "associate" to refer to the creation of a relationship between device and patient. "Assign" is used to refer to the creation of a relationship between a device and a prescription.

1. Creating Patients

  • Call POST /patient
  • You can optionally supply your own external identifier in the id field
  • For additional patient-related endpoints, see the patients section

2. Creating Prescriptions

  • For each of the patient's to-be-monitored prescriptions, call POST /prescription
  • You can also pass in your own external prescription ID if desired, or let PatchRx generate one
  • For additional prescription-related endponts, see the prescriptions section

3. Associate Gateway

4. Assign PatchCap

  • When the PatchCap is distributed to the patient, call PUT /assign_patchcap to assign it to their respective prescription
  • Assignment to a patient's prescription is required for data to flow properly
  • Assignment to a patient's prescription will also associate the PatchCap with the patient

Once steps 1-4 are complete, the patient only needs to plug in their Gateway, affix their PatchCap, and pull its activation tab (see setup). From thereon, the sytem should passively record their openings and make that data available via API.

4. Monitoring Data

Currently, opening events are retrieved via a single API call: GET /bottle_opens, which will return a list of a given patient's opening events, tagged with the prescription ID, medication name, device serial, and event time.

The full integration path does allow for patient monitoring via the PatchRx webapp.

  • From the patients tab, find and click on a patient
  • On their page, you can view time series data for openings and high level metrics across any desired timeframe, which you can set via the "Metrics Start" and "Metrics End" boxes

Temporarily Disabled. In the future, GET /patient_patchcap_connectivity will provide heartbeat-driven connectivity metrics (e.g., "online" vs. "offline").

5. Handling Patient Discontinuation

A small portion of patients will inevitably discontinue their monitoring program. In that event, it's important to clean up their PatchRx records to facilitate device reuse and avoid unnecessary billing charges.

Gateways are reusable (provided they still have their accessories and are in clean, working order).

If the patient returns a reusable device, use the PUT /unassociate_gateway call to unassociate the Gateway from the discontinuing patient and disable its SIM. Then use PUT /patient to update the patient's state to "archived". These calls will:

  • Mark the patient as "archived" (important for analytics, billing, etc.)
  • Disable the Gateway's SIM and related billing
  • Free up the Gateway for re-association with another patient

If the patient does NOT return a reusable device, simply use PUT /patient to update the patient's state to "archived". This will:

  • Mark the patient as "archived" (important for analytics, billing, etc.)
  • Disable the Gateway's SIM and related billing
  • Mark the Gateway as lost for inventory accounting purposes

If a patient returns a device that is not reusable (missing accessories, etc.), PatchRx has a recycling & rebate program. Reach out to your PatchRx representative for more information.


Permissioning

Permissioning

API connections have full partner-scoped permissions, meaning they can create, update, and read from any entities created underneath their partner.

Webapp users have health-entity-location-scoped permissions, meaning their abilities are limited by which health entity locations they're associated. For more detail, see the users endpoints.

External IDs

Some entities support creation and reference using external identifiers. This means that you can use your organization's unique identifiers in lieu of PatchRx's generated identifiers. Doing so is optional, and PatchRx will generate unique identifiers if they are not provided. Currently, this is supported for health entity locations, patients, and prescriptions.

Health Entity Locations

PatchRx uses a tiered structure for grouping patients. Organizations using the API are Partners. Each partner may have 1:N Health Entity Location(s).

These locations are used for managing patients and inventory in multi-site applications.

Create health entity location

Creates a heath entity location.

Authorizations:
apiKeyAuth
Request Body schema: application/json
required
id
string (HealthEntityLocationId)

Unique health entity location id; assigned by PatchRx if none provided upon creation

name
required
string (HealthEntityLocationName)

Name of the health entity location

Responses

Request samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "name": "Jane's Pharmacies, Toledo"
}

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "name": "Jane's Pharmacies, Toledo",
  • "is_active": true
}

Get health entity location

Get info for a single health entity location.

Authorizations:
apiKeyAuth
query Parameters
id
required
string (HealthEntityLocationId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique health entity location id; assigned by PatchRx if none provided upon creation

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Update health entity location

Update health entity location information.

Authorizations:
apiKeyAuth
query Parameters
id
required
string (HealthEntityLocationId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique health entity location id; assigned by PatchRx if none provided upon creation

Request Body schema: application/json
required
name
string (HealthEntityLocationName)

Name of the health entity location

is_active
boolean (IsActive)

Whether the given entity is active

Responses

Request samples

Content type
application/json
{
  • "name": "Jane's Pharmacies, Toledo",
  • "is_active": true
}

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "name": "Jane's Pharmacies, Toledo",
  • "is_active": true
}

Get all health entity locations

Get info for all health entity locations within the partner's purview.

Authorizations:
apiKeyAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Patients

The patients endpoint is used for creating and managing parallel representations of patients.

Get all patients

Get a list of all patients for the requesting partner

Authorizations:
apiKeyAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Add a patient

Add a patient to PatchRx. Each created patient must have a unique combination of first_name, last_name, and dob, or else a duplicate patient error will be raised.

Authorizations:
apiKeyAuth
Request Body schema: application/json
required
id
string <uuid> (PatientId)

Unique patient id; assigned by PatchRx if none provided upon creation

first_name
required
string (FirstName)

First name

last_name
required
string (LastName)

Last name

health_entity_location_id
required
string (HealthEntityLocationId)

Unique health entity location id; assigned by PatchRx if none provided upon creation

dob
required
string <date> (DateOfBirth)

Date of birth in YYYY-MM-DD format

timezone
required
string (Timezone)

Timezone as a postgresql timezone abbreviation or name

phone
string <phone> (PhoneNumber)

Phone number, including country code

nickname
string (Nickname)

Nickname

practitioner_id
string (UserId)

Unique user id; assigned by PatchRx (external ids not currently supported)

Responses

Request samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "first_name": "John",
  • "last_name": "Doe",
  • "health_entity_location_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "dob": "1968-03-24",
  • "timezone": "America/New_York",
  • "phone": "+16171111111",
  • "nickname": "JD",
  • "practitioner_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33"
}

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "first_name": "John",
  • "last_name": "Doe",
  • "nickname": "JD",
  • "dob": "1968-03-24",
  • "phone": "+16171111111",
  • "health_entity_location_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "practitioner_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "patient_state": "enrolled",
  • "timezone": "America/New_York"
}

Get patient info

Given a patient's unique id, retrieve their information.

Authorizations:
apiKeyAuth
query Parameters
id
required
string <uuid> (PatientId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique patient id; assigned by PatchRx if none provided upon creation

Responses

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "first_name": "John",
  • "last_name": "Doe",
  • "nickname": "JD",
  • "dob": "1968-03-24",
  • "phone": "+16171111111",
  • "health_entity_location_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "practitioner_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "patient_state": "enrolled",
  • "timezone": "America/New_York"
}

Update patient info

Given a patient id, update any patient info.

Authorizations:
apiKeyAuth
query Parameters
id
required
string <uuid> (PatientId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique patient id; assigned by PatchRx if none provided upon creation

Request Body schema: application/json
required
first_name
string (FirstName)

First name

last_name
string (LastName)

Last name

nickname
string (Nickname)

Nickname

health_entity_location_id
string (HealthEntityLocationId)

Unique health entity location id; assigned by PatchRx if none provided upon creation

practitioner_id
string (UserId)

Unique user id; assigned by PatchRx (external ids not currently supported)

dob
string <date> (DateOfBirth)

Date of birth in YYYY-MM-DD format

phone
string <phone> (PhoneNumber)

Phone number, including country code

patient_state
string (PatientState)
Enum: "enrolled" "archived"

The patient's state, new patients default to enrolled

timezone
string (Timezone)

Timezone as a postgresql timezone abbreviation or name

Responses

Request samples

Content type
application/json
{
  • "first_name": "John",
  • "last_name": "Doe",
  • "nickname": "JD",
  • "health_entity_location_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "practitioner_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "dob": "1968-03-24",
  • "phone": "+16171111111",
  • "patient_state": "enrolled",
  • "timezone": "America/New_York"
}

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "first_name": "John",
  • "last_name": "Doe",
  • "nickname": "JD",
  • "dob": "1968-03-24",
  • "phone": "+16171111111",
  • "health_entity_location_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "practitioner_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "patient_state": "enrolled",
  • "timezone": "America/New_York"
}

Prescriptions

The prescriptions endpoint is used for creating and managing parallel representations of patient's prescriptions.

Patients can have multiple prescriptions, and each prescription can have multiple PatchCaps as they're used and replaced.

Get patient's prescriptions

Get all prescriptions for a given patient

Authorizations:
apiKeyAuth
query Parameters
id
required
string <uuid> (PatientId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique patient id; assigned by PatchRx if none provided upon creation

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a new prescription

Create a prescription for a given patient. PatchRx uses the National Library of Medicine's RxNorm as our main drug database. If you use an RXCUI (RxNorm Concept Unique Identifier), PatchRx will automatically use the mapped RxString information from RxNorm in any PatchRx UI.

However, if you need to use an alternate identifier (e.g. NDC or DIN), use the corresponding request format and PatchRx systems will attempt to map the provided identifier to RxNorm. As these mappings are not always 100% accurate, you can optionally provide an alternate commercial name and drug strength, which will be displayed in any PatchRx UI instead of the mapped values to ensure consistency across systems.

Authorizations:
apiKeyAuth
Request Body schema: application/json
required
One of
id
string (PrescriptionId)

Unique prescription id; assigned by PatchRx if none provided upon creation

patient_id
required
string <uuid> (PatientId)

Unique patient id; assigned by PatchRx if none provided upon creation

rxcui
required
string (RXCUI)

A unique identifier assigned to an individual drug entity in RxNorm

alternate_commercial_name
string (AlternateCommercialName)

The drug's commercial name

Provide this field if you'd like to ensure this name is displayed in the PatchRx UI, otherwise, the mapped RxNorm RxString will be used

alternate_drug_strength
string (AlternateDrugStrength)

The drug's strength

Provide this field if you'd like to ensure this strength is displayed in the PatchRx UI, but note that alternate commercial name must be provided for this field to be used

Omit this field if the drug's strength is included in the alternate commercial name (otherwise it will be listed twice)

state
string (PrescriptionState)
Enum: "archived" "monitored"

The prescription's state, defaults to monitored for newly created prescriptions

provider_instructions
string (ProviderInstructions)

Any instructions given by the provider

dosing_device
string (DosingDevice)
Enum: "Standard pharmacy pill bottle" "Secondary pill bottle" "Pill tray - simple" "Pill tray - smart tech enabled" "Pill dispenser" "Other"

The primary dispensing/storage device being used by the patient

Responses

Request samples

Content type
application/json
Example
{
  • "id": "233e765d-ecf3-4c3f-9a69-0acb87b76814",
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "rxcui": "310965",
  • "alternate_commercial_name": "Aspirin",
  • "alternate_drug_strength": "100mg",
  • "state": "archived",
  • "provider_instructions": "string",
  • "dosing_device": "Standard pharmacy pill bottle"
}

Response samples

Content type
application/json
{
  • "id": "233e765d-ecf3-4c3f-9a69-0acb87b76814",
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "state": "archived",
  • "rxcui": "310965",
  • "rxstring": "Advil 200MG Oral Tablet",
  • "alternate_drug_id": "12345678",
  • "alternate_commercial_name": "Aspirin",
  • "alternate_drug_strength": "100mg",
  • "provider_instructions": "string",
  • "dosing_device": "Standard pharmacy pill bottle"
}

Get prescription info

Get all prescription info given a prescription id.

Authorizations:
apiKeyAuth
query Parameters
id
required
string (PrescriptionId)
Example: id=233e765d-ecf3-4c3f-9a69-0acb87b76814

Unique prescription id; assigned by PatchRx if none provided upon creation

Responses

Response samples

Content type
application/json
{
  • "id": "233e765d-ecf3-4c3f-9a69-0acb87b76814",
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "state": "archived",
  • "rxcui": "310965",
  • "rxstring": "Advil 200MG Oral Tablet",
  • "alternate_drug_id": "12345678",
  • "alternate_commercial_name": "Aspirin",
  • "alternate_drug_strength": "100mg",
  • "provider_instructions": "string",
  • "dosing_device": "Standard pharmacy pill bottle"
}

Update prescription info

Update prescription information for a given prescription id. Use empty strings to clear any fields.

Authorizations:
apiKeyAuth
query Parameters
id
required
string (PrescriptionId)
Example: id=233e765d-ecf3-4c3f-9a69-0acb87b76814

Unique prescription id; assigned by PatchRx if none provided upon creation

Request Body schema: application/json
required
One of
state
string (PrescriptionState)
Enum: "archived" "monitored"

The prescription's state, defaults to monitored for newly created prescriptions

rxcui
string (RXCUI)

A unique identifier assigned to an individual drug entity in RxNorm

provider_instructions
string (ProviderInstructions)

Any instructions given by the provider

dosing_device
string (DosingDevice)
Enum: "Standard pharmacy pill bottle" "Secondary pill bottle" "Pill tray - simple" "Pill tray - smart tech enabled" "Pill dispenser" "Other"

The primary dispensing/storage device being used by the patient

Responses

Request samples

Content type
application/json
Example
{
  • "state": "archived",
  • "rxcui": "310965",
  • "provider_instructions": "string",
  • "dosing_device": "Standard pharmacy pill bottle"
}

Response samples

Content type
application/json
{
  • "id": "233e765d-ecf3-4c3f-9a69-0acb87b76814",
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "state": "archived",
  • "rxcui": "310965",
  • "rxstring": "Advil 200MG Oral Tablet",
  • "alternate_drug_id": "12345678",
  • "alternate_commercial_name": "Aspirin",
  • "alternate_drug_strength": "100mg",
  • "provider_instructions": "string",
  • "dosing_device": "Standard pharmacy pill bottle"
}

Devices

The device endpoints are used for managing device <> patient, device <> prescription.

There are two types of devices, PatchCaps and Gateways.

PatchCaps are the actual pill bottle sensors, and are assigned to a patient's prescription. Gateways forward data from PatchCaps to the cloud, and are associated with the patient.

To get a patient's devices set up & ready to stream data, check out the relevant integration guide section:

Be sure to review the respective sections related to device return as well.

Note: PatchCaps can be associated with the patient, but PatchCap<>patient association is a weak relationship -- data is only reported from PatchCaps that have been assigned to a given prescription. For the purposes of the external API, it may make sense to skip PatchCap association and go straight to assignment.

Get PatchCap info

Given a PatchCap's serial number, retrieve its information.

Authorizations:
apiKeyAuth
query Parameters
serial_number
required
string (PatchCapSerialNumber)
Example: serial_number=B030125

Unique PatchCap serial number, typically 7 characters starting with "B"

Responses

Response samples

Content type
application/json
{
  • "serial_number": "B030125",
  • "gateway_id": "ABCD-ABCD-ABCD",
  • "tenovi_link_id": "5a4fd28d-6c90-4bf5-b776-ef44b3109645",
  • "first_event_time": "2019-08-24T14:15:22Z",
  • "last_event_time": "2019-08-24T14:15:22Z",
  • "battery_voltage": 3200,
  • "rssi": -75,
  • "prescription_id": "233e765d-ecf3-4c3f-9a69-0acb87b76814",
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33"
}

Get Gateway info

Given a Gateway's serial number, retrieve its information.

Authorizations:
apiKeyAuth
query Parameters
serial_number
required
string (GatewaySerialNumber)
Example: serial_number=A0000000

Unique Gateway serial number, typically 8 characters starting with "A"

Responses

Response samples

Content type
application/json
{
  • "gateway_id": "gw-123456",
  • "serial_number": "A0000000",
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "device_version": "TC-GWY-A1",
  • "firmware_version": "1.2.3",
  • "first_seen": "2019-08-24T14:15:22Z",
  • "last_seen": "2019-08-24T14:15:22Z",
  • "rsrp": -95.5
}

Associate PatchCap with patient

This does NOT fully attach a PatchCap to a patient's prescription, but merely associates it to the patient. This is used to indicate that the patient has the device, but does not indicate which prescription it is attached to.

Assignment to their prescription is required for data to flow properly. Association is used when the patient is known to have the PatchCap, but there is uncertainty around which of their prescriptions it's being affixed to.

Authorizations:
apiKeyAuth
query Parameters
serial_number
required
string (PatchCapSerialNumber)
Example: serial_number=B030125

Unique PatchCap serial number, typically 7 characters starting with "B"

Request Body schema: application/json
required
patient_id
required
string <uuid> (PatientId)

Unique patient id; assigned by PatchRx if none provided upon creation

Responses

Request samples

Content type
application/json
{
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33"
}

Response samples

Content type
application/json
{
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "serial_number": "B030125"
}

Assign PatchCap to prescription

This connects a PatchCap to a patient's prescription. Use it when you are certain that the given PatchCap is being used to monitor the given prescription.

Authorizations:
apiKeyAuth
query Parameters
serial_number
required
string (PatchCapSerialNumber)
Example: serial_number=B030125

Unique PatchCap serial number, typically 7 characters starting with "B"

Request Body schema: application/json
required
prescription_id
required
string (PrescriptionId)

Unique prescription id; assigned by PatchRx if none provided upon creation

Responses

Request samples

Content type
application/json
{
  • "prescription_id": "233e765d-ecf3-4c3f-9a69-0acb87b76814"
}

Response samples

Content type
application/json
{
  • "prescription_id": "233e765d-ecf3-4c3f-9a69-0acb87b76814",
  • "serial_number": "B030125"
}

Associate PatchRx Gateway with patient

Associate a PatchRx Gateway with a patient. Although not required, this is recommended for all patients as it improves stockkeeping accuracy and makes troubleshooting easier.

Authorizations:
apiKeyAuth
query Parameters
serial_number
required
string (GatewaySerialNumber)
Example: serial_number=A0000000

Unique Gateway serial number, typically 8 characters starting with "A"

Request Body schema: application/json
required
patient_id
required
string <uuid> (PatientId)

Unique patient id; assigned by PatchRx if none provided upon creation

Responses

Request samples

Content type
application/json
{
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33"
}

Response samples

Content type
application/json
{
  • "patient_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "serial_number": "A0000000"
}

Unassociate PatchRx Gateway from patient

Remove a PatchRx Gateway's association with a patient. This endpoint is useful when a Gateway needs to be reassigned to a different patient or retired from service.

Authorizations:
apiKeyAuth
query Parameters
serial_number
required
string (GatewaySerialNumber)
Example: serial_number=A0000000

Unique Gateway serial number, typically 8 characters starting with "A"

Responses

Response samples

Content type
application/json
{
  • "serial_number": "A0000000"
}

Data

The data endpoints are used for interfacing with sensor metadata and event data.

Get patient openings

Given a patient id, get all of that patient's recorded bottle openings.

Future note: this will eventually include a mechanism to only provide data since a certain date or event id, to prevent pulling of redundant data.

Authorizations:
apiKeyAuth
query Parameters
patient_id
required
string <uuid> (PatientId)
Example: patient_id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique patient id; assigned by PatchRx if none provided upon creation

start_time
required
string <date-time>
Example: start_time=2024-01-01T00:00:00Z

The start time for the query range, inclusive

end_time
required
string <date-time>
Example: end_time=2024-01-31T23:59:59Z

The end time for the query range, inclusive

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get patient PatchCap connectivity

NOTE: THIS ENDPOINT IS TEMPORARILY DISABLED

Given a patient id, get connectivity information for all of their prescriptions and PatchCaps during the given time period.

The last_seen timestamp can be used to implicitly determine true negative time spans. In the absence of a bottle open event, until a device heartbeat updates the last_seen timestamp, it is ambiguous whether the bottle has been opened. Only for time before last_seen can we implicitly assume that there was no bottle opening.

Authorizations:
apiKeyAuth
query Parameters
patient_id
required
string <uuid> (PatientId)
Example: patient_id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique patient id; assigned by PatchRx if none provided upon creation

start_date
required
string <date> (StartDate)
Example: start_date=2025-06-01

The start date for a given range, inclusive

end_date
required
string <date> (EndDate)
Example: end_date=2025-06-30

The end date for a given range, inclusive

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create PatchCap event

For debug use only

Create a PatchCap event (open, close, heartbeat, etc.). Note that the webapp will only display openings, and that heartbeats (event_id=0) will effect last seen timestamps.

Authorizations:
apiKeyAuth
Request Body schema: application/json
required
combined_mac
required
string (PatchCapMacAddress)

Unique MAC address for the PatchCap device

event_time
required
string <date-time> (PatchCapEventTime)

The time of the given event

event_id
required
number (PatchCapEventId)

PatchRx event type; 0=heartbeat, 2=open, 3=close

log_id
required
number (PatchCapLogId)

Incremental log id number for a given PatchCap, starts at 1 and increments everytime a PatchCap generates an event (will reset if PatchCap resets)

gateway_id
string (GatewayId)

Unique Gateway Id

rssi
integer (PatchCapRssi)

The RSSI of the PatchCap signal received by the Gateway

battery_voltage
integer (PatchCapBattery)

The remaining device battery in millivolts

Responses

Request samples

Content type
application/json
{
  • "combined_mac": "CF441EA2E487",
  • "event_time": "2024-06-17T16:42:36Z",
  • "event_id": 2,
  • "log_id": 47,
  • "gateway_id": "GW002_123456789012345",
  • "rssi": -73,
  • "battery_voltage": 2700
}

Response samples

Content type
application/json
[
  • {
    }
]

Users

The users endpoints are used for creating, updating, and managing the permissions of PatchRx webapp users.

PatchRx webapp user permissions are scoped by their health entity location associations, so users are only able to see patients that are attached to the same health entity locations as themselves.

All users are able to create new users within the webapp, but they are only able to associate them with a subset of their own health entity location associations.

Get all users

Get all users across your partner.

Authorizations:
apiKeyAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a new user

Create a webapp user for the PatchRx webapp.

After creation, the user will need to verify their email address. After verification, they should be able to login using either Microsoft or Google federated logins. If a user/password login is required, please reach out to your PatchRx contact.

When you create a new user, you will need to provide an initial health entity location id via the health_entity_location_id field. This is the initial health entity location that they will be associated with. Additional health entity location associations can be added via the associate user operation.

Authorizations:
apiKeyAuth
Request Body schema: application/json
required
first_name
required
string (FirstName)

First name

last_name
required
string (LastName)

Last name

email
required
string <email> (Email)

A valid email address

health_entity_location_id
required
string (HealthEntityLocationId)

Unique health entity location id; assigned by PatchRx if none provided upon creation

Responses

Request samples

Content type
application/json
{
  • "first_name": "John",
  • "last_name": "Doe",
  • "email": "john.doe@example.com",
  • "health_entity_location_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33"
}

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "first_name": "John",
  • "last_name": "Doe",
  • "email": "john.doe@example.com",
  • "is_deleted": false,
  • "health_entity_location_associations": [
    ]
}

Get user

Given a user id, get their webapp user info.

Authorizations:
apiKeyAuth
query Parameters
id
required
string (UserId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique user id; assigned by PatchRx (external ids not currently supported)

Responses

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "first_name": "John",
  • "last_name": "Doe",
  • "email": "john.doe@example.com",
  • "is_deleted": false,
  • "health_entity_location_associations": [
    ]
}

Update user

Update a user's information for a given user id. Set is_deleted to true to disable a given user's acess to the webapp.

Email is not currently updatable.

Authorizations:
apiKeyAuth
query Parameters
id
required
string (UserId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique user id; assigned by PatchRx (external ids not currently supported)

Request Body schema: application/json
required
first_name
string (FirstName)

First name

last_name
string (LastName)

Last name

is_deleted
boolean (IsDeleted)

Whether the given entity is deleted

Responses

Request samples

Content type
application/json
{
  • "first_name": "John",
  • "last_name": "Doe",
  • "is_deleted": false
}

Response samples

Content type
application/json
{
  • "id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33",
  • "first_name": "John",
  • "last_name": "Doe",
  • "email": "john.doe@example.com",
  • "is_deleted": false,
  • "health_entity_location_associations": [
    ]
}

Associate user with health entity location

Associate a user with a health entity location.

User permissions are limited by these associations. For example, if a partner had two health entity locations, HEL A and HEL B, and the user was only associated with HEL A, they'd only be able to see data for patients at HEL A.

Note: The ability to dissociate a user from a health entity location is coming soon.

Authorizations:
apiKeyAuth
query Parameters
id
required
string (UserId)
Example: id=047abd65-c1d0-4a31-b715-cf2cfa0bda33

Unique user id; assigned by PatchRx (external ids not currently supported)

Request Body schema: application/json
required
health_entity_location_id
required
string (HealthEntityLocationId)

Unique health entity location id; assigned by PatchRx if none provided upon creation

Responses

Request samples

Content type
application/json
{
  • "health_entity_location_id": "047abd65-c1d0-4a31-b715-cf2cfa0bda33"
}

Orders

NOTE: Under construction

The orders endpoints is used for retrieving order information.

Get order info

NOTE: Under construction

Given an order id, retrieve relevant information.

Authorizations:
apiKeyAuth
query Parameters
id
required
string <uuid> (OrderId)
Example: id=8eca5397-2257-4274-9d4d-3296ff6cb142

Unique patient order id, which is used to retrieve order information

Responses

Response samples

Content type
application/json
{}

Utilities

The utilities endpoints are for miscellaneous or integration-related usage.

Get PatchCap MAC from serial number

Given a PatchCap's MAC address, retrieve its serial number.

Authorizations:
apiKeyAuth
query Parameters
serial_number
required
string (PatchCapSerialNumber)
Example: serial_number=B030125

Unique PatchCap serial number, typically 7 characters starting with "B"

Responses

Response samples

Content type
application/json
{
  • "combined_mac": "CF441EA2E487",
  • "color": "R"
}

Get PatchCap serial number from MAC

Given a PatchCap's serial number, retrieve its MAC address.

Authorizations:
apiKeyAuth
query Parameters
combined_mac
required
string (PatchCapMacAddress)
Example: combined_mac=CF441EA2E487

Unique MAC address for the PatchCap device

Responses

Response samples

Content type
application/json
{
  • "serial_number": "B030125",
  • "color": "R"
}