Create Chat

Creates a new chat with two or more users.

Headers
  • Authorization
    Type: string
    required

    JWT Bearer token. Format: Bearer <JWT>

Body·
required
application/json
  • chatName
    Type: string
    required
  • userNames
    Type: array string[] 2…
    required
Responses
  • application/json
  • 400

    Invalid usernames, own username not included, or invalid chat name format.

  • application/json
Request Example for post/api/chat/createChat
curl https://demo.api.whispchat.com/api/chat/createChat \
  --request POST \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "chatName": "Project Discussion",
  "userNames": [
    "johndoe",
    "janedoe",
    "bobsmith"
  ]
}'
{
  "chatId": "123e4567-e89b-12d3-a456-426614174000",
  "chatName": "string",
  "lastMessageTimestamp": "2026-05-29T11:57:30.651Z",
  "lastMessage": "string",
  "createdAt": "2026-05-29T11:57:30.651Z",
  "creator": "123e4567-e89b-12d3-a456-426614174000",
  "groupChat": true
}