
## Get a department

`GET /v1/departments/:id`

Returns a single department by identifier with all its fields.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Department ID |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/departments/47" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/departments/47" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/departments/47', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Department:', data.name, '— head ID', data.headId)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/departments/47', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

The department object with all fields — see [Department fields](/docs/entities/departments/fields).

## Response example

```json
{
  "success": true,
  "data": {
    "id": 47,
    "name": "Sales department",
    "sort": 500,
    "parentId": 1,
    "headId": 99
  }
}
```

## Error response example

404 — department not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "department 9999 not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No department with this ID was found |
| 403 | `SCOPE_DENIED` | The API key does not have the `department` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## See also

- [Department fields](/docs/entities/departments/fields) — all fields
- [Update a department](/docs/entities/departments/update) — changing fields
- [List departments](/docs/entities/departments/list) — search with filters
- [Employees](/docs/entities/users) — find the head or employees of a department
