Chat

Presign a chat attachment upload

Step one of sending a file. Creates an attachment slot in the conversation and returns its id with an upload URL valid for 5 minutes: PUT the file's bytes to signedUrl with the Content-Type you declared as mimeType, then pass the id in attachmentIds of POST /chat/threads/{chatId}/messages (up to 10 per message). Until a message carries it, nobody sees the attachment. Images take up to 25 MB, PDFs up to 25 MB and videos up to 512 MB; at most 30 unsent uploads per conversation and hour. A sent file is served from a permanent public URL, which deleting the message does not revoke.

post/chat/threads/{chatId}/attachments/presign

Request

  • Base URL: https://viral.app/api/v1
  • URL: https://viral.app/api/v1/chat/threads/{chatId}/attachments/presign
  • Auth: API key in header x-api-key

Path parameters

chatIdstring required

Request body

fileNamestring required
mimeType'image/jpeg' | 'image/png' | 'image/webp' | 'image/gif' | 'video/mp4' | 'video/quicktime' | 'video/webm' | 'application/pdf' required
sizeBytesinteger required

Response

OK

attachmentIdstring required
signedUrlstring uri required

Changes

No recorded changes to this operation across all 1 revision of this API.