สำหรับเอเจนต์ AI: markdown ของหน้านี้ — /docs-content-en/entities/pages/block-content.md ดัชนีเอกสาร — /llms.txt

บทความในเอกสารมีให้บริการเป็นภาษาอังกฤษในขณะนี้

Read block content

GET /v1/pages/:pageId/blocks/:blockId/content

Always uses editMode=1. html is the content with the block-wrapper container. Optional anchor, nodes, cards, style, attrs, css, js and php are returned when supplied by Bitrix24; the full manifest is omitted. php=true denotes a code block with restricted content editing.

Requires the landing scope. READONLY keys can read. Optional query scope=KNOWLEDGE|GROUP|MAINPAGE selects the page context. No body is accepted by the contract. Credential-bearing strings are replaced with [REDACTED], including the entire HTML string if needed. The Bitrix24 response is bounded to 8 MiB; exceeding the limit returns 502.

If top-level editing data is absent, nodes, cards, style and attrs come from the corresponding manifest fields. Empty dictionaries may be returned as empty arrays by Bitrix24.

Request parameters

Field Type Required Description
pageId integer yes Positive safe page ID from Pages.
blockId integer yes Positive safe block ID belonging to this page.
scope string no KNOWLEDGE, GROUP or MAINPAGE; omit for an ordinary site.

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/pages/20/blocks/30/content" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/pages/20/blocks/30/content" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/20/blocks/30/content", {
  headers: {"X-Api-Key": "YOUR_API_KEY"},
})
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/20/blocks/30/content", {
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN"},
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)

Response fields

Field Type Description
success boolean true
data object Operation result.
data.html string HTML with block-wrapper; may be [REDACTED].
data.anchor string Optional anchor.
data.nodes object or array Optional node data or manifest selector dictionary.
data.cards object or array Optional card data or manifest selector dictionary.
data.style object or array Optional style data.
data.attrs object or array Optional attribute data.
data.css array Optional CSS resources.
data.js array Optional JavaScript resources.
data.php boolean Optional; true means content editing is restricted.

Response

JSON
{
  "success": true,
  "data": {
    "html": "<section>Example</section>",
    "anchor": "example",
    "nodes": {},
    "cards": {},
    "style": {},
    "attrs": {},
    "css": [],
    "js": [],
    "php": false
  }
}

Errors

HTTP Code Condition
400 INVALID_PARAMS Invalid pageId/blockId or blank code.
400 INVALID_SCOPE Invalid scope.
401 TOKEN_MISSING No Bitrix24 credentials.
403 SCOPE_DENIED Key lacks landing scope.
403 BITRIX_ACCESS_DENIED Bitrix24 user lacks permission.
404 ENTITY_NOT_FOUND Block not in this page, missing sample or manifest file.
409 LANDING_MODULE_NOT_ENABLED The Sites module is unavailable on this Bitrix24 account.
422 BITRIX_ERROR Bitrix24 business refusal; message preserved.
502 BITRIX_INVALID_RESPONSE Unexpected result or Bitrix24 response exceeds 8 MiB.

All system errors.

See also