Complete API endpoint reference for Task Flow API.
π‘ Interactive Documentation: For a fully interactive API experience with "Try it out" functionality, visit the Swagger UI at
http://localhost:3000/api-docswhen the server is running.
http://localhost:3000/api
For production, replace with your server URL.
Most endpoints require authentication using JWT tokens. Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
Login or register to receive a JWT token:
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "johndoe", "password": "password123"}'Response:
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 604800,
"expiresAt": "2026-01-16T12:00:00.000Z",
"user": {
"id": "uuid-here",
"username": "johndoe",
"email": "john@example.com",
"name": "John Doe"
}
}Create a new user account.
Endpoint: POST /api/auth/register
Request Body:
{
"username": "johndoe",
"email": "john@example.com",
"password": "securePassword123",
"name": "John Doe",
"phoneNumber": "+1234567890" // Optional
}Response: 201 Created
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 604800,
"expiresAt": "2026-01-16T12:00:00.000Z",
"user": {
"id": "uuid-here",
"username": "johndoe",
"email": "john@example.com",
"name": "John Doe",
"phoneNumber": "+1234567890",
"avatar": null,
"createdAt": "2026-01-09T12:00:00.000Z"
}
}Validation:
username: Required, unique, 3-30 charactersemail: Required, unique, valid email formatpassword: Required, minimum 6 charactersname: Optional, 1-100 charactersphoneNumber: Optional
Authenticate a user and receive a JWT token.
Endpoint: POST /api/auth/login
Request Body:
{
"username": "johndoe", // Can use email instead
"password": "securePassword123"
}Response: 200 OK
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 604800,
"expiresAt": "2026-01-16T12:00:00.000Z",
"user": {
"id": "uuid-here",
"username": "johndoe",
"email": "john@example.com",
"name": "John Doe",
"phoneNumber": "+1234567890"
}
}Notes:
- Can login with either
usernameoremail - Password is case-sensitive
Get the authenticated user's profile.
Endpoint: GET /api/auth/me
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"id": "uuid-here",
"username": "johndoe",
"email": "john@example.com",
"name": "John Doe",
"phoneNumber": "+1234567890",
"avatar": null
}Request a password reset token.
Endpoint: POST /api/auth/forgot-password
Request Body:
{
"email": "john@example.com"
}Response: 200 OK
{
"message": "Password reset email sent"
}Notes:
- Email is sent to the user with a reset token
- Token expires after 1 hour (configurable)
- If email is not configured, token is logged to console
Reset password using the token from email.
Endpoint: POST /api/auth/reset-password
Request Body:
{
"token": "reset-token-from-email",
"newPassword": "newSecurePassword123"
}Response: 200 OK
{
"message": "Password reset successful"
}Verify if a password reset token is valid.
Endpoint: POST /api/auth/verify-reset-token
Request Body:
{
"token": "reset-token-from-email"
}Response: 200 OK
{
"message": "Token is valid",
"email": "john@example.com"
}Error Response: 400 Bad Request
{
"error": "Invalid or expired token"
}Notes:
- Use this endpoint to verify token validity before showing password reset form
- Returns the user's email if token is valid
Change password for the currently authenticated user.
Endpoint: POST /api/auth/change-password
Headers:
Authorization: Bearer <your-jwt-token>
Request Body:
{
"newPassword": "newSecurePassword123"
}Response: 200 OK
{
"success": true,
"message": "Password changed successfully",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 604800,
"expiresAt": "2026-01-16T12:00:00.000Z"
}Notes:
- Requires authentication
- Returns a new JWT token after password change
- Old tokens remain valid until expiration
Get a list of all users (searchable).
Endpoint: GET /api/users
Headers:
Authorization: Bearer <token>
Query Parameters:
search: Search by name, email, or username (optional)
Example:
GET /api/users?search=john
Response: 200 OK
[
{
"id": "uuid-here",
"username": "johndoe",
"email": "john@example.com",
"name": "John Doe",
"phoneNumber": "+1234567890",
"avatar": null,
"createdAt": "2026-01-09T12:00:00.000Z"
}
]Get the authenticated user's profile.
Endpoint: GET /api/users/me
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"id": "uuid-here",
"username": "johndoe",
"email": "john@example.com",
"name": "John Doe",
"phoneNumber": "+1234567890",
"avatar": null
}Update the authenticated user's profile.
Endpoint: PUT /api/users/me
Headers:
Authorization: Bearer <token>
Request Body:
{
"name": "John Updated",
"email": "newemail@example.com",
"avatar": "https://example.com/avatar.jpg"
}Response: 200 OK
{
"id": "uuid-here",
"username": "johndoe",
"email": "newemail@example.com",
"name": "John Updated",
"phoneNumber": "+1234567890",
"avatar": "https://example.com/avatar.jpg"
}Get all tasks for the authenticated user with optional filters.
Endpoint: GET /api/tasks
Headers:
Authorization: Bearer <token>
Query Parameters:
status: Filter by status (e.g.,pending,in_progress,completed)priority: Filter by priority (e.g.,low,medium,high)
Example:
GET /api/tasks?status=in_progress&priority=high
Response: 200 OK
[
{
"id": "uuid-here",
"title": "Complete API documentation",
"description": "Write comprehensive API docs",
"status": "in_progress",
"priority": "high",
"category": "documentation",
"progress": 50,
"tags": ["docs", "api"],
"attachments": [],
"subtasks": [],
"assignedUserIds": [],
"dueDate": "2026-01-15T00:00:00.000Z",
"completedAt": null,
"createdAt": "2026-01-09T12:00:00.000Z",
"updatedAt": "2026-01-09T14:00:00.000Z",
"userId": "user-uuid",
"teamId": null
}
]Create a new task.
Endpoint: POST /api/tasks
Headers:
Authorization: Bearer <token>
Request Body:
{
"title": "New Task",
"description": "Task description",
"status": "pending",
"priority": "medium",
"category": "development",
"progress": 0,
"tags": ["backend", "api"],
"attachments": ["https://example.com/file.pdf"],
"dueDate": "2026-01-20T00:00:00.000Z",
"teamId": "team-uuid", // Optional
"assignedUserIds": ["user-uuid-1", "user-uuid-2"], // Optional
"subtasks": [ // Optional
{
"title": "Subtask 1",
"isCompleted": false
}
]
}Response: 201 Created
{
"id": "task-uuid",
"title": "New Task",
"description": "Task description",
"status": "pending",
"priority": "medium",
"category": "development",
"progress": 0,
"tags": ["backend", "api"],
"attachments": ["https://example.com/file.pdf"],
"subtasks": [
{
"title": "Subtask 1",
"isCompleted": false,
...
}
],
"assignedUserIds": ["user-uuid-1", "user-uuid-2"],
"dueDate": "2026-01-20T00:00:00.000Z",
"completedAt": null,
"createdAt": "2026-01-09T12:00:00.000Z",
"updatedAt": "2026-01-09T12:00:00.000Z",
"userId": "user-uuid",
"teamId": "team-uuid"
}Get a specific task by ID.
Endpoint: GET /api/tasks/:id
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"id": "task-uuid",
"title": "Task Title",
"description": "Task description",
"status": "in_progress",
"priority": "high",
"category": "development",
"progress": 75,
"tags": ["api", "backend"],
"attachments": [],
"subtasks": [
{
"id": "subtask-uuid",
"title": "Subtask 1",
"isCompleted": true,
"status": "completed"
}
],
"assignedUserIds": [],
"dueDate": "2026-01-15T00:00:00.000Z",
"completedAt": null,
"createdAt": "2026-01-09T12:00:00.000Z",
"updatedAt": "2026-01-09T14:00:00.000Z",
"userId": "user-uuid",
"teamId": null,
"team": null
}Update an existing task.
Endpoint: PUT /api/tasks/:id
Headers:
Authorization: Bearer <token>
Request Body:
{
"title": "Updated Task Title",
"status": "completed",
"progress": 100,
"completedAt": "2026-01-09T15:00:00.000Z"
}Response: 200 OK
{
"id": "task-uuid",
"title": "Updated Task Title",
"status": "completed",
"progress": 100,
"completedAt": "2026-01-09T15:00:00.000Z",
...
}Delete a task.
Endpoint: DELETE /api/tasks/:id
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"message": "Task deleted successfully"
}Notes:
- Deleting a task also deletes all its subtasks (cascade delete)
- Only the task owner can delete their tasks
Get all teams the authenticated user is a member of.
Endpoint: GET /api/teams
Headers:
Authorization: Bearer <token>
Response: 200 OK
[
{
"id": "team-uuid",
"name": "Development Team",
"description": "Backend development team",
"icon": "π»",
"color": "#4A90E2",
"avatarUrl": null,
"customTaskStatuses": null,
"createdAt": "2026-01-09T12:00:00.000Z",
"updatedAt": "2026-01-09T12:00:00.000Z"
}
]Create a new team (creator is automatically added as ADMIN).
Endpoint: POST /api/teams
Headers:
Authorization: Bearer <token>
Request Body:
{
"name": "Development Team",
"description": "Backend development team",
"icon": "π»",
"color": "#4A90E2"
}Response: 201 Created
{
"id": "team-uuid",
"name": "Development Team",
"description": "Backend development team",
"icon": "π»",
"color": "#4A90E2",
"avatarUrl": null,
"customTaskStatuses": null,
"createdAt": "2026-01-09T12:00:00.000Z",
"updatedAt": "2026-01-09T12:00:00.000Z",
"createdByUserId": "user-uuid"
}Get team details including members.
Endpoint: GET /api/teams/:id
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"id": "team-uuid",
"name": "Development Team",
"description": "Backend development team",
"icon": "π»",
"color": "#4A90E2",
"members": [
{
"id": "member-uuid",
"role": "ADMIN",
"user": {
"id": "user-uuid",
"username": "johndoe",
"name": "John Doe",
"email": "john@example.com",
"avatar": null
},
"joinedAt": "2026-01-09T12:00:00.000Z"
}
],
"createdAt": "2026-01-09T12:00:00.000Z",
"updatedAt": "2026-01-09T12:00:00.000Z"
}Update team details (ADMIN only).
Endpoint: PUT /api/teams/:id
Headers:
Authorization: Bearer <token>
Request Body:
{
"name": "Updated Team Name",
"description": "Updated description",
"color": "#E24A90"
}Response: 200 OK
{
"id": "team-uuid",
"name": "Updated Team Name",
"description": "Updated description",
"color": "#E24A90",
...
}Delete a team (ADMIN only).
Endpoint: DELETE /api/teams/:id
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"message": "Team deleted successfully"
}Add a user to a team (ADMIN only).
Endpoint: POST /api/teams/:id/members
Headers:
Authorization: Bearer <token>
Request Body:
{
"userId": "user-uuid",
"role": "MEMBER" // ADMIN or MEMBER
}Response: 201 Created
{
"id": "member-uuid",
"teamId": "team-uuid",
"userId": "user-uuid",
"role": "MEMBER",
"joinedAt": "2026-01-09T12:00:00.000Z"
}Remove a user from a team (ADMIN only).
Endpoint: DELETE /api/teams/:id/members/:userId
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"message": "Member removed successfully"
}Get all notifications for the authenticated user.
Endpoint: GET /api/notifications
Headers:
Authorization: Bearer <token>
Query Parameters:
unreadOnly: Set totrueto get only unread notifications
Example:
GET /api/notifications?unreadOnly=true
Response: 200 OK
[
{
"id": "notification-uuid",
"title": "Task Assigned",
"content": "You have been assigned a new task",
"type": "task_assigned",
"isRead": false,
"relatedEntityId": "task-uuid",
"relatedEntityType": "task",
"actorUserId": "user-uuid",
"actorUsername": "johndoe",
"actorAvatarUrl": null,
"createdAt": "2026-01-09T12:00:00.000Z"
}
]Create a notification for a user.
Endpoint: POST /api/notifications
Headers:
Authorization: Bearer <token>
Request Body:
{
"userId": "target-user-uuid",
"title": "New Notification",
"content": "Notification content",
"type": "custom",
"relatedEntityId": "entity-uuid",
"relatedEntityType": "task"
}Response: 201 Created
{
"id": "notification-uuid",
"title": "New Notification",
"content": "Notification content",
"type": "custom",
"isRead": false,
"relatedEntityId": "entity-uuid",
"relatedEntityType": "task",
"createdAt": "2026-01-09T12:00:00.000Z"
}Mark a specific notification as read.
Endpoint: PUT /api/notifications/:id/read
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"id": "notification-uuid",
"isRead": true,
...
}Mark all notifications as read for the authenticated user.
Endpoint: PUT /api/notifications/read-all
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"message": "All notifications marked as read"
}Delete a notification.
Endpoint: DELETE /api/notifications/:id
Headers:
Authorization: Bearer <token>
Response: 200 OK
{
"message": "Notification deleted successfully"
}All endpoints return a standardized error response format when something goes wrong:
{
"success": false,
"message": "Descriptive error message",
"errors": [], // Optional: array of sub-errors (e.g., validation fields)
"stack": "..." // Only available in development environment
}Returned when request parameters or body fail validation.
{
"success": false,
"message": "Validation Error",
"errors": [
{
"path": "body.email",
"message": "Invalid email format"
}
]
}Returned when authentication is missing or invalid.
{
"success": false,
"message": "Unauthorized"
}Returned when the authenticated user doesn't have permissions for the resource.
{
"success": false,
"message": "Access denied"
}Returned when the requested resource doesn't exist.
{
"success": false,
"message": "Task not found"
}Returned for unexpected server-side issues.
{
"success": false,
"message": "Something went wrong"
}Currently, no rate limiting is implemented. In production, consider adding rate limiting middleware to prevent abuse.
CORS is enabled for all origins in development. Configure appropriately for production.
π― Recommended: For the most complete and up-to-date API documentation, use the Swagger UI at:
http://localhost:3000/api-docs
The Swagger UI provides:
- β Try-it-out functionality - Test endpoints directly from your browser
- β Real-time validation - See request/response schemas
- β Authentication testing - Easily test protected endpoints
- β Auto-generated examples - See example requests and responses
- β Complete endpoint coverage - All endpoints are documented
- β Always up-to-date - Generated from source code annotations
- Start the server:
npm run dev - Open
http://localhost:3000/api-docsin your browser - Click Authorize button (top-right)
- Enter your JWT token from login/register
- Try any endpoint using Try it out button
- Getting Started - Setup and installation
- Configuration - Environment variables
- Database Schema - Database structure
- API Status - Feature implementation status
- Development Guide - Development workflow
- Troubleshooting - Common issues