For AI agents: markdown of this page — /docs-content-en/infra/work-schedules/update.md documentation index — /llms.txt
Update a schedule
PATCH /v1/work-schedules/:id
Changes the name, time zone or windows of a custom schedule. The library is shared across the Bitrix24 account, so new windows apply at once to every server assigned to the schedule, and the edit carries a version number so as not to overwrite someone else's.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | yes | ID of a custom schedule. Source — data[].id from the schedule list |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
version |
number | yes | The version you read. Source — version in the list or in get a schedule |
name |
string | no | New name, from 1 to 80 characters |
timezone |
string | no | New IANA time zone |
windows |
array | no | New windows { isoDay, start, end } — they replace the previous ones entirely. Window rules are on the section index |
Examples
curl — personal key
curl -X PATCH https://vibecode.bitrix24.com/v1/work-schedules/WORK_SCHEDULE_ID \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version": 2,
"windows": [
{ "isoDay": 1, "start": "08:00", "end": "17:00" },
{ "isoDay": 2, "start": "08:00", "end": "17:00" }
]
}'
curl — OAuth application
curl -X PATCH https://vibecode.bitrix24.com/v1/work-schedules/WORK_SCHEDULE_ID \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"version": 2,
"windows": [
{ "isoDay": 1, "start": "08:00", "end": "17:00" },
{ "isoDay": 2, "start": "08:00", "end": "17:00" }
]
}'
JavaScript — personal key
const res = await fetch(
`https://vibecode.bitrix24.com/v1/work-schedules/${workScheduleId}`,
{
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
version: 2,
windows: [
{ isoDay: 1, start: '08:00', end: '17:00' },
{ isoDay: 2, start: '08:00', end: '17:00' },
],
}),
}
)
const body = await res.json()
console.log(`Version ${body.data.version}, servers affected: ${body.affectedServers}`)
JavaScript — OAuth application
const res = await fetch(
`https://vibecode.bitrix24.com/v1/work-schedules/${workScheduleId}`,
{
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
version: 2,
windows: [
{ isoDay: 1, start: '08:00', end: '17:00' },
{ isoDay: 2, start: '08:00', end: '17:00' },
],
}),
}
)
const body = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data |
object | The schedule after the edit — the same shape as in get a schedule |
data.version |
number | The new version: every successful edit raises it by one |
affectedServers |
number | How many servers of the Bitrix24 account run on the schedule after the edit, other employees' servers included |
Response example
{
"success": true,
"data": {
"id": "cmfp4r0q2000a1ocg7h2k9x3d",
"kind": "CUSTOM",
"name": "Warehouse shifts",
"presetKey": null,
"timezone": "Europe/Berlin",
"windows": [
{ "isoDay": 1, "start": "08:00", "end": "17:00" },
{ "isoDay": 2, "start": "08:00", "end": "17:00" }
],
"version": 3,
"canEdit": true,
"assignedCount": 1
},
"affectedServers": 1
}
Error response example
409 — the schedule was changed after you read it:
{
"success": false,
"error": {
"code": "WORK_SCHEDULE_STALE",
"message": "The work schedule was changed by someone else — reload it and repeat the edit"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR |
The body does not fit the schema — no version, an unknown field, an unknown time zone — or the windows break the week rules. message carries the field path and the reason |
| 400 | WORK_SCHEDULE_EMPTY |
An empty windows was passed: servers on such a schedule would never run |
| 400 | RUN_MODE_UNAVAILABLE |
Run modes are not enabled for the Bitrix24 account yet |
| 401 | MISSING_API_KEY |
The X-Api-Key header is missing |
| 401 | INVALID_API_KEY |
The key is not recognized: no such key exists on the platform |
| 403 | WORK_SCHEDULE_PRESET_READONLY |
The schedule is a preset — it cannot be edited. For a different week, create a custom one |
| 403 | WORK_SCHEDULE_EDIT_FORBIDDEN |
Only the author or an administrator of the Bitrix24 account may edit the schedule |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The key is read-only — editing is closed to it |
| 403 | INFRA_SCOPE_REQUIRED |
The key lacks the vibe:infra scope |
| 403 | INFRA_FORBIDDEN_FOR_COWORK_KEY |
The call was made with a Cowork/Code key — the schedule library is closed to such a key. What to do — Project deploy key |
| 404 | NOT_FOUND |
No schedule with this id exists in the key's Bitrix24 account, or the key is not bound to a Bitrix24 account |
| 409 | WORK_SCHEDULE_STALE |
The version in the request is out of date: the schedule was changed after you read it. Read it again and repeat the edit with the new version |
| 429 | RATE_LIMITED |
The limit of 30 requests per minute per key is exceeded. The exact value is in the x-ratelimit-limit header (the ceiling is split between replicas) |
Full list of shared error codes — Errors.
Known specifics
- Editing windows or the time zone rebuilds the wake-ups of every assigned server. Replacing the windows, recomputing the wake-ups of each server on the schedule and the new version are written as one operation: on a refusal nothing changes. A name-only edit does not touch the wake-ups.
- Server costs change with the windows. A server on the schedule runs during its windows, so a longer week raises the cost of every assigned server, other employees' servers included — their number comes in
affectedServers.