To interact with tasks, users must register and log in. User authentication is done via email and password. Upon successful login, an authentication token is provided and must be included in the Authorization
header of all subsequent requests.
Authorization header format:
-
URL :
/users/register
-
Method :
POST
-
Description : Register a new user. A default workspace is created for each new user.
-
Request body :
Field Type Description email
string User's email address. password
string User's password. username
string User's username. role
string User's role (e.g., user, admin). -
Success Response :
- Code :
201 Created
- Content :
{ "message": "User successfully registered and default workspace created" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "Email already in use. Please change email address or login." }
-
Code :
422 Unprocessable Entity
-
Content :
{ "message": "Invalid input" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error registering account" }
-
-
URL :
/users/login
-
Method :
POST
-
Description : Log in a user.
-
Request body :
Field Type Description email
string User's email address. password
string User's password. -
Success Response :
- Code :
200 OK
- Content :
{ "message": "Authentication successful", "user": {"id": "<User ID>", "username": "<User username>", "email": "<User email>"} }
- Cookies : Two HttpOnly cookies named
token
andrefreshToken
are set, containing the JWT and the refresh token respectively.
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "Invalid credentials" }
-
Code :
401 Unauthorized
-
Content :
{ "message": "Invalid password" }
-
Code :
404 Not Found
-
Content :
{ "message": "User not found" }
-
Code :
422 Unprocessable Entity
-
Content :
{ "message": "Invalid input" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error", "result": "<Error Details>" }
-
-
URL :
/users/:id/update
-
Method :
PUT
-
Description : Update a user's information.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the user to update -
Request body : At least one of the following fields should be present:
Field Type Description email
string (Optional) User's email address. password
string (Optional) User's password. username
string (Optional) User's username. role
string (Optional) User's role. -
Success Response :
- Code :
200 OK
- Content :
{ "message": "User updated", "user": "<User Object>" }
- Code :
-
Error Responses :
-
Code :
403 Forbidden
-
Content :
{ "message": "You do not have sufficient rights to perform this action" }
-
Code :
404 Not Found
-
Content :
{ "message": "User not found" }
-
Code :
422 Unprocessable Entity
-
Content :
{ "message": "No fields for update were provided" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error", "result": "<Error Details>" }
-
Notes:
- The user themselves, an
admin
, or asuperadmin
can update the user's data. - A non-superadmin user cannot update an
admin
orsuperadmin
user's data. - The
Authorization
header should contain a valid JWT token in the formatBearer <JWT>
.
-
URL :
/users/logout
-
Method :
POST
-
Description : Logs out a user, clearing the refresh token from cookies and the database.
-
Request Cookies :
Field Type Description refreshToken
string User's refresh token. -
Success Response :
- Code :
200 OK
- Content :
{ "message": "User logged out successfully" }
- Code :
-
Error Responses :
- Code :
500 Internal Server Error
- Content :
{ "message": "Internal server error", "result": "<Error Details>" }
- Code :
Notes:
- To logout a user, send a
POST
request to/users/logout
with therefreshToken
in the cookies. No request body is required. - This endpoint will clear the
refreshToken
from cookies and delete the corresponding document in the database.
-
URL :
/users/auth/forgot-password
-
Method :
POST
-
Description : Reset password via email.
-
Request body :
Field Type Description email
string User's email address. -
Success Response :
- Code :
200 OK
- Content :
{ "message": "Email sent" }
- Code :
-
Error Responses :
-
Code :
404 Not Found
-
Content :
{ "message": "No account with that email address exists" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error", "result": "<Error Details>" }
-
-
URL :
/users/token
-
Method :
POST
-
Description : Refresh access token using the refresh token sent in cookies.
-
Request Cookies :
Field Type Description refreshToken
string User's refresh token. -
Success Response :
- Code :
200 OK
- Content :
{ "message": "Token refresh successful", "token": "<New Token>" }
- Cookies : Two HttpOnly cookies named
token
andrefreshToken
are set, containing the new JWT and refresh token respectively.
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "Refresh token not provided" }
-
Code :
404 Not Found
-
Content :
{ "message": "Refresh token not found" }
-
Code :
400 Bad Request
-
Content :
{ "message": "User not found" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error", "result": "<Error Details>" }
-
-
URL :
/users/:id/account
-
Method :
GET
-
Description : Retrieve information about a user.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the user to retrieve -
Success Response :
- Code :
200 OK
- Content :
{ "user": "<User Object without password>" }
- Code :
-
Error Responses :
-
Code :
403 Forbidden
-
Content :
{ "message": "You do not have sufficient rights to perform this action" }
-
Code :
404 Not Found
-
Content :
{ "message": "User not found" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error", "result": "<Error Details>" }
-
Notes:
- A user can only request their own data, unless they are
admin
orsuperadmin
. - An
admin
can request the data of any user, except for otheradmin
andsuperadmin
users. - A
superadmin
can request data from any user. - The
Authorization
header should contain a valid JWT token in the formatBearer <JWT>
.
-
URL :
/workspaces/:id
-
Method :
GET
-
Description : Get a workspace by ID.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the workspace to get -
Success Response :
- Code :
200 OK
- Content :
{ "workspace": "<Workspace Object>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "This workspace does not exist" }
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
403 Forbidden
-
Content :
{ "message": "You do not have sufficient rights to perform this action" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error" }
-
Notes:
- A workspace can be accessed only by the user who created it or its members.
- The
Authorization
header should contain a valid JWT token in the formatBearer <JWT>
.
-
URL :
/workspaces/user/:id
-
Method :
GET
-
Description : Get all workspaces of a specific user.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the user whose workspaces to get -
Success Response :
- Code :
200 OK
- Content :
{ "workspaces": "<Array of Workspace Objects>" }
- Code :
-
Error Responses :
-
Code :
403 Forbidden
-
Content :
{ "message": "You do not have sufficient rights to perform this action" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error" }
-
Notes:
- A user can only retrieve their own workspaces.
- The
Authorization
header should contain a valid JWT token in the formatBearer <JWT>
.
-
URL :
/workspaces
-
Method :
POST
-
Description : Create a new workspace.
-
Request body :
Field Type Description title
string Title of the workspace. userId
string User's ID who created the workspace. description
string Description of the workspace. members
Array Array of user IDs who are members of the workspace. -
Success Response :
- Code :
200 OK
- Content :
{ "workspace": "<Workspace Object>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "Please add a title" }
-
Code :
404 Not Found
-
Content :
{ "message": "The specified user does not exist" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error" }
-
Notes:
- The
Authorization
header should contain a valid JWT token in the formatBearer <JWT>
.
-
URL :
/workspaces/:id
-
Method :
PUT
-
Description : Edit a workspace.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the workspace to edit -
Request body :
Field Type Description title
string Title of the workspace. userId
string User's ID who created the workspace. description
string Description of the workspace. members
Array Array of user IDs who are members of the workspace. -
Success Response :
- Code :
200 OK
- Content :
{ "message": "Workspace updated", "workspace": "<Workspace Object>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "This workspace does not exist" }
-
Code :
403 Forbidden
-
Content :
{ "message": "You do not have sufficient rights to perform this action" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error" }
-
Notes:
- A workspace can only be edited by the user who created it or a member of it.
- The
Authorization
header should contain a valid JWT token in the formatBearer <JWT>
.
-
URL :
/workspaces/:id
-
Method :
DELETE
-
Description : Delete a workspace.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the workspace to delete -
Success Response :
- Code :
200 OK
- Content :
{ "message": "Workspace deleted <id>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "This workspace does not exist" }
-
Code :
403 Forbidden
-
Content :
{ "message": "You do not have sufficient rights to perform this action" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error" }
-
Notes:
- A workspace can only be deleted by a member of the workspace. If the user is not the creator of the workspace, they will only be removed from the workspace, not deleting it.
- The
Authorization
header should contain a valid JWT token in the formatBearer <JWT>
. - When a workspace is deleted, the tasks created by the user within that workspace will be transferred to their default workspace. If the default workspace is the one being deleted, a new default workspace will be created.
-
URL :
/tasks
-
Method :
POST
-
Description : Create a new task.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description title
string Title of the task. description
string Description of the task. dueDate
string Due date of the task in ISO format. priority
string Priority level (low, medium, high). status
string Status of the task (todo, in-progress, done). workspaceId
string ID of the workspace this task belongs to. -
Success Response :
- Code :
201 Created
- Content :
{ "message": "Task created successfully", "task": "<Task Object>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "Invalid input data" }
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
403 Forbidden
-
Content :
{ "message": "User does not have permission to create a task in this workspace" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error creating task" }
-
-
URL :
/tasks
-
Method :
GET
-
Description : Retrieve all tasks for the authenticated user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving tasks" }
-
-
URL :
/tasks/:id
-
Method :
GET
-
Description : Retrieve a task by its ID.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description id
ObjectId
ID of the task to retrieve -
Success Response :
- Code :
200 OK
- Content :
{ "task": "<Task Object>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
403 Forbidden
-
Content :
{ "message": "User does not have permission to view this task" }
-
Code :
404 Not Found
-
Content :
{ "message": "Task not found" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving task" }
-
-
URL :
/tasks/:id
-
Method :
PUT
-
Description : Update a task by its ID.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description id
ObjectId
ID of the task to update -
Request Body : At least one of the following fields should be present:
Field Type Description title
string (Optional) Title of the task. description
string (Optional) Description of the task. dueDate
string (Optional) Due date in ISO format. priority
string (Optional) Priority level. status
string (Optional) Status of the task. workspaceId
string (Optional) ID of the workspace. -
Success Response :
- Code :
200 OK
- Content :
{ "message": "Task updated successfully", "task": "<Task Object>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "Invalid input data" }
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
403 Forbidden
-
Content :
{ "message": "User does not have permission to update this task" }
-
Code :
404 Not Found
-
Content :
{ "message": "Task not found" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error updating task" }
-
-
URL :
/tasks/:id
-
Method :
DELETE
-
Description : Delete a task by its ID.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description id
ObjectId
ID of the task to delete -
Success Response :
- Code :
200 OK
- Content :
{ "message": "Task deleted successfully" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
403 Forbidden
-
Content :
{ "message": "User does not have permission to delete this task" }
-
Code :
404 Not Found
-
Content :
{ "message": "Task not found" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error deleting task" }
-
-
URL :
/tasks/:userId/urgent
-
Method :
GET
-
Description : Get the three most urgent tasks for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get urgent tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Urgent Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving urgent tasks" }
-
-
URL :
/tasks/:userId/all-tasks
-
Method :
GET
-
Description : Get all tasks for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get all tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving all tasks" }
-
-
URL :
/tasks/:userId/overdue
-
Method :
GET
-
Description : Get all overdue tasks for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get overdue tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Overdue Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving overdue tasks" }
-
-
URL :
/tasks/:userId/today
-
Method :
GET
-
Description : Get all tasks due today for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get today's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Today's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving today's tasks" }
-
-
URL :
/tasks/:userId/tomorrow
-
Method :
GET
-
Description : Get all tasks due tomorrow for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get tomorrow's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Tomorrow's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving tomorrow's tasks" }
-
-
URL :
/tasks/:userId/this-week
-
Method :
GET
-
Description : Get all tasks due this week for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get this week's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of This Week's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving this week's tasks" }
-
-
URL :
/tasks/:userId/next-week
-
Method :
GET
-
Description : Get all tasks due next week for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get next week's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Next Week's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving next week's tasks" }
-
-
URL :
/tasks/:userId/this-month
-
Method :
GET
-
Description : Get all tasks due this month for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get this month's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of This Month's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving this month's tasks" }
-
-
URL :
/tasks/:userId/next-month
-
Method :
GET
-
Description : Get all tasks due next month for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get next month's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Next Month's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving next month's tasks" }
-
-
URL :
/tasks/:userId/this-year
-
Method :
GET
-
Description : Get all tasks due this year for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get this year's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of This Year's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving this year's tasks" }
-
-
URL :
/tasks/:userId/next-year
-
Method :
GET
-
Description : Get all tasks due next year for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get next year's tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Next Year's Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving next year's tasks" }
-
-
URL :
/tasks/:userId/becoming
-
Method :
GET
-
Description : Get all becoming tasks for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get becoming tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Becoming Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving becoming tasks" }
-
-
URL :
/tasks/:userId/archived
-
Method :
GET
-
Description : Get all archived tasks for a specific user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user to get archived tasks for -
Success Response :
- Code :
200 OK
- Content :
{ "tasks": "<Array of Archived Task Objects>" }
- Code :
-
Error Responses :
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Error retrieving archived tasks" }
-
-
URL :
/invitations/send-invitation
-
Method :
POST
-
Description : Send an invitation to another user.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description senderId
string ID of the user sending the invitation. guestEmail
string Email of the user to invite. message
string Message to include in the invitation. -
Success Response :
- Code :
200 OK
- Content :
{ "invitations": "<Array of Invitation Objects>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "User does not exist" }
-
Code : `400 Bad Request**
-
Content :
{ "message": "You cannot send an invitation to yourself" }
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation already sent to this user" }
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation already received from this user" }
-
Code : `401 Unauthorized**
-
Content :
{ "message": "User not authenticated" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/invitations/sentout-invitations/:id
-
Method :
GET
-
Description : Retrieve all invitations sent by a user.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the user. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code : `200 OK**
- Content :
{ "invitations": "<Array of Invitation Objects>" }
-
Error Responses :
- Code : `500 Internal Server Error**
- Content :
{ "message": "Internal server error" }
-
URL :
/invitations/received-invitations/:id
-
Method :
GET
-
Description : Retrieve all invitations received by a user.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the user. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code : `200 OK**
- Content :
{ "invitations": "<Array of Invitation Objects>" }
-
Error Responses :
- Code : `500 Internal Server Error**
- Content :
{ "message": "Internal server error" }
-
URL :
/invitations/:invitationId/accept
-
Method : `PUT**
-
Description : Accept an invitation.
-
URL Parameters :
Parameter Type Description invitationId
ObjectId
ID of the invitation. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description userId
string ID of the user accepting. -
Success Response :
- Code : `200 OK**
- Content :
{ "invitations": "<Array of Invitation Objects>", "userContacts": "<Array of User Contact Objects>" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation does not exist or is not pending" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "You do not have sufficient rights to accept this invitation" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/invitations/:invitationId/decline
-
Method : `PUT**
-
Description : Decline an invitation.
-
URL Parameters :
Parameter Type Description invitationId
ObjectId
ID of the invitation. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description userId
string ID of the user declining. -
Success Response :
- Code : `200 OK**
- Content :
{ "invitations": "<Array of Invitation Objects>", "message": "Invitation declined" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation does not exist or is not pending" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "You do not have sufficient rights to decline this invitation" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/invitations/:invitationId/cancel
-
Method : `DELETE**
-
Description : Cancel an invitation.
-
URL Parameters :
Parameter Type Description invitationId
ObjectId
ID of the invitation. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code : `200 OK**
- Content :
{ "invitations": "<Array of Invitation Objects>", "message": "Invitation cancelled" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation does not exist or is already accepted" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "You do not have sufficient rights to cancel this invitation" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/workspaceInvitations/send-invitation
-
Method :
POST
-
Description : Send an invitation to join a workspace.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description senderId
string ID of the user sending the invitation. guestId
string ID of the user to invite. role
string Role to assign to the invited user. workspaceId
string ID of the workspace to invite to. -
Success Response :
- Code :
200 OK
- Content :
{ "workspaceInvitations": "<Array of Workspace Invitation Objects>", "workspaces": "<Array of Workspace Objects>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "User does not exist" }
-
Code :
400 Bad Request
-
Content :
{ "message": "You cannot send an invitation to yourself" }
-
Code :
400 Bad Request
-
Content :
{ "message": "Workspace does not exist" }
-
Code :
400 Bad Request
-
Content :
{ "message": "You cannot send an invitation to the default workspace" }
-
Code :
401 Unauthorized
-
Content :
{ "message": "User not authenticated" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/workspaceInvitations/sentout-invitations/:id
-
Method :
GET
-
Description : Retrieve all workspace invitations sent by a user.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the user. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code :
200 OK
- Content :
{ "workspaceInvitations": "<Array of Workspace Invitation Objects>" }
- Code :
-
Error Responses :
- Code :
500 Internal Server Error
- Content :
{ "message": "Internal server error" }
- Code :
-
URL :
/workspaceInvitations/received-invitations/:id
-
Method :
GET
-
Description : Retrieve all workspace invitations received by a user.
-
URL Parameters :
Parameter Type Description id
ObjectId
ID of the user. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code :
200 OK
- Content :
{ "workspaceInvitations": "<Array of Workspace Invitation Objects>" }
- Code :
-
Error Responses :
- Code : `500 Internal Server Error**
- Content :
{ "message": "Internal server error" }
-
URL :
/workspaceInvitations/:invitationId/accept
-
Method : `PUT**
-
Description : Accept a workspace invitation.
-
URL Parameters :
Parameter Type Description invitationId
ObjectId
ID of the invitation. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description userId
string ID of the user accepting. -
Success Response :
- Code : `200 OK**
- Content :
{ "workspaceInvitations": "<Array of Workspace Invitation Objects>", "message": "Workspace invitation accepted", "workspaces": "<Array of Workspace Objects>" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation does not exist or is not pending" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "You do not have sufficient rights to accept this invitation" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/workspaceInvitations/:invitationId/decline
-
Method : `PUT**
-
Description : Decline a workspace invitation.
-
URL Parameters :
Parameter Type Description invitationId
ObjectId
ID of the invitation. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description userId
string ID of the user declining. -
Success Response :
- Code : `200 OK**
- Content :
{ "workspaceInvitations": "<Array of Workspace Invitation Objects>", "message": "Invitation declined" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation does not exist or is not pending" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "You do not have sufficient rights to decline this invitation" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/workspaceInvitations/:invitationId/cancel
-
Method : `DELETE**
-
Description : Cancel a workspace invitation.
-
URL Parameters :
Parameter Type Description invitationId
ObjectId
ID of the invitation. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code : `200 OK**
- Content :
{ "workspaceInvitations": "<Array of Workspace Invitation Objects>", "message": "Invitation cancelled and member removed from workspace", "workspaces": "<Array of Workspace Objects>" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Invitation does not exist or is already accepted" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "You do not have sufficient rights to cancel this invitation" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error" }
-
-
URL :
/notifications/set-notification
-
Method :
POST
-
Description : Set a new notification.
-
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description creatorId
string ID of the user creating the notification. taskId
string (Optional) ID of the task related to the notification. workspaceId
string (Optional) ID of the workspace related to the notification. type
string Type of the notification (e.g., taskUpdate, workspaceUpdate). -
Success Response :
- Code :
200 OK
- Content :
{ "notificationsIds": "<Array of Notification IDs>" }
- Code :
-
Error Responses :
-
Code :
400 Bad Request
-
Content :
{ "message": "Task ID is required for this type of notification" }
-
Code :
400 Bad Request
-
Content :
{ "message": "Workspace ID is required for this type of notification" }
-
Code :
404 Not Found
-
Content :
{ "message": "User not found" }
-
Code :
404 Not Found
-
Content :
{ "message": "Task not found" }
-
Code :
404 Not Found
-
Content :
{ "message": "Workspace not found" }
-
Code :
500 Internal Server Error
-
Content :
{ "message": "Internal server error", "error": "<Error Details>" }
-
-
URL :
/notifications/:userId/get-all-notifications
-
Method :
GET
-
Description : Retrieve all notifications for a specific user with pagination.
-
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user. -
Query Parameters :
Parameter Type Description page
number (Optional) Page number for pagination (default is 1). limit
number (Optional) Number of items per page (default is 10). -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code :
200 OK
- Content :
{ "notifications": "<Array of Notification Objects>", "totalNumberOfNotifications": "<Total Number of Notifications>" }
- Code :
-
Error Responses :
- Code :
500 Internal Server Error
- Content :
{ "message": "Internal server error", "error": "<Error Details>" }
- Code :
-
URL :
/notifications/get-notifications/:userId
-
Method :
GET
-
Description : Retrieve notifications for a specific user.
-
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code :
200 OK
- Content :
{ "newNotifications": "<Array of New Notification Objects>", "earlierNotifications": "<Array of Earlier Notification Objects>" }
- Code :
-
Error Responses :
- Code :
500 Internal Server Error
- Content :
{ "message": "Internal server error", "error": "<Error Details>" }
- Code :
-
URL :
/notifications/mark-viewed/:userId
-
Method : `PUT**
-
Description : Mark multiple notifications as viewed.
-
URL Parameters :
Parameter Type Description userId
ObjectId
ID of the user. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description notificationsIds
array Array of notification IDs to mark as viewed. -
Success Response :
- Code : `200 OK**
- Content :
{ "message": "Notifications updated" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Notifications IDs are required" }
-
Code : `404 Not Found**
-
Content :
{ "message": "User not found" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error", "error": "<Error Details>" }
-
-
URL :
/notifications/mark-read/:notificationId
-
Method : `PUT**
-
Description : Mark a single notification as read.
-
URL Parameters :
Parameter Type Description notificationId
ObjectId
ID of the notification. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Request Body :
Field Type Description userId
string ID of the user marking the notification as read. -
Success Response :
- Code : `200 OK**
- Content :
{ "message": "Notification marked as read" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Notification ID is required" }
-
Code : `400 Bad Request**
-
Content :
{ "message": "User ID is required" }
-
Code : `404 Not Found**
-
Content :
{ "message": "Notification not found" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "User is not allowed to access this notification" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error", "error": "<Error Details>" }
-
-
URL :
/notifications/delete-notification/:notificationId
-
Method : `DELETE**
-
Description : Delete a notification.
-
URL Parameters :
Parameter Type Description notificationId
ObjectId
ID of the notification. -
Request Headers :
Header Type Description Authorization
string Bearer token obtained from login. -
Success Response :
- Code : `200 OK**
- Content :
{ "message": "Notification deleted" }
-
Error Responses :
-
Code : `400 Bad Request**
-
Content :
{ "message": "Notification ID is required" }
-
Code : `404 Not Found**
-
Content :
{ "message": "Notification not found" }
-
Code : `403 Forbidden**
-
Content :
{ "message": "User is not allowed to access this notification" }
-
Code : `500 Internal Server Error**
-
Content :
{ "message": "Internal server error", "error": "<Error Details>" }
-