AIエージェント向け: このページのMarkdown — /docs-content-en/infra/work-schedules.md ドキュメント索引 — /llms.txt

現在、ドキュメントは英語のみです。

Work schedule library

Work schedules for servers in the schedule run mode: the server runs during the schedule windows and sleeps outside them. The library is shared across the Bitrix24 account — one schedule can be assigned to many servers, and editing its windows immediately changes when every assigned machine runs.

Preset and custom schedules. The platform provides the presets: weekdays-9-18 — weekdays from 9 to 18, weekdays-9-19 — weekdays from 9 to 19, weekdays-9-20 — weekdays from 9 to 20, weekdays-8-19 — weekdays from 8 to 19, weekdays-8-20 — weekdays from 8 to 20, daily-9-21 — every day from 9 to 21. They cannot be edited or deleted: for a different weekly pattern, create a custom schedule. The set of presets keeps growing, so a key missing from this list means a preset newer than this page, not an error. A Bitrix24 account can keep up to 50 custom schedules.

Week windows. A window is an object { isoDay, start, end } in the schedule's local time: isoDay from 1 (Monday) to 7, start and end as HH:MM in 30-minute increments, with 24:00 for the end of the day. A window lasts at least an hour and never crosses midnight. A day holds up to two windows, at least 30 minutes apart.

Who can edit. A custom schedule can be edited and deleted by its author or by an administrator of the Bitrix24 account. The canEdit field in the response indicates whether the key owner may do so.

Before run modes are enabled. The library can always be read. Creating, editing and deleting, like setting a server's run mode, return 400 RUN_MODE_UNAVAILABLE until run modes are enabled for the Bitrix24 account. Until then the library is empty: the presets appear in it together with the run modes.

Schedule for new machines. An administrator of the Bitrix24 account can mark the schedule new machines are born on, so a new machine does not have to be moved to a schedule after it is created. There are two marks — one for servers and galaxy applications, one for agents and bots. An agent on a schedule sleeps outside its windows and answers no messages until the next window opens, so agents have a mark of their own. The mark does not touch machines that already exist.

Scope: vibe:infra

List schedules

GET /v1/work-schedules

Returns the work schedule library of the Bitrix24 account — platform presets and custom schedules — with the number of servers assigned to each.

Parameters

No parameters. The library of a Bitrix24 account is limited to the platform presets and 50 custom schedules, so filtering and pagination are not provided.

Examples

curl — personal key

Terminal
curl -H "X-Api-Key: YOUR_API_KEY" \
  https://vibecode.bitrix24.com/v1/work-schedules

curl — OAuth application

Terminal
curl -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  https://vibecode.bitrix24.com/v1/work-schedules

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/work-schedules', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
const own = data.filter(s => s.kind === 'CUSTOM')
console.log(`Schedules: ${data.length}, custom: ${own.length}`)

JavaScript — OAuth application

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

Response fields

Field Type Description
success boolean Always true on success
data array Schedules of the Bitrix24 account: presets first, then custom schedules in the order they were created
data[].id string Schedule ID. Accepted by setting a server's run mode and the other library operations
data[].kind string PRESET — a platform preset, CUSTOM — a custom schedule
data[].name string Name. A preset's name is returned in the key owner's language
data[].presetKey string | null Preset key: weekdays-9-18, weekdays-9-19, weekdays-9-20, weekdays-8-19, weekdays-8-20, daily-9-21. null for a custom schedule
data[].timezone string IANA time zone the windows are read in
data[].windows array Windows { isoDay, start, end } in local time. Window rules are on the section index
data[].version number Version number. Passed to update
data[].canEdit boolean Whether the key owner may edit and delete the schedule. Always false for a preset
data[].assignedCount number How many servers of the Bitrix24 account run on the schedule, other employees' servers included. The servers themselves are not named
data[].defaultForNewMachines boolean New servers and galaxy applications of the Bitrix24 account are born on this schedule when their create request names no mode. At most one schedule has true. An administrator of the Bitrix24 account sets the mark — Set the default schedule
data[].defaultForNewAgents boolean New agents and bots of the Bitrix24 account are born on this schedule. At most one schedule has true; the mark is set separately from defaultForNewMachines

Response example

JSON
{
  "success": true,
  "data": [
    {
      "id": "cmfp4qz7x00031ocg5d1a8k2m",
      "kind": "PRESET",
      "name": "Weekdays 9–18",
      "presetKey": "weekdays-9-18",
      "timezone": "Europe/Berlin",
      "windows": [
        { "isoDay": 1, "start": "09:00", "end": "18:00" },
        { "isoDay": 2, "start": "09:00", "end": "18:00" },
        { "isoDay": 3, "start": "09:00", "end": "18:00" },
        { "isoDay": 4, "start": "09:00", "end": "18:00" },
        { "isoDay": 5, "start": "09:00", "end": "18:00" }
      ],
      "version": 1,
      "canEdit": false,
      "assignedCount": 3,
      "defaultForNewMachines": false,
      "defaultForNewAgents": false
    },
    {
      "id": "cmfp4r0q2000a1ocg7h2k9x3d",
      "kind": "CUSTOM",
      "name": "Warehouse shifts",
      "presetKey": null,
      "timezone": "Europe/Berlin",
      "windows": [
        { "isoDay": 1, "start": "09:00", "end": "18:00" },
        { "isoDay": 2, "start": "09:00", "end": "13:00" },
        { "isoDay": 2, "start": "14:00", "end": "24:00" }
      ],
      "version": 2,
      "canEdit": true,
      "assignedCount": 1,
      "defaultForNewMachines": true,
      "defaultForNewAgents": false
    }
  ]
}

Error response example

403 — the key lacks the vibe:infra scope:

JSON
{
  "success": false,
  "error": {
    "code": "INFRA_SCOPE_REQUIRED",
    "message": "This API key does not have infrastructure rights (scope vibe:infra).",
    "details": { "requiredScope": "vibe:infra" }
  }
}

Errors

HTTP Code Description
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 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 manages servers and what they cost, so it is closed to such a key entirely, reads included. What to do — Project key for deploy
404 NOT_FOUND The key is not bound to a Bitrix24 account
429 RATE_LIMITED The limit of 60 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 common API errors — Errors.

Known specifics

  • The list is empty until run modes are enabled. The presets are added to the account's library when run modes are enabled, and custom schedules cannot be created before that. An empty data for such an account is not an error.
  • A preset's name depends on the key. The name is not stored in the data — it is translated into the key owner's language, so two keys of the same Bitrix24 account can get different strings. Identify a preset reliably by presetKey.

See also