Create chat room
POST
/chat-roomsCreate a chat room. With two members (including yourself) it becomes a DIRECT room, otherwise a GROUP room. For DIRECT rooms an existing room is returned if one already exists. initialMessage is optional; passing it also creates the first message. A system message recording the creation is always added to a newly created room, whether or not initialMessage is given (not when an existing DIRECT room is returned).
| Auth | Login required |
|---|
Request body
memberIdsstring[]requiredUser IDs of the other members (required); at least one.
namestringRoom name (for GROUP rooms).
initialMessagestringMessage to post immediately.
Request
curl https://api.4s.link/chat-rooms \-X POST \-H "Authorization: Bearer 4s_at_..." \-H "Content-Type: application/json" \-d '{"memberIds": ["a1b2c3d4-..."],"initialMessage": "よろしくお願いします"}'
Example response
{"id": "r1a2b3c4-...","type": "GROUP","name": "Project Team","members": [{"id": "rm1a2b3-...","status": "JOINED","user": { "id": "a1b2c3d4-...", "slug": "taro", "firstName": "太郎", "lastName": "山田", "avatarUrl": "https://.../avatar.png" }}],"lastMessage": { "id": "m1a2b3c4-...", "content": "よろしくお願いします", "createdAt": "2026-08-18T00:00:00.000Z" },"unreadCount": 0}