KasarKasar Docs
API Reference

Tasks

Create, list, update, complete, and delete tasks. Link tasks to CRM records, filter by assignee or priority, and track completion stats.

Tasks represent actions to be completed by your team: calls to make, emails to send, meetings to schedule. Each task can be linked to one or more CRM records (contacts, companies, opportunities) and assigned to a workspace user.

List Tasks

GET /api/v1/tasks

Returns a paginated list of tasks matching the given filters.

Query Parameters

ParameterTypeDefaultDescription
modestring--Preset filter: all, today, overdue, upcoming, completed
assigned_tostring--Filter by assignee UUID
prioritystring--Filter by priority: low, medium, high
action_typestring--Filter by type: call, email, meeting, linkedin_message, whatsapp_message
linked_entity_idstring--Filter tasks linked to a specific entity
linked_entity_typestring--Entity type: contacts, companies, opportunities
filtersstring--JSON-encoded FilterGroup for advanced filtering
sortstring--JSON array for multi-field sorting. When provided, sort_by and sort_dir are ignored.
sort_bystringdue_dateSingle field to sort by (used only when sort is absent or not valid JSON)
sort_dirstringascSort direction: asc or desc (used only with sort_by)
cursorstring--Pagination cursor from a previous response
limitnumber20Number of results per page (max 100)

Example

curl -X GET "https://kasar.app/api/v1/tasks?mode=today&assigned_to=550e8400-e29b-41d4-a716-446655440000&limit=20" \
  -H "Authorization: Bearer ksr_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json"

Response:

{
  "data": [
    {
      "id": "7a1b2c3d-4e5f-6789-abcd-ef0123456789",
      "title": "Follow up with Alice about renewal",
      "due_date": "2025-03-15T09:00:00Z",
      "priority": "high",
      "action_type": "call",
      "is_completed": false,
      "assigned_to_id": "550e8400-e29b-41d4-a716-446655440000",
      "created_at": "2025-03-10T14:22:00Z",
      "updated_at": "2025-03-10T14:22:00Z"
    }
  ],
  "total": 12,
  "nextCursor": "eyJpZCI6IjdhMWIyYzNk..."
}

The list endpoint returns task fields as stored in the database. Many-to-many links (e.g., linked contacts or companies) are not enriched in GET responses. Use linked_entity_id and linked_entity_type query parameters to filter tasks by their links instead. The linked_entities field is an input parameter for POST and PUT only.

Filtering by Mode

The mode parameter applies common preset filters:

ModeDescription
allAll tasks regardless of status or date
todayTasks due today that are not completed
overdueTasks past their due date that are not completed
upcomingTasks due in the future that are not completed
completedOnly completed tasks

Create a Task

POST /api/v1/tasks

Creates a new task and optionally links it to CRM records.

Request Body

FieldTypeRequiredDescription
titlestringYesTask title
due_datestringNoISO 8601 date/time
prioritystringNolow, medium, or high
assigned_to_idstringNoUUID of the workspace user to assign
action_typestringNocall, email, meeting, linkedin_message, whatsapp_message
linked_entitiesarrayNoArray of { id, type } objects to link

Example

curl -X POST "https://kasar.app/api/v1/tasks" \
  -H "Authorization: Bearer ksr_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Call Alice about contract renewal",
    "due_date": "2025-03-15T09:00:00Z",
    "priority": "high",
    "action_type": "call",
    "assigned_to_id": "550e8400-e29b-41d4-a716-446655440000",
    "linked_entities": [
      { "id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "contacts" }
    ]
  }'

Response (201):

{
  "task_id": "7a1b2c3d-4e5f-6789-abcd-ef0123456789",
  "action": "created"
}

When a task is assigned to a user other than the creator, a task_assigned notification is sent automatically to the assignee.

Update a Task

PUT /api/v1/tasks/{id}

Updates one or more fields on an existing task. Only include the fields you want to change.

Request Body

FieldTypeDescription
titlestringUpdated task title
due_datestringUpdated due date (ISO 8601)
prioritystringlow, medium, or high
assigned_to_idstringNew assignee UUID
action_typestringUpdated action type
linked_entitiesarrayReplace linked entities with this list

Example

curl -X PUT "https://kasar.app/api/v1/tasks/7a1b2c3d-4e5f-6789-abcd-ef0123456789" \
  -H "Authorization: Bearer ksr_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "priority": "medium",
    "due_date": "2025-03-20T09:00:00Z"
  }'

Response:

{
  "task_id": "7a1b2c3d-4e5f-6789-abcd-ef0123456789",
  "action": "updated"
}

Passing linked_entities replaces all existing links. To keep current links, include them in the array alongside any new ones.

Complete or Reopen a Task

PUT /api/v1/tasks/{id}/complete

Marks a task as completed, or reopens a previously completed task.

Request Body

FieldTypeDefaultDescription
completedbooleantrueSet to false to reopen a completed task

Example: Complete

curl -X PUT "https://kasar.app/api/v1/tasks/7a1b2c3d-4e5f-6789-abcd-ef0123456789/complete" \
  -H "Authorization: Bearer ksr_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{ "completed": true }'

Response:

{
  "task_id": "7a1b2c3d-4e5f-6789-abcd-ef0123456789",
  "action": "completed"
}

Example: Reopen

curl -X PUT "https://kasar.app/api/v1/tasks/7a1b2c3d-4e5f-6789-abcd-ef0123456789/complete" \
  -H "Authorization: Bearer ksr_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{ "completed": false }'

Response:

{
  "task_id": "7a1b2c3d-4e5f-6789-abcd-ef0123456789",
  "action": "reopened"
}

Completing a task automatically sets completed_at to the current timestamp and completed_by to the authenticated user. Reopening clears both fields. A task_completed notification is sent to relevant users.

Delete a Task

DELETE /api/v1/tasks/{id}

Permanently deletes a task and removes all entity links.

Example

curl -X DELETE "https://kasar.app/api/v1/tasks/7a1b2c3d-4e5f-6789-abcd-ef0123456789" \
  -H "Authorization: Bearer ksr_a1b2c3d4e5f6..."

Response (204): No content.

Task Stats

GET /api/v1/tasks/stats

Returns aggregated statistics about the authenticated user's tasks.

Example

curl -X GET "https://kasar.app/api/v1/tasks/stats" \
  -H "Authorization: Bearer ksr_a1b2c3d4e5f6..."

Response:

{
  "total": 48,
  "completedToday": 3,
  "remainingToday": 5,
  "overdue": 2,
  "thisWeek": 12,
  "completionRate": 72
}
FieldDescription
totalTotal number of tasks across all statuses
completedTodayTasks completed today
remainingTodayIncomplete tasks due today
overdueIncomplete tasks past their due date
thisWeekTasks due this week (completed and incomplete)
completionRatePercentage of completed tasks (0 to 100, rounded integer)

Error Responses

Task Not Found

{
  "error": true,
  "code": "RECORD_NOT_FOUND",
  "message": "Task not found"
}

Validation Error

{
  "error": true,
  "code": "VALIDATION_ERROR",
  "message": "Field 'priority' must be one of: low, medium, high"
}

On this page