> ## 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.

# Document downloaden

> Download een document met een labrapport via bestands-ID

Download een labrapport op basis van het bestands-ID. Geeft de ruwe bestandsbytes terug met de juiste `Content-Type`-header. Document-ID's haal je uit de `documents`-array in de response van [Labresultaten ophalen](https://docs.anivahealth.com/nl/api/appointments/get-results.md).

Vereist de scope `results_view`.

> [!NOTE]
>
> Toegang wordt gecontroleerd aan de hand van het profiel dat eigenaar is van het document. Een document dat je hebt geüpload met [Document uploaden](https://docs.anivahealth.com/nl/api/documents/upload-document.md) wordt gecontroleerd aan de hand van de profielgroep waaronder het is geüpload.

## Verzoek

### Padparameters

**id** `string` *required*

Bestands-ID (UUID) uit de `documents`-array in de response met resultaten van de afspraak.

## Respons

Bij succes geeft de API `200 OK` terug met de bestandsbytes en vier headers. Elke header bevat een veld uit de `documents`-array:

| Header | Veld | Voorbeeld |
| - | - | - |
| `Content-Type` | `content_type` | `application/pdf` |
| `Content-Disposition` | `file_name` | `attachment; filename="20260405 - Quade Befund - 7642001234.pdf"` |
| `ETag` | `etag` (tussen aanhalingstekens) | `"56104b36f860cfd5b41efc716fdf7b6f"` |
| `Original-File-Name` | `original_file_name` | `7642001234_B0012_FA_E.pdf` |

`Original-File-Name` is procentgecodeerde UTF-8, omdat een header niet elk teken kan bevatten dat in een geüploade bestandsnaam voorkomt. Decodeer deze met `decodeURIComponent` of iets vergelijkbaars.

`ETag` en `If-None-Match` zijn de standaard HTTP-cachingheaders (RFC 9110). Stuur de `etag` die je hebt mee in `If-None-Match` om een ongewijzigd bestand over te slaan. De API antwoordt dan met `304 Not Modified` zonder body.

## Foutresponsen

| Status | Beschrijving |
| - | - |
| `304` | Niet gewijzigd — de `If-None-Match`-etag komt nog overeen met het bestand. Geen body. |
| `400` | Ongeldig ID-formaat — de opgegeven waarde is geen geldige UUID. |
| `403` | Geen toegang — je API-sleutel heeft geen toegang tot deze bewerking of het document valt buiten jouw toegangscontext. |
| `404` | Document niet gevonden. |
| `500` | Interne serverfout. |

```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
```

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

```json 404 theme={null}
{
  "error": "Document not found"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.