Skip to main content

Generate credentials for document file replacement

POST /document/{id}
devhttps://api.sandbox.ovok.com

Generate credentials for file replacement

The file replacement follows the same pattern as file creation - you first get upload credentials, then upload directly to S3.

Parameters

ParameterInDescriptionExample
idparamsThe id of the DocumentReference023f2f-
fileNamebodyThe filename of the resource to be saved with.cat.png
contentTypebodyThe mime type of the fileimage/png

Response

Similar to document creation, this endpoint returns upload credentials:

{
"id": "12345",
"lastUpdated": "2000-01-01T00:00:00.000Z",
"author": {
"reference": "Practitioner/...",
"display": "Max Mustermann"
},
"fileName": "cat.png",
"contentType": "image/png",
"uploadOptions": {
"url": "https://s3.eu-central-1.amazonaws.com/s...",
"fields": {
"bucket": "s...",
"X-Amz-Algorithm": "A...",
"X-Amz-Credential": "A...",
"X-Amz-Date": "2025...",
"key": "bi...",
"Policy": "ey...",
"X-Amz-Signature": "a6..."
}
}
}

Use the credentials in uploadOptions to upload your replacement file directly to S3 using form data, exactly like the initial upload process.

Parameters

NameInTypeRequiredDescription
idpathstringyesFHIR DocumentReference id whose binary should be replaced. The endpoint returns fresh upload credentials; the metadata resource itself stays in place.

Request body

Content-Type: application/json

  • fileName: string (required) — The filename of the resource to be saved with.
  • contentType: string (required) — The MIME type of the file.
  • isPublic: boolean — Whether the file should be public or private.

Responses

CodeDescription
200Success.
400The request could not be operated by the server.
401The resource owner or authorization server denied the request.
404The requested resource could not be found.
422The request could not be validated by the server.
500The server encountered an unexpected condition. Please try again later.

200FileEntryDto (application/json)

  • id: string (required) — The ID of the DocumentReference resource.
  • meta: object — The metadata of the document.
    • lastUpdated: string (required) — The last updated date of the document.
  • author: object — The author of the document.
    • reference: string — The reference of the author.
    • display: string — The display name of the author.
  • fileName: string — The name of the document.
  • contentType: string — The content type of the document.
  • uploadOptions: object — The upload options of the document.
    • url: string (required) — The upload URL of the document.
    • fields: object (required) — The fields of the document.
  • publicToken: string — The public token of the document.

Example

{
"id": "87ea5dfc-8b8e-384d-8489-79496e706390",
"fileName": "test.txt",
"contentType": "text/plain",
"publicToken": "example.jwt.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzkzNTA5NzEsImV4cCI6MTc3OTM1NDU3MX0.PO6ZkOtyOEugGyNuZUyg_YxUt3ozpJ_QOdJuriC14uY",
"uploadOptions": {
"url": "https://example.com/upload",
"fields": {
"key": "value"
}
}
}