Media API for Telegram bots
Search YouTube and get a ready Telegram audio file. Pull Instagram, TikTok, Snapchat and Pinterest media as direct links. One key, one header.
Free plan: 100 requests a day. No card needed, the key comes from @dlsosbot.
curl -X POST https://api.dlsos.win/v1/download \ -H 'X-API-Key: SOS-…' \ -d '{"platform":"yt","link":"https://youtu.be/…"}'
{
"status": "success",
"cached": true,
"items": [{
"type": "audio",
"telegram_link": "https://t.me/…/98"
}],
"remaining": 4987
}
How it works
Your bot sends a link or a song name. You get back something it can send right away.
Get your key
Open @dlsosbot and send /apikey. The key works at once.
Search
Send a song name to /v1/search and pick a result.
Download
Send the link to /v1/download. Popular tracks return instantly from cache.
Send it
Forward the Telegram file in your bot, or stream the direct link.
What you get from each platform
YouTube audio and video come back as Telegram files, so your bot never handles the upload. Social media comes back as direct links.
| Platform | Response | Available on |
|---|---|---|
| YouTube audio and video | Telegram file link, cached after the first request | All plans |
| YouTube search | Title, link, duration and thumbnail | All plans |
| Direct links to videos, photos and carousels | Pro and up | |
| TikTok | Direct video and audio links | Pro and up |
| Snapchat | Direct video links from Spotlight and stories | Pro and up |
| Direct image, GIF and video links | Pro and up |
Pricing
Limits are per day and reset at midnight, Baghdad time. Failed requests are never counted.
Free
To try the API in your own bot.
- 100 requests a day
- YouTube and search
- Valid 30 days
Starter
For a small music bot getting started.
- 2,000 requests a day
- YouTube and search
- 30 days
Basic
For a music bot with a steady audience.
- 4,000 requests a day
- YouTube and search
- 30 days
Standard
For busy music bots and several groups.
- 8,000 requests a day
- YouTube and search
- 30 days
Pro Popular
For a music bot that also downloads from social media.
- 20,000 YouTube and search requests a day
- 3,000 social media downloads a day
- Instagram, TikTok, Snapchat and Pinterest
- 30 days
VIP
For busy bots with steady social media use.
- 30,000 YouTube and search requests a day
- 5,000 social media downloads a day
- Instagram, TikTok, Snapchat and Pinterest
- 30 days
Business
For large bots and several projects.
- 50,000 YouTube and search requests a day
- 10,000 social media downloads a day
- Instagram, TikTok, Snapchat and Pinterest
- 30 days
Ultra
For the biggest bots and resellers.
- 100,000 YouTube and search requests a day
- 25,000 social media downloads a day
- Instagram, TikTok, Snapchat and Pinterest
- 30 days
Documentation
Base URL https://api.dlsos.win. All responses are JSON.
Authentication
Send your key in the X-API-Key header with every request. Get it from @dlsosbot with /apikey. Keep it private, and use /revoke in the bot to replace a leaked key. Your usage and plan stay the same.
Limits
- Each successful request costs 1. Failed requests are refunded automatically.
- Your limit is per day and resets at 00:00 Baghdad time.
- Each key has its own platforms. A platform that is not enabled on your key returns 403.
- Check your remaining requests any time with /plan in the bot or
GET /v1/usage.
Search YouTube
GET/v1/search
| Parameter | Description |
|---|---|
| q | What to search for, for example a song name. Required. |
| limit | Number of results, 1 to 20. Default 10. |
curl -G https://api.dlsos.win/v1/search \ --data-urlencode "q=Blinding Lights" \ -H "X-API-Key: YOUR_KEY"
{
"status": "success",
"query": "Blinding Lights",
"cached": false,
"results": [
{
"id": "4NRXx6U8ABQ",
"title": "The Weeknd - Blinding Lights (Official Video)",
"url": "https://www.youtube.com/watch?v=4NRXx6U8ABQ",
"duration": 263,
"channel": "",
"thumbnail": "https://i.ytimg.com/vi/4NRXx6U8ABQ/hq720.jpg"
}
],
"remaining": 4998
}duration is in seconds. Pass any url to the download endpoint.
Track info
GET/v1/track
Get the title, duration and thumbnail of a YouTube video from its link or id, without downloading it. Useful to show the track name before you send it. Costs 1 request and needs the Search permission.
| Parameter | Description |
|---|---|
| link | A YouTube link (watch, youtu.be, shorts, music) or the 11-character video id. Required. |
curl -G https://api.dlsos.win/v1/track \ --data-urlencode "link=https://youtu.be/4NRXx6U8ABQ" \ -H "X-API-Key: YOUR_KEY"
{
"status": "success",
"cached": false,
"track": {
"id": "4NRXx6U8ABQ",
"title": "The Weeknd - Blinding Lights (Official Video)",
"url": "https://www.youtube.com/watch?v=4NRXx6U8ABQ",
"duration": 263,
"channel": "",
"thumbnail": "https://i.ytimg.com/vi/4NRXx6U8ABQ/hq720.jpg"
},
"remaining": 4995
}Returns 404 if the video does not exist or is private.
Download
POST/v1/download
| Field | Description |
|---|---|
| platform | yt, insta, tiktok, snap or pin. Required. |
| link | The media link. Short links work too. Required. |
| video | YouTube only. true for video, false for audio. Default false. |
curl -X POST https://api.dlsos.win/v1/download \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"platform":"yt","link":"https://youtu.be/4NRXx6U8ABQ","video":false}'YouTube returns a Telegram file link. Send it with your bot by reading the message from the link, or forward it.
{
"status": "success",
"platform": "yt",
"cached": true,
"items": [
{"type": "audio", "telegram_link": "https://t.me/…/98", "mirrored": true}
],
"remaining": 4997
}Instagram, TikTok, Snapchat and Pinterest return direct links. A post can have several items. Direct links expire, so download them right away.
{
"status": "success",
"platform": "insta",
"cached": false,
"title": "…",
"items": [
{"type": "video", "url": "https://…", "thumbnail": "https://…"},
{"type": "image", "url": "https://…"}
],
"remaining": 4996
}The first YouTube request for a track can take up to a minute while it is prepared. After that it returns instantly for everyone. Set your client timeout to at least 120 seconds and retry once on a 524.
Stream link
POST/v1/stream_sos
The same YouTube file as /v1/download (audio, or mp4 with "video": true), as a direct link served by us, to play or download at once. The body is the same as /v1/download, YouTube only. It costs one request.
curl -X POST https://api.dlsos.win/v1/stream_sos \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"platform":"yt","link":"https://youtu.be/4NRXx6U8ABQ","video":false}'{
"status": "success",
"url": "https://api.dlsos.win/v1/stream_sos/…?e=…&s=…",
"expires_at": 1767225600,
"ext": "m4a",
"video": false,
"title": "The Weeknd - Blinding Lights",
"duration": 263,
"telegram_link": null,
"remaining": 4995
}| Field | Description |
|---|---|
| url | Always given. A signed link to the file on our server. It works for one hour, until expires_at (unix time), and supports Range requests for seeking. The file is deleted from our server after that. |
| telegram_link | The same file in our Telegram channel. null the first time a track is requested, while it is still being stored; given on the requests after. |
| ext, video | The file type: m4a or another audio type, or mp4 for video. |
| title, duration | The track's title and its length in seconds. |
A new track can take a moment. Then the answer is 202 with {"status": "pending"} and a Retry-After header: wait that many seconds and send the same request again. A 202 does not cost a request. Request a new link when one expires; do not share it, anyone with the link can use it until it expires.
Usage
GET/v1/usage
Returns your plan, today's usage, the reset time and the platforms on your key. It does not cost a request. On a plan with social media downloads, social_limit, social_used and social_remaining show them: Instagram, TikTok, Snapchat and Pinterest are counted there, apart from your YouTube and search requests.
curl https://api.dlsos.win/v1/usage -H "X-API-Key: YOUR_KEY"
Errors
Errors come back as {"status": "error", "detail": "…"} with one of these codes.
| Code | Meaning | What to do |
|---|---|---|
| 400 | The link is invalid or does not match the platform. | Check the link and the platform value. |
| 401 | The key is missing or wrong. | Send it in X-API-Key. |
| 403 | The key is disabled, expired, or the platform is not on your plan. | Check /plan in the bot. |
| 404 | No media was found at the link. | Make sure the post is public. |
| 429 | Today's limit is used up (or today's social media limit, for a social media download). | Wait for the reset or upgrade. |
| 202 | The stream link is still being prepared (/v1/stream_sos). | Wait Retry-After seconds and send it again. |
| 502, 503 | A source is temporarily unavailable. | Retry in a few seconds. |
Code examples
Search a song and download the first result.
import httpx
API = "https://api.dlsos.win"
HEADERS = {"X-API-Key": "YOUR_KEY"}
def get_song(query: str) -> str:
with httpx.Client(headers=HEADERS, timeout=120) as http:
found = http.get(f"{API}/v1/search", params={"q": query, "limit": 1}).json()
url = found["results"][0]["url"]
data = http.post(f"{API}/v1/download",
json={"platform": "yt", "link": url, "video": False}).json()
return data["items"][0]["telegram_link"]
print(get_song("Blinding Lights"))
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
const api = "https://api.dlsos.win"
const key = "YOUR_KEY"
var client = &http.Client{Timeout: 120 * time.Second}
func call(method, path string, body any, out any) error {
var buf bytes.Buffer
if body != nil {
json.NewEncoder(&buf).Encode(body)
}
req, _ := http.NewRequest(method, api+path, &buf)
req.Header.Set("X-API-Key", key)
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
return json.NewDecoder(resp.Body).Decode(out)
}
func main() {
var s struct{ Results []struct{ URL string `json:"url"` } `json:"results"` }
call("GET", "/v1/search?limit=1&q="+url.QueryEscape("Blinding Lights"), nil, &s)
var d struct{ Items []struct{ Link string `json:"telegram_link"` } `json:"items"` }
call("POST", "/v1/download", map[string]any{"platform": "yt", "link": s.Results[0].URL}, &d)
fmt.Println(d.Items[0].Link)
}
const API = "https://api.dlsos.win";
const headers = { "X-API-Key": "YOUR_KEY", "Content-Type": "application/json" };
async function getSong(query) {
const found = await fetch(`${API}/v1/search?limit=1&q=${encodeURIComponent(query)}`, { headers })
.then(r => r.json());
const data = await fetch(`${API}/v1/download`, {
method: "POST",
headers,
body: JSON.stringify({ platform: "yt", link: found.results[0].url, video: false }),
}).then(r => r.json());
return data.items[0].telegram_link;
}
getSong("Blinding Lights").then(console.log);
Questions
How do I upgrade?
Message @SSSi5 with the plan you want. Your key stays the same, the new limit and platforms apply as soon as payment is confirmed.
When does my daily limit reset?
Every day at 00:00 Baghdad time. Unused requests do not carry over.
Do failed requests count?
No. If a request fails for any reason, it is refunded to your daily limit straight away.
Why is the first YouTube request slower?
The track is downloaded and uploaded to Telegram once. Every request after that returns the same file in under a second.
Can I use one key in several bots?
Yes. The limit is shared between them. For separate limits, ask for a second key.