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

# Download Document

> Download a lab report document by file ID

Download a lab report document by its file ID. Returns the raw file bytes with the appropriate `Content-Type` header. Document IDs are obtained from the `documents` array in the [Get Lab Results](/api/appointments/get-results) response.

<Note>Access is validated against the profile that owns the document.</Note>

## Request

### Path parameters

<ParamField path="id" type="string" required>
  File ID (UUID) from the `documents` array in the appointment results response.
</ParamField>

## Response

On success, the API returns `200 OK` with the file bytes and appropriate `Content-Type` header (e.g., `application/pdf`).

## Error responses

| Status | Description                                                                                                     |
| ------ | --------------------------------------------------------------------------------------------------------------- |
| `400`  | Invalid ID format — the provided value is not a valid UUID.                                                     |
| `403`  | Forbidden — your API key does not have access to this operation or the document is outside your access context. |
| `404`  | Document not found.                                                                                             |
| `500`  | Internal server error.                                                                                          |

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://anivahealth.com/api/v1/documents/f8a1b2c3-d4e5-4f6a-7b8c-9d0e1f2a3b4c \
    --header 'x-api-key: YOUR_API_KEY' \
    --output lab-report.pdf
  ```
</RequestExample>

<ResponseExample>
  ```text 200 theme={null}
  (Binary file content — save the response to a file)
  ```

  ```json 404 theme={null}
  {
    "error": "Document not found"
  }
  ```
</ResponseExample>
