Create a Task
Endpoint
POST /workspaces/:workspaceId/tasks
Description
This endpoint allows creating a new task in a specified workspace.
Base URL
https://api.swipeone.com/api
Authentication
Method: API Key Authentication
Header:
x-api-key: {your_api_key}
Headers
Header | Type | Required | Description |
|
| Yes | Your API key for authentication. |
Request Parameters
Parameter | Type | Location | Required | Description |
|
|
| Yes | The unique ID of the workspace where the task should be created. |
Request Body
A JSON object containing the task details.
Body Parameters
Parameter | Type | Required | Description |
|
| Yes | Name of the task. |
|
| No | The user assigned to the task. |
|
| No | Due date of the task (ISO 8601 format). |
|
| No | Reminder date for the task (ISO 8601 format). |
|
| No | The contact associated with the task. |
Example Request
curl -X POST "https://api.swipeone.com/api/workspaces/6660175570fbd8a9c22bedfb/tasks" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Follow up with John Doe",
"assignedTo": "user123",
"dueDate": "2024-07-10T12:00:00Z",
"reminder": "2024-07-09T12:00:00Z",
"contactId": "6682840d9286aa59ee3d4181"
}'
Response
Success Response (201)
{
"status": "success",
"data": {
"task": {
"_id": "669b2c93efb8b213a7c72a8e",
"name": "Follow up with John Doe",
"assignedTo": "user123",
"dueDate": "2024-07-10T12:00:00Z",
"reminder": "2024-07-09T12:00:00Z",
"contactId": "6682840d9286aa59ee3d4181",
"workspaceId": "6660175570fbd8a9c22bedfb",
"createdAt": "2024-07-01T10:25:17.813Z",
"updatedAt": "2024-07-01T10:25:17.813Z"
}
}
}
Error Responses
Status Code | Description |
| Invalid input. |
| Unauthorized β API key is missing or invalid. |
| Internal server error. |
Retrieve Tasks for a Contact
Endpoint
GET
/workspaces/:workspaceId/contacts/:contactId/tasks
Description
This endpoint retrieves a list of tasks associated with a specific contact.
Request Parameters
Parameter | Type | Location | Required | Description |
|
|
| Yes | The unique ID of the contact. |
|
|
| No | Page number for pagination (default: |
|
|
| No | Number of tasks per page (default: |
Example Request
curl -X GET "https://api.swipeone.com/api//workspaces/6660175570fbd8a9c22bedfb/contacts/6682840d9286aa59ee3d4181/tasks?page=1&limit=10" \
-H "x-api-key: YOUR_API_KEY"
Response
Success Response (200)
{
"status": "success",
"data": {
"tasks": [
{
"_id": "669b2c93efb8b213a7c72a8e",
"name": "Follow up with John Doe",
"assignedTo": "user123",
"dueDate": "2024-07-10T12:00:00Z",
"reminder": "2024-07-09T12:00:00Z",
"contactId": "6682840d9286aa59ee3d4181"
}
],
"total": 20,
"page": 1
}
}
Retrieve Task by ID
Endpoint
GET /tasks/:taskId
Description
Retrieves a specific task using its ID.
Example Request
curl -X GET "https://api.swipeone.com/api/tasks/669b2c93efb8b213a7c72a8e" \
-H "x-api-key: YOUR_API_KEY"
Response
Success Response (200)
{
"status": "success",
"data": {
"task": {
"_id": "669b2c93efb8b213a7c72a8e",
"name": "Follow up with John Doe",
"assignedTo": "user123",
"dueDate": "2024-07-10T12:00:00Z",
"reminder": "2024-07-09T12:00:00Z",
"contactId": "6682840d9286aa59ee3d4181"
}
}
}
Update a Task
Endpoint
PATCH /tasks/:taskId
Description
Update a task using its ID.
Request Body
Parameter | Type | Required | Description |
|
| No | Updated name of the task. |
|
| No | Updated assigned user. |
|
| No | Updated due date (ISO 8601 format). |
|
| No | Updated reminder date (ISO 8601 format). |
|
| No | Task status ( |
Example Request
curl -X PATCH "https://api.swipeone.com/api/tasks/669b2c93efb8b213a7c72a8e" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Task Name",
"status": "in_progress"
}'
Response
Success Response (200)
{
"status": "success",
"data": {
"task": {
"_id": "669b2c93efb8b213a7c72a8e",
"name": "Updated Task Name",
"assignedTo": "user123",
"status": "in_progress"
"dueDate": "2024-07-10T12:00:00Z",
"reminder": "2024-07-09T12:00:00Z",
"contactId": "6682840d9286aa59ee3d4181"
}
}
}
Retrieve All Tasks (Paginated)
Endpoint
GET /workspaces/:workspaceId/tasks
Description
This endpoint retrieves a paginated list of all tasks within a specified workspace.
Example Request
curl -X GET "https://api.swipeone.com/api/workspaces/6660175570fbd8a9c22bedfb/tasks?page=1&limit=10" \
-H "x-api-key: YOUR_API_KEY"
Response
Success Response (200)
When tasks are successfully retrieved:
{
"status": "success",
"data": {
"total": 50,
"page": 1,
"limit": 10,
"tasks": [
{
"_id": "669b2c93efb8b213a7c72a8e",
"name": "Follow up with John Doe",
"assignedTo": "user123",
"dueDate": "2024-07-10T12:00:00Z",
"reminder": "2024-07-09T12:00:00Z",
"status": "in_progress",
"contactId": "6682840d9286aa59ee3d4181",
"workspaceId": "6660175570fbd8a9c22bedfb",
"createdAt": "2024-07-01T10:25:17.813Z",
"updatedAt": "2024-07-01T10:25:17.813Z"
}
]
}
}
Error Responses
Status Code | Description |
| Invalid input parameters. |
| Unauthorized β API key is missing or invalid. |
| Workspace not found. |
| Internal server error. |
Example Error Response (400)
{
"status": "fail",
"message": "Invalid input parameters"
}
Notes
Supports pagination using
page
andlimit
parameters.Optional filters allow retrieving tasks based on
status
andassignedTo
.Ensure that the
workspaceId
provided exists in the system.