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

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

Publish site

POST /v1/sites/:id/publication

Publishes a site on the Bitrix24 account together with all of its unpublished pages, including pages inside folders.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionSite ID — a positive integer. List: GET /v1/sites
Parameterscope (query) Typestring Requiredno DescriptionInternal landing scope: KNOWLEDGE / GROUP / MAINPAGE. Pass it if the site belongs to that scope. Otherwise the response is 404 ENTITY_NOT_FOUND

The request body is empty or {}. Any field in the body is rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/sites/233/publication" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/sites/233/publication" \
  -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/233/publication', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Published:', data.active)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/233/publication', {
  method: 'POST',
  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 Descriptiontrue on success
Fielddata.id Typenumber DescriptionSite ID
Fielddata.active Typeboolean DescriptionWhether the site is published
Fielddata.deleted Typeboolean DescriptionWhether the site is in the trash. In GET /v1/sites responses the same field comes as the string "Y" / "N"
Fielddata.type Typestring DescriptionSite type: PAGE, STORE, KNOWLEDGE and other values from GET /v1/sites/fields

Response example

JSON
{
  "success": true,
  "data": {
    "id": 233,
    "active": true,
    "deleted": false,
    "type": "PAGE"
  }
}

Error response example

404 — the site is not found in the given scope:

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

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS Descriptionid is not a positive integer
HTTP400 CodeINVALID_SCOPE Descriptionscope is not KNOWLEDGE, GROUP or MAINPAGE
HTTP400 CodeINVALID_PARAMS DescriptionA request body was passed. The method accepts an empty body or {}
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo site with this id exists, it is not accessible to the key's user, or it belongs to a different scope
HTTP404 CodeENTITY_NOT_FOUND DescriptionThe site was not found after the operation — it was deleted by a concurrent request
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 did not confirm the publication or rejected it. The reason is in message
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
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionBitrix24 denied access: the key's user has no permissions on this site or no administrator permissions, or the feature is unavailable on the Bitrix24 account
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe API key is read-only
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the landing scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing

Full list of common API errors — Errors.

Known specifics

  • Publishing again succeeds without an error. For an already published site the response is 200, and the site does not change.
  • A site in the trash gets published but stays in the trash. The response comes with active: true and deleted: true. After restoring from the trash the site comes back unpublished — publish it again.

See also