Create document upload credentials
- Sandbox: available
- Staging: available
- Production: unknown
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 givenfileNameas title andcontentType, and you asauthor. contentTypemust 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 withGET /document/public/{token}. uploadOptionsholds a URL and form fields. Send amultipart/form-dataPOST touploadOptions.urlwith every entry ofuploadOptions.fieldsas a form field, then the file as the fieldfile. 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'bearerAuthorizationBearer <JWT>application/json- body
fileName*stringThe name of the file.
1 <= lengthcontentType*stringThe MIME type of the file.
isPublic?stringWhether the file is public. If true file will be publicly accessable with the token defined in the DocumentReference.extension
"false""true""false"The new document with its upload URL and form fields.
application/json- response
id*stringThe ID of the DocumentReference resource.
meta?The metadata of the document.
author?The author of the document.
fileName?stringThe name of the document.
contentType?stringThe content type of the document.
uploadOptions?The upload options of the document.
publicToken?stringThe public token of the document.
curl -X POST 'https://api.sandbox.ovok.com/document' \ -H 'Content-Type: application/json' \ -d '{ "fileName": "string", "contentType": "string"}'{ "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 ```