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

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

Move to trash

POST /v1/pages/:id/trash

Moves a page to trash and unpublishes it.

Requires the landing scope.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionPage ID. List: GET /v1/pages
Parameterscope (query) Typestring Requiredno DescriptionSite type: KNOWLEDGE — knowledge base, GROUP — workgroup site, MAINPAGE — main page. Omit the parameter for pages of all other sites

The body is empty or {}.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/pages/2427/trash" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/pages/2427/trash" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

JavaScript — personal key

javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/2427/trash", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)

JavaScript — OAuth application

javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/2427/trash", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionThe page after the action
Fielddata.id Typenumber DescriptionPage ID
Fielddata.siteId Typenumber DescriptionID of the page's site
Fielddata.folderId Typenumber | null DescriptionFolder ID. null — the page is at the site root
Fielddata.title Typestring DescriptionPage title
Fielddata.code Typestring DescriptionPage code in the URL
Fielddata.active Typeboolean DescriptionWhether the page is published
Fielddata.deleted Typestring DescriptionY — the page is in trash, N — it is not

Response example

JSON
{
  "success": true,
  "data": {
    "id": 2427,
    "siteId": 3,
    "folderId": null,
    "title": "Empty page",
    "code": "empty-page",
    "active": false,
    "deleted": "Y"
  }
}

Error response example

404 — no page with this id exists:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Page not found."
  }
}

Errors

HTTP Code Description
HTTP404 CodeENTITY_NOT_FOUND DescriptionPage not found. — no page with this id exists
HTTP404 CodeENTITY_NOT_FOUND DescriptionPage or folder not found. — Bitrix24 did not find the page or folder while performing the action
HTTP400 CodeINVALID_PAGE_ID Descriptionid must be a positive safe integer. — id is not a positive integer
HTTP400 CodeINVALID_PARAMS DescriptionBody must be a JSON object. — the body is not a JSON object
HTTP400 CodeINVALID_PARAMS DescriptionBody contains a field this operation does not accept. — the body contains a field, but it must be empty or {}
HTTP400 CodeINVALID_SCOPE Descriptionscope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted. — scope is not KNOWLEDGE, GROUP or MAINPAGE
HTTP422 CodeBITRIX_NO_EFFECT DescriptionBitrix24 did not confirm the page action. — Bitrix24 did not confirm the action
HTTP422 CodeBITRIX_NO_EFFECT DescriptionBitrix24 did not return the page after the action. — the page could not be read after the action
HTTP422 CodeBITRIX_NO_EFFECT DescriptionBitrix24 did not persist the requested page state. — after the action the page is not in trash
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 rejected the action, for example, for an include area. The error text comes from Bitrix24
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the landing scope
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionThe Bitrix24 user on whose behalf the key was issued has no permission to perform the action on the page
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key works in read-only mode; the request is rejected before it reaches Bitrix24
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeINVALID_API_KEY DescriptionThe key in X-Api-Key is not found or has been revoked
HTTP409 CodePORTAL_ADDRESS_CHANGED DescriptionThe on-premise Bitrix24 moved to a new address, but the key's webhook was issued for the old one. Reissue the key's webhook
HTTP429 CodeRATE_LIMITED DescriptionThe Bitrix24 request limit is exceeded. Retry the request in 1-2 seconds
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 did not respond or responded with a server error
HTTP503 CodeBITRIX_TIMEOUT DescriptionBitrix24 did not respond in time

Full list of general API errors — Errors.

Known specifics

  • A repeated call returns no error. For a page that is already in trash, the response is 200 with its current state.

See also