
## Move node

`POST /v1/humanresources/nodes/:id/move`

Moves an organizational structure node under a different parent node in the tree. After the move, the node and all its child nodes inherit the new parent.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Identifier of the node being moved. List: `GET /v1/humanresources/nodes?type=DEPARTMENT` |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `parentId` | number | yes | Identifier of the new parent node. List: `GET /v1/humanresources/nodes?type=DEPARTMENT` |

## Examples

### curl — personal key

```bash
curl -X POST -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"parentId": 17}' \
  https://vibecode.bitrix24.com/v1/humanresources/nodes/39/move
```

### curl — OAuth application

```bash
curl -X POST -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"parentId": 17}' \
  https://vibecode.bitrix24.com/v1/humanresources/nodes/39/move
```

### JavaScript — personal key

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/humanresources/nodes/39/move',
  {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ parentId: 17 }),
  }
)
const body = await res.json()
console.log(body.data.parentId)
```

### JavaScript — OAuth application

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/humanresources/nodes/39/move',
  {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ parentId: 17 }),
  }
)
const body = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data.id` | number | Identifier of the moved node |
| `data.name` | string | Node name |
| `data.type` | string | Node type: `DEPARTMENT` or `TEAM` |
| `data.structureId` | number | Organizational structure identifier |
| `data.parentId` | number | Identifier of the new parent node |
| `data.description` | string \| null | Node description |
| `data.accessCode` | string | Node access code |
| `data.userCount` | number | Number of employees in the node |
| `data.colorName` | string \| null | Node color |
| `data.xmlId` | string \| null | External identifier |
| `data.createdAt` | string \| null | Creation date |
| `data.updatedAt` | string \| null | Modification date |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 39,
    "name": "Sales department",
    "type": "DEPARTMENT",
    "structureId": 1,
    "parentId": 17,
    "description": "Direct sales group",
    "accessCode": "SN39",
    "userCount": 0,
    "colorName": "blue",
    "xmlId": null,
    "createdAt": null,
    "updatedAt": null
  }
}
```

## Error response example

400 — invalid node identifier in the path:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "id must be a positive integer"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | The node identifier in the path is not a positive integer |
| 403 | `SCOPE_DENIED` | The key is missing the `humanresources` scope |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |

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

## Known specifics

- The move response contains the node record without a `members` field. To get the node's employee list after the move, call [`GET /v1/humanresources/nodes/:id`](/docs/humanresources/nodes/get).

## See also

- [Child nodes](/docs/humanresources/node-operations/children)
- [Node communication channels](/docs/humanresources/node-operations/communications-get)
- [Node operations](/docs/humanresources/node-operations)
