For AI agents: markdown of this page — /docs-content-en/workday/time-control-settings-update.md documentation index — /llms.txt

Update time-control settings

PATCH /v1/workday/time-control/settings

Changes the time-control settings for the entire Bitrix24 account: the passed fields are overwritten, and the rest keep their previous values.

Requires the timeman scope. Permissions are checked for the credential owner: for a personal key, that is the key owner; for an app key, the user whose session token is passed in Authorization. A Bitrix24 account administrator can change the settings; an employee without administrator rights gets 403 BITRIX_ACCESS_DENIED. The Bitrix24 application behind the app key needs only the timeman permission. A READONLY key cannot change the settings. For the current values, see Get time-control settings.

Request fields (body)

All fields are optional, but the body must contain at least one. The fields come in pairs: reportRequestType and reportRequestUsers, reportSimpleType and reportSimpleUsers, reportFullType and reportFullUsers. Pass the user type together with its list in the same request, and pass a list only together with the user type.

Field Type Description
Fieldactive Typeboolean DescriptionSwitches time control on or off. With false, an employee without subordinates has no access to monthly reports on the Get the monthly absence report page, including their own
FieldminimumIdleForReport Typeinteger DescriptionMinimum absence, in minutes, for which an employee is asked for a report. A value below 1 is saved as 1
FieldregisterOffline Typeboolean DescriptionWhether to record when an employee is offline
FieldregisterIdle Typeboolean DescriptionWhether to record when an employee is away
FieldregisterDesktop Typeboolean DescriptionWhether to record work in the Bitrix24 desktop app
FieldreportRequestType Typestring DescriptionWhom to ask for an absence report: all — all employees, user — employees from reportRequestUsers, none — nobody
FieldreportRequestUsers Typeinteger[] DescriptionIDs of the employees who are asked for a report — positive integers. An empty array is allowed. List: List employees
FieldreportSimpleType Typestring DescriptionWho has access to the simple report — their own monthly time-control report: all — all employees, user — employees from reportSimpleUsers, none — nobody. none is saved as user with an empty reportSimpleUsers
FieldreportSimpleUsers Typeinteger[] DescriptionIDs of the employees with the simple report — positive integers. An empty array is allowed. List: List employees
FieldreportFullType Typestring DescriptionWho has access to the full report — the monthly reports of all employees: all — all employees, user — employees from reportFullUsers, none — nobody. none is saved as user with an empty reportFullUsers
FieldreportFullUsers Typeinteger[] DescriptionIDs of the employees with the full report — positive integers. An empty array is allowed. List: List employees

Examples

curl — personal key

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/workday/time-control/settings" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reportSimpleType": "user", "reportSimpleUsers": [103, 107]}'

curl — OAuth application

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/workday/time-control/settings" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"reportSimpleType": "user", "reportSimpleUsers": [103, 107]}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/workday/time-control/settings', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ reportSimpleType: 'user', reportSimpleUsers: [103, 107] }),
})
const { data } = await res.json()

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/workday/time-control/settings', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ reportSimpleType: 'user', reportSimpleUsers: [103, 107] }),
})
const { data } = await res.json()

Response fields

The response contains all of the account's time-control settings after the write, not only the changed fields. For a detailed description of each field, see Get time-control settings.

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue on a successful write
Fielddata Typeobject DescriptionTime-control settings after the write
Fielddata.active Typeboolean DescriptionWhether time control is switched on
Fielddata.minimumIdleForReport Typeinteger DescriptionMinimum absence, in minutes, for which a report is requested
Fielddata.registerOffline Typeboolean DescriptionWhether to record when an employee is offline
Fielddata.registerIdle Typeboolean DescriptionWhether to record when an employee is away
Fielddata.registerDesktop Typeboolean DescriptionWhether to record work in the Bitrix24 desktop app
Fielddata.reportRequestType Typestring Descriptionall, user or none
Fielddata.reportRequestUsers Typeinteger[] | string[] DescriptionIDs of the employees who are asked for a report
Fielddata.reportSimpleType Typestring Descriptionall or user. If you write none, it comes back as user with an empty reportSimpleUsers
Fielddata.reportSimpleUsers Typeinteger[] | string[] DescriptionIDs of the employees with the simple report
Fielddata.reportFullType Typestring Descriptionall or user. If you write none, it comes back as user with an empty reportFullUsers
Fielddata.reportFullUsers Typeinteger[] | string[] DescriptionIDs of the employees with the full report

IDs written by this method come back as numbers. IDs saved earlier by other means may come back as strings, like reportRequestUsers in the example below. Compare IDs after converting them to numbers.

Response example

JSON
{
  "success": true,
  "data": {
    "active": false,
    "minimumIdleForReport": 15,
    "registerOffline": true,
    "registerIdle": true,
    "registerDesktop": true,
    "reportRequestType": "user",
    "reportRequestUsers": ["1"],
    "reportSimpleType": "user",
    "reportSimpleUsers": [103, 107],
    "reportFullType": "all",
    "reportFullUsers": []
  }
}

Error response example

400 — the reportRequestUsers list is passed without reportRequestType: "user":

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "reportRequestUsers requires the matching type user"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionThe body is empty or not an object: Provide at least one setting
HTTP400 CodeINVALID_PARAMS DescriptionUnknown field: Unknown setting: <field>
HTTP400 CodeINVALID_PARAMS DescriptionInvalid value type: active or register* is not true or false, minimumIdleForReport is not an integer, *Type is not all, user or none, *Users is not an array of positive integers
HTTP400 CodeINVALID_PARAMS DescriptionType user is passed without its list, or a list is passed without type user: reportRequestType requires the matching users array, reportRequestUsers requires the matching type user
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionThe credential owner is not a Bitrix24 account administrator
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is in READONLY mode
HTTP409 CodeTIMEMAN_MODULE_NOT_ENABLED DescriptionTime Management is not available on this portal: the Time Management tool is switched off in the portal settings, or the module is not included in the plan
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 is unavailable or returned a response of an unexpected shape
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header was not passed
HTTP401 CodeTOKEN_MISSING DescriptionAn app key was sent without a session token in Authorization: Bearer
HTTP401 CodeINVALID_SESSION DescriptionThe session token is invalid or has expired
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the timeman scope
HTTP429 CodeRATE_LIMITED DescriptionThe general request limit was exceeded; the retry delay is in the Retry-After header

Full list of common API errors — Errors.

Known specifics

  • The body is validated as a whole before the write: if any field is invalid, no settings are changed, not even the valid fields from the same request.
  • Employee IDs in *Users are not checked for existence: a nonexistent ID is saved without an error.

See also