---
title: "🔒 Перевод жизненного цикла (статуса и состояния) задачи."
method: POST
path: "/projects/task/switch"
tags: ["Projects: Tasks"]
---

# 🔒 Перевод жизненного цикла (статуса и состояния) задачи.

`POST /projects/task/switch`

## Request

- Base URL: `http://localhost`
- URL: `http://localhost/projects/task/switch`
- Auth: one of:
  - API key in header `sid` and API key in header `rts` and API key in header `sig`
  - HTTP bearer

Перевод жизненного цикла (статуса и состояния) задачи.

**Access:** `authorized` (10 ) · **Scope:** `write`

**Allows:** `task:publish`, `task:work`, `task:pause`, `task:approve`, `task:done`, `task:review`, `task:deploy`, `task:test`, `task:close`, `task:reopen` (все обязательны; проверка в команде по ресурсу из запроса)

### TypeScript (copy-paste)

**`POST /projects/task/switch`**

<details open><summary><b>Params</b></summary>

```typescript
export interface ProjectsTaskSwitchParams {
  ID: string
  transition: TaskTransition
  resolutionType?: TaskResolutionType | null
  resolutionNote?: string | null
}
```

</details>

<details open><summary><b>Body</b></summary>

```typescript
export interface ProjectsTaskSwitchBody {
  comment?: {
  text: string
  mentioned?: Record<string, any> | null
  attachments?: Array<any> | null
} | null
}
```

</details>

<details open><summary><b>Response</b></summary>

```typescript
export type ProjectsTaskSwitchResponse = IServerResponse<Task>

export interface IServerResponse<T = any> {
  code: number
  data: T
  srvTS: number
  rkey: string
}
```

</details>

> Полный файл типов: [`/docs/types`](/docs/types) · raw: [`/docs/api-types.ts`](/docs/api-types.ts)

## Query parameters

- `ID` string, uuid, required
- `transition` 1 | 2 | 3 | 20 | 30 | 40 | 50 | 60 | 100 | 110 | 120, required: `work` = 1, `pause` = 2, `wait` = 3, `publish` = 20, `accept` = 30, `decline` = 40, `testing` = 50, `reject` = 60, `done` = 100, `close` = 110, `reopen` = 120
- `resolutionType` 0 | 1 | 2 | 3 | 4: `resolved` = 0, `notDoing` = 1, `notReproducible` = 2, `notBug` = 3, `duplicate` = 4
- `resolutionNote` string, nullable

## Headers

- `devID` string, uuid, required
- `tz` string, required
- `app` string, required
- `appVer` string, required
- `rKey` string

## Request body

- ProjectsTaskSwitchBody: JSON body for `projects/task/switch`
  - `comment` object, nullable
    - `text` string, required
    - `mentioned` object, nullable
    - `attachments` unknown[], nullable
      - unknown

## Response `200`

OK — `IServerResponse<Task>`

- object
  - `code` integer, required
  - `data` Task, required: Entity `Task` (table: Task )
    - `cID` string, uuid, required
    - `projectID` string, uuid, required
    - `productID` string, uuid, required
    - `versionID` string, uuid, nullable
    - `featureID` string, uuid, nullable
    - `ID` string, uuid, required
    - `status` 0 | 110 | 120 | 130 | 140 | 150 | 200, required: `draft` = 0, `approval` = 110, `work` = 120, `review` = 130, `deployment` = 140, `testing` = 150, `closed` = 200
    - `state` -1 | 0 | 1 | 10, required: `waiting` = -1, `pause` = 0, `work` = 1, `closed` = 10
    - `category` 1 | 3 | 6 | 9, required: `common` = 1, `dev` = 3, `qa` = 6, `bug` = 9
    - `type` 11 | 12 | 13 | 14 | 15 | 16 | 19 | 31 | 32 | 33 | 34 | 35 | 61 | 62 | 63 | 64 | 91 | 93 | 95 | 97 | 99, required: `planning` = 11, `analysis` = 12, `design` = 13, `research` = 14, `education` = 15, `documentation` = 16, `other` = 19, `frontend` = 31, `backend` = 32, `devops` = 33, `tests` = 34, `fullstack` = 35, `freetest` = 61, `smoke` = 62, `regression` = 63, `testcase` = 64, `bug_trivial` = 91, `bug_minor` = 93, `bug_major` = 95, `bug_critical` = 97, `bug_block` = 99
    - `priority` -10 | 0 | 1 | 10 | 20, required: `postponed` = -10, `unset` = 0, `inOrder` = 1, `important` = 10, `urgent` = 20
    - `urgently` integer, nullable
    - `title` string, required
    - `searchTitle` string, required
    - `key` integer, required
    - `currentAssignee` string, required
    - `ord` integer, required: Unix timestamp in milliseconds
    - `spec` string, required
    - `gist` string, nullable
    - `modules` object, nullable
    - `components` object, nullable
    - `approvalAssignee` string, nullable
    - `workAssignee` string, required
    - `workIterationKey` integer, nullable
    - `workTimePlan` integer, nullable
    - `workEvaluation` number, nullable
    - `reviewAssignee` string, nullable
    - `testAssignee` string, nullable
    - `resolutionVersionID` string, uuid, nullable
    - `resolutionType` 0 | 1 | 2 | 3 | 4: `resolved` = 0, `notDoing` = 1, `notReproducible` = 2, `notBug` = 3, `duplicate` = 4
    - `resolutionNote` string, nullable
    - `result` string, nullable
    - `meta` object, nullable
    - `git` object, nullable
    - `createDT` string, date-time, required
    - `creatorUID` string, uuid, required
    - `stage` 0 | 10 | 20 | 30 | 40 | 100, required: `dev` = 0, `alpha` = 10, `betta` = 20, `rc` = 30, `hotfix` = 40, `prod` = 100
    - `browser` 0 | 10 | 20 | 30 | 40 | 50 | 60: `any` = 0, `chrome` = 10, `safari` = 20, `opera` = 30, `edge` = 40, `firefox` = 50, `yandex` = 60
    - `bugType` 10 | 20 | 30 | 40: `ui` = 10, `fn` = 20, `ux` = 30, `spec` = 40
    - `build` string, nullable
    - `devices` unknown[], nullable
      - unknown
    - `labels` unknown[], nullable
      - unknown
    - `fuzzy` boolean, nullable
    - `updTS` integer, required: Unix timestamp in milliseconds
    - `isDeleted` boolean, nullable
    - `deletedTS` integer, nullable
    - `updUID` string, required
    - `rejectUID` string, nullable
    - `rejectTS` integer, nullable
  - `srvTS` integer, required: Server timestamp (ms)
  - `rkey` string, required: Request key

## Other responses

- `400`: BadRequest / Validation — неверные params/body/headers
- `401`: Unauthorized: Active user session required
- `403`: AccessNotAllowed: privilegeRequired - no privilege of the transition to the task (params.allow)
- `404`: NotFound: Specified task ID does not exist
- `406`: TimeResync — расхождение rts с сервером
- `422`: UnprocessableContent: Transition is not possible in the current task state or archived product

---

[API](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api.md) · [All operations](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api/revisions/a143b51ba29a?raw)
