## Save a task's DoD list

`POST /v1/scrum/tasks/:taskId/dod/:typeId`

Writes the Definition of Done checklist items for a Scrum project task under the selected DoD type. The task's saved list is replaced with the items from the request.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|-------|----------|
| `taskId` (path) | number | yes | Task ID. Project task list: [`GET /v1/tasks?filter[groupId]=53`](/docs/entities/tasks/list) |
| `typeId` (path) | number | yes | DoD type ID. List: [`GET /v1/scrum/groups/:groupId/dod/settings`](/docs/scrum/dod/settings), field `data.types[].id` |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|-------|----------|
| `items` | array | yes | The task's checklist items. An empty array clears the list |
| `items[].TITLE` | string | yes | Item text. The field name is uppercase |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/scrum/tasks/3671/dod/7" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "TITLE": "Code reviewed" },
      { "TITLE": "Tests passed" }
    ]
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/scrum/tasks/3671/dod/7" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "TITLE": "Code reviewed" },
      { "TITLE": "Tests passed" }
    ]
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/tasks/3671/dod/7', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    items: [
      { TITLE: 'Code reviewed' },
      { TITLE: 'Tests passed' },
    ],
  }),
})

const { success } = await res.json()
console.log(success)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/tasks/3671/dod/7', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    items: [
      { TITLE: 'Code reviewed' },
      { TITLE: 'Tests passed' },
    ],
  }),
})

const { success } = await res.json()
console.log(success)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data` | string | Empty string |

## Response example

```json
{
  "success": true,
  "data": ""
}
```

## Error response example

422 — no type with this `typeId`:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Could not find the type.",
    "b24Code": "TASKS_SDC_03"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `taskId` or `typeId` is not a positive integer |
| 400 | `INVALID_PARAMS` | `items` is not passed or is not an array |
| 400 | `INVALID_PARAMS` | The body is not a JSON object or contains a field other than `items` |
| 400 | `FST_ERR_CTP_EMPTY_JSON_BODY` | Request with `Content-Type: application/json` and an empty body |
| 401 | `MISSING_API_KEY` | `X-Api-Key` is not passed |
| 401 | `TOKEN_MISSING` | The key has no configured tokens |
| 403 | `SCOPE_DENIED` | The key lacks the `task` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 422 | `BITRIX_ERROR` | No type with this `typeId`. `error.b24Code` is `TASKS_SDC_03`, message "Could not find the type." |
| 422 | `BITRIX_ERROR` | No task with this `taskId`, or an `items` entry without the `TITLE` field. `error.b24Code` is `TASKS_SDC_05`, message "Error saving the list" |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- The API does not check whether the type belongs to the task's project: the list is saved even with the `typeId` of a type from another Scrum project. Take the type ID from the DoD settings of the project that contains the task.

## See also

- [Get DoD settings](/docs/scrum/dod/settings)
- [Save DoD settings](/docs/scrum/dod/save-settings)
- [Check whether a task needs DoD](/docs/scrum/dod/necessary)
- [Definition of Done in Scrum](/docs/scrum/dod)
