Register an uploaded file
POST
/chat-rooms/:roomId/filesRegister a file that was PUT to S3. The server verifies the real size and rejects anything over 10MB. If a file with the same name exists in the folder, it is numbered as "report (2).pdf". Set postToChat to true to also post it to the chat.
| Auth | Login required |
|---|
Path parameters
roomIdstringrequiredChat room ID.
Request body
uploadKeystringrequiredThe uploadKey returned by the upload-url endpoint.
fileNamestringrequiredDisplay name for the file.
folderIdstringDestination folder; omit or null for the root.
postToChatbooleanPost the file to the chat as a message.
contentstringMessage body when postToChat is set.
replyToIdstringMessage being replied to, when postToChat is set.
Request
curl https://api.4s.link/chat-rooms/ROOM_ID/files \-X POST \-H "Authorization: Bearer 4s_at_..." \-H "Content-Type: application/json" \-d '{"uploadKey": "chat-file-uploads/r1a2b3c4-.../a1b2c3d4-.../....pdf","fileName": "report.pdf","folderId": null,"postToChat": true}'
Example response
{"type": "file","id": "cf1a2b3c-...","name": "report.pdf","folderId": null,"mimeType": "application/pdf","size": 1234567,"messageId": null,"createdAt": "2026-08-29T00:00:00.000Z"}