Create an upload URL
POST
/chat-rooms/:roomId/files/upload-urlFiles are uploaded straight to S3, not through the API. PUT the file to the returned uploadUrl with exactly the requiredHeaders. Do not add an Authorization header (it breaks the signature). Register the upload afterwards with POST /chat-rooms/:roomId/files. The limit is 10MB.
| Auth | Login required |
|---|
Path parameters
roomIdstringrequiredChat room ID.
Request body
fileNamestringrequiredFile name (up to 255 characters).
mimeTypestringrequiredMIME type; must match the Content-Type of the PUT.
sizenumberrequiredSize in bytes (up to 10MB). The real size is verified on registration.
Request
curl https://api.4s.link/chat-rooms/ROOM_ID/files/upload-url \-X POST \-H "Authorization: Bearer 4s_at_..." \-H "Content-Type: application/json" \-d '{"fileName": "report.pdf","mimeType": "application/pdf","size": 1234567}'
Example response
{"uploadUrl": "https://.../chat-file-uploads/...?X-Amz-Signature=...","uploadKey": "chat-file-uploads/r1a2b3c4-.../a1b2c3d4-.../....pdf","expiresIn": 300,"requiredHeaders": { "Content-Type": "application/pdf", "Content-Length": "1234567" }}