---
title: "Download a file by id"
method: GET
path: "/v1/files/{file_id}"
tags: ["Files"]
---

# Download a file by id

`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

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.

## Path parameters

- `file_id` integer, required

## Query parameters

- `peer_id` integer
- `msg_id` integer
- `thumb_size` string

## Response `200`

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

## Other responses

- `400`: Invalid request — bad path or query parameter.
- `404`: Not found.
- `409`: The peer id could not be found, so no access hash exists for it. Not transient: seed the id via GET /v1/usernames/{username}, GET /v1/phones/{phone}, or by encountering it in a chat, then retry. Raw MTProto ids only: a Bot-API id like -1001234567890 must be sent as 1234567890 (strip the leading -100), and -123456789 as 123456789. When the request carries such an id, the hint names the exact id to retry with.
- `429`: Rate limit exceeded.
- `503`: Service temporarily unavailable.
- `504`: Request timed out.

---

[API](https://skmtc.dev/tgatlas/apis/tgatlas-telegram-channel-data-api.md) · [All operations](https://skmtc.dev/tgatlas/apis/tgatlas-telegram-channel-data-api/llms.txt) · [OpenAPI document](https://skmtc.dev/tgatlas/apis/tgatlas-telegram-channel-data-api/revisions/875ce0155fe9?raw)
