Untuk agen AI: markdown halaman ini — /docs-content-en/partner-connect/company.md indeks dokumentasi — /llms.txt

Artikel dokumentasi saat ini tersedia dalam bahasa Inggris.

Company connection

COMPANY mode is a shared company connection to Bitrix24, held by an account administrator. This page describes how this mode differs from the personal PERSONAL connection. The other pages of the Partner Connect section describe issuance in PERSONAL mode.

Connection mode

New clients use PERSONAL mode: consent and the key belong to the user. COMPANY mode prepares a shared company connection to Bitrix24.

  • Only a platform administrator can set this mode.
  • The mode requires a CONFIDENTIAL client, a client secret and PKCE S256.
  • Device sign-in is incompatible with COMPANY: an attempt to enable one while the other is enabled is rejected.
  • The mode can be switched until the client has issued its first key. A history of attempts without issuance does not prevent switching, and unfinished attempts are cancelled on switching.
  • The first issuance locks the mode permanently, even after the keys are revoked. An attempt to change the mode returns 409 CONNECT_COMPANY_MODE_LOCKED. For Company mode, register a new client.
  • An existing Company connection prevents switching back to PERSONAL.
  • The company key is also available on self-hosted portals verified by the platform.

When issuance is unavailable

If new issuance for COMPANY (CREATE and RECONNECT) is unavailable, the application receives the following refusals:

Step Response
StepGET /v1/connect/authorize ResponseAfter the redirect address is validated, a redirect to the registered redirect_uri with error=access_denied, the original state, and error_description set to CONNECT_COMPANY_NOT_READY or CONNECT_COMPANY_DISABLED. No authorization code is created
StepPOST /v1/connect/token with grant_type=authorization_code ResponseHTTP 403 with the refusal code in the code and error_description fields
StepDevice sign-in — starting and exchanging the code ResponseHTTP 400, error=unauthorized_client, code=CONNECT_COMPANY_DEVICE_FLOW_FORBIDDEN
StepConsent confirmed from a support session acting on behalf of another user ResponseRefusal CONNECT_COMPANY_IMPERSONATION_FORBIDDEN, including on an account that permits support access
StepToo many attempts ResponseHTTP 429 CONNECT_COMPANY_ATTEMPT_LIMITED. Retry after the indicated wait time

Device sign-in and support session refusals are not lifted by retrying or by selecting another account. CONNECT_COMPANY_DISABLED means that the connection is unavailable for the selected user or Bitrix24 account. CONNECT_COMPANY_NOT_READY means that the temporary technical conditions for the connection have not yet been met. Rotation of an existing secret has separate conditions — see Reconnection and secret rotation.

What the company key can access

Bitrix24

The company key acts in Bitrix24 on behalf of the holder — the employee who gave consent as an administrator — within the approved scopes and with write access. Bitrix24 checks the holder's current permissions for the selected employee and object: if the holder's administrator rights are removed, the key works with the permissions of a regular employee.

  • Readiness. A Bitrix24 connection does not need the crm scope: at least one approved Bitrix24 scope, such as user, is enough while the holder and connection checks pass. bitrix_ready does not mean the key can call any API route: the set of routes and the permissions for specific methods are checked separately.
  • Scope check. Before each Bitrix24 call, the platform checks the method against the current consent, including helper calls. The task scope is equivalent to tasks. The reduced user_basic and user_brief scopes permit user.get, but not methods that need the full user scope. An unknown method prefix and a method without the required consent return 403 SCOPE_MISSING before any request to Bitrix24.
  • Entities. The key can perform entity operations, including /v1/users, /v1/departments and /v1/tasks, within the approved scopes: reading, creating, updating, deleting, searching, fields, aggregation, import and batch operations — those the entity supports. Available operations are marked x-company-access: true in OpenAPI. Entities available only to OAuth applications and some custom routes are denied with 403 CONNECT_COMPANY_ROUTE_FORBIDDEN.
  • The include parameter and custom fields are available within the current consent. Data from different company connections is not mixed.
  • Writes are checked by the regular partner key rules, without a read-only restriction. A batch containing a method outside the consent is rejected as a whole before any command is sent.
  • Search in windowed mode is not available to the company key: pass autoWindow: false.
  • Extending scopes. Without the required scope, the response is 403 SCOPE_MISSING. To add scopes, change the application permissions and ask an account administrator to complete consent with operation=RECONNECT.

Storage and AI

  • Storage requires explicit vibe:storage consent. Without it, storage returns 403 CONNECT_COMPANY_STORAGE_NOT_READY. Availability is shown by capabilities.storage in the connection poll, independently of the holder check.
  • AI requires vibe:ai consent and a separate application permission. Current availability is shown by capabilities.ai.
  • Issuing derived tokens and keys, as well as managing external model keys, is not allowed: 403 CONNECT_COMPANY_DERIVED_TOKEN_FORBIDDEN.
  • Unknown routes are rejected: 403 CONNECT_COMPANY_ROUTE_FORBIDDEN.

These refusals are not lifted by selecting another Bitrix24 account. Issuance availability depends on the readiness of the selected connection.

Notifications and working time

Notifications — with im consent. Available: POST /v1/notifications and the read routes GET /v1/notifications, /v1/notifications/search, /v1/notifications/schema, /v1/notifications/groups, /v1/notifications/settings.

  • POST /v1/notifications sends a personal notification, or a system one with type=system, and requires the recipient's userId and message. A successful response is 201.
  • GET /v1/notifications reads the holder's inbox, not a shared company inbox.
  • Settings without userId refer to the holder: this additionally requires user consent. With an explicit userId, this consent is not needed, and Bitrix24 determines access.

Working time — with timeman consent, read-only. Available: GET /v1/workday/status, /v1/workday/settings, /v1/workday/records, /v1/workday/schedule, /v1/workday/time-control/settings, /v1/workday/time-control/report-settings, /v1/workday/time-control/users, /v1/workday/time-control/reports, /v1/workday/work-reports, /v1/workday/work-reports/subordinates, /v1/workday/work-reports/{id}, /v1/workday/daily-reports, /v1/workday/records/{recordId}/report.

Route Condition
Route/v1/workday/status, /v1/workday/settings ConditionWithout userId, return the holder's data
Route/v1/workday/records ConditionRequires userId and consent to one of user_brief, user_basic or user, even for an empty page
Route/v1/workday/time-control/users ConditionRequires departmentId and department consent
Route/v1/workday/schedule ConditionRequires id
Route/v1/workday/time-control/reports ConditionRequires userId, month, year
Route/v1/workday/work-reports, /v1/workday/daily-reports, /v1/workday/work-reports/{id} ConditionRequire userId
Route/v1/workday/work-reports/subordinates ConditionReads the reports of the holder's subordinates

Insufficient consent returns 403 SCOPE_MISSING. Other notification actions and working time changes are unavailable to the company key and return 403 CONNECT_COMPANY_ROUTE_FORBIDDEN. Responses to the company key include Cache-Control: no-store.

Who is connected

A successful POST /v1/connect/token response in COMPANY mode contains the portal and user objects at the top level. In the GET /v1/connect/company/status response, these objects are inside data. Names and email addresses come from the platform account — not from the Bitrix24 profile and not from the employee list.

Who user refers to:

  • On CREATE — the administrator who gave consent.
  • On RECONNECT — the administrator who accepted the new consent.
  • On ROTATE_SECRET by another administrator — the previous consent holder: rotation by itself does not transfer consent.

A missing email address is returned as an empty string.

user is null if there is no current consent, it has ended or belongs to another generation, the holder is missing, blocked, deleted or has an erasureState other than ACTIVE, or the holder's membership is not ready. A stale or failed holder check by itself does not change the identity. The NEEDS_ADMIN state without consent returns the Bitrix24 details and user: null.

A snapshot, not a cache. The objects describe the state at the time of the response. A name or email change does not necessarily increment revision, so do not use revision to cache the profile. Exchange and status responses, including refusals, come with Cache-Control: no-store. The fields do not open additional routes and do not renew the holder check. api_key is returned once on CREATE and ROTATE_SECRET and is absent on RECONNECT. Exchange errors do not contain portal and user.

Example of a successful CREATE response in COMPANY mode — the secret below is fictional. bitrix_ready: false describes the availability of this connection and does not open issuance.

JSON
{
  "connection_mode": "COMPANY",
  "connection_id": "connection-id",
  "portal": { "domain": "example.bitrix24.com", "name": "Example" },
  "user": { "name": "Admin", "email": "admin@example.com" },
  "status": "ACTIVE",
  "generation": 1,
  "credential_version": 1,
  "credential_unchanged": false,
  "bitrix_ready": false,
  "scope": "crm",
  "api_key": "FAKE-example-only"
}

Reconnection and secret rotation

While new issuance is unavailable, CREATE and RECONNECT receive the refusals from When issuance is unavailable, and secret rotation for an existing connection works.

GET /v1/connect/authorize accepts the operation parameter:

operation What it does
operationCREATE What it doesA new connection. The default value
operationRECONNECT What it doesA new administrator consent. The existing secret is kept: reconnection does not help if the secret may have been stolen
operationROTATE_SECRET What it doesReplaces the secret. The approved scopes are kept and not extended. Requires credential_version equal to the current version. Remains available for an existing connection while new issuance is closed, if the other checks pass

All operations require a server-side client with a secret, PKCE S256, current consent and a fresh check of Bitrix24 administrator rights.

  • For CREATE and RECONNECT, an authorization code is issued only after the platform has saved the connection candidate and the obligation to clean up the previous webhook.
  • Rotation changes the secret without a new webhook.
  • Additional scopes on RECONNECT require a separate explicit consent on the consent screen.
  • The first exchange and a successful rotation show the secret once.

Refusals:

HTTP Code What happened
HTTP409 CodeCONNECTION_GENERATION_CONFLICT What happenedAnother attempt won. The secret is not returned, and the losing candidate is revoked. Start a new authorization
HTTP409 CodeCONNECTION_WEBHOOK_CLEANUP_PENDING What happenedThe limit of unfinished cleanups has been reached. Wait for cleanup to finish
HTTP403 CodeCONNECTION_SCOPE_CONSENT_REQUIRED What happenedAdditional scopes have not been confirmed by explicit consent
HTTP403 CodeCONNECTION_SUSPENDED What happenedOrdinary reconnection does not lift a security suspension
HTTP503 CodeCONNECTION_ADMIN_CHECK_UNAVAILABLE What happenedAdministrator rights could not be checked. The existing connection is kept

Webhook cleanup. The platform deletes previous webhooks in the background, and this does not close Bitrix24 access: the connection works through the current holder's webhook while cleanup is in progress. A webhook that cannot be deleted stays recorded as a cleanup debt, and webhook_cleanup shows pending for it. If the outcome of creating a webhook is unknown, the cleanup obligation is kept, and in this case, while the connection has no working webhook, Bitrix24 access is closed with the reason CONNECTION_WEBHOOK_CLEANUP_PENDING. Automatic lookup of such a webhook by marker is not enabled.

Daily caps. Bitrix24 account caps and connection caps are independent and optional: null means no daily cap, not zero requests. Zero is not a valid value. General request limits, protection against frequent attempts, usage accounting and billing always apply. The absence of daily caps by itself does not open issuance. The CONNECT_COMPANY_DISABLED, CONNECT_COMPANY_NOT_READY and CONNECT_COMPANY_ATTEMPT_LIMITED refusals are not related to setting a daily cap.

Holder departure

A Company connection is held by the employee who completed consent as an account administrator. Administrator rights are needed only at the moment of consent: if they are removed later, the connection keeps working with the permissions of a regular employee. In the cloud, the number of administrators is limited by the plan, and on the Free and Basic plans there is a single administrator, so the holder's rights may change — this does not interrupt the connection.

When the connection moves to NEEDS_ADMIN. The holder departs: they are dismissed, deactivated or deleted in Bitrix24, become a guest or withdraw their consent, or their platform account is transferred or deleted. Every few minutes the platform checks the holder with the holder's own key. If the holder can no longer authenticate with their own key and a repeat check no earlier than 30 seconds later confirms it, the connection moves to NEEDS_ADMIN.

Until the check passes, Bitrix24 access is closed: the status poll shows reason_code — ADMIN_CHECK_REQUIRED and action — WAIT, and working calls receive 503 ADMIN_CHECK_REQUIRED with the Retry-After: 30 header. Retry after 30 seconds. After a successful check, access reopens on its own.

What the status poll shows after the holder departs:

  • status — NEEDS_ADMIN, reason_code — CONNECTION_ADMIN_REQUIRED, action — AUTHORIZE_ADMIN.
  • generation and revision have increased by 1.
  • webhook_cleanup — pending while the platform deletes the previous holder's webhook in Bitrix24 or when it cannot be deleted, or attention_required if the outcome of creating the webhook is unknown.

How to restore access. The connection secret stays valid, and you do not need to change it. Unfinished authorization attempts are cancelled, and unused authorization codes can no longer be exchanged. The person's return to work does not restore the connection: an account administrator restores access by completing consent with operation=RECONNECT. Bitrix24 becomes available right after that, and cleanup of the previous holder's webhook continues in the background. If a self-hosted Bitrix24 has no permanent administrator, grant an employee administrator rights for the duration of the reconnection: after consent the rights can be removed, and the connection keeps working.

Deactivation of the application by its owner and blocking of the application by the platform move all of its Company connections to SUSPENDED and revoke their secrets.

See also