لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/sites/trash.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Move a site to trash

POST /v1/sites/:id/trash

Moves a site to the trash and unpublishes it. This is not a physical deletion: the site can be restored from the trash.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionSite ID, a positive integer. List: GET /v1/sites
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

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/sites/233/trash" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/sites/233/trash" \
  -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/233/trash', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('In trash:', data.deleted)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/233/trash', {
  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 moving to trash — false
Fielddata.deleted Typeboolean DescriptionWhether the site is in the trash. After moving — true. 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

JSON
{
  "success": true,
  "data": {
    "id": 233,
    "active": false,
    "deleted": true,
    "type": "PAGE"
  }
}

Error response example

404 — site not found:

JSON
{
  "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

  • A site in the trash is not returned by ID. GET /v1/sites/:id returns 404 ENTITY_NOT_FOUND for it. Find such a site with GET /v1/sites and filter[deleted]=Y.
  • Moving a site that is already in the trash succeeds without an error. The response is 200, and the site does not change.

See also