## Request access to a connector

`POST /v1/applications/:id/connectors/:slug/access-request`

Sends the Bitrix24 account administrator a request to grant the application access to a company connector, and returns the connector with its current access state. No request body is required.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | string | yes | Application card ID. Get it from: [`GET /v1/applications`](/docs/applications/list) |
| `slug` (path) | string | yes | Connector code. Get it from: [`GET /v1/applications/:id/connectors`](/docs/applications/connectors/list) |

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/applications/APPLICATION_ID/connectors/orders/access-request \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/applications/APPLICATION_ID/connectors/orders/access-request \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/applications/APPLICATION_ID/connectors/orders/access-request', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('State:', data.appState)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/applications/APPLICATION_ID/connectors/orders/access-request', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
console.log('State:', data.appState)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data.slug` | string | Connector code |
| `data.title` | string | Connector title |
| `data.iconUrl` | string / null | Icon URL; `null` for a connector from the company catalog |
| `data.appState` | string | Application access state after the request: `DISABLED_ON_PORTAL`, `NOT_CONNECTED`, `CONNECTION_BROKEN`, `NO_GRANT`, `GRANT_PENDING`, `GRANT_DENIED`, `GRANT_REVOKED`, `EXPOSURE_WIDENED` or `AVAILABLE` |
| `data.readTools` | array | Connector read tools: `name`, `title`, `description`, `inputSchema` — as in the [connector list](/docs/applications/connectors/list) |
| `data.exposure.linkAccess` | string | The application's current link access: `OFF`, `VIBECODE_AUTH`, `PUBLIC` |
| `data.exposure.externalApiEnabled` | boolean | Whether the application's external API is enabled |

## Response example

```json
{
  "success": true,
  "data": {
    "slug": "orders",
    "title": "Orders",
    "iconUrl": "https://vibecode.bitrix24.com/api/connectors/orders/icon",
    "appState": "GRANT_PENDING",
    "readTools": [],
    "exposure": {
      "linkAccess": "OFF",
      "externalApiEnabled": false
    }
  }
}
```

## Error response example

404 — the connector is unavailable or does not support connecting a company:

```json
{
  "success": false,
  "error": {
    "code": "CONNECTOR_NOT_FOUND",
    "message": "CONNECTOR_NOT_FOUND"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `CONNECTOR_NOT_FOUND` | The connector is unavailable or does not support connecting a company |
| 404 | `APPLICATION_NOT_FOUND` | The application does not exist, is unavailable, is on a different server than the key, or connectors for applications are disabled for the portal |
| 413 | `FST_ERR_CTP_BODY_TOO_LARGE` | The request body is larger than 1 KiB |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in `READONLY` mode |
| 403 | `EXTERNAL_COLLABORATOR_KEY_SERVER_MISMATCH` | The external collaborator's key and the application are not bound to the same server |
| 403 | `EXTERNAL_COLLABORATOR_NOT_A_MEMBER` | The external developer's membership was revoked or has expired |
| 403 | `PORTAL_COLLABORATOR_NOT_A_MEMBER` | The user is no longer a member of the server's development team |
| 401 | `INVALID_API_KEY` | Invalid key |
| 401 | `MISSING_API_KEY` | `X-Api-Key` was not passed |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **Repeated request.** While a request is pending or access is active, a repeated call does not create a new request and does not notify the administrator again. A denied or revoked request can be submitted again.
- **A request does not grant access.** Access appears only after the administrator approves it. Before approving, the administrator connects the company to the connector, and until it is connected, `appState` after the request may remain `NOT_CONNECTED`.

## See also

- [Application connectors](/docs/applications/connectors)
- [List application connectors](/docs/applications/connectors/list)
- [Application secrets](/docs/applications/app-secrets)
