Run a clinic or telehealth brand? Request access →
Developers

API & webhooks

Place pen-cartridge orders, check availability by state, and get every status change pushed to your system as a signed webhook.

Overview

A JSON REST API over HTTPS. Requests and responses are JSON, timestamps are ISO 8601 in UTC, and responses are never cached. Base URL:

https://everyrhythm.com/api/v1

Authentication

Create keys in the portal under API & webhooks and send them as a bearer token. A key is shown once when you create it; we store only a hash. Revoke a key in the portal and it stops working immediately.

curl https://everyrhythm.com/api/v1/products \
  -H "Authorization: Bearer $ER_API_KEY"

Test & live mode

Every account has a sandbox and production, chosen by the key. Build against a test key, then switch to a live key; the requests are identical.

er_test_…
Sandbox. Orders are validated exactly like live ones but are never sent to a pharmacy. Each one moves through routing, submitted, compounding, shipped (with a sandbox tracking number) and delivered on its own, about 3 seconds per step, sending a webhook at every step.
er_live_…
Production. Orders are real prescriptions, routed to a licensed pharmacy and shipped to the patient.
  • Test and live data never mix. A key sees only orders and saved patients from its own mode; anything else returns 404. external_id values are tracked separately per mode.
  • Orders and webhook events carry livemode: false in the sandbox, true in production. Both go to your one webhook endpoint, so check it.
  • To test a rejection, put sandbox:reject in notes: the order stops at rejected after it is submitted. Cancel a sandbox order within the first few seconds to test cancellation.
  • Products and prescribers are shared by both modes. Sandbox orders show in the portal under Test data.

Errors

Errors use the HTTP status and a JSON body with a stable code, a readable message and, for validation errors, the field in param.

HTTP/1.1 422
{
  "error": {
    "code": "invalid_request",
    "message": "Patient state must be a 2-letter US state code.",
    "param": "patient.address.state"
  }
}
400invalid_jsonThe body is not valid JSON.
401unauthorizedMissing, malformed or revoked API key.
404not_foundNo order with that id on your account.
422invalid_requestA field failed validation. error.param names it.
500server_errorOur fault. Safe to retry with the same external_id.

Idempotency

Send your own external_id with every order. If a request times out, send it again with the same external_id: if the first one went through you get the original order back with 200 instead of 201, and no duplicate is created. The second request's body is ignored.

Products

GET/products

Every cartridge you can order. Use id as items[].product.

{
  "object": "list",
  "data": [
    {
      "id": "bpc-157",
      "object": "product",
      "name": "BPC-157",
      "format": "cartridge",
      "blend": false,
      "ingredients": ["BPC-157"],
      "status": "unconfirmed"
    }
  ]
}

status is available or unconfirmed. Treat anything other than available as not yet orderable.

Availability

GET/availability?state=TX

Product status for a patient's state. Call it before the patient pays. state is a 2-letter code; DC is accepted.

{
  "object": "availability",
  "state": "TX",
  "data": [
    { "product": "bpc-157", "status": "unconfirmed" },
    { "product": "bpc-tb-stack", "status": "unconfirmed" }
  ]
}

Prescribers

GET/prescribers

Prescribers on your account. Add them in the portal (name, NPI, license state); every order is placed under one.

{
  "object": "list",
  "data": [
    { "id": "prs_BxhncdoVijL6", "object": "prescriber", "name": "Jane Smith, MD", "npi": "1234567890", "license_state": "TX" }
  ]
}

The order object

Every order endpoint and every webhook returns this shape. events is the full timeline, oldest first. The patient block carries only what you need to match the order; the full record stays on your account.

{
  "id": "ord_oFxQreptLxH7",
  "object": "order",
  "livemode": true,
  "external_id": "emr-8f21c",
  "status": "shipped",
  "source": "api",
  "ship_to": "patient",
  "patient": {
    "id": "pat_7nc2BJxihf3d",
    "first_name": "Ana",
    "last_name": "Diaz",
    "dob": "1988-04-02",
    "state": "TX"
  },
  "prescriber": { "id": "prs_BxhncdoVijL6", "name": "Jane Smith, MD", "npi": "1234567890" },
  "items": [
    { "product": "bpc-157", "name": "BPC-157", "quantity": 2, "sig": "Inject 10 units SC daily" }
  ],
  "tracking": { "carrier": "UPS", "number": "1Z999AA10123456784" },
  "notes": null,
  "events": [
    { "at": "2026-10-15T01:36:20.028Z", "type": "order.received", "detail": "Created via api" },
    { "at": "2026-10-15T01:46:03.271Z", "type": "order.routing", "detail": null },
    { "at": "2026-10-15T01:46:04.658Z", "type": "order.submitted", "detail": null },
    { "at": "2026-10-15T01:46:05.966Z", "type": "order.compounding", "detail": null },
    { "at": "2026-10-15T01:46:07.304Z", "type": "order.shipped", "detail": null }
  ],
  "created_at": "2026-10-15T01:36:20.028Z",
  "updated_at": "2026-10-15T01:46:07.304Z"
}

Create an order

POST/orders

One order per patient, up to 20 lines. Returns 201 with the order in received, or 200 for a repeated external_id.

prescriber_idstring · requiredFrom GET /prescribers. Add prescribers in the portal.
itemsarray · required1–20 lines of { product, quantity, sig }.
items[].productstring · requiredA product id from GET /products.
items[].quantityinteger · required1–12 cartridges.
items[].sigstring · requiredDirections for use, up to 500 characters.
patientobjectRequired unless you send patient_id. Saved to your account and returned as patient.id.
patient.first_name / last_namestring · requiredUp to 80 characters each.
patient.dobstring · requiredYYYY-MM-DD, in the past.
patient.phonestring · requiredAt least 10 digits.
patient.addressobject · requiredline1, optional line2, city, state (2-letter code), zip (5 digits or ZIP+4).
patient.sexstringfemale, male or other.
patient.email / allergiesstringOptional.
patient_idstringA patient saved by an earlier order, instead of patient.
external_idstringYour id for the order, up to 100 characters. See Idempotency.
ship_tostringpatient (default) or clinic.
notesstringNotes for the pharmacy, up to 1,000 characters.
curl https://everyrhythm.com/api/v1/orders \
  -H "Authorization: Bearer $ER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "emr-8f21c",
    "prescriber_id": "prs_BxhncdoVijL6",
    "patient": {
      "first_name": "Ana", "last_name": "Diaz", "dob": "1988-04-02",
      "phone": "5125550142",
      "address": { "line1": "12 Elm St", "city": "Austin", "state": "TX", "zip": "78701" }
    },
    "items": [{ "product": "bpc-157", "quantity": 2, "sig": "Inject 10 units SC daily" }],
    "ship_to": "patient"
  }'

List orders

GET/orders?status=shipped&limit=50

Your orders, newest first. status filters to one status; limit is 1–200 (default 50). Returns { "object": "list", "data": [order, …] }.

Retrieve an order

GET/orders/{id}

One order with its full timeline, or 404 if it isn't on your account.

Cancel an order

POST/orders/{id}/cancel

Works while the order is received or routing and returns the cancelled order. Once it has been sent to a pharmacy you get 422 with param: "status"; contact us instead.

Lifecycle

received → routing → submitted → compounding → shipped → delivered
        ↘ cancelled (received or routing only)     ↘ rejected (by the pharmacy)
receivedcancellable
Validated and accepted.
routingcancellable
Being matched to a pharmacy licensed in the patient's state.
submitted
Sent to the pharmacy.
compounding
The pharmacy is preparing it.
shipped
On its way. tracking is set.
delivered
Delivered.
cancelled
Cancelled before it reached the pharmacy.
rejected
The pharmacy declined it. The event detail says why.

Webhooks

Instead of polling, give us an HTTPS URL. In the portal, open API & webhooks, save your endpoint, and copy the signing secret (whsec_…) shown there. One endpoint per account receives every event for every order.

Events

An event is sent each time an order's status, tracking or notes change. No event is sent when you create an order, because the API response already contains it.

order.routingRouting started.
order.submittedSent to the pharmacy.
order.compoundingThe pharmacy is preparing it.
order.shippedShipped. data.tracking has the carrier and number.
order.deliveredDelivered.
order.cancelledCancelled, by you or by us.
order.rejectedDeclined by the pharmacy.
order.updatedTracking or a note changed without a status change.

Payload

A POST with a JSON body. data is the full order object as it is after the change.

POST https://your-app.com/webhooks/everyrhythm
Content-Type: application/json
X-EveryRhythm-Signature: t=1792033567,v1=5f2b…c91e

{
  "id": "evt_Jk2Qx9…",
  "type": "order.shipped",
  "livemode": true,
  "created_at": "2026-10-15T01:46:07.304Z",
  "data": { "id": "ord_oFxQreptLxH7", "object": "order", "status": "shipped", … }
}

Verify signatures

X-EveryRhythm-Signature holds a Unix timestamp t and v1, the hex HMAC-SHA256 of `${t}.${raw body}` keyed with your signing secret. Check it against the raw request body, before parsing JSON, and reject timestamps more than five minutes old.

// Node.js
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(rawBody, header, secret) {
  const { t, v1 } = Object.fromEntries(header.split(",").map(p => p.split("=")));
  if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const want = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return want.length === v1.length && timingSafeEqual(Buffer.from(want), Buffer.from(v1));
}
# Python
import hashlib, hmac, time

def verify(raw_body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    t, v1 = parts.get("t"), parts.get("v1")
    if not t or not v1 or abs(time.time() - int(t)) > 300:
        return False
    want = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(want, v1)

Delivery

  • Reply with any 2xx within 5 seconds. Do slow work after you reply.
  • Each event is attempted once and is not retried. If your endpoint is down, call GET /orders/{id} or GET /orders?status=… to catch up; events has the full history.
  • Events can arrive out of order. Use the order's updated_at to ignore anything older than what you already have.
  • Use the event id to skip an event you have already processed.
  • Sandbox and production events share your endpoint; branch on livemode.

Product ids

Use these in items[].product. Each links to the cartridge's page.