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
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_id | String | Yes | Identifier 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
| Field | Type | Description |
|---|---|---|
| file_id | String | Unique identifier for the file |
| file_unique_id | String | Globally unique file identifier, consistent across Bots |
| file_size | Integer | File size in bytes |
| file_path | String | File path, can be used to download the file |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad request parameters, e.g. invalid file_id |
| 401 | Invalid or expired token |
| 404 | File not found |
| 500 | Internal server error |
