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

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

Page template areas

Binds other pages to the areas of a page layout — header, footer, sidebar — reads the bindings, changes them one at a time, and removes them all at once. Removing a binding leaves the pages themselves on the site.

Bitrix24 API: landing.template.getLandingRef, landing.template.setLandingRef Scope: landing

Get page template areas

GET /v1/pages/:id/template-areas

Returns the page's own layout area bindings: which page is inserted into its header, footer or sidebar. Site areas are not included; a separate method reads them.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionPage ID. List: GET /v1/pages
Parameterscope (query) Typestring Requiredno DescriptionInternal landing area: KNOWLEDGE / GROUP / MAINPAGE. Specify it if the page's site belongs to the corresponding area. Otherwise 404 ENTITY_NOT_FOUND is returned. Omit it for an ordinary site

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/pages/2381/template-areas" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/pages/2381/template-areas" \
  -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/pages/2381/template-areas', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
for (const [area, pageId] of Object.entries(data.areas)) {
  console.log(`Area ${area} → page ${pageId}`)
}

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/pages/2381/template-areas', {
  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 DescriptionAlways true on success
Fielddata.areas Typeobject DescriptionArea bindings. The key is the area number as a decimal string, the value is a page ID. Get a page: GET /v1/pages/:id. A page without its own bindings returns an empty object {}

Response example

JSON
{
  "success": true,
  "data": {
    "areas": {
      "1": 2385
    }
  }
}

Error response example

404 — no page with this ID was found:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Entity not found or not visible"
  }
}

Errors

HTTP Code Description
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo page with this ID was found, it is not visible to the user, or it belongs to another area: the wrong scope was passed
HTTP400 CodeINVALID_PARAMS Descriptionid must be a positive safe integer — id is not a positive integer
HTTP400 CodeINVALID_PARAMS DescriptionUnsupported query parameter — a query parameter the method does not accept was passed
HTTP400 CodeINVALID_SCOPE Descriptionscope is not KNOWLEDGE, GROUP or MAINPAGE
HTTP409 CodeLANDING_MODULE_NOT_ENABLED DescriptionThe Sites module is unavailable on this Bitrix24 account. Ask a Bitrix24 account administrator to enable it — while the module is off, a retry returns the same refusal
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 returned invalid template areas — Bitrix24 returned the areas in an unexpected shape
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the landing scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens

Full list of common API errors — Errors.

Known specifics

  • Site areas are not merged into the response. The response contains only the page's own bindings. A page that was never given its own areas returns an empty object, even when its site has areas. The site bindings are read by GET /v1/sites/:id/template-areas.

See also