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

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

Enable or disable a document public link

POST /v1/documents/:id/public-url

Enables or disables a public link that opens an app document in a browser without an API key and without signing in to Bitrix24.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionDocument ID, a positive integer. List: GET /v1/documents

Request fields (body)

Field Type Required Description
Fieldenabled Typeboolean Requiredyes Descriptiontrue enables the link, false disables it. The string "true" is rejected

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/documents/2001/public-url" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/documents/2001/public-url" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/2001/public-url', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ enabled: true }),
})

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/2001/public-url', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ enabled: true }),
})

const { success, data } = await res.json()

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.publicUrl Typestring | null DescriptionPublic link to the document after enabled: true. null after enabled: false

Response example

Link enabled:

JSON
{
  "success": true,
  "data": {
    "publicUrl": "https://example.bitrix24.com/~FbdN8"
  }
}

Link disabled:

JSON
{
  "success": true,
  "data": {
    "publicUrl": null
  }
}

Error response example

400 — enabled is missing or not a boolean:

JSON
{
  "success": false,
  "error": {
    "code": "MISSING_REQUIRED_FIELDS",
    "message": "enabled must be a boolean."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS Descriptionid is not a positive integer. Message: Document ID must be a positive integer.
HTTP400 CodeMISSING_REQUIRED_FIELDS Descriptionenabled is missing or not a boolean, for example "true"
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo document with this id. Message: Document not found.
HTTP502 CodeBITRIX_INVALID_RESPONSE DescriptionBitrix24 responded without the link state
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 rejected the request. The reason is in error.message
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionBitrix24 denied access to the document
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the documentgenerator scope
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeTOKEN_MISSING DescriptionNo tokens are mapped to the key — an OAuth application key was called without a user session

Full list of common API errors — Errors.

Known specifics

Anyone with the address can open the document via the link. Disable the link when access is no longer needed: after enabled: false, the previous link returns 404 in the browser.

Re-enabling gives a new address. A repeated enabled: true on an already enabled link returns the same address. After disabling, the next enable issues a different address.

See also