لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/sites/restore.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Restore a site
POST /v1/sites/:id/restore
Brings a site back from the trash.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionSite ID, a positive integer. Sites in the trash: GET /v1/sites?filter[deleted]=Y |
Parameterscope (query) |
Typestring | Requiredno | DescriptionInternal landing scope: KNOWLEDGE / GROUP / MAINPAGE. Pass it if the site belongs to that scope. Otherwise 404 ENTITY_NOT_FOUND is returned |
The request body is empty or {}. Any field in the body is rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/sites/233/restore" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/sites/233/restore" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/233/restore', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { success, data } = await res.json()
console.log('In trash:', data.deleted)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/233/restore', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on success |
Fielddata.id |
Typenumber | DescriptionSite ID |
Fielddata.active |
Typeboolean | DescriptionWhether the site is published. After restoring — false |
Fielddata.deleted |
Typeboolean | DescriptionWhether the site is in the trash. After restoring — false. In GET /v1/sites responses the same field comes as a string "Y" / "N" |
Fielddata.type |
Typestring | DescriptionSite type: PAGE, STORE, KNOWLEDGE and other values from GET /v1/sites/fields |
Response example
{
"success": true,
"data": {
"id": 233,
"active": false,
"deleted": false,
"type": "PAGE"
}
}
Error response example
404 — site not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "Site not found or not visible"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
Descriptionid is not a positive integer |
| HTTP400 | CodeINVALID_SCOPE |
Descriptionscope is not KNOWLEDGE, GROUP or MAINPAGE |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionA request body was passed. The method accepts an empty body or {} |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo site with this id exists, it is not accessible to the key's user, or it belongs to a different scope |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionThe site was not found after the operation: it was deleted by a concurrent request |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 did not confirm the site operation or rejected it. The reason is in message |
| HTTP409 | CodeLANDING_MODULE_NOT_ENABLED |
DescriptionThe Sites module is unavailable on the Bitrix24 account. Ask the Bitrix24 account administrator to enable it. While the module is disabled, a retry returns the same refusal |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionBitrix24 denied access: the key's user has no permissions on this site or no administrator rights, or the feature is unavailable on the Bitrix24 account |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe API key is read-only |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe API key does not have the landing scope |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no configured tokens |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
Full list of common API errors: Errors.
Known specifics
- Restoring does not bring back publication. The site comes back with
active: false, even if it was published before it went to the trash or was published while it was in the trash. Publish the site again withPOST /v1/sites/:id/publication. - Restoring a site that is not in the trash succeeds without an error. The response is
200, and the site does not change.