Personal health tracking API - medications, prescriptions, refills, blood pressure,
weight, and activity logging. All requests use JSON bodies; responses are JSON objects
or arrays.
Base URL: https://api.rx-trac.com
Interactive Docs →
OpenAPI Spec →
Auth Token Setup →
Authentication
All endpoints require a Bearer token.
Authorization: Bearer <token>
- Tokens issued by Authentik, expire after 10 minutes
- Obtain a token:
auth-token rx-trac
- Config:
~/.config/auth-token.env - set AUTHENTIK_URL and RX_TRAC_PUBLIC_CLIENT_ID
Request Format
All endpoints accept POST with a JSON body unless marked GET.
Date fields accept YYYY-MM-DD or "now". Time fields accept HH:MM,
HH:MM:SS, or "now".
Endpoints
Medications
| Method | Path | Key Body Params | Description |
| POST |
/med_track/get_active_medications |
query_date*, dosage_interval*, ignore_exclusions |
Active medications for a date + interval (am, noon, pm, all). Returns array of MedicationDTO. |
| POST |
/med_track/get_active_medication |
drug_name*, query_date* |
Single active medication by name and date. Returns MedicationDTO. |
| POST |
/med_track/add_medication |
drug_name*, generic_name*, medication_type*, use_generic_name* |
Create a new medication record. Returns MedicationDTO. |
| POST |
/med_track/add_description |
drug_name*, pill_form*, pill_size*, pill_color*, pill_shape*, pill_markings*, description_start_date* |
Attach physical description to a medication. Returns MedicationDTO. |
| POST |
/med_track/close_medication |
drug_name*, generic_name*, end_date* |
Close (discontinue) a medication. Returns MedicationDTO. |
| POST |
/med_track/get_medication_counts |
drug_name* ("all" for all), query_date* |
Remaining pill counts and days supply. Returns array of MedicationCountDTO. |
Scripts (Prescriptions)
| Method | Path | Key Body Params | Description |
| POST |
/med_track/add_script |
drug_name*, prescriber_firstname*, prescriber_lastname*, frequency_per_day*, am_dose*, noon_dose*, pm_dose*, script_strength*, script_strength_units*, script_start_date* |
Attach a prescription to a medication. Returns MedicationDTO. |
| POST |
/med_track/get_medication_schedule |
query_date* |
AM/Noon/PM dose schedule for all active medications. Returns array of schedule rows. |
| POST |
/med_track/update_script_schedule |
script_id*, am_dose*, noon_dose*, pm_dose* |
Update dosing interval flags for a script. Returns confirmation with updated flags. |
Refills
| Method | Path | Key Body Params | Description |
| POST |
/med_track/add_refill |
drug_name*, pharmacy_name*, pharmacy_city*, rx_number*, count*, starting_count*, refill_strength*, refill_strength_units*, refill_start_date_str*, renewal_date_str* |
Record a new refill. renewal_date_str accepts "calc" for automatic calculation. Returns MedicationDTO. |
| POST |
/med_track/get_active_refills |
query_date* |
Active refills with medication metadata. Returns array of RefillPlusDTO. |
Prescribers
| Method | Path | Params | Description |
| GET |
/med_track/get_prescribers |
- |
All prescribers. Returns array of PrescriberDTO. |
| POST |
/med_track/get_prescriber |
firstname*, lastname* |
Look up a prescriber by name. Returns PrescriberDTO or null. |
| POST |
/med_track/add_prescriber |
title*, firstname*, lastname*, speciality*, phone_number*, business_name*, address_one*, city*, state*, zipcode*, … |
Create a prescriber record. Returns PrescriberDTO. |
Pharmacies
| Method | Path | Params | Description |
| GET |
/med_track/get_pharmacies |
- |
All pharmacies. Returns array of PharmacyDTO. |
| POST |
/med_track/get_pharmacy |
pharmacy_name*, pharmacy_city* |
Look up a pharmacy by name and city. Returns PharmacyDTO or null. |
| POST |
/med_track/add_pharmacy |
pharmacy_name*, address_one*, city*, state*, zipcode*, phone_number*, url* |
Create a pharmacy record. Returns PharmacyDTO. |
Medication Events
| Method | Path | Key Body Params | Description |
| POST |
/med_track/post_meds |
dosage_interval*, date_posted*, time_posted*, dosage_date* ("calc" ok), ignore_exclusions* |
Record a medication event - creates usage records for every active drug at the given interval. PM events posted midnight–4am auto-assign to the previous day. Returns MedicationEventDTO. |
| POST |
/med_track/get_recent_events |
count* |
Most recent medication events. Returns array of MedicationEventDTO. |
Blood Pressure
| Method | Path | Key Body Params | Description |
| POST |
/med_track/post_bp |
date_posted*, time_posted*, systolic*, diastolic*, pulse* |
Record a blood pressure reading. Returns BloodPressureDTO. |
| POST |
/med_track/get_recent_blood_pressures |
count* |
Most recent BP readings. Returns array of BloodPressureDTO. |
Weight
| Method | Path | Key Body Params | Description |
| POST |
/med_track/post_lbs |
date_posted*, time_posted*, weight* |
Record a weight reading (pounds). Returns WeightDTO. |
| POST |
/med_track/get_recent_weights |
count* |
Most recent weight readings. Returns array of WeightDTO. |
Activity
| Method | Path | Key Body Params | Description |
| POST |
/med_track/post_activity |
date_posted*, time_posted*, activity*, unit_count*, unit_label* |
Log an activity entry (e.g. stairs / 3.0 / flights). Events posted midnight–4am auto-assign to previous day. Returns ActivityLogDTO. |
| POST |
/med_track/get_activity_totals |
query_date*, activity* ("all" ok) |
Aggregated unit totals per activity for a single date. Returns array of ActivityTotalDTO. |
| POST |
/med_track/get_activity_totals_range |
start_date*, end_date*, activity* |
Aggregated totals grouped by date across a range. Returns array of ActivityTotalDTO ordered by date. |
| POST |
/med_track/get_recent_activities |
count* |
Most recent activity log entries. Returns array of ActivityLogDTO. |
Exclusions
A drug exists in either medication usages or medication exclusions for a given event - never both.
| Method | Path | Key Body Params | Description |
| POST |
/med_track/get_med_usages |
event_id* |
Usage records for a medication event. Returns array of MedicationUsageInfoDTO. |
| POST |
/med_track/get_med_exclusions |
event_id* |
Exclusion records for a medication event. Returns array of MedicationExclusionDTO. |
| POST |
/med_track/add_med_exclusion |
event_id*, medication_id*, exclusion_type* (forgotten or excluded), note |
Move a drug from usages to exclusions for an event. Returns MedicationExclusionDTO. |
| POST |
/med_track/remove_med_exclusion |
exclusion_id* |
Restore an excluded drug back to usages. Returns confirmation with status and exclusion_id. |
| POST |
/med_track/get_exclusion_summary |
start_date*, end_date* |
Exclusions across a date range grouped for summary. Returns array of {dosage_date, dosage_interval, medication_name, exclusion_type, note}. |
* required parameter
Response Models
MedicationDTO
| Field | Type | Description |
id | integer | Primary key |
drug_name | string | Brand name |
generic_name | string | Generic name |
medication_type | string | Drug class (e.g. statin, beta blocker) |
use_generic_name | boolean | Whether UI should display generic name |
display_name | string | Derived display name (brand or generic) |
description | DescriptionDTO | null | Physical pill description |
script | ScriptDTO | null | Active prescription |
refill | RefillDTO | null | Active refill record |
ScriptDTO
| Field | Type | Description |
id | integer | Primary key |
frequency_per_day | string | once, twice, three, four, five |
am_dose / noon_dose / pm_dose | boolean | Dosing interval flags |
script_strength | number | Dosage strength |
script_strength_units | string | mg, mcg, g, units, etc. |
script_start_date / script_end_date | string | YYYY-MM-DD |
prescriber | PrescriberDTO | null | Prescribing provider |
RefillDTO
| Field | Type | Description |
id | integer | Primary key |
rx_number | string | Prescription number from pharmacy |
count | integer | Current remaining pill count |
starting_count | integer | Pills at time of fill |
refill_strength / refill_strength_units | number / string | Dispensed dosage |
renewal_date | string | Next refill date (YYYY-MM-DD) |
refill_start_date / refill_end_date | string | YYYY-MM-DD |
pharmacy | PharmacyDTO | null | Dispensing pharmacy |
MedicationCountDTO
| Field | Type | Description |
drug_name | string | Drug name |
remaining_count | integer | Pills remaining |
remaining_days | integer | Estimated days of supply remaining |
starting_count | integer | Pills at last fill |
last_refill_date | string | Date of last refill (YYYY-MM-DD) |
MedicationEventDTO
| Field | Type | Description |
id | integer | Primary key |
dosage_interval | string | am, noon, or pm |
dosage_date | string | Date the dose is credited to (YYYY-MM-DD) |
date_posted / time_posted | string | Actual post timestamp |
BloodPressureDTO / WeightDTO / ActivityLogDTO
| Field | Type | Description |
id | integer | Primary key |
date_posted / time_posted | string | Recording timestamp |
systolic / diastolic / pulse | integer | BloodPressureDTO only |
weight | integer | WeightDTO only - pounds |
activity / unit_count / unit_label | string / number / string | ActivityLogDTO only |
Example Requests
# Get a token
TOKEN=$(auth-token rx-trac)
# Log AM medications
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"dosage_interval":"am","date_posted":"now","time_posted":"now","dosage_date":"calc","ignore_exclusions":false}' \
"https://api.rx-trac.com/med_track/post_meds"
# Get active medications for AM interval
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"query_date":"now","dosage_interval":"am","ignore_exclusions":false}' \
"https://api.rx-trac.com/med_track/get_active_medications"
# Record blood pressure
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"date_posted":"now","time_posted":"now","systolic":122,"diastolic":78,"pulse":68}' \
"https://api.rx-trac.com/med_track/post_bp"
# Log weight
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"date_posted":"now","time_posted":"now","weight":185}' \
"https://api.rx-trac.com/med_track/post_lbs"
# Log activity
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"date_posted":"now","time_posted":"now","activity":"stairs","unit_count":3,"unit_label":"flights"}' \
"https://api.rx-trac.com/med_track/post_activity"
# Pill count check
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"drug_name":"all","query_date":"now"}' \
"https://api.rx-trac.com/med_track/get_medication_counts"
Error Codes
| Status | Meaning |
400 | Bad request - missing/invalid parameter or invalid enum value |
401 | Missing or invalid Bearer token, expired token, or audience mismatch |
404 | Resource not found (e.g. exclusion record) |
500 | Authentication failure or database error |
Contact
Email: [email protected]
License: Internal / Partner Use Only