Skip to content

getFile

Get file download information. After obtaining the file info, you can download the file via /file/:token/:path/:filename. File size must not exceed 20MB.

Request

GET /:token/getfile

POST /:token/getfile

This method supports both GET and POST requests.

Parameters

ParameterTypeRequiredDescription
file_idStringYesIdentifier of the file to get information about

Response

Returns a File object.

json
{
  "ok": true,
  "result": {
    "file_id": "BAADBAADAgADr4QLHFZ2Z7RXXXxxx",
    "file_unique_id": "AgADr4QLHFZ2Z7Q",
    "file_size": 1024000,
    "file_path": "documents/file_0.pdf"
  }
}

Response Fields

FieldTypeDescription
file_idStringUnique identifier for the file
file_unique_idStringGlobally unique file identifier, consistent across Bots
file_sizeIntegerFile size in bytes
file_pathStringFile path, can be used to download the file

Error Codes

CodeDescription
400Bad request parameters, e.g. invalid file_id
401Invalid or expired token
404File not found
500Internal server error