[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ffolders\u002Fpublic-link":3,"docs-tabs-entities\u002Ffolders\u002Fpublic-link":6},{"content":4,"lastmod":5},"## Public link to a folder\n\n`POST \u002Fv1\u002Ffolders\u002F:id\u002Fpublic-link`\n\nCreates a public link to a folder or returns the existing one: anyone who has the link can open the entire folder contents, including files added later. The link cannot be revoked through the API.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `id` (path) | number | yes | Folder ID. List: `GET \u002Fv1\u002Ffolders?parentId=X`. The root folder of a storage cannot be published |\n\nNo request body is sent.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffolders\u002F10741\u002Fpublic-link\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffolders\u002F10741\u002Fpublic-link\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffolders\u002F10741\u002Fpublic-link', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n  },\n})\nconst body = await res.json()\nif (!body.success) throw new Error(body.error.code)\nconst link = body.data.url\nconsole.log('Link received, folder in trash:', body.meta.inTrash)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffolders\u002F10741\u002Fpublic-link', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\nconst body = await res.json()\nif (!body.success) throw new Error(body.error.code)\nconst link = body.data.url\nconsole.log('Link received, folder in trash:', body.meta.inTrash)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | `true` on success |\n| `data.url` | string | Public link to the folder. Opens the folder and all its contents without authorization |\n| `data.revocableViaApi` | boolean | Always `false`: the link cannot be revoked through the API |\n| `meta.inTrash` | boolean | `true` — the folder is in the trash. The link is issued but opens the folder only after [restoration](\u002Fdocs\u002Fentities\u002Ffolders\u002Frestore) |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"url\": \"https:\u002F\u002Fbitrix24public.com\u002F\u003Cportal>.bitrix24.com\u002Ffolder\u002FEXAMPLE_TOKEN\",\n    \"revocableViaApi\": false\n  },\n  \"meta\": {\n    \"inTrash\": false\n  }\n}\n```\n\n## Error response example\n\n400 — the folder is a storage root:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"A storage root cannot be published.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_ID` | `id` is not a positive integer |\n| 400 | `INVALID_PARAMS` | The folder is a storage root. The request is rejected before it reaches Bitrix24, so that the entire personal or shared Drive is not exposed |\n| 401 | `TOKEN_MISSING` | The key's portal has no authorization tokens |\n| 403 | `SCOPE_DENIED` | The key lacks the `disk` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode, and creating a link changes portal data |\n| 403 | `BITRIX_ACCESS_DENIED` | The key owner has no permission to change the folder, or public links are disabled on the portal. The response does not distinguish these reasons |\n| 404 | `ENTITY_NOT_FOUND` | There is no folder with this `id` |\n| 422 | `DISK_PUBLIC_LINK_REFUSED` | Bitrix24 did not return a link |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused to create the link; the reason is in `message` |\n| 429 | `RATE_LIMITED` | Request limit exceeded — wait 1-2 seconds and retry |\n| 502 | `DISK_OUTCOME_UNKNOWN` | The connection to Bitrix24 dropped after the link was requested. The outcome is unknown, and no retry was made. A repeat call returns the same link if it was created |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 was unavailable while the folder was being read; the link was not requested |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**The link is an access secret.** The response comes with the `Cache-Control: private, no-store` header. Do not write `data.url` to logs, audit records or telemetry.\n\n**Existing link.** If the folder already has a public link, the call returns it instead of creating a new one. It may be another employee's link, including one with a password or an expiration date: the response does not say whether it is protected.\n\n**Trash and deletion.** While the folder is in the trash, the link does not open it; after restoration it opens the folder again. Via the API, the only way to disable the link is to [permanently delete the folder](\u002Fdocs\u002Fentities\u002Ffolders\u002Fpurge).\n\n**Batch calls.** The method is not part of [`POST \u002Fv1\u002Fbatch`](\u002Fdocs\u002Fbatch) — call it as a separate request.\n\n## See also\n\n- [Get a folder](\u002Fdocs\u002Fentities\u002Ffolders\u002Fget)\n- [Restore folder](\u002Fdocs\u002Fentities\u002Ffolders\u002Frestore)\n- [Permanently delete folder](\u002Fdocs\u002Fentities\u002Ffolders\u002Fpurge)\n- [Share a folder with a user](\u002Fdocs\u002Fentities\u002Ffolders\u002Fshares)\n- [Public link to a file](\u002Fdocs\u002Fentities\u002Ffiles\u002Fpublic-link)\n- [Folders](\u002Fdocs\u002Fentities\u002Ffolders)\n","2026-10-15",{},1795415252256]