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

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

Site public URL

GET /v1/sites/:id/public-url

Returns the URL at which the site opens on the internet, along with its publication flag. For an unpublished site, this is the URL at which it will open once published.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionSite identifier — a positive integer. 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. An ordinary site requested with scope also returns 404

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/sites/109/public-url" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

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

const { success, data } = await res.json()
console.log(data.published ? 'Site is live:' : 'Opens after publication:', data.url)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/109/public-url', {
  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.url Typestring DescriptionPublic site URL with the https:// protocol
Fielddata.published Typeboolean Descriptiontrue — the site is published and opens at url, false — it is not published. Matches the site's active field in GET /v1/sites/:id

Response example

An unpublished site:

JSON
{
  "success": true,
  "data": {
    "url": "https://b24-j2kodd.bitrix24.site",
    "published": false
  }
}

Error response example

404 — site not found:

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
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo site with this id, the site is not accessible to the key's user, or it belongs to a different scope
HTTP409 CodeLANDING_MODULE_NOT_ENABLED DescriptionThe Sites module is unavailable on this Bitrix24 account. Ask a Bitrix24 account administrator to enable it — until then a retry returns the same refusal
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 returned no URL for this site or rejected the request. The reason is in message
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionBitrix24 denied access: the key's user is not an administrator, or the feature is unavailable on the Bitrix24 account
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

The full list of common API errors — Errors.

See also