ChatifyAPI Documentation
Powerful real-time chat API for seamless communication in your applications
Authentication
POST
/api/v1/auth/login
Authenticate user and retrieve JWT token
Parameter | Type | Description |
---|---|---|
string | User's email address | |
password | string | User's password |
{
"status": "success",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
POST
/api/v1/auth/register
Create a new user account
Parameter | Type | Description |
---|---|---|
name | string | User's full name |
string | User's email address | |
password | string | User's password |
POST
/api/v1/auth/logout
Logout the current user and invalidate the token
POST
/api/v1/auth/refreshtoken
Get a new access token using the refresh token
{
"status": "success",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
Conversations
POST
/api/v1/conversation
Create a new conversation with another user
Parameter | Type | Description |
---|---|---|
receiver_id | string | ID of the user to start conversation with |
GET
/api/v1/conversation
Get all conversations for the authenticated user
{
"status": "success",
"data": {
"conversations": [
{
"_id": "672c05fc60f3fb044dc2d12c",
"participants": ["user1_id", "user2_id"],
"lastMessage": "Hello!",
"updatedAt": "2024-01-15T12:00:00Z"
}
]
}
}
Messages
POST
/api/v1/message
Send a new message in a conversation
Parameter | Type | Description |
---|---|---|
convo_id | string | ID of the conversation |
message | string | Message content |
files | file | Optional file attachments (images, documents) |
{
"status": "success",
"data": {
"message": {
"_id": "message_id",
"conversation": "convo_id",
"sender": "sender_id",
"content": "Hello!",
"files": ["file_url"],
"createdAt": "2024-01-15T12:00:00Z"
}
}
}
GET
/api/v1/message/:conversationId
Get all messages in a conversation
{
"status": "success",
"data": {
"messages": [
{
"_id": "message_id",
"sender": {
"_id": "sender_id",
"name": "John Doe"
},
"content": "Hello!",
"files": ["file_url"],
"createdAt": "2024-01-15T12:00:00Z"
}
]
}
}
Users
GET
/api/v1/user/getme
Get the authenticated user's profile
{
"status": "success",
"data": {
"user": {
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com"
}
}
}
GET
/api/v1/user?keyword=:searchTerm
Search for users by name or email
Parameter | Type | Description |
---|---|---|
keyword | string | Search term to find users |
{
"status": "success",
"data": {
"users": [
{
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com"
}
]
}
}