## Reset site permissions

`DELETE /v1/sites/:id/permissions`

Resets all access permissions assigned to a site in one call. To assign a new set of permissions instead of resetting them, use the method that replaces site permissions.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Site ID. List: [`GET /v1/sites`](/docs/entities/sites/list) |
| `scope` (query) | string | no | Site type: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup site, `MAINPAGE` — home page. Omit the parameter for all other sites |

The request takes no body. An empty object `{}` is accepted; a body with any field is rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/sites/42/permissions" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/sites/42/permissions" \
  -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/sites/42/permissions', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})
const body = await res.json()

if (body.success && body.data.updated) {
  console.log('Site permissions reset')
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/42/permissions', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const body = await res.json()

if (body.success && body.data.updated) {
  console.log('Site permissions reset')
}
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` — the reset succeeded |
| `data.updated` | boolean | Always `true`: Bitrix24 confirmed the permissions reset |

## Response example

```json
{
  "success": true,
  "data": {
    "updated": true
  }
}
```

## Error response example

404 — the site does not exist or is not visible to the key:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Site not found or not visible"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | A request body with fields was passed. Error text — `DELETE permissions takes no body` |
| 400 | `INVALID_PARAMS` | `id` is not a positive integer |
| 400 | `INVALID_SCOPE` | `scope` is not one of `KNOWLEDGE`, `GROUP`, `MAINPAGE` |
| 404 | `ENTITY_NOT_FOUND` | No site with this `id` exists, or it is not visible to the key. A knowledge base, workgroup site or home page requires the `scope` parameter |
| 403 | `BITRIX_ACCESS_DENIED` | The key does not belong to a Bitrix24 account administrator, or the Bitrix24 plan does not include extended site permissions |
| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is unavailable on the Bitrix24 account |
| 422 | `BITRIX_ERROR` | Bitrix24 did not confirm the permissions reset or rejected the site operation |
| 403 | `SCOPE_DENIED` | The key lacks the `landing` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens configured |

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

## Known specifics

- **The reset result cannot be verified through the API.** No method reads assigned site permissions. [`GET /v1/sites/:id/my-permissions`](/docs/entities/sites/my-permissions) shows only the current user's operations: for a Bitrix24 account administrator the list is the same before and after the reset.

## See also

- [Site permissions](/docs/entities/sites/permissions)
- [My site permissions](/docs/entities/sites/my-permissions)
- [Site list](/docs/entities/sites/list)
- [Sites](/docs/entities/sites)
- [Errors](/docs/errors)
