---
title: "Update a subtask"
method: PATCH
path: "/api/subtasks/{subtaskId}"
tags: ["Subtasks"]
---

# Update a subtask

`PATCH /api/subtasks/{subtaskId}`

## Request

- Base URL: `https://tre-app.com`
- URL: `https://tre-app.com/api/subtasks/{subtaskId}`
- Auth: HTTP bearer

When the body sets both `startDate` and `endDate`, `endDate` must be >= `startDate`. The merged planned dates must stay inside the card's plan, which must carry both planned dates (400, `details.rule` `CARD_HAS_NO_DATES` or `SUBTASK_OUT_OF_RANGE`, naming the plan and the offending date); actual dates are independent.

## Request body

- SubtaskUpdate
  - `title` string
  - `startDate` string, date, nullable
  - `endDate` string, date, nullable
  - `scheduleState` 'unclassified' | 'planned' | 'suspended' | 'cancelled': Meaning of the retained schedule; one server rule on every surface. Omit it: a create with a planned date is stored as planned, one without as unclassified; on update, touching a planned date promotes unclassified to planned, clearing both planned dates resets to unclassified, any other stored state is kept. Send suspended or cancelled explicitly; a non-unclassified state with both planned dates null is refused (400 BAD_REQUEST).
  - `actualStartDate` string, date, nullable: Observed start, explicitly recorded from evidence. Independent of the schedule; null means unknown, never not started.
  - `actualEndDate` string, date, nullable: Observed end, explicitly recorded from evidence. May fall outside the plan. Null means unknown, never incomplete.
  - `color` string

## Response `200`

Success

- Subtask
  - `id` string, uuid, required
  - `cardId` string, uuid, required
  - `title` string, required
  - `startDate` string, date, nullable, required
  - `endDate` string, date, nullable, required
  - `scheduleState` 'unclassified' | 'planned' | 'suspended' | 'cancelled', required: Meaning of the retained schedule. Unclassified means its intent has not been reviewed; suspended/cancelled retain the plan for retrospective comparison.
  - `actualStartDate` string, date, nullable, required: Observed start, explicitly recorded from evidence. Independent of the schedule; null means unknown, never not started.
  - `actualEndDate` string, date, nullable, required: Observed end, explicitly recorded from evidence. May fall outside the plan. Null means unknown, never incomplete.
  - `order` integer, required
  - `color` string, required
  - `createdAt` string, date-time, required

## Other responses

- `400`: Invalid request
- `401`: Unauthenticated
- `403`: Forbidden: insufficient role or token scope; scope denials name the held scope and the operation
- `404`: Not found
- `409`: Conflict
- `429`: Rate limited
- `500`: Internal server error
- `503`: Temporarily unavailable

---

[API](https://skmtc.dev/tre-app/apis/tre-rest-api.md) · [All operations](https://skmtc.dev/tre-app/apis/tre-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/tre-app/apis/tre-rest-api/revisions/26a7187a05fc?raw)
