# Result Retrieval

In addition to receiving results via [Callbacks](/docs/pathology/callback-config), you can query and retrieve transformed pathology data directly using the Result Retrieval endpoint.

This is ideal for:

- Systems where inbound webhooks cannot be received or configured.
- On-demand result polling and fetching.
- Directly downloading results within 30 days of upload time.


## Endpoint

```http
GET https://app.jondax.eu/api/v1/results/:uploadId
Authorization: Bearer <JONDAX_API_KEY>
```

Results are returned formatted in your account's configured webhook output format (JSON, FHIR JSON, HL7, FHIR XML, CSV, or Parquet).

### Parameters

| Parameter | Type | In | Required | Description |
|  --- | --- | --- | --- | --- |
| `uploadId` | string (UUID) | path | Yes | The unique `UploadId` received during upload. |


## Request Example

```bash
curl --location 'https://app.jondax.eu/api/v1/results/<uploadId>' \
--header 'Authorization: Bearer <JONDAX_API_KEY>'
```

## HTTP Status Codes & Responses

### 1. HTTP 200 OK (Completed)

When processing is complete, the endpoint returns the structured output matching your configured output format:

#### JSON (`Content-Type: application/json`)

```json
{
  "customerId": 11,
  "fileName": "lab_report_blood.pdf",
  "results": [
    {
      "Date": "2026-06-03",
      "Biomarker-Name": "Hemoglobin",
      "Result": "14.2",
      "Unit": "g/dL",
      "Low-Ref-Range": "13.0",
      "High-Ref-Range": "17.0",
      "Interpretation": "Normal",
      "LOINC-Code": "718-7"
    },
    {
      "Date": "2026-06-03",
      "Biomarker-Name": "WBC",
      "Result": "6.8",
      "Unit": "10^3/uL",
      "Low-Ref-Range": "4.0",
      "High-Ref-Range": "11.0",
      "Interpretation": "Normal",
      "LOINC-Code": "6690-2"
    }
  ]
}
```

#### FHIR JSON (`Content-Type: application/fhir+json`)

Returns a standard FHIR `DiagnosticReport` / `Observation` Bundle.

#### HL7 v2 (`Content-Type: text/plain` with `Content-Disposition`)

```text
MSH|^~\&|JONDAX|LAB|||20260603120000||ORU^R01|...
PID|1||PAT12345||DOE^JOHN||19800101|M
OBR|1|||LAB^Pathology Report|||20260603
OBX|1|NM|718-7^Hemoglobin^LN||14.2|g/dL|13.0-17.0|N|||F
```

### 2. HTTP 202 Accepted (In Progress)

If the document is still in queue or processing, the endpoint returns `202 Accepted` indicating that the result is not yet ready:

```json
{
  "success": false,
  "status": "In Progress",
  "uploadId": "<uploadId>",
  "message": "Document is currently being processed",
  "statusUrl": "/api/v1/results/<uploadId>"
}
```

> **Polling Recommendation:** When receiving `202 Accepted`, wait **5–10 seconds** before making the next request.


### 3. HTTP 401 Unauthorized

Returned if the API key is missing or invalid.

```json
{
  "success": false,
  "statusCode": 401,
  "message": "Invalid or missing API key"
}
```

### 4. HTTP 403 Forbidden

Returned if the requested `uploadId` belongs to another customer account.

```json
{
  "success": false,
  "statusCode": 403,
  "message": "You do not have permission to access this upload result"
}
```

### 5. HTTP 404 Not Found

Returned if the `uploadId` does not exist or has exceeded the 30-day retention window.

```json
{
  "success": false,
  "statusCode": 404,
  "message": "Result not found or expired (> 30 days)"
}
```

### 6. HTTP 422 Unprocessable Entity

Returned if document processing failed (e.g. unreadable scan or corrupted file).

```json
{
  "success": false,
  "statusCode": 422,
  "message": "Document processing failed. Please verify file quality or re-upload."
}
```

## Data Retention

All upload results and files are accessible via the Result Retrieval endpoint for **30 days** following upload. After 30 days, files and records are automatically purged.