Files

Download a file by id

Streams the bytes of a file referenced by file_id. The id is obtained from a prior message, channel, or user response (look for media.photo.id or media.document.id in /v1/peers/{peer_id}/history, or photo.id on a user / channel profile). For photo files, an explicit thumb_size may be requested; if omitted, the largest available size is returned.

get/v1/files/{file_id}

Request

  • Base URL: https://telegram155.p.rapidapi.com
  • URL: https://telegram155.p.rapidapi.com/v1/files/{file_id}
  • Auth: none declared

Path parameters

file_idinteger required

Numeric file id obtained from a prior response (e.g. media.photo.id, media.document.id). File ids exceed 2^53, so a JSON parser that reads numbers as doubles (JSON.parse in JavaScript, among others) will silently round them. Read id fields as strings or big integers — from the raw response body — or the id you send back will not be the one we returned. A rounded id is repaired automatically when it names exactly one file we have seen; when several files round to the same value the response is 409 and you should add peer_id and msg_id.

Query parameters

peer_idinteger

Peer the file was seen in. Optional; used only to disambiguate a file_id that lost precision in your JSON parser.

msg_idinteger

Message the file was seen in. Optional; used with peer_id to disambiguate a file_id that lost precision in your JSON parser.

thumb_sizestring

Photo files only: requested thumbnail size code (e.g. s, m, x, y). Omit to receive the largest available size. Ignored for documents.

Response

File bytes streamed as a binary response. Content-Type reflects the file's media type when known, otherwise application/octet-stream.

Changes

No recorded changes to this operation across all 1 revision of this API.