[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-source-storage\u002Fversions-download":3,"docs-tabs-source-storage\u002Fversions-download":6},{"content":4,"lastmod":5},"## Download the archive\n\n`GET \u002Fv1\u002Fapps\u002F:id\u002Fsources\u002F:versionId\u002Fdownload`\n\nReturns a temporary signed link for downloading the source archive of the selected application version.\n\nThe operation stays available even when source saving is disabled: the previously saved history remains readable.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `id` (path) | UUID | yes | Application identifier. Get it via [`GET \u002Fv1\u002Fapps`](\u002Fdocs\u002Fapps\u002Flist). |\n| `versionId` (path) | string | yes | Version identifier of the form `v\u003CN>`. Get it via [List versions](\u002Fdocs\u002Fsource-storage\u002Fversions). The `savedVersionId` returned by a [deploy](\u002Fdocs\u002Finfra\u002Fdeploy\u002Fdeploy) to a server on a personal key belongs to the server's history, not the application's: with it, this method returns a link to the archive of a different application version or `404 VERSION_NOT_FOUND`. Download that version via the [server endpoints](\u002Fdocs\u002Fsource-storage\u002Fservers). |\n\n## Examples\n\n### curl — personal key\n\n```bash\n# Get the link\ncurl -H \"X-Api-Key: YOUR_API_KEY\" \\\n  https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fapps\u002F\u003CAPP_ID>\u002Fsources\u002Fv3\u002Fdownload\n\n# Download the archive using that link, no additional headers\ncurl -o source-v3.tar.gz \"\u003Curl from the response above>\"\n```\n\n### curl — OAuth application\n\n```bash\n# Get the link\ncurl -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fapps\u002F\u003CAPP_ID>\u002Fsources\u002Fv3\u002Fdownload\n\n# Download the archive using that link, no additional headers\ncurl -o source-v3.tar.gz \"\u003Curl from the response above>\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst { data } = await fetch(\n  `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fapps\u002F${appId}\u002Fsources\u002Fv3\u002Fdownload`,\n  { headers: { 'X-Api-Key': 'YOUR_API_KEY' } },\n).then((r) => r.json())\n\nconst archive = await fetch(data.url)\nconst buffer = await archive.arrayBuffer()\n\u002F\u002F Next, unpack the archive: read tar.gz with a tar library, zip with JSZip or similar\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst { data } = await fetch(\n  `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fapps\u002F${appId}\u002Fsources\u002Fv3\u002Fdownload`,\n  {\n    headers: {\n      'X-Api-Key': 'YOUR_APP_KEY',\n      'Authorization': 'Bearer USER_SESSION_TOKEN',\n    },\n  },\n).then((r) => r.json())\n\nconst archive = await fetch(data.url)\nconst buffer = await archive.arrayBuffer()\n\u002F\u002F Next, unpack the archive: read tar.gz with a tar library, zip with JSZip or similar\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | Always `true` on success. |\n| `data.url` | string | Signed link to the archive. Requires no additional headers when downloading. The archive format is given by the version's `contentType` field, see [Get version metadata](\u002Fdocs\u002Fsource-storage\u002Fversions-get). |\n| `data.expiresAt` | string | When the signature expires (ISO 8601, UTC). The requested link lifetime is 30 minutes, but the signature may expire earlier: download the archive right away and check this field. |\n\n## Response example\n\n`HTTP 200`, the signed link in the example is shortened:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"url\": \"https:\u002F\u002F\u003Cstorage-endpoint>\u002F...\",\n    \"expiresAt\": \"2026-10-07T09:12:22.000Z\"\n  }\n}\n```\n\n## Error response example\n\n404 — the application has no version with that identifier:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"VERSION_NOT_FOUND\",\n    \"message\": \"Version v99 not found\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_VERSION_ID` | The `versionId` format does not match `v\u003Cnon-negative integer>`. |\n| 403 | `SOURCE_APP_ID_MISMATCH` | The call was made with an authorization key `vibe_app_…` issued for a different application. Such a key can access only its own application's snapshots, even when both applications were created by the same author. |\n| 403 | `NOT_AUTHORIZED` | The personal key belongs neither to the application author nor to a Bitrix24 account administrator and was not issued for this application. |\n| 404 | `APP_NOT_FOUND` | The application does not exist, was deleted, or belongs to another portal. |\n| 404 | `VERSION_NOT_FOUND` | A version with this `versionId` does not exist or was deleted. |\n| 410 | `SOURCE_VERSION_BYTES_PURGED` | The version record still exists, but its bytes have already been purged from storage. The only recovery is to [save the archive again](\u002Fdocs\u002Fsource-storage\u002Fsave). |\n| 502 | `SOURCE_DOWNLOAD_URL_FAILED` | Storage is temporarily unavailable — retry the request. |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Source code storage](\u002Fdocs\u002Fsource-storage)\n- [List versions](\u002Fdocs\u002Fsource-storage\u002Fversions)\n- [Get version metadata](\u002Fdocs\u002Fsource-storage\u002Fversions-get)\n- [Save a snapshot](\u002Fdocs\u002Fsource-storage\u002Fsave)\n- [Server-keyed source endpoints](\u002Fdocs\u002Fsource-storage\u002Fservers)\n","2026-10-07",{},1795415507768]