لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/documents/crm-public-url.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Enable or disable a CRM document public link
POST /v1/crm-documents/:id/public-url
Enables or disables a public link that opens a document attached to a CRM record 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. Documents of a record: GET /v1/crm-documents |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
Fieldenabled |
Typeboolean | Requiredyes | Descriptiontrue enables the link, false disables it. The string "true" and numbers are rejected |
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/crm-documents/1961/public-url" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/crm-documents/1961/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
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-documents/1961/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
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-documents/1961/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:
{
"success": true,
"data": {
"publicUrl": "https://example.bitrix24.com/~rDxtx"
}
}
Link disabled:
{
"success": true,
"data": {
"publicUrl": null
}
}
Error response example
400 — enabled is missing or not a boolean:
{
"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: 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 exists, or it was deleted |
| HTTP502 | CodeBITRIX_INVALID_RESPONSE |
DescriptionBitrix24 responded without the link state |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionNo access to the CRM record the document is attached to, including when the record does not exist. Message: Access denied |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the crm 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. Disable the link when access is no longer needed: after enabled: false the old link returns 404 in a browser.
Re-enabling issues a new address. Sending enabled: true again while the link is already enabled returns the same address. After the link is disabled, the next enabled: true issues a different address.