لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/workday.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Workday

Employee time tracking: opening and closing the day, pausing, current status, Bitrix24 account settings, and work schedule.

Scope: timeman for most operations; records also requires one of user_brief, user_basic, or user | Base URL: https://vibecode.bitrix24.com/v1 | Authorization: X-Api-Key

Which key to choose | Quick start | Full example | Endpoint reference | Error codes

Documentation sections

Which key to choose

This section works with two key types. The choice determines on whose behalf the workday is recorded.

Scenario Key Request headers
ScenarioPersonal time tracking, a script on your own server KeyPersonal API key vibe_api_… Request headersX-Api-Key: vibe_api_…
ScenarioOAuth application from the Vibecode catalog — time tracking for each user who installed the app KeyAuthorization key vibe_app_… Request headersX-Api-Key: vibe_app_… + Authorization: Bearer <session_token>

Actions are recorded on behalf of the key owner (for a personal key) or the session user (for OAuth). For a detailed description of the formats and how to obtain a session_token, see Keys and authorization.


Quick start

1. Check the current status

Terminal
curl -H "X-Api-Key: YOUR_API_KEY" \
  https://vibecode.bitrix24.com/v1/workday/status
JSON
{
  "success": true,
  "data": {
    "status": "CLOSED",
    "id": 1,
    "timeStart": "2026-05-04T09:00:00+02:00",
    "timeFinish": "2026-05-04T18:00:00+02:00",
    "duration": "08:30:00",
    "timeLeaks": "00:30:00",
    "active": true,
    "ipOpen": "203.0.113.10",
    "ipClose": "203.0.113.10",
    "latOpen": 0,
    "lonOpen": 0,
    "latClose": 0,
    "lonClose": 0,
    "tzOffset": 7200
  }
}

To read another employee's status, use the same call with the userId parameter:

Terminal
curl -H "X-Api-Key: YOUR_API_KEY" \
  "https://vibecode.bitrix24.com/v1/workday/status?userId=503"

Bitrix24 makes another employee's time sheet available only to Bitrix24 account administrators and to the employee's direct managers. Without those rights Bitrix24 does not return the employee's data. Get employee IDs from GET /v1/users. The workday history of an employee is returned by GET /v1/workday/records, where userId is required and timeman must be combined with user_brief, user_basic, or user.

2. Open the workday

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/workday/open \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

3. Close the day with a report

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/workday/close \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "report": "Closed 5 deals, processed 12 leads" }'

Full example: automatic workday tracking

Scenario: a script opens the day at 9:00, tracks the lunch break, and closes the day at 18:00 with an automatic report.

javascript
const VIBE_KEY = process.env.VIBE_KEY
const BASE = 'https://vibecode.bitrix24.com/v1'

async function api(method, path, body = null) {
  const opts = {
    method,
    headers: { 'X-Api-Key': VIBE_KEY }
  }
  if (body) {
    opts.headers['Content-Type'] = 'application/json'
    opts.body = JSON.stringify(body)
  }
  const res = await fetch(`${BASE}${path}`, opts)
  return res.json()
}

// 1. Check the current status — so we don't open an already-open day
const { data: current } = await api('GET', '/workday/status')
console.log('Current status:', current.status)

// 2. Open the workday if it is closed
if (current.status === 'CLOSED' || !current.status) {
  const { data: opened } = await api('POST', '/workday/open', {})
  console.log('Day opened at', opened.timeStart)
} else {
  console.log('Day already open since', current.timeStart)
}

// 3. Get the time-tracking settings on the portal
const { data: settings } = await api('GET', '/workday/settings')
console.log('Latest allowed start of day:', settings.ufTmMaxStart)
console.log('Minimum day duration:', settings.ufTmMinDuration)

// 4. Going to lunch — pause the day
const { data: paused } = await api('POST', '/workday/pause', {})
console.log('Status after pause:', paused.status)

// ...break...

// 5. Back from lunch — resume the day
const { data: resumed } = await api('POST', '/workday/open', {})
console.log('Day resumed, status:', resumed.status)

// 6. End of the workday — close it with a report
const { data: closed } = await api('POST', '/workday/close', {
  report: 'Automatic closing'
})
console.log('Day closed, time worked:', closed.duration)
console.log('Break duration:', closed.timeLeaks)

Endpoint reference

Method Path Bitrix24 method Description
MethodPOST Path/v1/workday/open Bitrix24 methodtimeman.open DescriptionOpen or resume the workday
MethodPOST Path/v1/workday/close Bitrix24 methodtimeman.close DescriptionClose the workday
MethodPOST Path/v1/workday/pause Bitrix24 methodtimeman.pause DescriptionPause the workday
MethodGET Path/v1/workday/status Bitrix24 methodtimeman.status DescriptionCurrent workday status — your own or that of the employee in userId
MethodGET Path/v1/workday/records Bitrix24 methodtimeman.record.list DescriptionHistory of an employee's workday records
MethodGET Path/v1/workday/settings Bitrix24 methodtimeman.settings DescriptionTime-tracking settings in the Bitrix24 account — your own or those of the employee in userId
MethodGET Path/v1/workday/schedule Bitrix24 methodtimeman.schedule.get DescriptionWork schedule details by id

An empty successful result is returned as data: null. That is how open, close, pause, status and settings respond when Bitrix24 returns success with no value. There is no service envelope with result, total and next inside data — you do not need to unwrap anything.

A missing schedule in schedule returns 404 ENTITY_NOT_FOUND (see Work schedule). The record history (records) has its own paginated payload with meta.

For an interactive method switcher with examples and field tables, see Endpoints.


Error codes

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionBitrix24 returned INVALID_PARAMS — request field validation failed
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header was not provided
HTTP401 CodeINVALID_API_KEY DescriptionThe key is not recognized — no such key exists on the platform
HTTP401 CodeKEY_EXPIRED DescriptionThe API key has expired
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no OAuth tokens configured for the portal
HTTP402 CodeACCOUNT_FROZEN DescriptionThe portal balance is frozen — top up the balance
HTTP403 CodeSCOPE_DENIED DescriptionFor records, the key does not satisfy the compound requirement: it needs timeman plus at least one of user_brief, user_basic, or user; other operations require only timeman
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 rejected the request; the reason is in message (for example, an attempt to close an already-closed day)
HTTP429 CodeRATE_LIMITED DescriptionThe rate limit for requests to Bitrix24 was exceeded
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionThe Bitrix24 portal is unavailable

For the full list of common API errors, see Errors.


See also