Skip to main content

Tasks API

Base path: /tasks

All endpoints require JWT authentication and @RequirePermission('tasks', 'action').

Lookups

Task types, statuses, and priorities are configurable. Each supports CRUD and reordering.

Types

MethodPathDescription
GET/tasks/lookups/typesList task types
POST/tasks/lookups/typesCreate type
PUT/tasks/lookups/types/:idUpdate type
DELETE/tasks/lookups/types/:idDelete type
PUT/tasks/lookups/types/reorderReorder types
// GET /tasks/lookups/types
[
{ "id": "type-uuid", "name": "Call", "color": "#3b82f6", "position": 1 },
{ "id": "type-uuid", "name": "Email", "color": "#10b981", "position": 2 },
{ "id": "type-uuid", "name": "Meeting", "color": "#f59e0b", "position": 3 },
{ "id": "type-uuid", "name": "Follow-up", "color": "#8b5cf6", "position": 4 }
]

Statuses

MethodPath
GET/tasks/lookups/statuses
POST/tasks/lookups/statuses
PUT/tasks/lookups/statuses/:id
DELETE/tasks/lookups/statuses/:id
PUT/tasks/lookups/statuses/reorder
[
{ "id": "status-uuid", "name": "Not Started", "color": "#6b7280", "position": 1, "isDefault": true },
{ "id": "status-uuid", "name": "In Progress", "color": "#3b82f6", "position": 2 },
{ "id": "status-uuid", "name": "Completed", "color": "#10b981", "position": 3, "isCompleted": true }
]

Priorities

MethodPath
GET/tasks/lookups/priorities
POST/tasks/lookups/priorities
PUT/tasks/lookups/priorities/:id
DELETE/tasks/lookups/priorities/:id
PUT/tasks/lookups/priorities/reorder

Settings

GET /tasks/settings/:key

Get a task setting by key.

{ "key": "default_due_days", "value": 7 }

PUT /tasks/settings/:key

Update a task setting. Requires @AdminOnly().

{ "value": 14 }

Dashboard Widgets

GET /tasks/dashboard/upcoming

Get upcoming tasks for the current user.

GET /tasks/dashboard/upcoming?days=7&limit=10
[
{
"id": "task-uuid",
"title": "Follow up with Globex",
"typeName": "Call",
"priorityName": "High",
"dueDate": "2025-01-22T09:00:00Z",
"entityType": "leads",
"entityId": "lead-uuid",
"entityName": "Alice Johnson"
}
]

GET /tasks/dashboard/counts

{
"overdue": 3,
"dueToday": 5,
"dueThisWeek": 12,
"completed": 45,
"total": 65
}

Entity Tasks

GET /tasks/entity/:entityType/:entityId

Get all tasks linked to a specific entity.

GET /tasks/entity/leads/lead-uuid
[
{
"id": "task-uuid",
"title": "Send proposal",
"typeName": "Email",
"statusName": "In Progress",
"priorityName": "High",
"assignedTo": "user-uuid",
"assignedToName": "John Doe",
"dueDate": "2025-01-25T17:00:00Z",
"createdAt": "2025-01-20T10:00:00Z"
}
]

Core CRUD

POST /tasks

{
"title": "Send proposal to Globex",
"description": "Include enterprise pricing and implementation timeline",
"typeId": "type-uuid",
"statusId": "status-uuid",
"priorityId": "priority-uuid",
"assignedTo": "user-uuid",
"dueDate": "2025-01-25T17:00:00Z",
"entityType": "opportunities",
"entityId": "opp-uuid",
"reminderAt": "2025-01-25T09:00:00Z"
}

GET /tasks

GET /tasks?page=1&limit=25&statusId=uuid&priorityId=uuid&assignedTo=uuid&entityType=leads&overdue=true

Query Parameters:

ParamTypeDescription
searchstringSearch in title and description
statusIdUUIDFilter by status
priorityIdUUIDFilter by priority
typeIdUUIDFilter by type
assignedToUUIDFilter by assigned user
entityTypestringFilter by linked entity type
entityIdUUIDFilter by linked entity
overduebooleanOnly overdue tasks
dueBeforedateDue before date
dueAfterdateDue after date

GET /tasks/:id

PUT /tasks/:id

DELETE /tasks/:id

POST /tasks/:id/complete

Mark a task as completed.

{
"completionNotes": "Proposal sent and acknowledged by client"
}

Response:

{
"id": "task-uuid",
"title": "Send proposal to Globex",
"statusName": "Completed",
"completedAt": "2025-01-24T16:00:00Z",
"completedBy": "user-uuid"
}

POST /tasks/:id/reopen

Reopen a completed task.

Subtasks

GET /tasks/:id/subtasks

[
{
"id": "subtask-uuid",
"title": "Draft pricing section",
"isCompleted": true,
"completedAt": "2025-01-23T10:00:00Z"
},
{
"id": "subtask-uuid",
"title": "Get manager approval",
"isCompleted": false,
"completedAt": null
}
]

POST /tasks/:id/subtasks

{
"title": "Review proposal with legal team"
}

Notes, Activities, History

  • GET /tasks/:id/notes
  • POST /tasks/:id/notes
  • GET /tasks/:id/activities
  • GET /tasks/:id/history