Use this method to get basic info about a file and prepare it for downloading

POST /getFile

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.

Body Required

  • file_id string Required

    File identifier to get info about

Responses

  • default
    Hide response attributes Show response attributes object
    • ok boolean Required

      Default value is false.

    • error_code integer Required
    • description string Required
    • parameters object

      Contains information about why a request was unsuccessful.

      Hide parameters attributes Show parameters attributes object
      • migrate_to_chat_id integer

        Optional. The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.

      • retry_after integer

        Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated

  • 200
    Hide response attributes Show response attributes object
    • ok boolean Required

      Default value is true.

    • result object Required

      This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. 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.

      Maximum file size to download is 20 MB

      Hide result attributes Show result attributes object
      • file_id string Required

        Identifier for this file, which can be used to download or reuse the file

      • file_unique_id string Required

        Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.

      • file_size integer

        Optional. File size, if known

      • file_path string

        Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.

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"
  }
}