Document

Create document upload credentials

  • Sandbox: available
  • Staging: available
  • Production: unknown
POST
/document

Creates a document and returns a signed form that you use to upload its file straight to storage. Use it for every new file: Ovok never receives the file bytes itself.

Auth: bearer token. The document is created with your token, so you need create access to Binary and DocumentReference. Scope: the caller's project (from the token).

Behaviour

  • Creates an empty Binary and a DocumentReference with status: current, the given fileName as title and contentType, and you as author.
  • contentType must be one of the allowed types: image/jpeg, image/jpg, image/png, image/gif, image/webp, application/pdf, application/json, application/xml, text/plain, text/csv, video/mp4, video/webm, audio/mpeg, audio/wav.
  • With isPublic: "true", the document also gets a public token (publicToken) that anyone can use with GET /document/public/{token}.
  • uploadOptions holds a URL and form fields. Send a multipart/form-data POST to uploadOptions.url with every entry of uploadOptions.fields as a form field, then the file as the field file. The form expires 10 minutes after it is issued and accepts files up to 5 GB.
  • The document exists as soon as this call returns, even if you never upload the file.
  • This route is rate limited: 20 requests a minute for admins, 10 a minute for other users.

Example

curl -X POST 'https://api.sandbox.ovok.com/document' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \  -H 'Content-Type: application/json' \  -d '{ "fileName": "cat.png", "contentType": "image/png", "isPublic": "false" }'
{  "id": "87ea5dfc-8b8e-384d-8489-79496e706390",  "meta": { "lastUpdated": "2026-01-01T12:00:00.000Z" },  "author": { "reference": "Practitioner/...", "display": "Max Mustermann" },  "fileName": "cat.png",  "contentType": "image/png",  "uploadOptions": {    "url": "https://...",    "fields": { "key": "...", "Policy": "...", "X-Amz-Signature": "...", ... }  }}

Then upload the file with the returned form:

curl -X POST '<uploadOptions.url>' \  -F 'key=...' \  -F 'Policy=...' \  -F 'X-Amz-Signature=...' \  -F 'file=@cat.png'

Authorization

bearer
headerAuthorizationBearer <JWT>

Request Body

application/json
  1. body
fileName*string

The name of the file.

Length1 <= length
contentType*string

The MIME type of the file.

isPublic?string

Whether the file is public. If true file will be publicly accessable with the token defined in the DocumentReference.extension

Default"false"
Value in"true""false"

Response Body

The new document with its upload URL and form fields.

application/json
  1. response
id*string

The ID of the DocumentReference resource.

meta?

The metadata of the document.

author?

The author of the document.

fileName?string

The name of the document.

contentType?string

The content type of the document.

uploadOptions?

The upload options of the document.

publicToken?string

The public token of the document.

Example Request
curl -X POST 'https://api.sandbox.ovok.com/document' \  -H 'Content-Type: application/json' \  -d '{  "fileName": "string",  "contentType": "string"}'
Example Response
{  "id": "string",  "meta": {    "lastUpdated": "string"  },  "author": {    "reference": "string",    "display": "string"  },  "fileName": "string",  "contentType": "string",  "uploadOptions": {    "url": "string",    "fields": {      "property1": "string",      "property2": "string"    }  },  "publicToken": "string"}

Search documents GET

Lists the documents you can read, newest first by default. Use it to build a file list. **Auth:** bearer token. The search runs with your token, so Medplum returns only DocumentReferences you can read. ## Behaviour - `_count` sets the page size (default `100`), `_offset` the number of documents to skip (default `0`), and `_sort` the order (default `-_lastUpdated`). - `total` is an estimate from Medplum, not an exact count. Use it for a page counter, not for logic that needs the exact number. - Each entry has `id`, `meta.lastUpdated`, `author`, `fileName`, `contentType`, and `publicToken` when the document is public. Entries never include `uploadOptions`. ## Example ```bash curl -G 'https://api.sandbox.ovok.com/document' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -d '_count=20' \ -d '_offset=0' ```

Download a public document GET

Downloads the file of a public document, without a bearer token. Use it to embed a file in a web page or an email, for example in an `<img>` tag. **Auth:** none. The public token in the path is the credential: anyone with the URL can get the file. ## Behaviour - The token is the document's `publicToken`. A document gets one when it is created or updated with `isPublic` set to true. - The response is `307 Temporary Redirect` to a signed file URL, as in `GET /document/{id}`, including the same resizing options (`width`, `height`, `fit`). - A token stops working when the document is made private again, or when its public token is replaced. ## Example ```bash curl -L 'https://api.sandbox.ovok.com/document/public/example.jwt.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' -o file.png ```