-
Notifications
You must be signed in to change notification settings - Fork 8
API Overview
- POST /login: Authenticate a user and return access and refresh tokens
- POST /register: Register a new user
- POST /refresh: Refresh an access token using a refresh token
- POST /logout: Invalidate the current access token
- GET /: List all users (with pagination and filtering)
- GET /me: Get the current user's profile
- PUT /me: Update the current user's profile
- DELETE /me: Delete the current user's account
- GET /search: Search for users by username
- POST /: Create a new chat
- GET /: List all chats for the current user (with pagination and filtering)
- POST /start: Start a new chat with another user
- GET /{chat_id}: Get details of a specific chat
- PUT /{chat_id}: Update a chat's details
- DELETE /{chat_id}: Delete a chat
- GET /{chat_id}/members: List members of a chat
- POST /{chat_id}/members: Add a member to a chat
- DELETE /{chat_id}/members/{user_id}: Remove a member from a chat
- GET /{chat_id}/unread_count: Get the count of unread messages in a chat
- POST /: Create a new message
- GET /{chat_id}: Get messages for a specific chat (with pagination and filtering)
- PUT /{message_id}: Update a message
- DELETE /{message_id}: Delete a message
- PUT /{message_id}/status: Update the read status of a message
- Token-based authentication with refresh mechanism
- User management (registration, profile updates, deletion)
- Chat creation and management
- Real-time messaging
- Message read status tracking
- Unread message count
- User search functionality
All endpoints, except for login and register, require authentication. The API uses OAuth2 with Bearer tokens. Include the access token in the Authorization header of your requests:
Authorization: Bearer <your_access_token>
List endpoints (users, chats, messages) support pagination using skip and limit query parameters.
Some list endpoints support filtering:
- Users can be filtered by username
- Chats can be filtered by name
- Messages can be filtered by content
The API supports real-time updates through Redis. Events are dispatched for:
- New messages
- Message updates
- Message deletions
- Message status changes
- Unread count updates
The API uses standard HTTP status codes for indicating the success or failure of requests. Detailed error messages are provided in the response body for easier debugging and error handling on the client side.
The current version of the API is v1. All endpoints are prefixed with /api/v1/.
For detailed information on request and response formats, please refer to the API documentation available at /docs when running the server.