Authentication
Every request must include one of:
X-API-Key: <key>header (what this project's own front end sends)- HTTP Basic Auth,
username:passwordboth equal to the key
DF@2026:DF@2026 (app/config/api_key.php, overridable via TRUPATH_API_KEY or api_key.local.php). If you rotate it, update the API_KEY constant in assets/generator-app.js to match.POST api/generate-report.php
Request body: {"case": { ... }} - exactly what the Report Generator's "Download Case JSON" button produces.
{
"study": {"code": "WOMENS", "name": "TruWomen’s Health Panel"},
"patient": {"name": "Sally Sicko", "id": "WH-100245", "dob": "1986-04-14", "sex": "Female"},
"physician": {"provider": "Scott M. Sweazy, M.D.", "npi": "", "practiceFacility": "", "officePhone": "", "officeFax": ""},
"order": {"specimen": "Vaginal swab", "testFacility": "TruPath Labs", "accession": "WH260816-01", "collected": "2026-08-16", "received": "2026-08-16", "reported": "2026-08-16"},
"detected": [
{"name": "Atopobium vaginae", "load": "High", "cls": "BACTERIA"},
{"name": "Candida albicans", "load": "Moderate", "cls": "FUNGAL"}
],
"genes": ["ermB"],
"empiric": {"name": "Metronidazole", "strength": "500 mg", "dosing": "Take 1 tablet by mouth twice daily"},
"allergies": [],
"pregnancy": "NO",
"renalDysfunction": false,
"liverDysfunction": false,
"alternatives": [],
"showSampleBanner": true
}
Field notes
| Field | Notes |
|---|---|
detected[].name | Must match a pathogen's display_name exactly (Pathogens dashboard page). |
detected[].load | Qualitative: "High", "Moderate", or "Low" - not a numeric PCR copy count. Low is excluded from the significance/coverage calculation. |
detected[].cls | One of BACTERIA / VIRUS / FUNGAL / PROTOZOA. |
genes[] | Resistance-gene IDs (TetM, blaTEM, mefA, ermB by default). A detected gene can exclude an otherwise-matched drug (e.g. ermB excludes macrolides and clindamycin) from both the coverage calculation and alternatives ranking. |
alternatives[] | Optional, up to 3 antimicrobial generic names. If omitted, the server auto-ranks from the master mapping (same as the page's "Reload from Master Mapping" button), filtered for genes/allergies/pregnancy/renal/hepatic. |
pregnancy | "YES", "NO", or "UNKNOWN". |
showSampleBanner | Default true - shows the red "SAMPLE - NOT FOR CLINICAL USE" footer banner on the printed report. |
Response
{
"success": true,
"message": "Report generated successfully",
"renderer": "chrome",
"reportId": "20260816120000_a1b2c3d4",
"pdfUrl": "https://.../uploads/pdf/20260816120000_a1b2c3d4.pdf",
"htmlUrl": "https://.../uploads/html/20260816120000_a1b2c3d4.html",
"getApi": "https://.../api/get-report.php?reportId=20260816120000_a1b2c3d4"
}
renderer is "chrome" when the primary headless-Chrome-print pipeline produced the PDF (pixel-identical to the browser's own "Print / Save PDF"), or "dompdf-fallback" when Chrome wasn't available on the host. On failure: HTTP 4xx/5xx with {"success": false, "message": "..."}.
GET api/get-report.php?reportId=...
Looks up a previously generated report's PDF/HTML URLs by reportId. Same auth as above.
GET api/reference-data.php
Returns the current pathogens/resistance genes/antimicrobials/recommendations straight from the database - what the admin dashboard's Pathogens, Resistance Genes, Antimicrobials, and Recommendations pages manage. Useful for keeping an external system's copy of the panel in sync. Same auth as above.
Postman collection
⇩ Download TruPath_API.postman_collection.json - includes every request above with realistic sample bodies. Import it into Postman, then check the collection variables:
| Variable | Value | Notes |
|---|---|---|
baseUrl | https://tpl.robbiekohli.com | The bare domain only, no trailing slash and no product subfolder - every request's own path already spells out /tpl-womens-health/api/..., so this same baseUrl value is shared as-is across every TruPath product on this domain. |
apiKey | DF@2026:DF@2026 | Sent as the X-API-Key header on every request. |
reportId | (blank) | Paste a reportId from a Generate Report response here to use with Get Report. |
Full request path for this product: https://tpl.robbiekohli.com/tpl-womens-health/api/generate-report (and the same pattern for get-report / reference-data).