[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-infra\u002Fwork-schedules\u002Fupdate":3,"docs-tabs-infra\u002Fwork-schedules\u002Fupdate":6},{"content":4,"lastmod":5},"## Update a schedule\n\n`PATCH \u002Fv1\u002Fwork-schedules\u002F:id`\n\nChanges 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 edit.\n\n## Parameters\n\n| Parameter | In | Type | Required | Description |\n|----------|---|-----|:-----:|----------|\n| `id` | path | string | yes | ID of a custom schedule. Source — `data[].id` from the [schedule list](.\u002Flist.md) |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|----------|\n| `version` | number | yes | The version you read. Source — `version` in the [list](.\u002Flist.md) or in [Get a schedule](.\u002Fget.md) |\n| `name` | string | no | New name, from 1 to 80 characters |\n| `timezone` | string | no | New IANA time zone |\n| `windows` | array | no | New windows `{ isoDay, start, end }` — they replace the previous ones entirely. For the window rules, see the [section index](\u002Fdocs\u002Finfra\u002Fwork-schedules) |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PATCH https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fwork-schedules\u002FWORK_SCHEDULE_ID \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"version\": 2,\n    \"windows\": [\n      { \"isoDay\": 1, \"start\": \"08:00\", \"end\": \"17:00\" },\n      { \"isoDay\": 2, \"start\": \"08:00\", \"end\": \"17:00\" }\n    ]\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PATCH https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fwork-schedules\u002FWORK_SCHEDULE_ID \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"version\": 2,\n    \"windows\": [\n      { \"isoDay\": 1, \"start\": \"08:00\", \"end\": \"17:00\" },\n      { \"isoDay\": 2, \"start\": \"08:00\", \"end\": \"17:00\" }\n    ]\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch(\n  `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fwork-schedules\u002F${workScheduleId}`,\n  {\n    method: 'PATCH',\n    headers: {\n      'X-Api-Key': 'YOUR_API_KEY',\n      'Content-Type': 'application\u002Fjson',\n    },\n    body: JSON.stringify({\n      version: 2,\n      windows: [\n        { isoDay: 1, start: '08:00', end: '17:00' },\n        { isoDay: 2, start: '08:00', end: '17:00' },\n      ],\n    }),\n  }\n)\nconst body = await res.json()\nconsole.log(`Version ${body.data.version}, servers affected: ${body.affectedServers}`)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch(\n  `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fwork-schedules\u002F${workScheduleId}`,\n  {\n    method: 'PATCH',\n    headers: {\n      'X-Api-Key': 'YOUR_APP_KEY',\n      'Authorization': 'Bearer USER_SESSION_TOKEN',\n      'Content-Type': 'application\u002Fjson',\n    },\n    body: JSON.stringify({\n      version: 2,\n      windows: [\n        { isoDay: 1, start: '08:00', end: '17:00' },\n        { isoDay: 2, start: '08:00', end: '17:00' },\n      ],\n    }),\n  }\n)\nconst body = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | Always `true` on success |\n| `data` | object | The schedule after the edit — the same shape as in [Get a schedule](.\u002Fget.md) |\n| `data.version` | number | The new version: every successful edit raises it by one |\n| `affectedServers` | number | How many servers of the Bitrix24 account run on the schedule after the edit, other employees' servers included |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"cmfp4r0q2000a1ocg7h2k9x3d\",\n    \"kind\": \"CUSTOM\",\n    \"name\": \"Warehouse shifts\",\n    \"presetKey\": null,\n    \"timezone\": \"Europe\u002FBerlin\",\n    \"windows\": [\n      { \"isoDay\": 1, \"start\": \"08:00\", \"end\": \"17:00\" },\n      { \"isoDay\": 2, \"start\": \"08:00\", \"end\": \"17:00\" }\n    ],\n    \"version\": 3,\n    \"canEdit\": true,\n    \"assignedCount\": 1,\n    \"defaultForNewMachines\": true,\n    \"defaultForNewAgents\": false\n  },\n  \"affectedServers\": 1\n}\n```\n\n## Error response example\n\n409 — the schedule was changed after you read it:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"WORK_SCHEDULE_STALE\",\n    \"message\": \"The work schedule was changed by someone else — reload it and repeat the edit\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `VALIDATION_ERROR` | The body does not match the schema — a missing `version`, an unknown field, an unknown time zone — or the windows violate the rules for weekly schedules. For a schema violation, `message` carries the field path and the reason. For a week-rule violation, `message` carries the day and the window bounds in minutes from midnight |\n| 400 | `WORK_SCHEDULE_EMPTY` | An empty `windows` was passed: servers on such a schedule would never run |\n| 400 | `RUN_MODE_UNAVAILABLE` | Run modes are not enabled for the Bitrix24 account yet |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |\n| 401 | `INVALID_API_KEY` | The key is not recognized: no such key exists on the platform |\n| 403 | `WORK_SCHEDULE_PRESET_READONLY` | The schedule is a preset — it cannot be edited. For a different week, [create a custom one](.\u002Fcreate.md) |\n| 403 | `WORK_SCHEDULE_EDIT_FORBIDDEN` | Only the author or an administrator of the Bitrix24 account may edit the schedule |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode — it cannot edit schedules |\n| 403 | `INFRA_SCOPE_REQUIRED` | The key lacks the `vibe:infra` scope |\n| 403 | `INFRA_FORBIDDEN_FOR_COWORK_KEY` | The call was made with a Cowork key, which cannot access the schedule library. For guidance, see [Project deploy key](\u002Fdocs\u002Fcowork\u002Fdeploy-key) |\n| 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 |\n| 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` |\n| 429 | `RATE_LIMITED` | The limit of 30 requests per minute per key is exceeded. The effective value is in the `x-ratelimit-limit` header |\n\nFor the full list of common API errors, see [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **Editing windows or the time zone rebuilds the wake-ups of every assigned server.** The new windows, the recomputed wake-ups of each server on the schedule and the new version are written as one operation: if the operation fails, nothing changes. A name-only edit does not touch the wake-ups.\n- **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 — the number of assigned servers is returned in `affectedServers`.\n\n## See also\n\n- [Get a schedule](.\u002Fget.md)\n- [Create a schedule](.\u002Fcreate.md)\n- [Delete a schedule](.\u002Fdelete.md)\n","2026-11-05",{},1794739579007]