Hemolog logo

Developers

API

Read your treatment history and log doses from Shortcuts, scripts, and other apps

Anyone with a Hemolog account can use the REST API to work with their own treatment logs. Copy your API key from the Profile page, then pass it as a query parameter on each request.

The API is intentionally small: fetch your full history, fetch the last three logs (the same slice shown on your emergency page), or post a new treatment. Deleted treatments are never returned.

Authentication

Send your API key in an Authorization: Bearer header. A query parameter still works for older clients.

Authorization header
curl -H "Authorization: Bearer YOUR_API_KEY" https://hemolog.com/api/treatments
Query parameter
https://hemolog.com/api/treatments?apikey=YOUR_API_KEY

GET /api/recent-treatments also accepts alertid — the public ID printed on your emergency card — instead of an API key. The other endpoints require the key.

Keep your key private

Treat the API key like a password. Anyone who has it can read your treatments and log new ones. Reset it anytime on your profile page; the old key stops working immediately.

GET

/api/treatments

Returns every non-deleted treatment for the key holder, newest date first.

API key: Authorization header or apikey query parameter (required)

Response
[
  {
    "id": "abc123",
    "uid": "abc123",
    "cause": "",
    "createdAt": "2026-10-15T14:30:00.000Z",
    "date": "2026-10-15",
    "deletedAt": null,
    "medication": {
      "brand": "Advate",
      "units": 3000,
      "lot": "LOT1234"
    },
    "sites": "Left arm",
    "type": "PROPHY",
    "user": {
      "uid": "firebase-uid",
      "email": "you@example.com",
      "name": "Jane Doe",
      "photoUrl": "https://example.com/photo.jpg"
    }
  }
]

Each item includes an extra id field that matches uid.

GET

/api/recent-treatments

Returns the three most recent treatments, the same slice shown on the public emergency page. Sorted by createdAt, newest first.

API key: Authorization header or apikey query parameter, or alertid (at least one required)

cURL
curl -X GET \
  'https://hemolog.com/api/recent-treatments?apikey=YOUR_API_KEY' \
  -H 'Accept: application/json'

With an alert ID: /api/recent-treatments?alertid=your-alert-id

POST

/api/log-treatment

Creates a new treatment. Send a JSON body with any subset of treatment fields. Missing fields are copied from your most recent log, so a Shortcut can post { "type": "PROPHY" } and reuse the last medication, dose, and sites. If you have never logged a treatment, omitted fields fall back to empty values and PROPHY.

API key: Authorization header or apikey query parameter (required)

Body: JSON object (partial treatment). createdAt, deletedAt, and uid are set by the server.

Request body
{
  "type": "PROPHY",
  "date": "2026-10-18",
  "sites": "Left arm",
  "medication": {
    "brand": "Advate",
    "units": 3000,
    "lot": "LOT5555"
  }
}
Success
{
  "message": "Success"
}

The response is a success message, not the created record.

Minimal cURL
curl -X POST \
  'https://hemolog.com/api/log-treatment?apikey=YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"type":"PROPHY"}'

Errors

Failed requests return HTTP 500 with an error string:

Missing key
{
  "error": "Access denied. Missing api key."
}
Invalid key
{
  "error": "Invalid API key. Reset your key on your profile page at Hemolog.com"
}

Posting without a JSON body returns { "error": "Missing treatment data." }

Treatment object

Fields you can send when logging, and that you will see on reads:

type
PROPHY, BLEED, PREVENTATIVE, or ANTIBODY
date
Treatment date as YYYY-MM-DD
cause
Bleed cause or notes. Empty string for a typical prophylaxis log.
sites
Infusion site, for example Left arm
medication.brand
Product name
medication.units
Dose as a number
medication.lot
Optional lot number
createdAt
ISO timestamp set by the server when the log is created
deletedAt
null on active treatments. Soft-deleted logs are omitted from API responses.
user
Attached account snapshot: uid, email, name, photoUrl

Examples

A few ways people actually use this API — from a one-off curl to a home-screen Shortcut.

cURL

Confirm your key works by fetching the last three treatments:

cURL
curl -X GET \
  'https://hemolog.com/api/recent-treatments?apikey=YOUR_API_KEY' \
  -H 'Accept: application/json'

JavaScript

Export your full history from the browser console, a Node script, or a personal dashboard:

JavaScript
const response = await fetch(
  'https://hemolog.com/api/treatments?apikey=YOUR_API_KEY'
)
const treatments = await response.json()

if (!response.ok) {
  throw new Error(treatments.error || 'Request failed')
}

console.log(treatments)

Apple Shortcut

Log prophylaxis from your home screen. Because the API fills in missing fields from your last treatment, the Shortcut only needs to send a type.

  1. Open Shortcuts and create a new shortcut.
  2. Add Get Contents of URL.
  3. Set the URL to https://hemolog.com/api/log-treatment?apikey=YOUR_API_KEY.
  4. Method: POST. Request body: JSON with type set to PROPHY.
  5. Add the shortcut to your Home Screen. Repeat for BLEED if you want a second button.
JSON body
{
  "type": "PROPHY"
}

Python CSV export

Pull your history into a spreadsheet before a clinic visit:

Python
import csv
import json
import urllib.request

API_KEY = 'YOUR_API_KEY'
url = f'https://hemolog.com/api/treatments?apikey={API_KEY}'

with urllib.request.urlopen(url) as response:
    treatments = json.load(response)

with open('treatments.csv', 'w', newline='') as file:
    writer = csv.writer(file)
    writer.writerow(['date', 'type', 'brand', 'units', 'sites', 'cause'])
    for treatment in treatments:
        medication = treatment.get('medication') or {}
        writer.writerow([
            treatment.get('date'),
            treatment.get('type'),
            medication.get('brand'),
            medication.get('units'),
            treatment.get('sites'),
            treatment.get('cause'),
        ])
Your API key

Copy or reset your key on your Profile page. If a request fails with an invalid key, generate a new one there and update your scripts.