rx-trac API

rx-trac API
StompingBear APIs

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

MethodPathKey Body ParamsDescription
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)

MethodPathKey Body ParamsDescription
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

MethodPathKey Body ParamsDescription
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

MethodPathParamsDescription
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

MethodPathParamsDescription
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

MethodPathKey Body ParamsDescription
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

MethodPathKey Body ParamsDescription
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

MethodPathKey Body ParamsDescription
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

MethodPathKey Body ParamsDescription
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.

MethodPathKey Body ParamsDescription
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

FieldTypeDescription
idintegerPrimary key
drug_namestringBrand name
generic_namestringGeneric name
medication_typestringDrug class (e.g. statin, beta blocker)
use_generic_namebooleanWhether UI should display generic name
display_namestringDerived display name (brand or generic)
descriptionDescriptionDTO | nullPhysical pill description
scriptScriptDTO | nullActive prescription
refillRefillDTO | nullActive refill record

ScriptDTO

FieldTypeDescription
idintegerPrimary key
frequency_per_daystringonce, twice, three, four, five
am_dose / noon_dose / pm_dosebooleanDosing interval flags
script_strengthnumberDosage strength
script_strength_unitsstringmg, mcg, g, units, etc.
script_start_date / script_end_datestringYYYY-MM-DD
prescriberPrescriberDTO | nullPrescribing provider

RefillDTO

FieldTypeDescription
idintegerPrimary key
rx_numberstringPrescription number from pharmacy
countintegerCurrent remaining pill count
starting_countintegerPills at time of fill
refill_strength / refill_strength_unitsnumber / stringDispensed dosage
renewal_datestringNext refill date (YYYY-MM-DD)
refill_start_date / refill_end_datestringYYYY-MM-DD
pharmacyPharmacyDTO | nullDispensing pharmacy

MedicationCountDTO

FieldTypeDescription
drug_namestringDrug name
remaining_countintegerPills remaining
remaining_daysintegerEstimated days of supply remaining
starting_countintegerPills at last fill
last_refill_datestringDate of last refill (YYYY-MM-DD)

MedicationEventDTO

FieldTypeDescription
idintegerPrimary key
dosage_intervalstringam, noon, or pm
dosage_datestringDate the dose is credited to (YYYY-MM-DD)
date_posted / time_postedstringActual post timestamp

BloodPressureDTO / WeightDTO / ActivityLogDTO

FieldTypeDescription
idintegerPrimary key
date_posted / time_postedstringRecording timestamp
systolic / diastolic / pulseintegerBloodPressureDTO only
weightintegerWeightDTO only - pounds
activity / unit_count / unit_labelstring / number / stringActivityLogDTO 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

StatusMeaning
400Bad request - missing/invalid parameter or invalid enum value
401Missing or invalid Bearer token, expired token, or audience mismatch
404Resource not found (e.g. exclusion record)
500Authentication failure or database error

Contact

Email: [email protected]
License: Internal / Partner Use Only