IntegrationsBeginner
How to send photos, documents, and files with a Telegram bot
Upload local images and documents, or share remote URLs, through the Telegram bot API.
7 minBeginner
Text is only part of what bots can send. Telegram has dedicated endpoints for photos, documents, audio, and video. This guide covers the three ways to send a file: a public URL, a local upload, and a reused file ID.
What you need
- A bot token and a chat ID
- A file to send (local path or public URL)
- curl for testing
Step 1: Send a photo from a URL
The fastest path is to hand Telegram a public image URL. Telegram fetches it for you, so there is nothing to upload.
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendPhoto" \
-d chat_id=58291043 \
-d photo="https://picsum.photos/600" \
-d caption="Photo by URL"Step 2: Upload a local file
For files on your own disk, send multipart form data. With curl, the -F flag and an @ prefix upload the file directly.
zsh - upload a document
$curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument" \
$ -F chat_id=58291043 \
$ -F document=@"./report.pdf"
{"ok":true,"result":{"document":{"file_id":"BQACAgIAAx...","file_name":"report.pdf"}}}
$
Reuse the file_id
Every successful upload returns a
file_id. Pass that same id next time instead of the file path and Telegram serves the cached copy instantly, with no re-upload.Step 3: Pick the right method
| Content | Method | Notes |
|---|---|---|
| Image shown inline | sendPhoto | Compressed by Telegram |
| Any file kept as-is | sendDocument | No compression, keeps name |
| Voice or music | sendAudio | Shows a player |
| Short looping clip | sendAnimation | GIF or muted mp4 |
Telegram - file delivered
Agent
[document] report.pdf (248 KB)Agent
Here is the report you asked for.Size limits
Bots can send files up to 50 MB and photos up to 10 MB through the standard API. For larger files, split them or host elsewhere and send a link.
Result
You can now push images and documents from a URL, from disk, or from a cached file ID, picking the method that matches the content type.
Watch related tutorials
20:00Lovable AI: How to Build an App & Upload to App Store (Tutorial)
YouTube
12:00How to Schedule Social Media Posts on Publer | Step-by-Step Guide
Publer
10:40Create, schedule, and analyze all your social media posts with Publer
Publer
11:30How to Schedule in Bulk 100+ Social Media Posts Using Publer's CSV
Publer
15:20Publer Social Media Review - Step-by-Step Tutorial & Walkthrough
Stewart Gauld
13:10Publer Tutorial for Beginners | Social Media Scheduling Made Easy
Tech & Tutorials
Tags
#telegram#media#files#bot#upload