# Create document replacement credentials

Canonical page: https://docs.ovok.com/api/document/create-document-replacement-credentials

`POST /document/{id}`

Replaces the file of an existing document. It updates the document's metadata and returns a signed upload form, as `POST /document` does.

**Auth:** bearer token. The document is read and updated with your token, so you need update access to the DocumentReference.

## Behaviour

- `fileName` and `contentType` are required and set on the document. `isPublic` is optional and works as in `PATCH /document/{id}`.
- The current file is deleted before the upload form is returned. Until you upload the new file, the document has no file to download.
- The document keeps its id, so existing references to it stay valid.
- Upload with `uploadOptions` as described for `POST /document`. The form expires after 10 minutes.

## Example

```bash
curl -X POST 'https://api.sandbox.ovok.com/document/c3499c27-2973-0a7f-807e-fb8676a92dcb' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{ "fileName": "new-cat.png", "contentType": "image/png" }'
```
