Back to API List
Real-time Chat API
WebSocket-based chat with rooms, typing indicators, message history, and user presence.
Communication
Internal API - Hosted by this App
API Endpoints & Usage
Explore and interact with the available endpoints for the Real-time Chat API. These API routes are live! The paths shown below are relative to your application's base URL. For example, if this application is hosted at
https://gen-endpoint.com
, an endpoint path for this API, such as /api/chat/rooms
, would be accessible at https://gen-endpoint.com/api/chat/rooms
. You can use the "Try it out" section for each endpoint or use tools like curl
, Postman, or your browser's address bar (for GET requests) to interact with them.GET
/api/chat/rooms
List available chat rooms with participant counts.
Show Static Examples
Example Response:
[
{
"id": "room_1",
"name": "General Discussion",
"description": "Main chat room for all users",
"participants": 45,
"lastActivity": "2024-08-16T12:00:00Z",
"type": "public"
},
{
"id": "room_2",
"name": "Tech Support",
"description": "Get help with technical issues",
"participants": 12,
"lastActivity": "2024-08-16T11:30:00Z",
"type": "public"
}
]
Try it out
You can add or change query parameters in the path above (e.g., ?name=User).
POST
/api/chat/rooms
Create new chat room with customizable settings.
Show Static Examples
Example Request Body:
{
"name": "Project Alpha",
"description": "Discussion for Project Alpha team",
"type": "private",
"maxParticipants": 20
}
Example Response:
{
"id": "room_3",
"name": "Project Alpha",
"description": "Discussion for Project Alpha team",
"type": "private",
"createdAt": "2024-08-16T12:00:00Z",
"createdBy": "usr_1"
}
Try it out
GET
/api/chat/rooms/{roomId}/messages
Get message history for room with pagination. Replace {roomId} with an actual ID.
Show Static Examples
Example Request Parameters:
?page=1&limit=50&before=2024-08-16T12:00:00Z
Example Response:
{
"messages": [
{
"id": "msg_123",
"content": "Hello everyone!",
"author": {
"id": "usr_1",
"name": "Alice",
"avatar": "https://placehold.co/40x40.png"
},
"timestamp": "2024-08-16T11:58:00Z",
"type": "text"
}
],
"pagination": {
"page": 1,
"limit": 50,
"hasMore": true
}
}
Try it out
Replace placeholders (e.g., {userId}) with actual values in the path above. You can also add/edit query parameters (e.g., ?key=value).
POST
/api/chat/rooms/{roomId}/messages
Send message to chat room. Replace {roomId} with an actual ID.
Show Static Examples
Example Request Body:
{
"content": "How is everyone doing?",
"type": "text",
"replyTo": null
}
Example Response:
{
"id": "msg_124",
"content": "How is everyone doing?",
"author": {
"id": "usr_2",
"name": "Bob"
},
"timestamp": "2024-08-16T12:00:00Z",
"roomId": "room_1"
}
Try it out
Replace placeholders (e.g., {userId}) with actual values in the path above.