
## Update site

`PATCH /v1/sites/:id`

Updates the fields of an existing site. Pass only the fields you want to change, flat at the root of the JSON — without the `fields` wrapper.

## Parameters

| Parameter | Type | Req. | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Site identifier |
| `scope` | string | no | For a site in the knowledge-base section, pass `scope: "KNOWLEDGE"` (the same value as on create) — otherwise the server returns `403 BITRIX_ACCESS_DENIED` ("Site edit access denied"). Can be passed as a body field or the `?scope=KNOWLEDGE` query parameter. Not required for regular landing sites |

## Fields to update (body)

| Parameter | Type | Description |
|----------|-----|---------|
| `title` | string | Site name, up to 255 characters |
| `code` | string | Symbolic site code in the URL. Slashes are not allowed. If the code consists only of digits, the `site` prefix is added |
| `active` | boolean | Accepted without error but not saved — activity is managed in the Bitrix24 account interface (the site is activated when a page is published) |
| `domainId` | number | Domain identifier |
| `type` | string | Site type: `PAGE`, `STORE` or `KNOWLEDGE` |
| `description` | string | Site description, up to 255 characters |
| `xmlId` | string | External identifier, up to 255 characters |
| `landingIdIndex` | number | Identifier of the site home page |
| `landingId404` | number | Identifier of the 404 error page |
| `landingId503` | number | Identifier of the 503 error page |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/sites/157" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Promo landing — updated",
    "active": false
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/sites/157" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Promo landing — updated",
    "active": false
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/157', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Promo landing — updated',
    active: false,
  }),
})

const { success, data } = await res.json()
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/157', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Promo landing — updated',
    active: false,
  }),
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `data` | object | The updated site object with all key fields |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 157,
    "title": "Promo landing — updated",
    "code": "/promo/",
    "type": "PAGE",
    "active": false,
    "domainId": 5,
    "createdById": 1,
    "dateCreate": "12.09.2024 10:23:14",
    "dateModify": "07.05.2026 12:18:42"
  }
}
```

## Error response example

403 — no permission to update this site:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ACCESS_DENIED",
    "message": "Access denied"
  }
}
```

## Errors

| HTTP | `error.code` | Marker in `error.message` | Description |
|------|--------------|--------------------------|---------|
| 403 | `BITRIX_ACCESS_DENIED` | — | No permission to modify the site or the specified fields, or a site with this ID does not exist or is inaccessible — Bitrix24 responds "Access denied". For PATCH, `404` is not returned, unlike `GET /v1/sites/:id` |
| 422 | `BITRIX_ERROR` | `SLASH_IS_NOT_ALLOWED` | A `/` character was passed in `code` — slashes in the code are not allowed |
| 422 | `BITRIX_ERROR` | `DOMAIN_IS_INCORRECT` | An incorrect domain name format was passed |
| 422 | `BITRIX_ERROR` | `DOMAIN_EXIST` | The specified domain is already taken by another site |
| 422 | `BITRIX_ERROR` | `DOMAIN_EXIST_TRASH` | The domain is bound to a site in the trash — unbind it first |
| 422 | `BITRIX_ERROR` | `DOMAIN_NOT_FOUND` | A domain with the specified `domainId` does not exist |
| 422 | `BITRIX_ERROR` | `CODE_IS_NOT_UNIQUE` | The site code is not unique within the domain |
| 403 | `SCOPE_DENIED` | — | The API key does not have the `landing` scope |
| 401 | `TOKEN_MISSING` | — | The API key has no configured tokens |

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

## See also

- [Get site](/docs/entities/sites/get) — current field values
- [List sites](/docs/entities/sites/list) — find a site by filter
- [Delete site](/docs/entities/sites/delete) — delete an empty site
- [Batch](/docs/batch) — bulk update
- [Limits and optimization](/docs/optimization) — rate limits
