> ## Documentation Index
> Fetch the complete documentation index at: https://docs.braintest.ir/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Test Result (HTML)

> Retrieve a rendered HTML report for a finished test record, ready for display, printing, or PDF export.

Use this endpoint to fetch a completed test record's results as a fully rendered HTML document. This is ideal when you want to display the report directly to participants or clinicians without building a custom UI.

## Prerequisites

The record must be finished (`is_finished: true`). If the test is not yet completed, this endpoint returns HTTP 409.

## Endpoint

```http theme={"dark"}
GET https://braintest.ir/api/v2/record/{token}/result/html/
```

## Headers

| Header    | Value                                 |
| --------- | ------------------------------------- |
| `API-KEY` | Your API key from the organizer panel |

## Path parameters

<ParamField path="token" type="string" required>
  The UUID token of the finished test record.
</ParamField>

## Response

<ResponseField name="data" type="object">
  <ResponseField name="html" type="string">
    Complete HTML document string containing the styled test report. Embed this in an iframe, render it in a WebView, or convert it to PDF.
  </ResponseField>
</ResponseField>

## Example request

```bash theme={"dark"}
curl -X GET "https://braintest.ir/api/v2/record/a1b2c3d4-e5f6-7890-abcd-ef1234567890/result/html/" \
  -H "API-KEY: YOUR_API_KEY"
```

## Example response

```json theme={"dark"}
{
  "data": {
    "html": "<html><head><title>Test Result</title></head><body><h1>Millon Clinical Multiaxial Inventory</h1><p>Results for participant Ali Ahmadi...</p></body></html>"
  },
  "successful": true,
  "messages": []
}
```

## Use cases

* **Embed in iframe:** Set the `html` string as the `srcdoc` of an iframe to display the report inside your application.
* **Print or download:** Open the HTML in a new browser window and trigger the print dialog for a physical copy or PDF export.
* **Mobile apps:** Render the HTML in a native WebView component for iOS or Android.

## Error responses

| Status | Meaning                | What to do                                                                                         |
| ------ | ---------------------- | -------------------------------------------------------------------------------------------------- |
| `409`  | Test not yet completed | Wait for the participant to finish, then poll `GET /record/{token}` until `is_finished` is `true`. |
