For AI agents: markdown of this page — /docs-content-en/bots/files/download.md documentation index — /llms.txt

Download file

GET /v1/bots/:botId/files/:fileId

Returns a download link for a file from a chat with the bot. The file ID comes in the message event and in the file upload response.

Parameters

Parameter Type Required Description
ParameterbotId (path) Typenumber Requiredyes DescriptionBot ID
ParameterfileId (path) Typenumber Requiredyes DescriptionFile ID

Examples

curl — personal key

Terminal
curl https://vibecode.bitrix24.com/v1/bots/42/files/789 \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl https://vibecode.bitrix24.com/v1/bots/42/files/789 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/files/789', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Download URL:', data.downloadUrl)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/files/789', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionFile link
Fielddata.downloadUrl Typestring DescriptionDownload link for the file. The file name, size, and type are returned in the Upload file response

Response example

JSON
{
  "success": true,
  "data": {
    "downloadUrl": "https://portal.bitrix24.com/rest/1/abc123/download/?token=imbot%7CaWQ9Nzg5..."
  }
}

Error response example

404 — bot not found:

JSON
{
  "success": false,
  "error": {
    "code": "BOT_NOT_FOUND",
    "message": "Bot 999 not found. Register it first via POST /v1/bots."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_BOT_ID DescriptionbotId is not a number
HTTP400 CodeINVALID_PARAMS DescriptionfileId in the path must be a positive integer from 1 to 9007199254740991, without a sign, leading zeros, fraction, exponent or whitespace. Rejected before calling Bitrix24
HTTP404 CodeBOT_NOT_FOUND DescriptionNo bot found with this ID
HTTP403 CodeBOT_ACCESS_DENIED DescriptionBot belongs to a different API key
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 error (error text in message)
HTTP403 CodeSCOPE_DENIED DescriptionAPI key does not have the imbot scope
HTTP410 CodeBOT_DISABLED DescriptionThe bot is disabled and does not process API calls. How to restore it — Bot disabled
HTTP401 CodeTOKEN_MISSING DescriptionAPI key has no configured tokens

Full list of common API errors — Errors.

See also