[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fdocuments\u002Fcrm-public-url":3,"docs-tabs-entities\u002Fdocuments\u002Fcrm-public-url":6},{"content":4,"lastmod":5},"## Enable or disable a CRM document public link\n\n`POST \u002Fv1\u002Fcrm-documents\u002F:id\u002Fpublic-url`\n\nEnables 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.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `id` (path) | number | yes | Document ID, a positive integer. Documents of a record: [`GET \u002Fv1\u002Fcrm-documents`](\u002Fdocs\u002Fentities\u002Fdocuments\u002Fcrm-list) |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `enabled` | boolean | yes | `true` enables the link, `false` disables it. The string `\"true\"` and numbers are rejected |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-documents\u002F1961\u002Fpublic-url\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"enabled\": true}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-documents\u002F1961\u002Fpublic-url\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"enabled\": true}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-documents\u002F1961\u002Fpublic-url', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ enabled: true }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('Link:', data.publicUrl)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-documents\u002F1961\u002Fpublic-url', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ enabled: true }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.publicUrl` | string \\| null | Public link to the document after `enabled: true`. `null` after `enabled: false` |\n\n## Response example\n\nLink enabled:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"publicUrl\": \"https:\u002F\u002Fexample.bitrix24.com\u002F~rDxtx\"\n  }\n}\n```\n\nLink disabled:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"publicUrl\": null\n  }\n}\n```\n\n## Error response example\n\n400 — `enabled` is missing or not a boolean:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"MISSING_REQUIRED_FIELDS\",\n    \"message\": \"enabled must be a boolean\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `id` is not a positive integer. Message: `id must be a positive integer` |\n| 400 | `MISSING_REQUIRED_FIELDS` | `enabled` is missing or not a boolean, for example `\"true\"` |\n| 404 | `ENTITY_NOT_FOUND` | No document with this `id` exists, or it was deleted |\n| 502 | `BITRIX_INVALID_RESPONSE` | Bitrix24 responded without the link state |\n| 403 | `BITRIX_ACCESS_DENIED` | No access to the CRM record the document is attached to, including when the record does not exist. Message: `Access denied` |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |\n| 401 | `TOKEN_MISSING` | No tokens are mapped to the key — an OAuth application key was called without a user session |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**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.\n\n**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.\n\n## See also\n\n- [Get a CRM document](\u002Fdocs\u002Fentities\u002Fdocuments\u002Fcrm-get)\n- [Documents of a CRM entity](\u002Fdocs\u002Fentities\u002Fdocuments\u002Fcrm-list)\n- [Enable or disable a document public link](\u002Fdocs\u002Fentities\u002Fdocuments\u002Fpublic-url)\n- [Documents](\u002Fdocs\u002Fentities\u002Fdocuments)\n","2026-10-09",{},1794739374250]