chat
Create new chat
Create a new chat (direct, group, channel, or broadcast) with name, type, participants, and optional settings.
POST
/api/chat/projects/{projectId}/chatsAuthentication
Requires JWT
Note
Include your JWT in the
Authorization: Bearer YOUR_TOKEN header (user-facing apps, RBAC). View authentication guide →Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Project ID. |
Request Body
Chat name, type (direct/group/channel/broadcast), participants array, optional description and settings.
json
{
"name": "Johnathan Torp I",
"description": "Introducing the French Polynesia-inspired Towels, blending amazing style with local craftsmanship",
"type": "broadcast",
"participants": [
"hard drive hack"
],
"settings": {}
}{
"name": "Johnathan Torp I",
"description": "Introducing the French Polynesia-inspired Towels, blending amazing style with local craftsmanship",
"type": "broadcast",
"participants": [
"hard drive hack"
],
"settings": {}
}SDK setup
Create a client and set credentials (JWT and/or API key) before calling the API. Match the authentication type shown above.
import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();
client.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig");import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();
client.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig");Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const result = await client.chat.create({
projectId: "proj_vqH6LQ3d9gup",
name: "Juvenal Hoeger-Lesch",
type: "card input",
participants: "3d14:ead1:f47b:54da:771f:fae0:daba:08e2",
description: "Discover the major new Mouse with an exciting mix of Bamboo ingredients",
settings: "array navigate"
});const result = await client.chat.create({
projectId: "proj_vqH6LQ3d9gup",
name: "Juvenal Hoeger-Lesch",
type: "card input",
participants: "3d14:ead1:f47b:54da:771f:fae0:daba:08e2",
description: "Discover the major new Mouse with an exciting mix of Bamboo ingredients",
settings: "array navigate"
});Try It Live
Test this endpoint with your own credentials. Your requests will be sent to the live API.
Use the auth endpoints to obtain a JWT.
No Request Yet
Send a request to see the full inspector
Responses
201Chat created
json
{
"success": true,
"data": {
"_id": "65a1b2c3d4e5f6789012345f",
"name": "Team Chat",
"type": "group",
"participants": [
{
"user": "65a1b2c3d4e5f6789012345",
"role": "admin"
}
],
"createdAt": "2024-01-15T10:00:00.000Z"
}
}{
"success": true,
"data": {
"_id": "65a1b2c3d4e5f6789012345f",
"name": "Team Chat",
"type": "group",
"participants": [
{
"user": "65a1b2c3d4e5f6789012345",
"role": "admin"
}
],
"createdAt": "2024-01-15T10:00:00.000Z"
}
}400Bad request or validation error.
401Authentication required or invalid token.
Errors
| Code | Meaning |
|---|---|
400 | Bad request or validation error. |
401 | Authentication required or invalid token. |