Use this method to get basic info about a file and prepare it for downloading
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>
, where <file_path>
is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
POST
/getFile
curl \
-X POST https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getFile \
-H "Content-Type: application/json" \
-d '{"file_id":"string"}'
Request example
{
"file_id": "string"
}
Request examples
{
"file_id": "string"
}
Response examples (default)
{
"ok": false,
"error_code": 42,
"description": "string",
"parameters": {
"migrate_to_chat_id": 42,
"retry_after": 42
}
}
Response examples (default)
{
"ok": false,
"error_code": 42,
"description": "string",
"parameters": {
"migrate_to_chat_id": 42,
"retry_after": 42
}
}
Response examples (200)
{
"ok": true,
"result": {
"file_id": "string",
"file_unique_id": "string",
"file_size": 42,
"file_path": "string"
}
}
Response examples (200)
{
"ok": true,
"result": {
"file_id": "string",
"file_unique_id": "string",
"file_size": 42,
"file_path": "string"
}
}