# Subtasks and duplicates

## Subtasks

A to-do can hold a short checklist: "call the clinic", "print the form", "book the taxi". Each subtask is a title and a tick. It has no date, tag, priority or note of its own, and it never appears in a view, a count or a progress pie. Search does find a to-do by its subtask titles.

Every to-do carries `subtasks`, in order, `[]` when there are none:

```json
"subtasks": [
  { "id": "6f1c0a52-…", "title": "call the clinic", "done": true },
  { "id": "0b7e9d13-…", "title": "print the form", "done": false }
]
```

A subtask's `id` is a lowercase UUID and stays the same for its life.

### Changing one subtask

Add one at the end, or right after another with `after`:

```bash
curl -s "https://api.inittasks.com/v1/todos/$TODO/subtasks" \
  -H "Authorization: Bearer $INITTASKS_TOKEN" -H "Content-Type: application/json" \
  -d '{"title": "book the taxi"}'
```

| call | what it does |
|---|---|
| `POST /v1/todos/{id}/subtasks` | add one: `title`, optional `after` |
| `PATCH /v1/todos/{id}/subtasks/{subtaskId}` | rename (`title`), tick (`done`), or move (`after`: an id, or `null` for first) |
| `DELETE /v1/todos/{id}/subtasks/{subtaskId}` | remove it |
| `POST /v1/todos/{id}/subtasks/{subtaskId}/promote` | make it a to-do of its own |

Adding and changing one answer `{ "subtask", "todo" }`: the subtask, and the to-do with its whole list. Removing one answers the to-do. Promoting one answers `{ "todo", "from" }`: the new to-do, and the one it came from without the subtask. An unknown subtask id is [not_found](/errors/not_found).

### Replacing the list

`PATCH /v1/todos/{id}` with `subtasks` replaces the whole list. Keep an item's `id` to keep it; leave the `id` out on a new one. `[]` or `null` clears it. `POST /v1/todos` takes the same field.

### Rules

- At most 50 subtasks per to-do, and at most 10,000 bytes together.
- A title is one line of at most 120 characters, trimmed, not blank. A line break becomes a space. A longer title is refused rather than cut.
- Ticking the last open subtask does not complete the to-do. Completing the to-do leaves its open subtasks unticked.
- A repeating to-do's completed copy keeps its ticks; the next occurrence starts with every subtask unticked.
- **Make it a to-do** (`/promote`): a new open to-do titled as the subtask, right after its parent, in the same project, heading and day. The subtask leaves the list.

## Duplicating a to-do

`POST /v1/todos/{id}/duplicate` makes the apps' `duplicate`: a new open to-do right after the original, in the same project and under the same heading.

```bash
curl -s -X POST "https://api.inittasks.com/v1/todos/$TODO/duplicate" \
  -H "Authorization: Bearer $INITTASKS_TOKEN"
```

The copy carries the title, subtitle, description, tags, dates, time, length, reminders, priority, colour and repeat rule. Its subtasks are copied unticked, with new ids. It never carries a completion or a trash stamp: a done to-do's copy is open. The body is optional: `{ "id": "…" }` chooses the copy's id, and an `Idempotency-Key` makes a retry safe.

## MCP

| task | tool |
|---|---|
| read a to-do with its checklist | `get_todo` |
| add, rename, tick, move, remove one | `add_subtask`, `update_subtask`, `delete_subtask` |
| make one a to-do | `subtask_to_todo` |
| replace the list | `subtasks` on `create_todo` / `update_todo` |
| duplicate | `duplicate_todo`, or `bulk_update_todos` with `duplicate` |

The MCP tools take a subtask by its id or its exact title.
