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 file information and a one-time download link.

Parameters

Parameter Type Required Description
botId (path) number yes Bot ID
fileId (path) number yes File 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
id number File ID
name string File name
size number Size in bytes
downloadUrl string One-time download link

Response example

JSON
{
  "success": true,
  "data": {
    "id": 789,
    "name": "report.pdf",
    "size": 2048576,
    "downloadUrl": "https://portal.bitrix24.com/rest/download.json?token=abc123..."
  }
}

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
400 INVALID_BOT_ID botId is not a number
404 BOT_NOT_FOUND No bot with this ID found
403 BOT_ACCESS_DENIED Bot belongs to a different API key
502 BITRIX_ERROR Bitrix24 error (error text in message)
403 SCOPE_DENIED API key does not have the imbot scope
401 TOKEN_MISSING API key has no configured tokens

Full list of common API errors — Errors.

Known specifics

One-time link: downloadUrl is a temporary link. A new method call is required to download again.

See also