For AI agents: markdown of this page — /docs-content-en/partner-connect/authorize.md documentation index — /llms.txt

Start user authorization

GET /v1/connect/authorize

Redirects the user to the Alaio Vibecode consent page.

Parameters

Parameter Type Required Description
Parameterclient_id Typestring Requiredyes DescriptionPartner identifier received when the client was registered
Parameterredirect_uri Typestring Requiredyes DescriptionCallback URL. Must match one of the URLs registered for the client
Parameterstate Typestring Requiredyes DescriptionArbitrary string returned together with the code. Protects against CSRF
Parameterscope Typestring Requiredno DescriptionRequested scopes, separated by spaces or commas: crm task im. If omitted, the scopes registered for the client apply. A request for a scope outside the registered set is rejected
Parametercode_challenge Typestring Requiredconditional DescriptionSHA-256 hash of code_verifier in base64url without =. Required for a public client or when PKCE is mandatory, otherwise optional
Parametercode_challenge_method Typestring Requiredconditional DescriptionS256, required together with code_challenge. Other methods, empty values and a method without a hash are rejected
Parameterportal Typestring Requiredno DescriptionBitrix24 account domain to preselect on the consent page: mycompany.bitrix24.com. A hint, not an account choice — see Account hint
Parameteroperation Typestring Requiredno DescriptionOnly for a client in COMPANY mode: CREATE — a new connection, RECONNECT — new administrator consent without changing the secret, ROTATE_SECRET — secret replacement without expanding scopes. Defaults to CREATE. The purpose is kept for the whole flow and does not change during consent or code exchange — see Reconnection and secret rotation
Parametercredential_version Typeinteger Requiredconditional DescriptionCurrent version of the connection secret, starting at 1. Required for a client in COMPANY mode with operation=ROTATE_SECRET. Take the value from the data.credential_version field of the GET /v1/connect/company/status response

For a client with a secret, PKCE is optional unless it is enabled in the client settings. If you pass code_challenge, the platform stores it and requires the matching code_verifier when the code is exchanged. PKCE complements client_secret rather than replacing it. For a public client and when PKCE is mandatory, the hash is always required.

Account hint

If the application knows which Bitrix24 account the user came from, pass that account's domain in the portal parameter. The scheme and path do not have to be stripped, and case does not matter.

https://vibecode.bitrix24.com/v1/connect/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=https://yourapp.com/callback&scope=crm%20task&state=abc123random&portal=mycompany.bitrix24.com
  • If the user is an active member of the specified account, that account is preselected on the consent page. Otherwise the account on the page is chosen the same way as without the parameter.
  • The user can choose a different account. The key is issued for the account the user confirmed, so take the key's account from the portal.domain field of the POST /v1/connect/token response, not from your hint.
  • The authorize response does not depend on the parameter: the application does not learn whether the user is a member of the specified account.
  • An invalid value causes no error and is not returned to redirect_uri — sign-in proceeds as without the parameter.
  • The hint is honored only by the authorization code flow for clients in PERSONAL mode. Clients in COMPANY mode ignore the parameter, and device sign-in has no account hint.

Examples

The endpoint is opened by navigating the user's browser to a link your application builds. No API key and no X-Api-Key or Authorization headers are needed: the application identifies itself with the client_id parameter.

curl — OAuth application

The request shows the response the user's browser receives: 302 with the consent page address in the Location header.

Terminal
curl -i "https://vibecode.bitrix24.com/v1/connect/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=https%3A%2F%2Fyourapp.com%2Fcallback&scope=crm%20task&state=abc123random"

JavaScript — OAuth application

javascript
const state = crypto.randomUUID()
// store state in the user's session to check it on redirect_uri

const params = new URLSearchParams({
  client_id: 'YOUR_CLIENT_ID',
  redirect_uri: 'https://yourapp.com/callback',
  scope: 'crm task',
  state,
})

const authorizeUrl = `https://vibecode.bitrix24.com/v1/connect/authorize?${params}`
// send the user to authorizeUrl: as a link or as a redirect from your server

Server code that builds such a link and checks state on return is in the full example. You can also build the link for your application without code: use the "Build a link" helper in the application card, see Application registration and scopes.

Response fields

The response is a redirect to redirect_uri with parameters in the query string:

Parameter Type Description
Parametercode Typestring DescriptionOne-time authorization code. Arrives after approval. Exchanged for a key via POST /v1/connect/token
Parameterstate Typestring DescriptionThe state value from the request, unchanged
Parametererror Typestring DescriptionDenial code. Arrives instead of code
Parametererror_description Typestring DescriptionMachine-readable denial reason code. Arrives on a denial after the consent screen and when a client in COMPANY mode is denied — see Company connection

Response example

Successful redirect after approval:

https://yourapp.com/callback?code=AUTH_CODE_HERE&state=abc123random

Redirect on denial by the user on the consent page:

https://yourapp.com/callback?error=access_denied&state=abc123random

Error response example

400 — client_id is unknown or the client is disabled:

JSON
{
  "error": "invalid_client",
  "error_description": "Unknown or inactive client"
}

Errors

This endpoint returns errors in three different ways, and you must handle all three.

Before redirect_uri is verified — a regular 400 response with an RFC 6749 body. There is nowhere to send the user back: the address is not yet confirmed, and a redirect to an unverified URL would be a vulnerability.

HTTP error Condition
HTTP400 errorinvalid_request ConditionOne of client_id, redirect_uri, state is missing
HTTP400 errorinvalid_client Conditionclient_id is unknown or the client is disabled
HTTP400 errorinvalid_request Conditionredirect_uri is malformed: it does not parse as a URL, or contains a # fragment, a username or a password. error_description — Redirect URI is malformed
HTTP400 errorinvalid_request ConditionThe redirect_uri scheme is not allowed for its host: not https for a host other than localhost, neither http nor https for localhost. error_description — Redirect URI scheme is not allowed for this host
HTTP400 errorinvalid_request Conditionredirect_uri does not match any registered URL. error_description — Redirect URI not registered

After redirect_uri is verified — a redirect back to it with the error and state parameters (RFC 6749 §4.1.2.1). Your redirect_uri handler must parse this.

error in the redirect Condition
error in the redirectinvalid_scope ConditionAn unknown scope or a scope outside the client's registered set was requested
error in the redirectinvalid_scope ConditionA client in COMPANY mode requested a vibe:* platform scope other than vibe:ai and vibe:storage: only these two platform scopes are available to a Company connection
error in the redirectinvalid_request ConditionMandatory PKCE was not passed, or an invalid code_challenge or code_challenge_method was passed. Only S256 is supported
error in the redirectinvalid_request ConditionA client in COMPANY mode passed an operation other than CREATE, RECONNECT, ROTATE_SECRET
error in the redirectaccess_denied with error_description=CONNECT_COMPANY_NOT_READY ConditionA client in COMPANY mode is refused before the consent page: the technical conditions for the connection are not met — the client is disabled or its Company configuration is invalid, the requested operation is not allowed for it, the partner has not confirmed the Company mode, the client's mode is changing at that moment, or issuance of Company connections is not ready on the platform. The refusal holds until its cause is removed, so retrying by itself does not clear it
error in the redirectaccess_denied with error_description=CONNECT_COMPANY_DISABLED ConditionA client in COMPANY mode is refused before the consent page: the Company connection is unavailable for the selected user or Bitrix24 account — see Company connection
error in the redirectaccess_denied ConditionThe user clicked "Deny" on the consent page
error in the redirectaccess_denied ConditionThe user confirmed access, but the key could not be issued: the Bitrix24 account's plan does not grant access to Vibecode, the region is not supported, or the key limit is reached. The machine-readable reason code arrives in error_description
error in the redirecttemporarily_unavailable ConditionThe user confirmed access, but key issuance did not complete because Bitrix24 was temporarily unavailable. The machine-readable reason code, for example BITRIX_UNAVAILABLE, arrives in error_description. The attempt can be retried
https://yourapp.com/callback?error=invalid_scope&state=abc123random

Any other refusal of a client in COMPANY mode arrives the same way: error=access_denied and the machine-readable reason code in error_description. The list of these codes is open — see Company connection.

Rate limit exceeded — 429 before any parameter check, so there is neither a redirect nor a state. Limit: 30 requests per minute, counted per client_id and caller address pair. The effective value is in the x-ratelimit-limit header. The body comes in the common API envelope — { "success": false, "error": { "code": "RATE_LIMITED", "message": "..." } }, not in RFC 6749 form, and the X-RateLimit-* headers are present.

This path must be handled separately because authorize is opened by browser navigation: the user sees a page with JSON instead of the consent screen, nothing arrives at redirect_uri, and the application does not get its state back. The application must treat such an authorization as incomplete after its own timeout rather than wait for the callback. The Retry-After value gives the minimum pause.

Key issuance is denied after the user has already confirmed access. The user sees the reason on the Vibecode consent page and returns to the application via a button — then error, error_description and the original state arrive at redirect_uri:

https://yourapp.com/callback?error=access_denied&error_description=INT_TARIFF_REQUIRED&state=abc123random

error_description carries the machine-readable reason code the application can use to show its own screen:

Code in error_description What happened
Code in error_descriptionINT_TARIFF_REQUIRED What happenedThe Bitrix24 account's plan does not grant access to Vibecode. Where access requires the Vibe+ plan, INT_VIBE_PLUS_REQUIRED arrives instead
Code in error_descriptionKEY_LIMIT_REACHED What happenedThe key cannot be issued: the user's key limit or the platform's per-account cap is reached — see Key limit
Code in error_descriptionBITRIX_UNAVAILABLE What happenedBitrix24 did not respond while the key was being issued. Arrives with error=temporarily_unavailable, not access_denied
Code in error_descriptionSTATE_EXPIRED What happenedThe consent link expired before confirmation — start authorization again with /v1/connect/authorize
Code in error_descriptionadmin_approval_requested What happenedThe user is not a Bitrix24 account administrator and asked the administrators to allow AI for the application — the request reached them in the bot chat. Arrives when administrator approval of AI is enabled on the platform. Once the administrator allows AI, start authorization again with /v1/connect/authorize

The list of codes is open: the application must treat any error_description as a denial reason and must not rely on the list above being exhaustive.

When access is denied for a payment reason, the user sees a built-in payment card on the consent page. The actions apply to the selected Bitrix24 account. For INT_TARIFF_REQUIRED the card prompts the user to choose a Bitrix24 plan and, depending on the selected account, may also offer Vibe+. For INT_VIBE_PLUS_REQUIRED it offers the Vibe+ plan. In the Vibe+ model the card offers trial activation if available. The Bitrix24 demo plan is activated in Bitrix24 itself, if available there.

Until the user clicks the button to return to the application, nothing arrives at redirect_uri. Returning after such a denial passes error=access_denied, the machine-readable reason code in error_description and the original state. No code and no API key are issued. After a purchase or trial activation, return to the application and start authorization again with /v1/connect/authorize: the one-time state of the previous link has already been used.

Full reference of common API errors — Errors.

See also