## Save DoD settings

`POST /v1/scrum/groups/:groupId/dod/types/:typeId/settings`

Sets whether the checklist is required, the checklist items, and the participants of a Definition of Done type in a Scrum project. Items and participants are replaced entirely with the values from the request.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|-------|----------|
| `groupId` (path) | number | yes | Scrum project ID. List: [`GET /v1/workgroups`](/docs/entities/workgroups/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 |
|------|-----|-------|----------|
| `requiredOption` | string | yes | `Y` — the DoD checklist is required for tasks of this type, `N` — it is not |
| `items` | array | yes | Checklist items of the type. An empty array deletes all items |
| `items[].TITLE` | string | yes | Item text. The field name is uppercase |
| `participants` | array | yes | Participants of the type. An empty array deletes all participants |
| `participants[].entityId` | string | yes | `user` |
| `participants[].id` | number | yes | Employee ID. List: [`GET /v1/users`](/docs/entities/users/list) |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/scrum/groups/53/dod/types/7/settings" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requiredOption": "Y",
    "items": [{ "TITLE": "Code reviewed" }, { "TITLE": "Tests passed" }],
    "participants": [{ "entityId": "user", "id": 1 }]
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/scrum/groups/53/dod/types/7/settings" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "requiredOption": "Y",
    "items": [{ "TITLE": "Code reviewed" }, { "TITLE": "Tests passed" }],
    "participants": [{ "entityId": "user", "id": 1 }]
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/groups/53/dod/types/7/settings', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    requiredOption: 'Y',
    items: [{ TITLE: 'Code reviewed' }, { TITLE: 'Tests passed' }],
    participants: [{ entityId: 'user', id: 1 }],
  }),
})

const { data } = await res.json()
console.log(data.type.dodRequired)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/groups/53/dod/types/7/settings', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    requiredOption: 'Y',
    items: [{ TITLE: 'Code reviewed' }, { TITLE: 'Tests passed' }],
    participants: [{ entityId: 'user', id: 1 }],
  }),
})

const { data } = await res.json()
console.log(data.type.dodRequired)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data.type.id` | number | DoD type ID |
| `data.type.entityId` | number | ID of the Scrum project backlog the type belongs to |
| `data.type.name` | string | Type name |
| `data.type.sort` | number | Position of the type in the list |
| `data.type.dodRequired` | string | Saved value of `requiredOption` |
| `data.type.participants` | array | Saved participants in the format `{ "id": 1, "entityId": "user" }` |

## Response example

```json
{
  "success": true,
  "data": {
    "type": {
      "id": 7,
      "entityId": 5,
      "name": "Technical task",
      "sort": 2,
      "dodRequired": "Y",
      "participants": [
        {
          "id": 1,
          "entityId": "user"
        }
      ]
    }
  }
}
```

## 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` | `groupId` or `typeId` is not a positive integer |
| 400 | `INVALID_PARAMS` | `requiredOption` is not passed or is not `Y` or `N` |
| 400 | `INVALID_PARAMS` | `items` or `participants` is not passed or is not an array |
| 400 | `INVALID_PARAMS` | The body is not a JSON object, for example an array |
| 400 | `INVALID_PARAMS` | The body contains a field other than `requiredOption`, `items`, and `participants` |
| 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` | An `items` entry without the `TITLE` field, for example with lowercase `title`. `error.b24Code` is `TASKS_SDC_03`, message "System error" |
| 422 | `BITRIX_ERROR` | An `items` entry is a string, not an object. `error.b24Code` is `0`, message "Internal server error." |
| 422 | `BITRIX_ERROR` | The project does not exist or the user has no access to it. `error.b24Code` is `TASKS_SDC_02` |

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

## Known specifics

- A participant with `"entityId": "department"` is not saved: the request returns success, but `data.type.participants` in the response is empty. Check the saved participants against the response.

## See also

- [Get DoD settings](/docs/scrum/dod/settings)
- [Save a task's DoD list](/docs/scrum/dod/save-list)
- [Definition of Done in Scrum](/docs/scrum/dod)
- [List employees](/docs/entities/users/list)
