> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/lab-reports/lab-reports.md).

# Overview

Convert lab report and DXA scan PDFs into structured, standardized biomarker data via a simple REST API.

## Terra Lab Reports API

Upload a clinical lab report or a DXA body-composition/bone-density scan and receive structured biomarker data: extracted, standardized, and delivered to your webhook or available via REST.

Both go to the same endpoint. Terra identifies which it received and tells you in `report_type`.

### Key features

* **Multi-Format Upload**: Upload clinical lab reports or DXA scans as PDF, PNG, JPEG, GIF, WebP, or HEIC, as one file or one photo per page (up to 20 files and 50 MB)
* **Automatic Report-Type Detection**: Terra classifies each upload as a lab report or a scan; no parameter to set, and the result is reported in `report_type`
* **Site-Scoped Scan Results**: Scan measurements carry the anatomical site they were taken at, so the same measure at fifteen places stays fifteen distinct results
* **Biomarker Standardization**: Results are fuzzy-matched against a 4,100+ biomarker reference dataset, producing a canonical `biomarker` slug and UCUM-compliant unit codes. Values stay in the units the lab printed.
* **Reference Ranges with Context**: Extracted ranges include demographic context (sex, age, pregnancy status, menstrual cycle phase)
* **Async Processing**: Upload returns immediately with an upload ID; results arrive via webhook or polling, typically within 3 to 5 minutes
* **Webhook Delivery**: Full session payload is delivered automatically to your configured destination on completion
* **Flexible Querying**: List and filter sessions by reference ID, upload ID, report type, and date range

### API endpoints

| Method | Endpoint                             | Description              |
| ------ | ------------------------------------ | ------------------------ |
| POST   | `/v2/reports`                        | Upload a lab report      |
| GET    | `/v2/reports`                        | List sessions            |
| GET    | `/v2/reports/{session_id}`           | Retrieve session details |
| POST   | `/v2/reports/{session_id}/reprocess` | Reprocess a session      |
| DELETE | `/v2/reports/{session_id}`           | Delete a session         |

Base URL: `https://access.tryterra.co/api`

### Documentation

1. [Quickstart](/lab-reports/quickstart.md): Upload, poll, and retrieve in 3 steps
2. [Core concepts](/lab-reports/core-concepts.md): Session lifecycle, data model, async processing
3. [API reference](/lab-reports/api-reference.md): Full endpoint specifications
4. [Webhook payload](/lab-reports/webhook-payload.md): Payload format and field specs
5. [Biomarker reference](/lab-reports/biomarker-reference.md): Standardization, UCUM codes, common biomarkers
6. [Best practices](/lab-reports/best-practices.md): Error handling, idempotency, limits

To see the API in a working app, start from the [Lab Reports example app](https://docs.tryterra.co/developer-tools/example-apps/terra-panel): `terra examples clone lab-reports-web-app my-app`.
