Telegram sendAudio for a Sume track: URL 20 MB, upload 50 MB
Telegram can fetch a sendAudio file from a URL up to 20 MB, or accept an upload up to 50 MB. Pass the Sume artifact link first; upload only as a fallback.

To send a finished Sume music track to a Telegram chat, call sendAudio with the artifact URL as the audio value. Telegram's Bot API says that a file fetched from an HTTP URL can be at most 20 MB, and that an upload by multipart form can be at most 50 MB. A Music Router track is usually audio/mpeg on media.sume.com, so check the byte size and choose the route.
The three ways to pass the file
The audio parameter accepts a file_id, an HTTP URL or a multipart upload.
| Method | Telegram documents | Fit for a Sume track |
|---|---|---|
| file_id | Recommended for a file that is already on Telegram | Use it to resend the same track |
| HTTP URL | 20 MB maximum for files downloaded by Telegram servers | First choice: pass the media.sume.com artifact URL |
| Multipart upload | 50 MB maximum for this method | Fallback if the URL fetch fails or the file is larger |
| Local Bot API server | Uploads up to 2000 MB | Only if you run your own server |
Send by URL, keep the file_id
Start the job in the default async mode, read the audio artifact when the envelope is terminal, and send the URL. The Music Router costs a fixed $0.125 per generation and has no duration field, so most tracks are small; check anyway with a HEAD request.
import json, os, urllib.request
def send_audio(chat_id: int, url: str, title: str) -> str:
head = urllib.request.Request(url, method="HEAD")
size = int(urllib.request.urlopen(head, timeout=10).headers["Content-Length"])
if size > 20 * 1024 * 1024:
raise ValueError("over the 20 MB URL limit: upload the bytes instead")
body = {"chat_id": chat_id, "audio": url, "title": title}
req = urllib.request.Request(
"https://api.telegram.org/bot%s/sendAudio" % os.environ["TELEGRAM_BOT_TOKEN"],
data=json.dumps(body).encode(),
headers={"Content-Type": "application/json"})
reply = json.load(urllib.request.urlopen(req, timeout=30))
return reply["result"]["audio"]["file_id"]Why keep the file_id
Telegram recommends a file_id for a file that already sits on its servers. Store the id returned by the first send and reuse it for later chats; then Telegram does not download the file from Sume again. Keep the Sume job id with it so the track can be traced.
Limits
The Telegram page that I read says nothing about how long a track may be, so do not promise a duration. The URL must be reachable by Telegram's servers without your Sume API key, which is why the public artifact link is used and not a status URL. If the send fails, read the error text from the reply before you retry, and do not start a second generation just because Telegram failed; the first job is already paid and its artifact is still there.
Sources
Related posts
More in Integrations
- Threads link limit: 5 unique URLs per post, checked before publish
Threads allows 5 unique URLs per post and returns THREADS_API__LINK_LIMIT_EXCEEDED past that. Count unique links in the caption before posting a Sume clip.
- Threads topic tag: 1 to 50 characters, no periods or ampersands
Meta's Threads API accepts a topic tag of 1 to 50 characters and rejects periods and ampersands. Validate the tag in code before you publish a Sume clip.
- TikTok import get_transcript: TikTok only, plan the Instagram fallback
get_transcript on media-imports is TikTok only; Instagram imports return no transcript. Fallback: video_inspect transcribe at $0.01 a minute.
- TruGen and Avatario avatar IDs in LiveKit vs a Sume avatar handle
In LiveKit, TruGen and Avatario pick a face with an avatar_id. Sume uses a stable avatar_handle you create yourself. Here is how they differ.
Written by Sume