For AI agents: markdown of this page — /docs-content-en/entities/pages/from-template.md documentation index — /llms.txt

Create from a template

POST /v1/pages/from-template

Creates a page using a code from the template catalogue. The template type must match the site type. An unknown code returns 404 ENTITY_NOT_FOUND. Returns the freshly read page.

Requires the landing scope. Write actions refuse a READONLY key.

Request parameters

Field Type Required Description
scope string no Query: KNOWLEDGE, GROUP or MAINPAGE; omit for an ordinary site.
siteId integer yes Site from List sites.
templateCode string yes code from Page templates.
title string no New page title.
description string no Description.
folderId integer | null no folderId of an existing page in the site from list pages; null or 0 selects root.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/pages/from-template" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"siteId": 10, "templateCode": "empty", "title": "Example"}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/pages/from-template" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"siteId": 10, "templateCode": "empty", "title": "Example"}'

JavaScript — personal key

javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/from-template", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({"siteId": 10, "templateCode": "empty", "title": "Example"}),
})
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/from-template", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({"siteId": 10, "templateCode": "empty", "title": "Example"}),
})
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.id integer Freshly read page ID.
data.siteId integer Page site.
data.folderId integer | null Folder; null at root.
data.title string title
data.code string Page address code.
data.active boolean Whether the page is published.
data.deleted string Y/N Y means in trash; N means not in trash.
JSON
{
  "success": true,
  "data": {
    "id": 42,
    "siteId": 10,
    "folderId": null,
    "title": "Example",
    "code": "example",
    "active": false,
    "deleted": "N"
  }
}

Errors

HTTP Code Condition
400 MISSING_REQUIRED_FIELDS Required parameters are missing.
400 INVALID_PARAMS Invalid body shape or parameter value.
400 INVALID_SCOPE Invalid scope.
401 TOKEN_MISSING No Bitrix24 credentials.
403 SCOPE_DENIED The key lacks landing.
403 BITRIX_ACCESS_DENIED The Bitrix24 user lacks permission.
404 ENTITY_NOT_FOUND Site, folder or template not found.
422 BITRIX_ERROR Bitrix24 business refusal; its message is preserved.
422 BITRIX_NO_EFFECT Bitrix24 did not confirm the action or return the expected result.
403 WRITE_BLOCKED_READONLY_KEY A READONLY key cannot write to the portal.

All system errors.

400 — invalid scope:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_SCOPE",
    "message": "scope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted."
  }
}

See also