# Documents

Canonical page: https://docs.ovok.com/python-sdk/namespaces/documents

`ovok.documents` stores files such as reports and consent forms. It lists and deletes documents,
starts uploads, updates metadata and builds download URLs.

## Upload a document [#upload-a-document]

`create_upload()` creates the document and returns where to upload its file.
`replace_upload()` does the same for a new version of an existing document.

```python
from ovok_sdk import Ovok

ovok = Ovok("https://api.sandbox.ovok.com", "your-tenant")
document = ovok.documents.create_upload({"name": "report.pdf", "contentType": "application/pdf"})
```

## List, update and delete documents [#list-update-and-delete-documents]

```python
documents = ovok.documents.list({"patientId": "patient-id"})
ovok.documents.update_metadata("document-id", {"name": "Discharge report"})
ovok.documents.delete("document-id")
```

## Link to a download [#link-to-a-download]

`download_url()` and `public_download_url()` only build the URL; they send no request. A public
URL takes the document's share token instead of its ID.

```python
url = ovok.documents.download_url("document-id")
shared = ovok.documents.public_download_url("public-token")
```

## API reference [#api-reference]

See [`ovok_sdk.resources.documents`](/python-sdk/reference/resources/documents) for every method, parameter and error.
