Send a message
POST
/chat-rooms/:roomId/messagesPost a message to a chat room. Send `content` as JSON for a text message, or a `file` as multipart/form-data for an image message. Only room members can post.
| Auth | Login required |
|---|
Path parameters
roomIdstringrequiredChat room ID.
Request body
contentstringMessage body; required for text messages.
filefileImage file (when sending as multipart/form-data)
replyToIdstringThe message being replied to. Must be a non-deleted message in the same room.
mentionsobject[]Mentions, as `[{ userId, name }]`. The `name` must appear in `content` as `@name` (entries that do not are ignored). Only users returned by GET /chat-rooms/:id/mention-candidates are accepted. Up to 20 per message (400 beyond that). Send it as a JSON string when using multipart.
Request
curl https://api.4s.link/chat-rooms/ROOM_ID/messages \-X POST \-H "Authorization: Bearer 4s_at_..." \-H "Content-Type: application/json" \-d '{"content": "@山田太郎 よろしくお願いします","mentions": [{ "userId": "a1b2c3d4-...", "name": "山田太郎" }]}'
Example response
{"id": "m1a2b3c4-...","type": "USER","content": "よろしくお願いします","imageUrl": null,"createdAt": "2026-08-18T00:00:00.000Z","user": { "id": "a1b2c3d4-...", "slug": "taro", "firstName": "太郎", "lastName": "山田", "avatarUrl": "https://.../avatar.png" }}