[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-partner-connect\u002Fauthorize":3,"docs-tabs-partner-connect\u002Fauthorize":6},{"content":4,"lastmod":5},"## Start user authorization\n\n`GET \u002Fv1\u002Fconnect\u002Fauthorize`\n\nRedirects the user to the Alaio Vibecode consent page.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `client_id` | string | yes | Partner identifier received when the client was registered |\n| `redirect_uri` | string | yes | Callback URL. Must match one of the URLs registered for the client |\n| `state` | string | yes | Arbitrary string returned together with the code. Protects against CSRF |\n| `scope` | string | no | Requested 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 |\n| `code_challenge` | string | conditional | SHA-256 hash of `code_verifier` in `base64url` without `=`. Required for a public client or when PKCE is mandatory, otherwise optional |\n| `code_challenge_method` | string | conditional | `S256`, required together with `code_challenge`. Other methods, empty values and a method without a hash are rejected |\n| `portal` | string | no | Bitrix24 account domain to preselect on the consent page: `mycompany.bitrix24.com`. A hint, not an account choice — see [Account hint](#account-hint) |\n| `operation` | string | no | Only 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](\u002Fdocs\u002Fpartner-connect\u002Fcompany#reconnection-and-secret-rotation) |\n| `credential_version` | integer | conditional | Current 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 \u002Fv1\u002Fconnect\u002Fcompany\u002Fstatus`](\u002Fdocs\u002Fpartner-connect\u002Fcompany-status) response |\n\nFor 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.\n\n### Account hint\n\nIf 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.\n\n```\nhttps:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fconnect\u002Fauthorize?client_id=YOUR_CLIENT_ID&redirect_uri=https:\u002F\u002Fyourapp.com\u002Fcallback&scope=crm%20task&state=abc123random&portal=mycompany.bitrix24.com\n```\n\n- 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.\n- 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 \u002Fv1\u002Fconnect\u002Ftoken`](\u002Fdocs\u002Fpartner-connect\u002Ftoken) response, not from your hint.\n- The `authorize` response does not depend on the parameter: the application does not learn whether the user is a member of the specified account.\n- An invalid value causes no error and is not returned to `redirect_uri` — sign-in proceeds as without the parameter.\n- 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](\u002Fdocs\u002Fpartner-connect\u002Fdevice-authorize) has no account hint.\n\n## Examples\n\nThe 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.\n\n### curl — OAuth application\n\nThe request shows the response the user's browser receives: `302` with the consent page address in the `Location` header.\n\n```bash\ncurl -i \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fconnect\u002Fauthorize?client_id=YOUR_CLIENT_ID&redirect_uri=https%3A%2F%2Fyourapp.com%2Fcallback&scope=crm%20task&state=abc123random\"\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst state = crypto.randomUUID()\n\u002F\u002F store state in the user's session to check it on redirect_uri\n\nconst params = new URLSearchParams({\n  client_id: 'YOUR_CLIENT_ID',\n  redirect_uri: 'https:\u002F\u002Fyourapp.com\u002Fcallback',\n  scope: 'crm task',\n  state,\n})\n\nconst authorizeUrl = `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fconnect\u002Fauthorize?${params}`\n\u002F\u002F send the user to authorizeUrl: as a link or as a redirect from your server\n```\n\nServer code that builds such a link and checks `state` on return is in the [full example](\u002Fdocs\u002Fpartner-connect#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](\u002Fdocs\u002Fpartner-connect\u002Fregistration).\n\n## Response fields\n\nThe response is a redirect to `redirect_uri` with parameters in the query string:\n\n| Parameter | Type | Description |\n|----------|-----|----------|\n| `code` | string | One-time authorization code. Arrives after approval. Exchanged for a key via [`POST \u002Fv1\u002Fconnect\u002Ftoken`](\u002Fdocs\u002Fpartner-connect\u002Ftoken) |\n| `state` | string | The `state` value from the request, unchanged |\n| `error` | string | Denial code. Arrives instead of `code` |\n| `error_description` | string | Machine-readable denial reason code. Arrives on a [denial after the consent screen](#denial-after-the-consent-screen) and when a client in `COMPANY` mode is denied — see [Company connection](\u002Fdocs\u002Fpartner-connect\u002Fcompany) |\n\n## Response example\n\n**Successful redirect** after approval:\n\n```\nhttps:\u002F\u002Fyourapp.com\u002Fcallback?code=AUTH_CODE_HERE&state=abc123random\n```\n\n**Redirect on denial** by the user on the consent page:\n\n```\nhttps:\u002F\u002Fyourapp.com\u002Fcallback?error=access_denied&state=abc123random\n```\n\n## Error response example\n\n400 — `client_id` is unknown or the client is disabled:\n\n```json\n{\n  \"error\": \"invalid_client\",\n  \"error_description\": \"Unknown or inactive client\"\n}\n```\n\n## Errors\n\nThis endpoint returns errors in three different ways, and you must handle all three.\n\n**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.\n\n| HTTP | `error` | Condition |\n|------|---------|---------|\n| 400 | `invalid_request` | One of `client_id`, `redirect_uri`, `state` is missing |\n| 400 | `invalid_client` | `client_id` is unknown or the client is disabled |\n| 400 | `invalid_request` | `redirect_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` |\n| 400 | `invalid_request` | The `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` |\n| 400 | `invalid_request` | `redirect_uri` does not match any registered URL. `error_description` — `Redirect URI not registered` |\n\n**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.\n\n| `error` in the redirect | Condition |\n|---------------------|---------|\n| `invalid_scope` | An unknown scope or a scope outside the client's registered set was requested |\n| `invalid_scope` | A 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 |\n| `invalid_request` | Mandatory PKCE was not passed, or an invalid `code_challenge` or `code_challenge_method` was passed. Only `S256` is supported |\n| `invalid_request` | A client in `COMPANY` mode passed an `operation` other than `CREATE`, `RECONNECT`, `ROTATE_SECRET` |\n| `access_denied` with `error_description=CONNECT_COMPANY_NOT_READY` | A 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 |\n| `access_denied` with `error_description=CONNECT_COMPANY_DISABLED` | A 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](\u002Fdocs\u002Fpartner-connect\u002Fcompany) |\n| `access_denied` | The user clicked \"Deny\" on the consent page |\n| `access_denied` | The 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` |\n| `temporarily_unavailable` | The 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 |\n\n```\nhttps:\u002F\u002Fyourapp.com\u002Fcallback?error=invalid_scope&state=abc123random\n```\n\nAny 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](\u002Fdocs\u002Fpartner-connect\u002Fcompany).\n\n**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.\n\nThis 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.\n\n### Denial after the consent screen\n\nKey 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`:\n\n```\nhttps:\u002F\u002Fyourapp.com\u002Fcallback?error=access_denied&error_description=INT_TARIFF_REQUIRED&state=abc123random\n```\n\n`error_description` carries the machine-readable reason code the application can use to show its own screen:\n\n| Code in `error_description` | What happened |\n|---------------------------|---------------|\n| `INT_TARIFF_REQUIRED` | The Bitrix24 account's plan does not grant access to Vibecode. Where access requires the Vibe+ plan, `INT_VIBE_PLUS_REQUIRED` arrives instead |\n| `KEY_LIMIT_REACHED` | The key cannot be issued: the user's key limit or the platform's per-account cap is reached — see [Key limit](\u002Fdocs\u002Fpartner-connect\u002Fkeys#key-limit) |\n| `BITRIX_UNAVAILABLE` | Bitrix24 did not respond while the key was being issued. Arrives with `error=temporarily_unavailable`, not `access_denied` |\n| `STATE_EXPIRED` | The consent link expired before confirmation — start authorization again with `\u002Fv1\u002Fconnect\u002Fauthorize` |\n| `admin_approval_requested` | The 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 `\u002Fv1\u002Fconnect\u002Fauthorize` |\n\nThe 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.\n\nWhen 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.\n\nUntil 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 `\u002Fv1\u002Fconnect\u002Fauthorize`: the one-time state of the previous link has already been used.\n\nFull reference of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Exchange a code for an API key](\u002Fdocs\u002Fpartner-connect\u002Ftoken)\n- [Public client: PKCE flow](\u002Fdocs\u002Fpartner-connect\u002Fpkce)\n- [Application registration and scopes](\u002Fdocs\u002Fpartner-connect\u002Fregistration)\n- [Partner Connect](\u002Fdocs\u002Fpartner-connect)\n","2026-11-19",{},1795415493729]