Upload a chat attachment
- Sandbox: available
- On your own host? Choose https://{host} in the playground.
Starts an upload of a file to send in chat: a PDF, PNG, JPEG or WebP of up to 10 MB. Ovok keeps it private; your access policy needs no document rights.
Behaviour
- The answer names the attachment (
id) and where to upload its file:POSTit toupload.urlwithin ten minutes as multipart form data, every one ofupload.fieldsfirst and the file last asfile. - Then send it with a message:
POST /v1/chat/threads/<threadId>/messageswithattachments: ["<id>"]. One upload can go into any number of your threads. - Only you can send your upload. Everyone who can read a message it went out with can download it.
Example
curl -X POST 'https://api.sandbox.ovok.com/v1/chat/attachments' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "fileName": "Flu vaccination 2026.pdf", "contentType": "application/pdf" }'bearerAuthorizationBearer <JWT>application/json- body
fileName*stringThe file’s name, as readers see it.
1 <= length <= 200contentType*stringThe file’s type: a PDF, PNG, JPEG or WebP.
"application/pdf""image/png""image/jpeg""image/webp"The attachment and where to upload its file. Location names it.
application/json- response
id*stringThe attachment id.
title*stringThe file’s name.
contentType*stringThe file’s type.
upload*POST the file to url within ten minutes as multipart form data: every one of fields, then file. At most 10 MB.
curl -X POST 'https://api.sandbox.ovok.com/v1/chat/attachments' \ -H 'Content-Type: application/json' \ -d '{ "fileName": "string", "contentType": "application/pdf"}'{ "id": "string", "title": "string", "contentType": "string", "upload": { "url": "string", "fields": { "property1": "string", "property2": "string" } }}Mark a chat thread read POST
Marks the thread read by you, up to `readAt` (now when not sent): your unread count goes to 0, and everyone in the thread hears `chat.read` with the time, for read receipts. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/chat/threads/<threadId>/read' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "readAt": null }' ```
Download your chat upload GET
Answers a link that downloads one of your own chat uploads, for example to check it before you send it. ## Behaviour - The link works for an hour and needs no bearer. The file comes as the type it was uploaded as. - Anyone else's upload answers **404**, as does an upload whose file is gone. ## Example ```bash curl 'https://api.sandbox.ovok.com/v1/chat/attachments/<attachmentId>' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```