# Tasks

Follow-up work items, anchored to a lead and owned by a person.

Source: https://docs.leadarc.io/reference-tasks.html

- [GET /v1/workspaces/{ws}/tasks](#get-v1-workspaces-ws-tasks)
- [POST /v1/workspaces/{ws}/tasks](#post-v1-workspaces-ws-tasks)
- [PATCH /v1/workspaces/{ws}/tasks/{id}](#patch-v1-workspaces-ws-tasks-id)
- [POST /v1/workspaces/{ws}/tasks/{id}/complete](#post-v1-workspaces-ws-tasks-id-complete)
- [DELETE /v1/workspaces/{ws}/tasks/{id}](#delete-v1-workspaces-ws-tasks-id)

## GET /v1/workspaces/{ws}/tasks

`tasks:read` · read bucket · returns list of task

Tasks, filterable by lead, assignee, due date, status

```bash
curl -sS https://api.leadarc.io/v1/workspaces/airpay/tasks?limit=25 \
  -H "Authorization: Bearer $LEADARC_API_KEY"
```

**Query parameters.** Anything else is [`400 unsupported_filter`](errors.html#status-400).

`assignee_id` `cursor` `due_after` `due_before` `lead_id` `limit` `order` `status` `task_type`

**Errors from this endpoint**, on top of the [common ones](errors.html): [`invalid_cursor`](errors.html#status-400), [`invalid_request`](errors.html#status-400), [`not_found`](errors.html#status-404), [`unprocessable`](errors.html#status-422).

```json
{
  "object": "list",
  "data": [{
    "object": "task",
    "id": "tsk_i-_uD-R7uXULK8lecjVGbgq71OpftiUkqXfdvx",
    "workspace": "airpay",
    "lead_id": "lead_BP2vnPmKyttNP2OlH_mWL78t1o6nBVC6oVbHny",
    "reply_id": "rep_Dk9dw7dVABGNJm9HK9onvZKXLneRRpj9MIB-C3",
    "title": null,
    "notes": "Send the onboarding one-pager and the Loom.",
    "task_type": null,
    "due_date": "2026-07-29",
    "due_time": "10:30",
    "status": "open",
    "creator_id": "usr_zaDRRpdu8EPZSU3i89lvZgKPkVQo4uBFA_KOhm",
    "assignee_id": "usr_zaDRRpdu8EPZSU3i89lvZgKPkVQo4uBFA_KOhm",
    "completed_at": null,
    "created_at": "2026-07-27T09:30:00Z",
    "sequence": null
  }],
  "has_more": false,
  "next_cursor": null
}
```
**Notes.**

1. **`tasks` has no `client_id` column.** Every query derives the tenant through `tasks.response_id` → `responses_index.client_id`, and adds `isNotNull(tasks.response_id)` unconditionally. `response_id` is nullable so a task can hang off a CRM `company_id` instead. The CRM is dead but the rows exist, and a company-anchored task has no lead, no reply, and no workspace derivable this way. Those rows are invisible to the API.

2. **`tasks` has no `status` column.** Status is derived: open is `completed_at IS NULL AND deleted_at IS NULL`. `deleted_at` rows are filtered out and never surfaced as a status.

3. **`tasks` has no `title` column.** `title` is present in the object for shape stability and is **always `null` for a manually created task**. The only source is `followup_sequence_steps.title`, so it is populated only on a task materialized by a sequence. `POST` and `PATCH` reject `title` with `400 invalid_request` rather than accepting it and dropping it.

4. **`due_time` is a wall-clock `text` string in the viewer's local timezone**, not an instant. `tasks.due_time` is `text` holding `"HH:MM"` in 24-hour form. `tasks.due_date` is a `date` column with `mode:"date"`, a calendar day. A task with `due_date: "2026-07-29"` and `due_time: null` is due by calendar day only.

5. **[`sequence`](objects.html#sequence) is the only sanctioned view of the materialization internals.** When a task came from a sequence it is `{ "id": "seq_…", "name": "Interested follow-up", "step_index": 2 }`. The raw `sequence_id`, `enrollment_id`, `sequence_step_id`, `email_template_id`, `email_body`, and `linkedin_text` columns are withheld.

## POST /v1/workspaces/{ws}/tasks

`tasks:write` · write bucket · returns task

Create a task on a lead

```bash
curl -sS https://api.leadarc.io/v1/workspaces/airpay/tasks \
  -X POST \
  -H "Authorization: Bearer $LEADARC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lead_id":"lead_BP2vnPmKyttNP2OlH_mWL78t1o6nBVC6oVbHny","due_date":"...","due_time":"..."}'
```

**Body fields.** An unknown field is rejected.

`lead_id` `due_date` `due_time` `notes` `assignee_id`

**Errors from this endpoint**, on top of the [common ones](errors.html): `invalid_cursor`, `invalid_request`, `not_found`, `unprocessable`.

```json
{
  "lead_id": "lead_BP2vnPmKyttNP2OlH_mWL78t1o6nBVC6oVbHny",
  "due_date": "2026-07-29",
  "due_time": "10:30",
  "notes": "Send the onboarding one-pager and the Loom.",
  "assignee_id": "usr_zaDRRpdu8EPZSU3i89lvZgKPkVQo4uBFA_KOhm"
}
```
`201` with the created [`task`](objects.html#task). `creator_id` is the key's owner.

`assignee_id` is validated against the workspace's assignable members. `company_id` and `opportunity_id` are never accepted.

**Not idempotent.** A retry creates a second task.

## PATCH /v1/workspaces/{ws}/tasks/{id}

`tasks:write` · write bucket · returns task

Edit due date, time, notes, assignee

```bash
curl -sS https://api.leadarc.io/v1/workspaces/airpay/tasks/tsk_i-_uD-R7uXULK8lecjVGbgq71OpftiUkqXfdvx \
  -X PATCH \
  -H "Authorization: Bearer $LEADARC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"due_date":"...","due_time":"...","notes":"..."}'
```

**Body fields.** An unknown field is rejected.

`due_date` `due_time` `notes` `assignee_id`

**Errors from this endpoint**, on top of the [common ones](errors.html): `invalid_request`, `not_found`.

## POST /v1/workspaces/{ws}/tasks/{id}/complete

`tasks:write` · write bucket · returns task

Complete a task

```bash
curl -sS https://api.leadarc.io/v1/workspaces/airpay/tasks/tsk_i-_uD-R7uXULK8lecjVGbgq71OpftiUkqXfdvx/complete \
  -X POST \
  -H "Authorization: Bearer $LEADARC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"completed":"..."}'
```

**Body fields.** An unknown field is rejected.

`completed`

**Errors from this endpoint**, on top of the [common ones](errors.html): `invalid_request`.

## DELETE /v1/workspaces/{ws}/tasks/{id}

`tasks:write` · write bucket · returns task

Soft-delete a task

```bash
curl -sS https://api.leadarc.io/v1/workspaces/airpay/tasks/tsk_i-_uD-R7uXULK8lecjVGbgq71OpftiUkqXfdvx \
  -X DELETE \
  -H "Authorization: Bearer $LEADARC_API_KEY"
```

**Errors from this endpoint**, on top of the [common ones](errors.html): `invalid_request`, `not_found`.

There is no hard delete for anything in this API.

---

---

Base URL `https://api.leadarc.io/v1`. Generated from the API source.
