
## Rename calendar resource

`PATCH /v1/calendar-resources/:id`

Changes the name of a calendar resource.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Resource ID. List: [`GET /v1/calendar-resources`](./list.md) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `name` | string | yes | New resource name. Any other field in the body is rejected with `400 READONLY_FIELD` |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/calendar-resources/285" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Meeting room 2, third floor"}'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/calendar-resources/285" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Meeting room 2, third floor"}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/calendar-resources/285', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Meeting room 2, third floor' }),
})

const { success, data } = await res.json()
console.log('New name:', data.name)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/calendar-resources/285', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Meeting room 2, third floor' }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | The resource after the change. Its fields are the `data.*` rows below |
| `data.id` | number | Resource ID |
| `data.name` | string | Resource name after the change |
| `data.createdBy` | number | ID of the employee who created the resource. List: [`GET /v1/users`](/docs/entities/users) |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 285,
    "name": "Meeting room 2, third floor",
    "createdBy": 1295
  }
}
```

## Error response example

404 — no resource with this ID:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Calendar record not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `MISSING_REQUIRED_FIELDS` | `name` is not passed or is an empty string |
| 400 | `READONLY_FIELD` | The body contains fields other than `name` |
| 400 | `INVALID_PARAMS` | `id` is not a positive integer |
| 404 | `ENTITY_NOT_FOUND` | No resource with this `id` in the resource list |
| 422 | `BITRIX_ERROR` | Bitrix24 did not confirm the rename or did not save the new name |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The API key is in read-only mode — writes are forbidden |
| 403 | `SCOPE_DENIED` | The API key does not have the `calendar` scope |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied the key owner permission to change the resource |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not passed |
| 429 | `RATE_LIMITED` | Rate limit exceeded |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a malformed resource list |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time |

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

## Known specifics

**No batch rename.** `POST /v1/calendar-resources/batch` with the `update` action is rejected with `400 ACTION_NOT_SUPPORTED`. Rename each resource with a separate call to this method.

## See also

- [List calendar resources](./list.md)
- [Create calendar resource](./create.md)
- [Delete calendar resource](./delete.md)
- [Calendar resources](/docs/entities/calendar-resources)
