Structa

STRUCTA.MED

Structured Lab Intelligence

Initializing
Structa

STRUCTA.MED

Structured Lab Intelligence

Initializing
← For laboratories

API reference

The reference is in English.

StructaMed Partner API v1

Send structured laboratory results, receive a rule-based interpretation. The analysis is deterministic and rule-based: no AI model is called, and nothing you send is used for any purpose other than producing the response.

This is an interpretation aid for clinicians and laboratory staff. It does not replace clinical judgement, and it makes no diagnosis.

Machine-readable spec (OpenAPI 3.1): https://structamed.com/partner/openapi.yaml. A Postman collection is at https://structamed.com/partner/structamed.postman_collection.json (set the variables baseUrl and apiKey). This reference is also published at https://structamed.com/labs/api. A step-by-step setup guide for your IT team is available on request.

Quickstart: your first call in 5 minutes

  1. Get your key. We send you a test key, sm_test_ followed by 32 characters. It works on every endpoint, is never billed and is capped at 300 reports a month (see Test keys). Keep it on your server: never in a web page, a mobile app or a repository.
  2. Set it as an environment variable on the machine that will call us: export STRUCTA_KEY=sm_test_...
  3. Send a request (the examples below use the same small panel: a 41-year-old woman, five results), then save the PDF.

The host is https://structamed.com. Every call sends the key as Authorization: Bearer <key>.

curl: analysis (JSON) and the PDF report

curl -s https://structamed.com/api/v1/analyze \
  -H "Authorization: Bearer $STRUCTA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "patient": { "sex": "female", "age": 41 },
    "collected_at": "2026-09-30",
    "results": [
      { "name": "Hemoglobin", "value": 11.2, "unit": "g/dL" },
      { "name": "Ferritin",   "value": 9,    "unit": "ng/mL" },
      { "name": "TSH",        "value": 2.4,  "unit": "mIU/L" },
      { "name": "Glucose",    "value": 5.3,  "unit": "mmol/L" },
      { "name": "hs-CRP",     "value": "<0.5", "unit": "mg/L" }
    ]
  }'

# the same body to /api/v1/report returns a PDF: save it with -o
curl -s https://structamed.com/api/v1/report \
  -H "Authorization: Bearer $STRUCTA_KEY" -H "Content-Type: application/json" \
  -d '{ "patient": { "sex": "female", "age": 41, "display_id": "CASE-0001" }, "design": "blocks",
        "results": [ { "name": "Ferritin", "value": 9, "unit": "ng/mL" }, { "name": "TSH", "value": 2.4, "unit": "mIU/L" } ] }' \
  -o report.pdf

Node.js (18 or later, built-in fetch)

import { writeFileSync } from "node:fs";

const body = {
  patient: { sex: "female", age: 41, display_id: "CASE-0001" },
  collected_at: "2026-09-30",
  results: [
    { name: "Hemoglobin", value: 11.2, unit: "g/dL" },
    { name: "Ferritin", value: 9, unit: "ng/mL" },
    { name: "TSH", value: 2.4, unit: "mIU/L" },
  ],
};
const headers = { Authorization: `Bearer ${process.env.STRUCTA_KEY}`, "Content-Type": "application/json" };

// analysis: JSON
let res = await fetch("https://structamed.com/api/v1/analyze", { method: "POST", headers, body: JSON.stringify(body), signal: AbortSignal.timeout(30_000) });
if (!res.ok) throw new Error(`${res.status} ${JSON.stringify((await res.json()).error)}`);
const analysis = await res.json();
console.log(analysis.summary, analysis.findings.length, "findings", analysis.warnings ?? []);

// report: PDF
res = await fetch("https://structamed.com/api/v1/report", { method: "POST", headers, body: JSON.stringify({ ...body, design: "blocks" }), signal: AbortSignal.timeout(60_000) });
if (!res.ok) throw new Error(`${res.status} ${JSON.stringify((await res.json()).error)}`);
writeFileSync("report.pdf", Buffer.from(await res.arrayBuffer()));

Python (requests)

import os, requests

URL = "https://structamed.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['STRUCTA_KEY']}"}  # json= sets Content-Type
body = {
    "patient": {"sex": "female", "age": 41, "display_id": "CASE-0001"},
    "collected_at": "2026-09-30",
    "results": [
        {"name": "Hemoglobin", "value": 11.2, "unit": "g/dL"},
        {"name": "Ferritin", "value": 9, "unit": "ng/mL"},
        {"name": "TSH", "value": 2.4, "unit": "mIU/L"},
    ],
}

r = requests.post(f"{URL}/analyze", headers=HEADERS, json=body, timeout=30)
r.raise_for_status()  # on an error the JSON body is {"error": {"code", "message", "request_id"}}
analysis = r.json()
print(analysis["summary"], len(analysis["findings"]), "findings", analysis.get("warnings", []))

r = requests.post(f"{URL}/report", headers=HEADERS, json={**body, "design": "blocks"}, timeout=60)
r.raise_for_status()
with open("report.pdf", "wb") as f:
    f.write(r.content)

What to look at in the answer. findings[] (one per graded marker, with status, severity and the range used), unrecognized[] (rows we could not grade, each with a reason: nothing is dropped silently), warnings[] (notes about how your input was read, including every unknown field that was ignored) and next_steps. Before go-live send a real panel to POST /api/v1/recognize (free, not counted): it tells you which of your marker names and units resolve. A Postman collection with a request for every endpoint is at https://structamed.com/partner/structamed.postman_collection.json: import it, set the variables baseUrl and apiKey, and press Send.

Endpoint

POST https://structamed.com/api/v1/analyze
Content-Type: application/json

Every endpoint, all on https://structamed.com:

EndpointMethodKeyAnswer
/api/v1/analyzePOSTyesJSON interpretation (this page). One report.
/api/v1/analyze/batchPOSTyes1 to 20 analyze requests in one call. One report per successful item.
/api/v1/reportPOSTyesThe same analysis as a branded PDF. One report.
/api/v1/fhir, /api/v1/hl7, /api/v1/ldt (beta)POSTyesThe same analysis from FHIR R4, HL7 v2 or LDT 3 input. One report.
/api/v1/recognizePOSTyesName and unit recognition only; no analysis. Free, not counted.
/api/v1/loincGETnoThe supported LOINC list. 30 requests per minute per client address.
/api/healthGETnoUptime probe (not part of the v1 interface and not in the OpenAPI file): 200 { "status", "time", "version" }; ?deep=1 also runs the rule engine once on a fixed synthetic panel and answers 503 with "engine": "error" if that fails. 30 requests per minute per client address.

Authentication

Send your key in either header:

Authorization: Bearer sm_live_<32 characters>
x-api-key: sm_live_<32 characters>

Bearer is read in any letter case, extra spaces are ignored. If you send both headers, the Authorization: Bearer header is used and x-api-key is ignored (even when the Bearer key is wrong); x-api-key is read only when there is no Bearer header.

Keys are issued to you once. Only a hash is stored on our side, so a lost key cannot be recovered, only replaced. A missing, unknown or deactivated key returns 401 unauthorized. If the key service cannot be reached in time, the answer is 503 service_unavailable (the key is not necessarily wrong: retry). A key that has passed its expiry date returns 401 key_expired ("This API key has expired. Contact support@structamed.com for a new one."). Live keys expire only if an expiry date was agreed.

Test keys. For development you also get a key starting sm_test_ (sm_test_<32 characters>). It works on every endpoint exactly like a live key, but it is never billed. It is capped at 300 reports per month unless another cap is agreed, and it expires 30 days after it is issued unless agreed otherwise. Every response to it says so: the header x-structa-test: 1 on every answer once the key is recognised (including errors; a 401 unauthorized or a per-address 429 is answered before the key is known and does not carry it), "test": true at the top level of JSON answers, and the word TEST in the title of the PDF from /api/v1/report. Do not use it in production.

Request

{
  "patient": { "sex": "male", "age": 45, "birth_date": "1980-01-31" },
  "collected_at": "2026-09-30",
  "mode": "clinical",
  "lang": "en",
  "results": [
    { "name": "ApoB", "code": "optional", "value": 1.32, "unit": "g/L",
      "ref_low": 0.6, "ref_high": 1.0, "ref_text": "optional printed range", "flag": "H" }
  ],
  "previous": [
    { "collected_at": "2025-09-30", "results": [ { "name": "ApoB", "value": 1.1, "unit": "g/L" } ] }
  ]
}
FieldRequiredNotes
patient.sexyes"male" or "female". Reference ranges and several rules depend on it. "M", "F" and any letter case ("Male") are read as male / female and a warnings entry says so; "other", "unknown" or null cannot be graded and are 400 invalid_request.
patient.ageone of age / birth_dateYears, 0-120.
patient.birth_dateone of age / birth_dateYYYY-MM-DD. Age is computed at collected_at (today if absent). If both are sent, age is used.
patient.contextnoClinical context the engine can use: athlete, menopausal status, pregnancy, medications, conditions. See Patient context.
collected_atnoYYYY-MM-DD, or an ISO date-time (2026-09-17T08:30, ...T08:30:00Z, ...T08:30:00+02:00). The date is used for age and for dating the trend; the time of day, when both this and a previous panel carry one, gives the interval for serial troponin (see Serial troponin).
modeno"clinical" (default) or "wellness". Wellness uses optimal-range framing and wellness next steps.
langnoen (default), de, uk, fr, pl, es, pt, pt-PT. Texts fall back to English where a translation is missing. Marker names are always English. pt-PT (European Portuguese): the engine runs in pt, so the JSON texts are the pt (Brazilian) texts; the PDF reports of /v1/report print a reviewed overlay of European usage on top (colheita, doente, intervalo habitual, "está a ...", hormona ...). It is an overlay, not a second translation, and has not yet been checked by a native speaker. Values and units are never changed.
resultsyes1 to 300 entries.
results[].nameyesThe marker name as you label it ("ApoB", "Hemoglobin", "hs-CRP"). Matched against our marker list by name/synonym.
results[].valueyesA number, or a string: "5.2", "6,1", "5.2 H", "<0.5", "Negative", "1+". null or "" marks a row without a result (see Values).
results[].unitno, but send itUnits are checked and converted to the engine's own unit where the conversion is known. A unit that is invalid for the marker causes the row to be reported in unrecognized. See Values.
results[].ref_low, ref_highnoYour laboratory's own reference limits. When present they are used instead of our defaults (ref_source: "partner"). One side only is allowed.
results[].ref_textnoA printed range as text, used only if ref_low/ref_high are absent.
results[].flagnoH, HH, L, LL, N (or high/low/normal). Treated as a hint; the value is graded against the range.
results[].codenoA LOINC code (for example 1884-6). A supported code decides the marker; see LOINC codes.
target_rangesnoYour own target ranges, up to 200: [{ "name" or "key", "low", "high", "unit", "label" }]. Send exactly one of name (as for results[].name) and key, and at least one of low and high (a missing bound is open). unit is the unit of the bounds (converted exactly to the marker's unit; absent means the marker's own unit); label (up to 60 characters) is printed instead of "Practice target". Display only: severity, status, risk, urgency, notes and next steps are graded against the laboratory or engine range exactly as without it. A matching finding carries target; a malformed entry or an unknown marker is 400 invalid_request with the entry named. See Target ranges.
previousnoUp to 12 earlier panels, each with collected_at (date or ISO date-time) and results in the same shape. Used for trends and for serial troponin. A panel may instead (or also) carry omics for the omics trends (see Omics trends); results may then be left out.

Maximum body size: 1 MB.

Response (200)

{
  "request_id": "req_...",
  "engine_version": "structamed-engine/2026-10",
  "lang": "en",
  "summary": "Some findings are outside the optimal range and worth reviewing.",
  "summary_code": "summary.wellness_findings_present",
  "risk": { "score": 1.4, "level": "low" },
  "counts": { "received": 19, "graded": 19, "abnormal": 4 },
  "findings": [ ... ],
  "patterns": [ { "type": "anemia", "confidence": "moderate", "evidence": ["..."] } ],
  "clusters": ["metabolic"],
  "notes": [ { "key": "notes.lipid_abnormal", "text": "..." } ],
  "next_steps": { "urgency": "routine", "steps": [ { "category": "monitor", "key": "...", "text": "...", "confidence": "moderate" } ] },
  "unrecognized": [ { "name": "Xyz", "value": 3, "unit": "u", "reason": "marker name is not recognized" } ],
  "trends": [ ... ],
  "trends_skipped": [ { "key": "ferritin", "reason": "unit differs between panels; not compared" } ]
}

trends and trends_skipped appear only when previous was sent. Points are ordered by collected_at, never by array position: a previous panel dated after the current one is placed after it. An earlier value in another unit is converted through the engine's converter (when the current value is not in the engine unit, every point is shown in the engine unit with converted_from); ug/L = ng/mL, mIU/L = uIU/mL and (sodium, potassium, chloride, bicarbonate) mmol/L = mEq/L are the same unit.

findings[]

One entry per graded marker, normal ones included.

FieldMeaning
key, nameEngine marker key and its English name. input_name is your own label. matched_by is "loinc" or "name": how your row was matched to the marker.
derivedtrue for a value the engine calculated (for example HOMA-IR from glucose and insulin), not one you sent.
value, unitThe value in the engine's unit. unit is always present; "" (an empty string) means the marker has no unit (INR, ratios, antigen results such as HBsAg). If a unit conversion happened, submitted holds your original value, unit and range: the range you sent, or, where you sent none, the range the row was graded against shown in your unit.
value_label, operatorFor word results ("Negative") and limit values ("<0.5").
ref_low, ref_highThe range actually used for grading; null where a side does not exist.
ref_source"partner" if the range came from your request, "engine_default" if it is ours.
context_rangeThe range the grade was read against when the patient's context moved it, for example an athlete's CK; ref_low and ref_high stay as they were; absent when the context did not apply.
statuslow, normal or high against that range.
severitynormal, info, warning or critical. Severity is not the same as status: it also reflects how far outside the range the value is and the clinical context.
targetOnly when you sent a target_ranges entry for this marker: { "low", "high", "unit", "label", "position" } in the finding's unit (null for an open bound or no label). position is "below", "within" (ends included) or "above", null for a limit value such as "<0.5". It is not a severity and no grade reads it.
rationale[]Steps explaining the finding (code, rendered text, values).

Target ranges

A target range is your own narrower range for a marker (for example ferritin 50 to 100 ng/mL where the laboratory range is 15 to 150). It is shown next to the laboratory range and never replaces it:

  • status, severity, risk, next_steps, notes and every other field are the same with and without target_ranges; a critical value stays critical even when it lies inside your target.
  • The PDF from /api/v1/report prints one extra line under the row in all three designs, in the report language: "Practice target: 50–100 µg/L, below target" (or your label). The patient design words it calmly ("Your practice's own target: ...") and never as abnormal.
  • A target is placed against the value after the unit conversion; if its unit cannot be converted exactly, the target is left out and a warnings entry says so.
  • Word results (value_label) get no target. Works in analyze, report and every item of analyze/batch.

A previous panel may carry omics (the same block as the request's omics), with or without blood results. With omics in the request itself, the response's integrated block then gains trends[] and, when something could not be compared, trends_skipped[]. Blood trends are not affected, and a request without previous[].omics returns the same response as before.

  • Matching. A functional row is matched by its catalogue key (so "Cortisol, Morning" and "Cortisol (morning)" are one series) and a compatible unit; a row whose unit differs between visits is listed in trends_skipped with the reason, never converted silently. Epigenetic ages are matched by clock (OMICm, SYMPHONY, GrimAge ...) or organ system, DunedinPACE and the gut microbiome age as one item each, microbiome scores by key (and scale_max), DNAm markers by name. A visit dated after the current collected_at is not compared. Provoked collections and non-numeric results are not compared.
  • Fields. kind (functional, age, pace, microbiome_score, microbiome_taxon, microbiome_index, dnam_marker), key, name, unit, points (oldest first, the current visit last, each with status for functional rows), previous, current, previous_at, delta, change_percent, direction (up/down/flat), quality, basis, and where it applies status_change (from/to), crossed_range (out = moved outside the lab range, in = back inside it) and acceleration_delta (ages: the change of age minus chronological age, in years).
  • Epigenetic clocks, noise and rules. Clock names are recognised in the usual lab spellings (Horvath, Hannum, DNAm PhenoAge, GrimAge, GrimAge2, DunedinPACE, OMICmAge, SYMPHONY, DNAmTL, "PC" versions). Each integrated.ages.items[] entry carries noise (years), within_noise, clock (canonical key) and meaning (what the clock measures and its limits, with PMIDs). The noise is 1.5 years for principal-component clocks (Higgins-Chen 2022, PMID 36277076: replicates agree within 1.5 years in most cases), 3 years for single-CpG clocks (a display convention; the paper reports replicate differences of up to 9 years) and 2 years for any other clock or organ age (display convention). A difference inside the noise is not read as an acceleration. DunedinPACE is a rate (1.0 = one biological year per calendar year, Belsky 2022, PMID 35029144), is never shown as an age, and the paper defines no cut-off; the grey zone around 1.00 in the PDF is a display band. The GrimAge components, a DunedinPACE entry among clocks and a telomere length are listed as sent, without an age difference. Integrated rules AE1 (GrimAge beyond its noise with raised hsCRP or smoking-related markers), AE2 (pace above 1.0 with raised HbA1c, raised triglycerides or low HDL), AE3 (an organ age 2 years or more ahead with the matching blood tests out of range) and AE4 (clocks that disagree beyond their noise, or a DNAm PhenoAge that differs from the blood Phenotypic Age by more than its noise) are info, evidence grade C, associations only; they are silent under 18.
  • Direction of good. quality is improving or worsening only where the data say which way is better: a functional row by its own range (back inside = improving, outside = worsening, both outside on the same side = towards the range improving), biological ages and DunedinPACE (lower is better; ages are read as the change of the difference to chronological age when both ages are known), microbiome scores (higher is the more favourable) and DNAm markers with a stated direction. Everything else is changed (a move of 10 percent or more inside the range, or a result with no range), and a small move is stable. The thresholds (10 percent, 1 year, 0.05 DunedinPACE, 10 percentile points, 5 percent of a score's scale) separate a change from noise for display; they are not clinical limits.
  • PDF. Blocks and classic print a change table (before, now, change, range, reading) after the integrated findings; the patient report prints one line, only for results that crossed their range. All in the report language.
  • At most 12 previous panels in total (MAX_PREVIOUS), blood and omics together.

Per marker present in both the current panel and at least one earlier panel with the same unit: points (oldest first, the current panel last), direction (up/down/flat, flat being under 5% movement), quality (improving, worsening, mixed, stable, judged by distance to the range, not by the sign of the change; the range is the one you sent for the row, otherwise the range the engine graded the current value against), first, last, change_percent, notable_change (true when the value moved by 25% or more between the first and last point, whatever quality says: a marker can be stable because it stays inside its range and still have fallen by 40%; the flag never changes quality, direction or out_of_range). Trend values are the numbers as you sent them, in your unit. A marker whose unit differs between panels is listed in trends_skipped, never converted silently.

display (present only when your unit is not the unit the findings of this response use): the same series in the findings' unit, { "unit", "values": [...] }, values[i] belonging to points[i]; points, first, last and unit stay in your unit. expected_for (perimenopause, postmenopause or testosterone_therapy): present when the direction of the change is what the stated patient.context already explains. With menopausal_status peri or post (women): FSH and LH up, estradiol and progesterone down (a perimenopausal FSH of 25 IU/L or more under age 40 is not marked). With medications: ["testosterone"]: LH and FSH down, estradiol up. A haematocrit or haemoglobin rise on testosterone is never marked. quality is not altered by expected_for; the PDF labels such a row "Expected" instead of "worsening".

warnings[]

Top-level list of plain-text notes, present only when there is something to say:

  • Unknown request fields. A field the API does not read (a misspelt ref_hi, a name in patient, a new field you tried) is accepted, so a client that sends more than we read keeps working, and is named: unknown field results[3].ref_hi ignored. This covers the top level, patient, results[], previous[] (and its rows) and the rows of omics; at most 20 are listed, then N more unknown fields ignored. Check this list the first time you send a new field.
  • A row whose LOINC code and name disagree (for example the code is a urine test and the name says serum). The code wins; the warning tells you so you can fix the source.
  • A unit read from inside a value ("5.4 mmol/L": the number and the unit are split and the warning says to send unit apart), a patient.sex of "M" / "F", a result without a unit read in the marker's one unit, a reference range that does not fit the unit, a molar default range.

unrecognized[]

Nothing is dropped silently. A row appears here if its name is not a known marker, if it duplicates another row for the same marker (the first one is analyzed), if the engine rejected its unit or value as impossible for that marker, or if it was recognized but could not be graded. A finding is only as good as the name matching: please review this list.

observations[]

Additive and optional: present only when the panel has descriptive rows. These are findings printed as words, not measurements: blood smear morphology ("Acanthocytes: NONE SEEN"), urine sediment and crystals, epithelial cells, leukocyte esterase, rare differential lines ("Other Cells", "Prolymphocytes"), parasites. They have no reference range here, so they are never graded; they are reported here instead of in unrecognized (a row that has a marker in the catalog, such as nucleated red cells, urine casts or a blast percentage, is still graded there).

Each item is { name, id?, label?, value, unit?, kind, result, note_key?, note? }:

FieldMeaning
name, id, labelname is the row as you sent it. id is the canonical id of a common item (anisocytosis, poikilocytosis, spherocytes, schistocytes, blasts, parasites, crystals, casts, epithelial_cells, leukocyte_esterase, urine_sediment, mucus ...; the full list is the enum in the OpenAPI spec) and label is that item in the response lang (en, de, uk, fr, pl, es, pt). Both are absent for a name nobody has a translation for. The PDFs print label in the report language, so a Portuguese or German sheet reads in one language whatever the source lab printed.
kindsmear, urine_sediment, differential or other.
resultnot_detected ("none seen", "negative", "not detected", "absent", 0, and the same words in German, French, Polish, Spanish, Portuguese and Ukrainian), present ("few", "rare", "moderate", "many", "1+" to "4+", "positive", a number above 0 ...) or unclear (a range such as "0-2/HPF", a limit, or a plain cell count with no reference range).
note_key, notePresent for a present item that can matter on its own and for an unclear item; note is plain text in lang.

How they reach the summary: not_detected items are never named in Not assessed: and never make the summary partial. unclear items are named in Not assessed:. When any item is present, the summary ends with Descriptive findings reported present: <names>. Review with the clinician. (in lang), and a clean code (summary.no_significant_findings, ..._partial) becomes summary.descriptive_findings_present. A present parasite, blast or schistocyte finding raises next_steps.urgency to at least soon (never above it, from a descriptive word alone). A positive word on schistocytes ("Few") is reported here, not graded as 1 %. Rows of this kind that are same-value duplicates of a graded row stay in unrecognized with the reason duplicate of another row for the same marker (<name of the graded row>) and are not named in the summary.

The clinician PDF prints one compact "Descriptive observations" block (present items highlighted, not-detected items muted); the patient PDF prints one plain sentence only when something is present, and nothing when everything is not detected.

recognition

An answer carries a recognition block when it has something to report (a row nothing recognised, or a row your dictionary resolved); POST /api/v1/recognize always returns it. The block holds total_rows, by_source (partner_dictionary, code, global, none), no_value (rows without a result value) and unresolved[] with the reason and up to three closest catalog entries per row (suggestions, hints only, never applied). POST /api/v1/recognize takes the same key and body as /api/v1/analyze and returns only this block (plus unit warnings and omics notes); it runs no analysis, makes no AI call, renders no PDF and is not counted as a report. Rows your account's dictionary maps carry matched_by: "partner_dictionary" in findings[].

biological_age

Optional. A research estimate of biological age (Phenotypic Age, Levine et al., Aging 2018;10(4):573-591) computed from albumin, creatinine, glucose, CRP (or hs-CRP), lymphocyte %, MCV, RDW, alkaline phosphatase and WBC, plus the patient's age. It is present only when all nine markers are usable and age is 20 to 85; units are converted for you, and a CRP reported as < its limit is used at that limit (floor 0.01 mg/dL). The block holds phenotypicAge, chronologicalAge, difference (negative is younger than the calendar age), inputs[] (the nine values in the paper's units), method and note. It is an estimate from population data, not a diagnosis, and it changes no grade, risk, urgency, note or next step. When seven or more of the nine markers were sent but it could not be computed, biological_age_status (code, reason) says why; otherwise neither field appears.

integrated.references and findings[].ref_ids (Beta)

When the request carries omics, integrated.references lists every source cited by the integrated findings, as { "id": 1, "text": "...", "url": "..." } (url only where the source has an address). Each finding that cites a source carries ref_ids, the ascending ids of its sources; the PDF prints them as [1,2] beside the evidence grade and lists the sources in a final "References" section. Sources come from the rule's own wording (guideline or paper named in it) and from the gene catalogue entries of the genes the finding names. A finding whose rule and genes cite nothing has no ref_ids, and references is absent when no finding cites a source; nothing is filled in. Numbers follow the order in which the PDF prints the findings (system blocks, then priority), not the order of integrated.findings. Citations are in English whatever the request lang.

collection

results[] and omics.functional[] rows accept an optional collection object: specimen, time_point, fasting (boolean), provoked (boolean), provoking_agent and collected_at (date or ISO date-time). Explicit fields win over what is inferred from the printed name; provoked: false overrides any provocation wording. Unknown fields or wrong types are refused with 400 and a message naming the field.

integrated.functional: degree, detection and meaning

Besides status, each row of integrated.functional may carry ref_low / ref_high (the printed bounds as numbers; for a range the lab keyed to sex or age, the half for the patient), deviation (slight, moderate, marked: distance beyond the limit as a multiple of the limit and a share of the range width; descriptive only, never an action limit) with ratio_to_limit, detection (below_limit with detection_limit, or not_detected) for below-detection rows, and meaning_key (the catalogue key of a short text on what the analyte is and what a high or low result commonly goes with). A printed range with a qualifier word ("5-10 borderline"), a two-tier range ("1.0-3.0 / 3.0-5.0") or a range keyed to a sex or age that does not fit is not read as a normal range: the row follows its printed flag or stays unknown, and integrated.notes names it. Flags such as Elevated, H* and <L are read; Abnormal, A and ++ mean "outside, direction unknown".

Microbiome taxa and indices (omics.microbiome.taxa, indices; beta)

Besides the pathway scores, omics.microbiome accepts the relative abundance of named taxa and community indices as a lab prints them:

"microbiome": {
  "indices": [
    { "name": "Shannon index", "value": 2.4, "ref_low": 3.0, "ref_high": 4.5 },
    { "name": "Firmicutes/Bacteroidetes ratio", "value": 1.9 }
  ],
  "taxa": [
    { "name": "Akkermansia muciniphila", "value": 0.2, "unit": "%", "ref_low": 1, "ref_high": 5 },
    { "name": "Faecalibacterium prausnitzii", "value": 3.1, "ref_text": "5-15" },
    { "name": "Enterobacteriaceae", "value": 4.8, "flag": "H" }
  ]
}

Each row needs name and a value of 0 or more (a taxon in percent, the default unit, cannot exceed 100); unit, ref_low, ref_high, ref_text and flag are optional. The row is graded against the range the lab printed, in the same order as functional rows (numeric bounds, printed text, flag). With none of these the row is returned with status: "no_range": no population range is applied, because none holds across labs, methods and diets. integrated.microbiome.measures[] returns every row with key (recognised names: 33 taxa and indices in the seven report languages), kind (taxon or index), status, ref, deviation and meaning (what it is, what low or high commonly goes with, and how weak the evidence is). Rules MB1-MB5 join these rows with blood and stool results (low diversity or butyrate producers with a raised hs-CRP or calprotectin, a poor TMAO-pathway score with raised ApoB or LDL-C, low Akkermansia with raised insulin-resistance markers, Proteobacteria or Enterobacteriaceae with raised calprotectin, low diversity with raised insulin or triglycerides); each is grade C, priority info and cites its sources in integrated.references. Earlier visits sent in previous[].omics are compared too (kind microbiome_taxon / microbiome_index). A microbiome result never identifies a condition.

LOINC codes

Send the LOINC code in results[].code when your system has it. Precedence:

  1. A supported code decides the marker (matched_by: "loinc"). Your name is not used to route; it is still returned as input_name.
  2. An unknown or absent code falls back to the name (matched_by: "name"). Nothing is rejected for an unknown code.
  3. If a supported code and the name point at different markers, or at different specimens (urine against serum), the code wins and an entry is added to warnings[].

Specimens are separate markers: urine creatinine and serum creatinine, urine albumin and serum albumin never map to each other. Mass and molar codes of one analyte (for example LDL 13457-7 in mg/dL and 22748-8 in mmol/L) map to the same marker; send the unit that goes with your value and it is converted.

The supported list (code, marker key, specimen, usual unit, LOINC name, verification date) is served as JSON by GET /api/v1/loinc: no key needed, 30 requests per minute per client address.

Values, units and ranges

What the API accepts, as tested against a corpus of LIS-style rows.

Marker names. Case, British spellings, a glued flag or star (ALT (SGPT) *, Glucose (H)), and specimen words (Serum Urea, Ferritin, Serum, PSA, Plasma) are handled; so are common LIS labels such as FPG, Alk Phos, Gamma GT, Total White Cell Count, Mean Cell Volume, Total CO2, Lipoprotein (a). Two labels are refused on purpose, with a reason in unrecognized: post-prandial glucose (it has no fasting range) and bioavailable testosterone (it is not total testosterone). A LOINC code in code overrides the name.

Values.

You sendResult
5.2, "5.2", " 4.0 ", "6,1" (decimal comma)the number
"5.4 mmol/L", "5.4%", "<0.5 mg/L" (a unit inside the value)the number; the unit is read from the value when the row sends no unit (or the same one), and a warnings entry says so. When unit says something else the value is not guessed
"5.2 H", "H 5.2", "5.2 (H)", "5.2*"the number; the letter is used as flag when you sent none
"<0.5", "< 0.5", "<=0.5", ">=5"a limit value: operator is < or >, graded against the range without treating the limit as a measurement
"Negative", "Non-reactive", "Not detected", "Nil", "1+", "Trace", "Positive"a word result, graded by the marker's qualitative rules, for markers that have a qualitative form (serology, urinalysis dipstick, stool tests, titres). On a quantitative marker (hs-CRP, glucose, ferritin ...) it is never turned into 0: the row is listed in unrecognized with the reason qualitative result on a quantitative marker
null, "", "N/A", "Pending", "See comment", "Not done", "TNP", "Haemolysed", "--"not a result: listed in unrecognized with a reason, never graded; the other rows of the panel are still analyzed
a value outside the physiologically possible range for the markerunrecognized ("outside the physiologically plausible range")

A result without a unit. A marker that is printed in only one unit is read in the engine's unit and a warnings[] entry says so (No unit was sent for "Potassium"; the value was read as mmol/L.). A marker that is commonly printed in two unit systems (glucose, creatinine, haemoglobin, cholesterol, testosterone, vitamin D, ferritin, HbA1c ...) is not graded without its unit: the row is listed in unrecognized ("no unit was sent and this marker is reported in more than one unit ... send the unit"), unless your own ref_low/ref_high fit the engine's unit, in which case it is read in that unit with the warning. A unit that is not the marker's own and has no conversion (for example CK-MB in ng/mL, renin in pg/mL, vitamin A in ug/dL) is refused the same way (unit is not valid for this marker): it is never graded as if it were the engine's unit.

What was not assessed. When a panel has rows in unrecognized (or rows with status: "not_applicable"), the summary never reads as an all-clear: summary_code is summary.no_significant_findings_partial instead of summary.no_significant_findings, summary.rows_not_graded (and risk is null) when nothing could be graded, and the summary text ends with Not assessed: <names>. whatever the code (same-value duplicates and not_detected descriptive observations are not named; see observations[]). When every row of the panel is unrecognised, refused for its unit or not_applicable, the code is summary.no_marker_assessed ("no marker could be assessed", risk is { "score": null, "level": null }). When a row that can signal an emergency (for example a potassium of 12 or a glucose of 990) was read but not graded, the code is summary.critical_row_not_graded, risk is null and next_steps.urgency is at least soon.

Counts. counts.received is the number of rows you sent, counts.graded the number of those the engine graded. A value the engine derives itself (the LH/FSH ratio) has derived: true on its finding and is counted in counts.derived (present only when there is one), so graded never exceeds received.

Expected findings and the summary. A finding that your patient.context explains (a condition, menopausal_status, heart failure ...) carries expected_for_condition. When every finding that is left is of that kind, summary_code is summary.findings_consistent_with_condition ("The findings are consistent with the recorded condition or context; no further significant deviations were detected.") instead of summary.no_significant_findings. In known diabetes an HbA1c above 7 % (53 mmol/mol; ADA Standards of Care 2025, the usual target for many adults) is glycaemic-control information: it is never marked expected, and the note notes.hba1c_above_diabetes_target says the individual target may differ.

Clinical and wellness mode can differ in tone and in the optimal band, never in fact. Vitamin D: clinical mode uses the clinical cut-off (US National Academy of Medicine / IOM: below 30 nmol/L deficient, 30 to under 50 inadequate, 50 and above sufficient; the Endocrine Society 2024 guideline no longer endorses a 25(OH)D threshold), so 60 nmol/L is within the range (displayed from 50); wellness mode keeps 75 nmol/L (30 ng/mL) as its optimal target and reports 60 nmol/L as below it. Ferritin: a value inside the laboratory range and under 30 ug/L is reported in wellness mode as severity: info with the note notes.ferritin_below_wellness_optimal ("below the optimal range used in wellness mode"); it is not called low, does not count towards a nutrient-reserve pattern and does not start an anaemia review.

Patients under 18. Whole-year ages use age-banded ranges for haemoglobin, WBC, neutrophils, lymphocytes, platelets, creatinine, ALP, AST, potassium, phosphate, urea, urate, TSH, free T4 and testosterone (sources in lib/analyze/paediatricRanges.ts; age 0 uses the union of the infant bands). A marker with no paediatric range (sex steroids, SHBG, AMH, LDH, GGT, MCV/MCH, eGFR; bilirubin and reticulocytes under 1 year) is not judged against an adult range: the finding has status: "not_applicable", no pattern or advice comes from it, and context_ignored says so (a range printed on the report still applies).

A thousands separator is not guessed: "1,234" is read as 1234 (a decimal comma is only assumed when there is no group of three digits after it). Send plain numbers if your system prints comma decimals with three decimals.

Units. Case and the micro sign are levelled (umol/L, µmol/L, μmol/L; MMOL/L). Counts may be x10^9/L, 10^9/L, x10E9/L, K/uL, x10^3/uL, 10*3/uL (and /uL for WBC and platelets, which is divided by 1000). A method note in the unit is dropped (mmol/mol (IFCC), % (NGSP)). Values in conventional and SI units are converted to the engine's unit and the original is returned in submitted. Lipoprotein(a): mg/dL is native, g/L and mg/L are converted; nmol/L is never converted (the ratio to mg/dL depends on the assay): the value is kept in nmol/L and, if you sent no reference range, it is graded against a molar default of ours, < 75 nmol/L (EAS 2022 consensus: < 75 nmol/L (30 mg/dL) low risk, 75-125 grey zone, > 125 nmol/L (50 mg/dL) high risk), with ref_source: "engine_default" and a warning that says so. Your own ref_low/ref_high win.

Reference ranges. ref_low/ref_high or ref_text (3.5 - 5.1, 3.5-5.1, 3.5 to 5.1, 0.6–1.0, <5.2, <= 5.2, > 1.0, ≥1.0, Desirable: <5.2, several risk-tier lines, Male: 59-104 Female: 45-84, Age 18-60: 59-104 / Age >60: 50-110) are read for the patient's sex and age; for tiers the "desirable" tier is the range. A range with ref_low greater than ref_high is rejected with 400. A range in a unit other than the value's: if the text names the unit (53-106 umol/L) it is converted; if it does not and the numbers do not fit the value's unit but fit another known unit of the marker (creatinine 0.6-1.2 beside a value in µmol/L), it is read in that unit and a warnings[] entry says so; if it fits no known unit it is set aside, the engine's default range is used (ref_source: "engine_default") and a warning says so.

Panels. 1-300 rows (301 gives 400). Two rows for the same marker (for example mg/dL and mmol/L): the first is always the one graded. If the later row agrees with it (within 10 % after unit conversion) it is listed in unrecognized as a duplicate. If it disagrees, both rows are listed in unrecognized with the reason conflicting duplicate, so the conflict is visible; the first is still the one graded. In previous, a unit spelled differently (umol/L and µmol/L) is the same unit; a really different unit (mg/dL against µmol/L) is left out of trends and listed in trends_skipped only when it cannot be converted: an earlier value in a convertible unit (HbA1c % / mmol/mol, glucose, creatinine, cholesterol ... in mg/dL or mmol/L) is converted into the current value's unit and the value as sent is kept in the point (converted_from). A creatinine that has risen to 1.5 times an earlier value or more adds the first note notes.creatinine_rise_from_baseline (KDIGO AKI definition).

Patient context

patient.context is optional. Unknown fields or values and contradictions (pregnancy or menopausal status for male, a trimester without pregnant: true, pregnant with menopausal_status: post, oral_contraceptive for a male) return 400. Pregnancy at age 55 or above is accepted with a warnings entry. Whatever you send is answered in two top-level lists, present only when patient.context was sent: context_applied (what changed the analysis) and context_ignored (accepted, but the engine has no rule for it, with the reason). Nothing is pretended: a field that is not wired is never listed as applied.

"context": {
  "athlete": true,
  "menopausal_status": "pre | peri | post",
  "pregnant": true, "trimester": 2,
  "fasting": true,
  "medications": ["statin", "levothyroxine", "testosterone", "biotin", "metformin", "oral_contraceptive", "glp1"],
  "conditions": ["type2_diabetes", "hypothyroidism", "ckd", "heart_failure"],
  "setting": "outpatient | acute",
  "smoker": true
}
FieldValuesWhat it does
athletetrue, false, "endurance", "strength"Athlete reference ranges: CK ceiling 1000 U/L, creatinine ceiling 125 (endurance) / 140 (strength) umol/L, ferritin floor 50 ug/L, lower resting heart rate and diastolic BP floors (endurance). true is applied with the endurance cohort internally (the default ranges), but the report and context_applied call it "Athlete" (type not specified), never "Endurance"; send "endurance" or "strength" to state the type. A range your own row prints is not overwritten: the severity is re-judged against the athlete range and a note says so. false is listed as ignored (it is the default).
sample_timing"under_24h", "24_72h", "over_72h"Last hard training or match before the sample. Needs athlete. Adds a note on raised muscle markers; ranges and grades do not change.
diet_pattern"vegan", "vegetarian", "low_carb", "keto", "high_protein"Needs athlete. Adds notes on vitamin B12, ferritin, iron, zinc, LDL, total cholesterol, uric acid, urea and creatinine; ranges and grades do not change.
sport_type"contact", "weight_class", "aesthetic"Needs athlete. Adds a note on CK in contact sports; weight_class and aesthetic count as a risk in the energy availability pattern.
season_phase"pre_season", "competition", "off_season"Needs athlete. Adds notes on values that shift across a season; off_season is printed and adds no note.
training_camp"altitude", "heat"Needs athlete. Adds a note on red cell markers.
recent_eventslist of "illness", "injury", "blood_donation"In the last 3 months. Needs athlete. Adds notes; ranges and grades do not change.
weight_cuttingtrue, falseCutting or making weight. Needs athlete. Counts as a risk in the energy availability pattern.
menstrual_status"regular", "oligomenorrhea", "missed_3_11", "missed_12_plus", "never_started"Female athletes; needs athlete. Adds notes and counts toward the energy availability pattern; ranges and grades do not change.
cycle_phase"follicular", "luteal"Same conditions as menstrual_status. Adds a note on estradiol, progesterone, LH and FSH.
menopausal_statuspre, peri, post (women)Replaces the age rule when given. post: postmenopausal at any age (FSH/LH high, estradiol/progesterone low and low AMH are expected, postmenopausal testosterone ranges and ROMA cut-offs). pre: never postmenopausal, so premenopausal ranges stay valid and high FSH or low estradiol show at any age. peri: the age rules are off, and FSH or LH above the premenopausal range, a low estradiol or progesterone (down to age 40; below 40 a FSH of 25 IU/L or more stays the premature-ovarian-insufficiency flag) are shown as info with expected_for_condition: "perimenopause" and the note notes.menopause_hormones_expected (hormone levels fluctuate through the transition: STRAW+10; NICE NG23 advises against FSH or AMH testing to diagnose it over 45). A low AMH from age 45 (with peri, post or no status) is shown as info with expected_for_condition: "menopausal_transition" ("postmenopause" with post) and keeps its real status against the displayed range. Without it the old rule stays: from age 45 (AMH), 50 (testosterone ranges, ROMA) or 55 (FSH/LH, estradiol, progesterone, hCG) a woman is read as postmenopausal.
pregnant, trimestertrue, 1-3Pregnancy reference ranges (haemoglobin, haematocrit, RBC, ferritin, TSH, creatinine, ALT/AST, calcium and others) and pregnancy notes. The trimester selects trimester ranges for TSH, D-dimer, progesterone and (3rd trimester) uric acid; it is sent to the engine as a gestational week inside the trimester (10, 20, 32). Not applied under age 18 (listed as ignored). Condition softening is not applied in pregnancy. Ranges your own rows print win.
medicationslevothyroxineA TSH outside the laboratory range gets a dose and adherence step instead of a new thyroid work-up. A TSH inside the range is not escalated (the AACE/ATA goal is a normal TSH).
metforminVitamin B12 below 221 pmol/L (= 300 pg/mL, the ADA borderline limit on metformin; a result sent in pg/mL is compared with 300) is a warning, with a note.
oral_contraceptiveNote that high SHBG / low free testosterone is an artifact of the pill.
other_hormonal_contraceptiveHormonal IUD, implant, injection, ring or patch: in an athlete the cycle is not scored for low energy availability.
biotinApplied as a note only: when the panel has immunoassay markers known to be affected by high-dose biotin (TSH, free T4/T3, troponin, PTH, ferritin, hCG, vitamin D, testosterone, estradiol, cortisol, ...), a notes.biotin_interference note recommends confirming with a biotin-free sample (stop biotin at least 48-72 h before the draw; FDA 2017/2019). Severities are not changed; affected_markers lists the markers.
statinApplied: LDL-C, non-HDL-C, ApoB or total cholesterol below the printed lower limit is the expected on-treatment result, so it is not reported as a finding (the marker reads normal, no deviation) and notes.statin_on_treatment says why and names the ESC/EAS 2019 goals (LDL-C < 1.4 mmol/L very-high risk, < 1.8 mmol/L high risk, reduction >= 50 %). Raised CK, ALT or AST adds notes.statin_ck_alt: the statin as a possible cause, with the ESC/EAS 2019 thresholds (CK 4x ULN or more: continue and monitor without symptoms and under 10x ULN, otherwise stop and re-check; ALT/AST 3x ULN or more: stop or reduce and re-test in 4-6 weeks). A raised LDL-C on treatment is graded as usual; treatment goals are not graded.
testosteroneApplied as notes only (Endocrine Society 2018, product labels); severities are not changed and a markedly high value is never softened. A raised haematocrit, haemoglobin or RBC adds notes.med_testosterone_hematocrit, and a haematocrit above 54 % (men) also adds the next step considerTestosteroneHematocrit (review the therapy with the prescriber). Low LH or FSH adds notes.med_testosterone_gonadotropins (the expected effect of exogenous testosterone). A high testosterone or free testosterone adds notes.med_testosterone_level_timing (timing of the draw against the dose). A high estradiol adds notes.med_testosterone_estradiol, and in clinical mode the testicular-tumour work-up step assessRaisedEstradiolMale is not added for a man on stated testosterone therapy. Raised cholesterol, LDL-C, triglycerides or non-HDL-C, or a low HDL-C, adds notes.med_testosterone_lipids. A high PSA, or a PSA above 4 ng/mL (men), adds notes.med_testosterone_psa. In trends, LH/FSH down and estradiol up are marked expected_for: "testosterone_therapy". In the patient report (design: "patient") the status tag of such a row reads "Expected on treatment".
glp1Applied as notes only (semaglutide, liraglutide, dulaglutide; tirzepatide carries the same label statements); severities are not changed. A high lipase or amylase adds notes.med_glp1_pancreatic_enzymes; a high calcitonin adds notes.med_glp1_calcitonin and the next step considerGlp1Calcitonin; a raised creatinine or low eGFR adds notes.med_glp1_kidney (volume depletion); a low glucose adds notes.med_glp1_hypoglycemia (insulin and sulfonylureas are the combination at risk).
creatineApplied as a note only: a raised creatinine or low eGFR gets notes.med_creatine_creatinine (creatine can raise creatinine without kidney damage; kidney disease is not ruled out; cystatin C and urine albumin help). Severities are not changed.
clopidogrel, warfarin, allopurinol, carbamazepine, thiopurine, fluoropyrimidine, iron_supplementAccepted; the blood engine has no rule (listed as ignored there). With omics (beta) they link to the multi-omics pharmacogenomic and haematology rules: e.g. clopidogrel + a CYP2C19 poor/intermediate genotype, statin + SLCO1B1 decreased function + raised CK, iron_supplement + a thalassaemia trait.
settingoutpatient, acuteClinical setting of the request. Absent or acute = the default (emergency-style) reading, unchanged. outpatient: the emergency-style cardiac next steps (serial troponin at 0h/3h, "measure SpO2/RR now") are replaced by an outpatient work-up (ECG, echocardiography and specialist assessment, repeat troponin on a new sample), unless chest pain or breathlessness is reported or the troponin is critical; a natriuretic peptide (NT-proBNP, BNP) graded critical is read as warning (ESC 2021 HF guideline: non-acute rule-out NT-proBNP 125 pg/mL, the age-stratified 450/900/1800 pg/mL values are acute-setting; NICE NG106: > 2000 ng/L specialist assessment within 2 weeks, 400-2000 ng/L within 6 weeks). With conditions: ["heart_failure"] a stable heart-failure picture reads soon, not urgent. Genuinely critical values (potassium, sodium, a critical troponin, creatinine ...) stay critical and urgent in every setting. acute is listed as ignored. Send setting (or have your integration configured with defaultSetting) for every outpatient panel: without it the engine reads the acute way (serial troponin, vitals every 4-6 h, Order CBC/CMP on a 24 h inpatient timeline, 48-72 h kidney repeat). With outpatient the CMP order reads "within 48-72 hours", the kidney repeat is a confirm-and-stage step (KDIGO 2024: CKD needs more than 3 months) and the timed source hunt for an inflammatory marker is limited to sepsis.
conditionsckd, diabetes, type1_diabetes, type2_diabetes, thyroid_disease, hypothyroidism, hyperthyroidism, anticoagulation, chronic_liver_disease, gout, heart_failure, acs_pci, ascvdWarnings on the markers the condition explains (CKD: creatinine, eGFR, urea ...; diabetes: glucose, HbA1c ...; thyroid: TSH, FT4, FT3; heart failure: NT-proBNP, BNP) are shown as info with expected_for_condition. Critical findings are never softened. The diabetes types and the thyroid kinds are not told apart. A condition explains a marker only in its own direction (diabetes: raised glucose / HbA1c, never a low glucose; CKD: raised creatinine, low eGFR; ...), and a thyroid result with TSH raised and free T4 low (or the reverse) is never softened. Contradictory entries (type1_diabetes with type2_diabetes, hypothyroidism with hyperthyroidism) return 400. Not applied in pregnancy (listed as ignored). acs_pci (acute coronary syndrome or PCI as the indication for antiplatelet therapy) changes no blood marker; the multi-omics CYP2C19 / clopidogrel finding is high priority only with it (CPIC 2022 is strong for that indication). ascvd (established atherosclerotic cardiovascular disease, also implied by acs_pci) changes no blood marker: the lipid next step does not send the reader to a SCORE2 primary-prevention estimate (ESC 2021: SCORE2 is for apparently healthy people aged 40-69, SCORE2-OP from 70; also withheld for heart failure, CKD with eGFR < 60 and age < 40).
medications_otherstring (200 characters)Free text about other medicines. Shown, never interpreted (listed as ignored).
allergies{ "drug_classes": ["penicillins", "cephalosporins", "sulfonamides", "nsaids_aspirin", "iodinated_contrast", "opioids"], "other": "text" }Documented drug allergies, shown in the report header. A next step whose text names a drug of an allergic class gets a visible caution (allergy_caution on the step lists the classes). No other interpretation; other is free text and never interpreted.
surgical_history{ "procedures": [...], "other": "text" }, procedures: bariatric_rygb, bariatric_sleeve, bariatric_bpd_ds, gastrectomy_total, gastrectomy_partial, ileal_resection, thyroidectomy, splenectomy, nephrectomy, oophorectomy_bilateral, cholecystectomy, hysterectomy, otherBariatric surgery: a low B12, iron/ferritin, folate, vitamin D, calcium, copper or zinc (or a high PTH) gets notes.history_bariatric_deficiency; if none of the ASMBS screening set is on the panel a "consider" next step lists it. Total gastrectomy: a low B12 gets a note and a replacement step (notes.history_gastrectomy_total_b12); partial: lower-risk wording. Ileal resection: low B12 note. Thyroidectomy: TSH / free T4 read as replacement monitoring; low calcium with a low or not-raised PTH gets notes.history_postsurgical_hypoparathyroidism (a PTH step when PTH is absent). Splenectomy: a high platelet count, WBC or lymphocyte count graded warning is shown as info with expected_for_condition: "splenectomy"; a critical value is never softened; notes.history_splenectomy_counts. Nephrectomy: creatinine / eGFR note (read against the patient's own baseline). oophorectomy_bilateral (women only; male returns 400): postmenopausal reading of the sex hormones at any age; an explicit menopausal_status wins. Severity is never changed except for the splenectomy counts above. cholecystectomy, hysterectomy, other and the free text are recorded and shown, with no rule.
smokerbooleantrue: CEA is read against the smoker limit of 5 ng/mL (non-smokers 3 ng/mL; laboratory catalogues). A CEA above your printed non-smoker range but at or below 5 ng/mL reads normal and notes.smoker_cea says so; above 5 ng/mL it is graded as usual. false is listed as ignored (the default).
fastingbooleanfalse adds a note when glucose, triglycerides or insulin read high; true is listed as ignored. These markers are always graded against fasting ranges, so grades do not change.

Each context_applied entry: { "field", "value", "effect", "affected_markers": [...] }. affected_markers are the markers of THIS panel the rule can act on; an empty list means the rule is on but nothing in the panel is subject to it. Each context_ignored entry: { "field", "value", "reason" }.

Serial troponin

When the panel has a troponin (troponin = hs-cTnT, or troponin_i) and a previous panel carries the same marker, the change is judged and the verdict is added to the finding's rationale (codes rationale.troponinRise01h, troponinRise02h, troponinRiseRelative, troponinRiseNoInterval, troponinNoRise, troponinNoRiseNoInterval, with values: from, to, delta, percent, hours, p99). The nearest earlier panel is used; values are compared in the engine's unit (ng/L).

Interval (from the two time stamps)RuleRise =
up to 1.5 h, hs-cTnTESC 2020 NSTE-ACS 0/1-h algorithm (Elecsys hs-cTnT)change of 5 ng/L or more
1.5 to 2.5 h, hs-cTnTESC 2020 0/2-h algorithmchange of 10 ng/L or more
longer, unknown, or troponin_i (assay-specific cut-offs are not applied)Fourth Universal Definition of Myocardial Infarctionchange of more than 20 % with at least one value above the 99th percentile (the finding's upper limit)

A rise is graded critical (acute myocardial injury until proven otherwise), the case is urgent, and the emergency work-up stays even with setting: "outpatient". A change below the thresholds does not raise the severity; the rationale says so, and that a stable raised value points to chronic injury (the clinical picture and ECG decide). The interval is unknown when either time stamp has no time of day (date only, including two panels on the same day), or when one has a UTC offset and the other does not; then only the relative rule is applied and the rationale says that the 0/1-h and 0/2-h rules need collected_at with a time. A falling troponin is not a rise.

Lipid and tumour-marker next steps

Added to next_steps.steps (all worded as a work-up, never as a diagnosis; clinical mode only for the tumour markers):

Step key (nextSteps.category.)WhenContent
assessFamilialHypercholesterolaemiaLDL-C 4.9 mmol/L (190 mg/dL) or higher, patient 18 or older, not pregnantPossible familial hypercholesterolaemia: exclude secondary causes, Dutch Lipid Clinic Network score, genetic testing and cascade screening (ESC/EAS 2019). Says that SCORE2-type calculators are not valid in FH; the steps that send the reader to SCORE2 (assessAtherogenicRisk, reviewLipids) are left out.
assessSevereHypertriglyceridaemiaTriglycerides above 10 mmol/L (about 880 mg/dL)Acute-pancreatitis risk (ESC/EAS 2019): abdominal pain and lipase, secondary causes, very low-fat diet and no alcohol, fibrate (omega-3 as add-on), lipid specialist, fasting repeat.
evaluateRaisedPSAPSA above its (age-specific) rangeEAU risk-adapted pathway: repeat under standard conditions, free/total ratio in the 3-10 ng/mL zone, risk assessment and multiparametric MRI before any biopsy, urology.
evaluateRaisedAFPAFP above 400 ng/mLLiver imaging (ultrasound, then multiphase CT or MRI) and hepatology; hepatitis status; AFP with a liver lesion is highly specific for HCC (EASL) but alone is not a diagnosis.
evaluateRisingTumourMarkerprevious has at least two earlier panels with the same CEA, AFP, CA 19-9, CA 125, CA 15-3 or PSA; the series rises on at least 2 consecutive measurements, 30 % or more in total, and the latest value is above its limitConfirm with a repeat sample within about a month and correlate with imaging per the treating oncologist's protocol. The finding gets a rationale.tumourMarkerRising step and its severity is raised from info to warning. A series that is flat, not consecutive, under 30 %, or still inside its limit is not flagged.

Errors

Every error is JSON: { "error": { "code": "...", "message": "...", "request_id": "..." } }.

HTTPcodeWhen
400invalid_requestMalformed JSON or a failed validation; the message names the field.
401unauthorizedMissing, unknown or inactive key.
401key_expiredThe key is past its expiry date. Ask support@structamed.com for a new one.
413payload_too_largeBody over 1 MB (4 MB for a batch).
422no_recognized_resultsNo row could be matched to a marker; error.unrecognized lists them.
429rate_limitedMore than 30 requests per minute for your key (or the per-minute value set on it; the message names it). Also returned, before the key is checked, when one network address sends more than 300 requests a minute. Carries a Retry-After header (whole seconds until the window ends, at most 60).
429monthly_limit_exceededYour monthly report allowance is used up (only if one is set on your key; a test key always has one, 300 by default). No Retry-After: the count restarts with the calendar month (UTC).
404not_foundA path under /api/v1/ that is not an endpoint.
405method_not_allowedThe wrong method for an endpoint (for example GET /api/v1/analyze); the Allow header lists the right ones.
502 / 500analysis_failed / internal_errorUnexpected failure. Retry; quote request_id if it persists.
503service_unavailableThe key service did not answer in time, so the key could not be checked. The key is not necessarily wrong and nothing was processed or counted: retry after Retry-After (5 seconds).

HTTP details

  • Server to server. The API sends no CORS headers: a browser on another origin cannot call it (the preflight OPTIONS is answered 204 without Access-Control-*), and a key in a web page would be public anyway. Call it from your backend.
  • Headers on every answer. x-request-id (the same value as request_id), Cache-Control: no-store on analyze, batch, report, recognize and the format routes (patient data is never cached), and x-structa-test: 1 for a test key. There are no X-RateLimit-* headers: the per-minute limit is in the rate_limited message, and Retry-After is sent with that error. The answers set no cookies.
  • Content type. Send Content-Type: application/json. A body that is valid JSON is also read when the header is missing or wrong (text/plain); one that is not JSON is 400 invalid_request.
  • Unknown fields are ignored, not refused, and named. A misspelled field (ref_hi instead of ref_high, a name in patient) is accepted and dropped, and every one is listed in warnings[] as unknown field results[3].ref_hi ignored (see the warnings section). A known field with the wrong type is 400, and so is an unknown key in patient.context, in the top level of omics, in collection, in report_options and in a target_ranges entry. flag is a hint: a value we do not know is ignored.
  • Wrong method or path. An unknown path under /api/v1/ is 404 not_found and the wrong method (GET on a POST route) is 405 method_not_allowed with an Allow header; both use the JSON error object above. OPTIONS is answered 204 with Allow.
  • Compression. Send the body uncompressed (Content-Encoding: gzip requests are not decoded and fail as invalid JSON). The answers are compressed by the platform when your client accepts it.
  • Platform limit. The hosting platform refuses a request body above 4.5 MB before it reaches the API, with its own (non-JSON) 413 answer; our limits (1 MB, 4 MB for a batch) are below it, so you get our JSON error first.
  • Language values are case-sensitive: en, not EN.
  • Time. A typical analyze answer takes tens of milliseconds and a PDF a few hundred. A very large omics request (hundreds of functional rows) in the blocks design can take several seconds; set your client timeout to at least 60 seconds for /api/v1/report.

Limits and metering

  • 300 results per request, 12 previous panels, 1 MB body (4 MB for a batch; both below the hosting platform's own 4.5 MB request limit).
  • 30 requests per minute per key (counted per server instance), unless a different value from 1 to 600 is set on your key to match your volume. The rate_limited message names the limit that applies to you. A batch counts one request per item.
  • One successful (HTTP 200) call counts as one report, on /api/v1/analyze or /api/v1/report; in a batch, each successful item counts as one. Failed calls and failed batch items are not counted.
  • Test keys (sm_test_...) are never billed. They are capped at 300 reports per month (unless another cap is agreed; over it you get 429 monthly_limit_exceeded) and expire after 30 days unless agreed otherwise. /api/v1/recognize is free and uncounted for every key. The per-minute limit applies as for any key, with its own counter: recognize calls do not use up the per-minute allowance of analyze and report.

Batch

POST https://structamed.com/api/v1/analyze/batch

{ "items": [ <an /api/v1/analyze request>, <another>, ... ] }

1 to 20 items, body up to 4 MB. You are authenticated once and each item runs through exactly the same rule-based pipeline as a single /api/v1/analyze call, one after the other. No AI model is called and nothing is stored. The per-minute limit is charged one unit per item. If used + items would pass your monthly allowance (a test key: its cap) the whole batch is refused with 429 monthly_limit_exceeded before any work.

The answer is 200 whenever the batch itself was valid:

{ "request_id": "req_...",
  "test": true,
  "counts": { "items": 3, "ok": 2, "failed": 1 },
  "results": [
    { "index": 0, "status": 200, "body": { ...the /api/v1/analyze answer... } },
    { "index": 1, "status": 400, "error": { "code": "invalid_request", "message": "...", "request_id": "req_..." } },
    { "index": 2, "status": 200, "body": { ... } } ] }

"test": true (and the x-structa-test: 1 header) is present only for a test key. A failed item never fails the batch. Errors of the batch itself (bad JSON, items missing, empty or over 20, authentication, rate limit, size) use the standard error envelope.

Branded PDF report

POST https://structamed.com/api/v1/report
Content-Type: application/json

Same authentication, request body, validation, limits and errors as /api/v1/analyze, and the same rule-based analysis (no AI model is called). The response is 200 application/pdf instead of JSON: a report your clinicians can read, in your branding. Two optional fields are added:

FieldNotes
patient.display_idA reference printed on the PDF, up to 64 characters (a case number, for instance). Names are not required and should not be sent unless you need them printed.
design"blocks", "classic" or "patient"; anything else is 400 invalid_request. Absent: your profile's default (blocks). "patient" is a plain-language report for the patient: a headline, an "N/M in usual range" ring, area tiles, a numbered list of what the results say with a status tag (On target, Keep an eye on, Talk to your doctor, Expected on treatment), trend charts when previous results are sent, and a marker-by-marker page. It never states a diagnosis. The texts exist in all seven languages (en, de, es, pt, uk, fr, pl); pt-PT prints the European overlay on the pt texts. Header of the patient report: your logo if the profile has one; otherwise your displayName as the wordmark; otherwise (no logo, no name) the STRUCTA MED wordmark, unless hideStructaBranding is true, in which case the header carries no name. The footer line "interpreted by STRUCTA MED" is printed unless hideStructaBranding is true. With patient.context.medications containing testosterone, or a trend marked expected_for: "testosterone_therapy", the "Expected" tag reads "Expected on treatment". The disclaimer line is printed whatever the profile says.
report_options(Beta) { "appendix": "compact" \| "full", "findings": "compact" \| "full", "units": "engine" \| "lab" \| "conventional", "test_menu": [test names or codes] }. appendix: how much of the omics appendix is printed. compact (default) lists the results outside range and counts the in-range or below-detection rows of a panel with more than 25 rows ("153 further results within range"); full lists every row of every panel, urine creatinine of a toxin panel included. findings: how much of the integrated findings is printed. full (default) prints every finding with its text, evidence rows and charts. compact keeps high and moderate findings as they are, prints each information-level finding as one line (code, title, evidence grade, reference numbers and the first sentence of its text), and prints the one-line meaning of a key-finding row of the other tests only for a moderate or marked deviation; the blood sections, the checklist, the appendix and the references (numbering unchanged) are not affected, nor is the JSON. units: the units the PDF prints. engine (default) is the unit of the JSON finding. lab keeps the unit you submitted where the engine converted a row (glucose sent in mg/dL stays in mg/dL, with your own range, and the trend table is printed in your units). conventional prints glucose, cholesterol fractions, triglycerides, creatinine, uric acid and bilirubin in mg/dL and every other row as engine. Only the number and the unit shown change; ranges, severities and grades are not recomputed. test_menu: a list of up to 500 test names or LOINC codes your laboratory offers (each up to 120 characters; case, accents and punctuation are ignored). An "Order a test" item of the integrated checklist (omics reports) that names a test outside the list is kept, never dropped, and marked "not on your test menu"; an item whose test is on the list carries no mark. An entry matches a test when it equals one of the test's names or contains it as whole words ("Oral glucose tolerance test (75 g)" matches the OGTT step; "Glucose" does not). Absent or []: nothing is marked. Repeat, review and refer items, the JSON integrated block and all grades and priorities are unchanged. Any other field is 400.

lang selects the language of the PDF (as for analyze, including pt-PT); when absent your profile's default is used. Errors are the same JSON error objects as for analyze; a failed render returns 500 internal_error.

One successful call is one metered report. A report call is not also counted as an analyze call.

Your profile

The look of your PDF is set per partner by us; it is not sent with each request. Fields:

FieldMeaning
displayNameYour name, printed in the PDF (up to 80 characters).
logoPNG or JPEG, printed in the header instead of the StructaMed mark. Supplied as a data URL or an https URL (fetched once and cached).
paletteOne of the colour presets: structa (default), ocean, navy, sky, forest, emerald, burgundy, plum, amber, graphite, rose, slate. Clinical status colours never change.
hideStructaBrandingtrue removes the StructaMed mark and the "STRUCTA.MED" footer text; your displayName and logo take their place (white-label). Default false.
defaultLangLanguage when the request sends none. Default en.
defaultDesignblocks (default), classic or patient.
defaultSettingoutpatient or acute: the clinical setting used when a request sends no patient.context.setting. Absent: engine default. Set by us in the profile, never per request.

Without a profile you get the defaults: StructaMed palette and branding, English, blocks.

The line "Structured for clinical review. Final judgment remains with the clinician." (translated) is a safety statement and is printed on every report, whatever the profile says.

Other input formats

Three more routes take the formats a laboratory system already speaks. They share the key, the metering (one report per successful call; test keys are not metered), the rate limits, the error envelope and the 1 MB body limit of POST /api/v1/analyze, and make no AI call. Nothing is stored. Query parameters lang, mode, display_id and context are passed into the request as if they were body fields and are validated the same way.

Patient context on these routes. Send it in the X-Structa-Context header (JSON, or URL-encoded JSON): health data stays out of the URL and the access logs of proxies and servers. The context query parameter described next still works but is deprecated; when both are sent, the header wins. The query parameter context is URL-encoded JSON with exactly the patient.context object of /api/v1/analyze (see Patient context), for example ?context=%7B%22menopausal_status%22%3A%22peri%22%7D. It is validated by the same validator (same 400s and contradictions; invalid JSON is 400 invalid_request), and the answer carries context_applied / context_ignored exactly as in analyze. A panel sent as FHIR, HL7 or LDT with context is graded the same as the JSON request with that patient.context. FHIR only: a pregnancy status Observation (LOINC 82810-3 with the answer Pregnant: LOINC LA15173-0, or SNOMED CT 77386006) sets pregnant: true. If the query and the Bundle both say something, the query wins and warnings says so. Nothing else (menopause, medications, conditions) is read from FHIR: send it in context.

RouteBodyDefault answer?format=
POST /api/v1/fhirFHIR R4 JSON: a Bundle, or { "observations": [...], "patient": { "sex", "age", "birth_date" } } (application/fhir+json or application/json)FHIR Bundle (application/fhir+json)json returns the v1 body
POST /api/v1/hl7HL7 v2 ORU^R01 as text (x-application/hl7-v2+er7 or text/plain; MLLP framing tolerated)v1 bodyfhir returns a FHIR Bundle
POST /api/v1/ldtLDT 3 file bytes (any Content-Type)v1 bodyfhir returns a FHIR Bundle

LDT 3 is beta: mapped from the KBV LDT 3.2 description; checked with your sample files before go-live.

FHIR input variants that are read. A Bundle of type collection, transaction or searchset; a single Observation or an array of Observations (send { "observations": [...], "patient": { "sex", "age" or "birth_date" } } when the patient is not in the message); a DiagnosticReport with Observations and a Patient contained in it (also inside a Bundle; #id references in result are resolved). Values: valueQuantity (with comparator), valueString (a number with its unit in one string is split), valueCodeableConcept (text, else a coding display, else the SNOMED CT codes for positive, negative, not detected, present and absent), valueInteger. Reference ranges: low / high, or text ("3.5-5.0", "<5"). Interpretation: the v3 codes H, HH, L, LL, N, or the words High, Low, Normal. A marker is matched by its LOINC coding, else by code.text or a coding display. Components (blood pressure), cancelled and entered-in-error Observations are skipped with a note.

HL7 v2 input variants that are read. ORU^R01 of versions 2.3, 2.5 and 2.5.1; OBX value types NM, ST/TX/FT, SN (comparators and ranges) and CE/CWE/CNE; reference ranges in OBX-7 ("3.5-5.0", "<5", ">1"); abnormal flags (OBX-8); result status (X, D, W skipped; P kept with a note, replaced by a later final result); several OBR groups, each dated by its OBR-7 (earlier dates become previous); MLLP framing (0x0B ... 0x1C 0x0D), CR, CRLF or LF segment separators; separators read from MSH. A body with more than one message is read up to the second MSH and conversion_notes says so. The body is read as UTF-8, else as ISO-8859-1 / Windows-1252.

What is read: the marker name, LOINC code when present, value, unit, reference range, flag and collection date of each result, and the patient's sex and birth date (or age). Earlier collection dates in the same message become previous. What is never copied: names, patient or case identifiers, addresses, and any other free-text identifying field. The only reference printed is the display_id you send yourself.

conversion_notes (v1 body, only when not empty) lists what the converter skipped or could not read, for example a result without a value or a resource type that is not read. In a FHIR answer the same lines appear as Note: Observations. The FHIR Bundle holds a Patient (gender and age only), a DiagnosticReport and one Observation per finding; LOINC codes you sent are carried back. A test key tags the Bundle (meta.tag, system https://structamed.com/fhir/tag, code test) and adds the x-structa-test: 1 header. A message that cannot be read returns 400 invalid_request with the reason. Send the body as UTF-8; a UTF-16 file (byte-order mark) is refused with a message that says so. A word result ("Negative") is a valueString.

Integration options for partners

The endpoints above are the public v1 interface. The option below is not part of it yet: it is set up per integration partner during onboarding. Tell us whether your systems need it and we agree the timing with you.

OptionWhat it does
PDF and photo inputSend a lab report as PDF or photo and receive the same structured, interpreted answer. The values are read by an AI model; the processing location is stated in your data processing agreement. Metered separately from reports.

Example

curl -s https://structamed.com/api/v1/analyze \
  -H "Authorization: Bearer $STRUCTA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "patient": { "sex": "male", "age": 45 },
    "results": [
      { "name": "ApoB", "value": 1.32, "unit": "g/L", "ref_low": 0.6, "ref_high": 1.0 },
      { "name": "ALT", "value": 22, "unit": "U/L", "ref_high": 50 }
    ]
  }'

Running the integration

Keys: handling, rotation, test and live

  • Server side only. The API sends no CORS headers on purpose. Keep the key in your backend's secret store or environment, never in front-end code, a mobile app, a log line or a repository. A key that was exposed is replaced, not edited: tell us and we issue a new one.
  • Only a hash is stored on our side, so a lost key cannot be recovered, only replaced.
  • Rotation without downtime. A partner can have more than one active key at the same time. Ask for a second key, deploy it, switch your traffic to it, then tell us to deactivate the first. Both keys of one partner share one per-minute limit and one monthly count (live and test usage are counted apart). A key we deactivate stops working within about 30 seconds (a key held in our deployment configuration: at the next deployment).
  • Expiry. A key with an expiry date answers 401 key_expired after it (the date itself is still valid). Live keys expire only if a date was agreed.
Test key sm_test_...Live key sm_live_...
Endpoints, analysis, PDFsthe samethe same
Billingnever billedone report per successful analyze / report call (and per successful batch item)
Monthly cap300 reports unless another cap is agreed (429 monthly_limit_exceeded over it)only if one is agreed
Expiry30 days after issue unless agreed otherwisenone unless agreed
Markingheader x-structa-test: 1, "test": true in JSON, TEST in the PDF title and a test tag on FHIR Bundlesnone
Per-minute limit30 per minute unless set on the key (1 to 600)the same

Retries, idempotency and timeouts

  • The API is stateless. Sending the same request twice gives the same analysis (only request_id differs). There is no Idempotency-Key header and nothing to deduplicate: a retried request that had already succeeded is counted as a second report (a live key; test keys are never billed). Retry only what failed.
  • What to retry. 429 rate_limited: wait the seconds in Retry-After. 503 service_unavailable: wait Retry-After (5) seconds; nothing was processed or counted. 500, 502, a network error or a timeout: retry up to 2 more times with a growing pause (1 s, then 3 s). Never retry a 4xx other than 429: the request itself must change.
  • Timeouts to set in your client. Connect 5 seconds. Total: 30 seconds for analyze, recognize, fhir, hl7 and ldt; 60 seconds for report and for analyze/batch. Typical times: an analysis a few tens of milliseconds, a PDF 0.2 to 1.5 seconds for a blood panel of about 110 rows with some omics, several seconds for a report with hundreds of omics rows (a 19-page blocks PDF takes about 4 seconds).
  • Our own timeouts. Every database call behind the API (key lookup, usage counter, partner dictionary and profile) is limited to 1.5 to 2.5 seconds, so a slow database never makes an analysis slow. Keys configured with us as environment keys, and the analysis itself, do not need the database. If the key service cannot be reached the answer is 503 service_unavailable (retry), never a misleading 401. If the usage counter cannot be written after a successful call, the report is still delivered and the missing count is logged on our side to be added by hand; a test key's count is written after the response has been sent. If the counter cannot be read, the monthly cap is not enforced for that call (the API fails open on purpose so a database outage never stops your traffic).

Data, regions and logs

  • Nothing you send is stored. A request is processed in memory and the response is returned; patient data, results and the PDF are not written to any database or file. The only thing we keep per call is a counter: reports per key, per month. No contents, no patient reference.
  • Logs. Request bodies and result values are not written to our application logs (production builds drop debug logging; error logs carry the request_id and the error text). The hosting platform's request log holds the path, status and timing, and the query string: send clinical context in the X-Structa-Context header, not in the URL.
  • Regions. The API runs on serverless functions in Frankfurt (EU, fra1). The database used only for keys, the usage counter and partner profiles is hosted by Supabase in Zurich (Switzerland). No AI model is called, so no data goes to a model provider.
  • No AI. The analysis is rule-based and deterministic. The same input and engine_version give the same output.

Versioning and changelog

  • /api/v1 is stable. Within v1 we add fields and add enum values; we do not remove or rename a field, change its type or change what it means. Write your parser to ignore fields it does not know and to tolerate new enum values. A breaking change would be a new path, /api/v2, announced to you in advance and run beside v1 for an agreed period.
  • engine_version (in every analysis response, for example structamed-engine/2026-10) changes when the clinical rules, ranges or texts change. A grade can change between two engine versions for the same input when a rule is refined: store the version with the result you keep.
  • Changelog. Additive changes are listed here, newest first. - 2026-11: unknown request fields are named in warnings[] (they were silently ignored); 404 not_found and 405 method_not_allowed are JSON; 503 service_unavailable when the key service does not answer; a unit written inside a value ("5.4 mmol/L") is read, with a warning; patient.sex "M" / "F" is read; FHIR input accepts a single Observation and a DiagnosticReport with contained Observations; HL7 input reads ISO-8859-1 bodies and says when a body holds more than one message; one Postman collection.

Support

Write to support@structamed.com and quote the request_id of the call (it is in every JSON body and in the x-request-id header). A new key, a higher limit, a branded PDF profile and a change to your marker dictionary are all requests to that address.

Glossary

  • Reference range: the interval a laboratory prints as expected for a healthy population. Yours win over our defaults when sent.
  • Status: where the value sits relative to the range used (low/normal/high).
  • Severity: how much attention the finding deserves (info, warning, critical).
  • Pattern: a combination of markers that together suggest a recognized picture (for example iron-deficiency anemia). Patterns are suggestions for review, not diagnoses.
  • Cluster: the body system a group of findings belongs to.
  • Risk: a coarse overall level (low, medium, high) with a numeric score derived from the findings; useful for sorting, not for diagnosis.