Repository files navigation
POST /login
Request Params: None
Request Body:
{
"username" : " string" ,
"password" : " string"
}
Response:
200 OK (login success) or 201 Created (register success)
{
"access_token" : " jwt_token"
}
GET /users
Request Params: None
Headers: Authorization: Bearer <token>
Response:
[
{
"id" : 1 ,
"username" : " string"
}
]
POST /rooms
Request Params: None
Headers: Authorization: Bearer <token>
Request Body:
{
"name" : " string" ,
"description" : " string"
}
Response:
{
"id" : 1 ,
"name" : " string" ,
"description" : " string" ,
"OwnerId" : 1 ,
"roomType" : " group-chat" ,
...
}
Get All Rooms (joined by user)
GET /rooms
Request Params: None
Headers: Authorization: Bearer <token>
Response:
[
{
"UserId" : 2 ,
"RoomId" : 1 ,
"createdAt" : " 2025-07-01T23:31:07.874Z" ,
"updatedAt" : " 2025-07-01T23:31:07.874Z" ,
"Room" : {
"id" : 1 ,
"name" : " General Chat" ,
"description" : " Tempat ngobrol santai semua member." ,
"OwnerId" : 2 ,
"roomType" : " group-chat" ,
"createdAt" : " 2025-07-02T00:00:00.000Z" ,
"updatedAt" : " 2025-07-02T00:00:00.000Z" ,
"Owner" : {
"id" : 2 ,
"username" : " Andi"
}
}
}
]
GET /chats/:RoomId
Request Params:
RoomId (path param, integer): Room ID
Headers: Authorization: Bearer <token>
Response:
[
{
"id" : 1 ,
"UserId" : 2 ,
"RoomId" : 1 ,
"text" : " Hello!" ,
"createdAt" : " 2025-07-02T08:00:00.000Z" ,
"updatedAt" : " 2025-07-02T08:00:00.000Z"
}
]
POST /chats/:RoomId
Request Params:
RoomId (path param, integer): Room ID
Headers: Authorization: Bearer <token>
Request Body:
{
"text" : " string" ,
"ChatId" : 1 // optional, for reply/threads
}
Response:
{
"id" : 1 ,
"UserId" : 2 ,
"RoomId" : 1 ,
"text" : " string" ,
"createdAt" : " 2025-07-02T08:00:00.000Z" ,
"updatedAt" : " 2025-07-02T08:00:00.000Z"
}
POST /rooms/:RoomId/ai-chats
Request Params:
RoomId (path param, integer): Room ID
Headers: Authorization: Bearer <token>
Request Body:
Response:
{
"id" : 1 ,
"UserId" : 1 ,
"RoomId" : 1 ,
"text" : " AI response" ,
...
}
POST /rooms/:RoomId/summaries
Request Params:
RoomId (path param, integer): Room ID
Headers: Authorization: Bearer <token>
Response:
{
"id" : 1 ,
"UserId" : 1 ,
"RoomId" : 1 ,
"text" : " Summary text" ,
...
}
POST /rooms/private
Request Params: None
Headers: Authorization: Bearer <token>
Request Body:
{
"targetUserId" : 2 ,
"message" : " string"
}
Response:
{
"message" : " Private chat created successfully" ,
"room" : {
"id" : 1 ,
"name" : " private-chat-UserA-and-UserB" ,
"roomType" : " private-chat" ,
"OwnerId" : 1 ,
...
}
}
POST /rooms/:RoomId/invitations
Request Params:
RoomId (path param, integer): Room ID
Headers: Authorization: Bearer <token>
Request Body:
Response:
{
"message" : " User <username> has been invited to room <room name>"
}
All errors will return a JSON response with a message field describing the error.
All endpoints (except /login) require JWT authentication via the Authorization header.
Replace <token> with your JWT access token.
Replace path params (e.g., :RoomId) with actual values.
About
Real Time Chat App, with AI Assistant (server-side)
Resources
Stars
Watchers
Forks
You can’t perform that action at this time.