
## Revoke a key as the application

`POST /v1/connect/revoke`

The endpoint follows RFC 7009 and revokes **one** key — the one you present in the request. Call it when the user disables the integration on your side: otherwise earlier keys keep working and occupy slots in the [key limit](/docs/partner-connect/keys#key-limit).

## Request fields (body)

Accepts `application/x-www-form-urlencoded` and JSON with the same fields.

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `client_id` | string | yes | Application identifier |
| `client_secret` | string | conditional | Application secret. Confidential clients must send it. Public clients (`PUBLIC`) do not send it — they have none |
| `token` | string | yes | API key to revoke. The key comes in the `api_key` field of the [`POST /v1/connect/token`](/docs/partner-connect/token) response |

## Examples

The endpoint authenticates with the application credentials — `client_id` and `client_secret` in the request body. The `X-Api-Key` and `Authorization` headers are not needed.

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/connect/revoke \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d client_id=YOUR_CLIENT_ID \
  -d client_secret=YOUR_CLIENT_SECRET \
  -d token=API_KEY_TO_REVOKE
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/connect/revoke', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    client_id: 'YOUR_CLIENT_ID',
    client_secret: 'YOUR_CLIENT_SECRET',
    token: apiKeyToRevoke,
  }),
})

if (res.status === 200) {
  // the key is revoked or there was nothing to revoke — retrying is safe
}
```

## Response fields

A successful response is HTTP `200` with an empty object `{}`. The same response is returned for an unknown token, for someone else's key and for an already revoked one — so brute force cannot reveal whether other parties' keys are still valid. Hence the call is **idempotent**: it is safe to repeat.

## Response example

```json
{}
```

## Error response example

401 — the client is unknown:

```json
{
  "error": "invalid_client",
  "error_description": "Unknown client"
}
```

## Errors

Errors come in the RFC 7009 form — `{ error, error_description }`, without the `success` wrapper. The exception is a rate limiter rejection; its form is described after the table.

| HTTP | `error` | Condition |
|------|---------|---------|
| 400 | `invalid_request` | `client_id` or `token` is missing |
| 400 | `invalid_client` | A public client sent `client_secret` |
| 401 | `invalid_client` | The client is unknown or the secret does not match |
| 409 | `key_manages_foreign_server` | The key manages a live server of another owner, a server without an owner, or a server of the same owner in another Bitrix24 account. The `code` field is `KEY_MANAGES_FOREIGN_SERVER`. Determine the server's owner and Bitrix24 account, rebind it to a key of that owner in the same Bitrix24 account, then retry the revocation |
| 409 | `key_operation_in_progress` | Another operation is changing the same key right now. The `code` field is `KEY_OPERATION_IN_PROGRESS`. Retry the request after it completes |

The body of both `409` rejections contains `error`, `error_description` and `code`.

**There are two rate limiters here, and both respond with `429`.** The endpoint's own limiter: 60 requests per minute. The effective value is in the `x-ratelimit-limit` header. It counts **by caller address only** — `client_id` is deliberately not part of the limiter key, so rotating it gives no new budget, and all instances of the integration behind one address share those 60 requests. It sets the `X-RateLimit-*` headers. The platform's entry limiter: 60 requests per **second** per address, and this counter is shared across all of `/v1/`, not per endpoint. It does not set `X-RateLimit-*` headers, and its `Retry-After` is always 1. In both cases the body comes in the common API envelope — `{ "success": false, "error": { "code": "RATE_LIMITED", "message": "..." } }` — which differs from the RFC 7009 form of this endpoint's other responses, and the limiters cannot be told apart by the body, only by the presence of `X-RateLimit-Limit`. The rejection is **not** terminal: the key is not revoked. Retry after the delay given in `Retry-After`.

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

## Known specifics

**Revocation stops the key immediately.** If the presented key was issued to your client and was active, requests with it return `401 KEY_INACTIVE` after revocation, and its slot in the limit is freed. The `200 {}` response alone does not prove revocation: an unknown key, a key belonging to another client and an already revoked key give the same response.

**Client deactivation does not block revocation.** You can also revoke a key issued before your client was deactivated: deactivation stops issuing new keys but does not prohibit revoking earlier ones.

**What the endpoint does not do:**

- **it does not remove the webhook in the Bitrix24 account** — the user deletes it on their side; revoking the key does not replace that.
- **it does not return a lost key** — to revoke a key you must present it; it cannot be recovered.
- **it does not trigger on its own** — if the user stops using the integration, the key lives on. Calling the endpoint is your responsibility.

## See also

- [Key lifetime, revocation and limit](/docs/partner-connect/keys)
- [Exchange a code for an API key](/docs/partner-connect/token)
- [Partner Connect](/docs/partner-connect)
