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

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

Site template areas

Binds pages to the areas of the site layout — header, footer, sidebar — reads the bindings, changes them one at a time and removes them all at once. The pages themselves stay on the site when a binding is removed.

Bitrix24 API: landing.template.getSiteRef, landing.template.setSiteRef Scope: landing

Get site template areas

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

Returns the bindings of the site layout areas to pages: which page is inserted into the header, footer or sidebar. Page areas are not included; a separate method reads them.

Parameters

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

Examples

curl — personal key

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

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/sites/225/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/sites/225/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/sites/225/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 the page ID. Get the page: GET /v1/pages/:id. A site without bindings returns an empty object {}

Response example

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

Error response example

404 — no site 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 site with this ID was found, it is not accessible to the user, or it belongs to another scope: 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 not available on the Bitrix24 account. Ask a Bitrix24 account administrator to enable it — while the module is disabled, retrying the request 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 tokens configured

Full list of common API errors — Errors.

Known specifics

  • Page areas are not merged into the response. The response contains only the bindings of the site itself. The page bindings are read by GET /v1/pages/:id/template-areas: for a page that has no areas of its own, it returns an empty object, even when its site has areas.

See also