TrialCurve API documentation
One request: send an image of a Kaplan–Meier figure and get back every survival panel's digitised curves, numbers at risk, reconstructed individual patient data (Guyot 2012), hazard ratios, medians and RMST, with checks against the statistics printed on the figure.
Quickstart
Get a key from the pricing page: 5 figures for $59 one-off (10 for $149, 50 for $590), or pay as you go at $15 a figure with the first 3 each month free, card required. The same key works in the uploader on the site. Then send a figure:
curl https://trialcurve.com/v1/reconstruct \
-H "Authorization: Bearer $TRIALCURVE_KEY" \
-F image=@figure2a.png
The response contains every arm's digitised curve, its at-risk table, reconstructed individual patient data (IPD), and summary statistics including hazard ratios. Add -F 'options={"format":"csv"}' to get IPD rows for every panel (panel,endpoint,population,arm,time,event) instead.
Authentication
Send your key as a bearer token: Authorization: Bearer tc_live_…. Your key is shown on the page you reach after checkout, and that page works for 24 hours. To rotate a key, call POST /v1/keys/rotate with the current key. The old key stops working within a minute. Lost it? Email hello@trialcurve.com.
POST /v1/reconstruct
Send multipart/form-data with:
| Field | Type | Description |
|---|---|---|
image | file | PNG, JPEG or WebP, up to 4 MB. A Kaplan–Meier figure, ideally including its numbers-at-risk table. Whole multi-panel figures are fine: every survival panel is returned. |
options | JSON string | Optional. See options. |
Alternatively, send application/json with image_base64 plus the options fields at the top level. Keep the image to about 3.3 MB (before base64) this way: anything larger passes the platform's request limit, so use multipart.
Cost: one request is one figure, however many panels it has, in either mode. $15 a figure, the first 3 each month free. Failed requests (4xx/5xx) are not billed, and neither is a measurement-only result (billing.units is 0).
Options & hints
{
"mode": "standard" | "audit", // audit is a deeper reading, at higher model effort. Same price
"format": "json" | "csv", // csv returns IPD rows, every panel: panel,endpoint,population,arm,time,event
"overlay": false, // include a PNG (base64) of the reconstruction: over the figure, or a redraw
"hints": {
"arm_names": ["Placebo", "Drug"], // override names, in the order the arms are returned
"n_arms": 2, // if the figure has no at-risk table
"at_risk": { // type the table yourself if the image doesn't include it
"times": [0, 6, 12, 18],
"counts": [[150, 120, 90, 60], [148, 130, 110, 91]]
},
"n_per_arm": [150, 148], // no table: reconstruct from initial N (less accurate). Same order as arm_names
"total_events": [101, 80], // improves the final interval when reported in the paper. Same order
"reference_arm": "Placebo", // HR reference (name or index); default below
"y_percent": true // force the y scale if the labels are unreadable
},
"published": { // values reported in the paper, compared with the first panel only
"hazard_ratio": 0.72, "hr_arm": "Drug", "hr_reference": "Placebo",
"arms": { "Drug": { "n": 148, "median": 14.2, "events": 80 } }
}
}
kind. "km" (the default) reads a Kaplan–Meier figure. "forest" reads a forest plot and returns rows: each with group, label, estimate, ci_low, ci_high, log_estimate, se, patients and events where printed, and flags. With format: "csv" it returns one line for each row. A forest plot counts as one figure. "waterfall" and "swimmer" read those plots and return bars (one for each patient) and a summary. A refusal such as no_forest_plot may carry seen, naming what the image looked like. They were tested on 17 real figures and 7 synthetic ones on 10 November 2026: see the scores, our own test, not peer reviewed.
mode. Both modes zoom in. standard reads at high effort and audit at xhigh. If a printed value flags, the figure is read a second time at xhigh, if time allows. The free upload on the site is one quick reading with no zoom.
Arm order. Arms come back in the figure's table order, and arm_names, n_per_arm and total_events follow it.
Default reference arm. An arm named placebo, control, standard (also standard of care, SOC, usual care, best supportive care), observation (also surveillance, no treatment) or chemotherapy on its own; otherwise the first listed. Never chosen by outcome.
Response
The top-level fields describe the first survival panel. A whole figure can hold several, so every panel is also returned in panels, each with the same fields plus what the figure printed and how the reconstruction compares with it.
{
"id": "req_…",
"panels": [{ // one entry per survival panel in the figure
"panel": { "label": "A", "endpoint": "Overall survival", "population": "Intention-to-treat",
"curve_source": "vision_model" | "pixel_measurement_confirmed_by_vision_model",
"plotted": "survival" | "cumulative_incidence" },
"arms": [ … ], "comparisons": [ … ], // as below
"badge": { "kind": "checks_passed", "text": "3 of 3 printed checks passed", … }, // also: nothing_to_check, review
"flags": [ … ], "notes": [ … ], // what to look at; worth a glance
"at_risk_integrity": [ … ], // cells that rise, or sit above the curve
"overlay_kind": "figure" | "redraw", // drawn over the figure where pixel calibration succeeded
"printed_statistics": { "hazard_ratios": [ … ], "medians": [ … ], "event_counts": [ … ] },
"printed_value_checks": [{
"item": "hazard ratio", "printed": 0.72, "reconstructed": 0.735, "relative_difference": 0.021,
"status": "pass" | "flag",
"role": "validation" | "consistency", // N and printed event counts feed the reconstruction
"direction": "printed" | "inferred", // was the comparison's direction stated on the figure?
"printed_ci95": [0.60, 0.86], "within_printed_ci": true,
"second_reading_agrees": true // present when a flagged figure was read a second time
}],
"quality": { … }, "warnings": [ … ]
}],
"reader": { "model": "claude-opus-5-5", "effort": "high", "zoom": true, "escalated": false, "attempts": [ … ] },
"arms": [{
"name": "Pembrolizumab", "color": "#00bfc4",
"curve": { "time": [0, 0.41, …], "survival": [1, 0.996, …] }, // digitised step points
"censor_marks": [3.1, 7.9, …],
"at_risk": { "times": [0, 12, 24, 36], "counts": [269, 144, 91, 47] },
"ipd": { "time": [0.41, …], "event": [1, 0, …] }, // one row per reconstructed patient
"summary": {
"n": 269, "events": 229, "median": 14.62,
"survival_at": { "12": 0.5412, "24": 0.3571 },
"rmst": { "tau": 58.9, "value": 21.3 },
"method": "guyot_2012_with_at_risk_table",
"reconstruction_max_abs_error": 0.0071 // KM(IPD) vs digitised curve
}
}],
"comparisons": [{ "arm": "Pembrolizumab", "reference": "Chemotherapy", "hazard_ratio": 0.68,
"ci95": [0.57, 0.81], "wald_p": 1.2e-05, "logrank_p": 1.1e-05, "rmst_difference": 5.1 }],
"axes": { "x": { "min": 0, "max": 60, "labels_used": 6, "calibration_residual_px": 0.4, "calibration": {…} },
"y": { "scale": "percent", … } },
"quality": { "score": 1.0, "grade": "high", "reasons": [] },
"warnings": [],
"validation": { "provenance": {…}, "vision_cross_check": {…}, "published_value_checks": […], "ai_use_disclosure": {…},
"checks_summary": {…}, "methods_paragraph": "…", "citation": "…", "overall": {…} },
"billing": { "units": 1 }
}
Times are in the units of the figure's time axis. Hazard ratios come from a Cox model (Efron ties) fitted to the reconstructed IPD, so they are unstratified; a printed hazard ratio that is stratified or adjusted can differ by a few percent. Cumulative-incidence panels are reconstructed on the 1 − cumulative incidence scale (panel.plotted says which). Always check quality.grade, warnings and the printed_value_checks before using the numbers.
Things to handle: hazard_ratio and ci95 are null when no hazard ratio can be estimated, for example when an arm has no events. A measurement-only result has no panels key. The first panel's overlay is at the top level (overlay_png_base64), and it is left out, with a warning, if the response would pass 4.2 MB. CSV responses carry the headers X-Quality-Grade (the worst panel), X-Validation-Status, X-Panels and X-Billing-Units.
Validation report
- provenance: engine version, image SHA-256, UTC timestamp, method statement, hints used.
- vision_cross_check: the model's reading of each curve compared with the pixel measurement (max and mean |ΔS| per arm), plus every check against statistics printed on the figure.
- published_value_checks: each value you pass in
published(for example from the paper's text) is compared with the first panel's reconstruction. Status ispasswhen the relative difference is within 10% (N must match exactly). - independent_extraction (measurement-only mode, audit): the second extraction after resampling. When the vision model is unavailable, the same algorithm runs again on a resampled image, with per-arm agreement.
- ai_use_disclosure: tool, version, date, developer, model and provider, purpose, prompt hash (the prompt is available on request), zoom and effort, a human-oversight note and a suggested statement for JCA/HTA dossiers, following the EU HTA Coordination Group's AI principles.
- methods_paragraph and citation: text to paste. Replace
[Analyst name]before use. - checks_summary: how many checks passed. N and printed event counts feed the reconstruction, so they are counted apart as consistency checks.
- overall:
statusisno_flagsorreview_recommended, withflags,notesand abadgeready to print.no_flagsdoes not replace your own review of the overlay and checks.
Errors
| HTTP | code | Meaning |
|---|---|---|
| 400 | missing_image, bad_image, bad_options | The request could not be read. |
| 401 | missing_api_key, invalid_api_key, revoked_api_key | Check the Authorization header. |
| 402 | subscription_inactive | The subscription behind the key is cancelled or unpaid. Only /v1/reconstruct returns this: rotation, usage and the billing portal still work. |
| 413 | image_too_large | Images must be under 4 MB. |
| 413 | result_too_large | Too large to return as JSON, even without overlays. Ask for format: "csv". Not billed. |
| 422 | axes_not_found, x_calibration_failed, y_calibration_failed, no_curves | The figure could not be digitised. Crop tighter or use a sharper image. Not billed. |
| 402 | academic_allowance_used | An academic key has used this month's free figures. The allowance resets on the 1st (UTC). |
| 422 | no_survival_panels | No Kaplan–Meier or cumulative-incidence panel was found in the image. Not billed. |
| 429 | demo_limit | The site's upload only, not the API. Retry-After says when to try again. |
| 503 | billing_not_configured | Temporary: the service is not accepting keys. Try again later. |
| 503 | billing_busy | The payment provider is busy or unreachable. Retry-After says when to try again. Not billed. |
Errors have the shape {"error": {"code": "…", "message": "…"}}.
Usage, keys & billing
GET /v1/usage: figures used in the current billing period.POST /v1/keys/rotate: issues a new key and revokes the old one.GET /api/portal: returns a Stripe billing portal URL for invoices, payment method and cancellation. Or email hello@trialcurve.com.
Getting the best results
- Send the whole figure: multi-panel layouts, inset tables and printed statistics are handled, and every survival panel is returned.
- Use the sharpest copy you have: export the figure from the PDF, or zoom the PDF to 200% before taking a screenshot (text at least ~10 px tall). Images up to 2576 px on the long edge are read at full resolution.
- If curves share a colour and cross, pass
arm_namesand check the overlay. - No at-risk table in the paper? Pass
n_per_armand, if reported,total_events. Expect wider error. - For dossier work use
mode: "audit"and pass the reported values inpublished. Whole review to do? A validation pack does it for you, checked by a person.
Method & citation
Reading: Claude Opus 5.5 reads the whole figure (every panel's axes, arm names, curves as step corners, numbers-at-risk table and printed statistics), with a zoom tool for small text, steps and overlapping curves (the free upload on the site runs without zoom). Measurement: each panel the model locates is also traced in pixels (plot-frame detection, tick calibration, colour separation, sub-pixel tracing of each step function); where the two agree, the measured curve is used. Checks: every reconstruction is compared with the hazard ratios, medians and event counts printed on the figure. On the API, a figure with a flagged check is read a second time at higher effort, if time allows. If the vision model is unavailable, the measurement engine runs alone with on-device OCR, and the response says so. Reconstruction: Guyot P, Ades AE, Ouwens MJNM, Welton NJ. Enhanced secondary analysis of survival data: reconstructing the data from published Kaplan-Meier survival curves. BMC Med Res Methodol 2012;12:9.