SaverAPI Python SDK
Social media video downloader API for Python — YouTube (up to 4K), Instagram, TikTok, Facebook, X and more
Official client for SaverAPI.NET: download videos, Reels and audio, get YouTube in up to 4K or as a ready Telegram file_id, read YouTube metadata, look up Instagram profiles, recognise songs with Shazam and scan media for NSFW content — with one API key, from sync code, asyncio or the command line.
pip install -U saverapi-client # sync client + CLI
pip install -U "saverapi-client[async]" # + AsyncSaverAPI (httpx)
Get a free API key at saverapi.net — no card needed.
Why SaverAPI
- One API for every major platform — Instagram Reels and posts, TikTok, YouTube video and MP3, Facebook, X (Twitter), Pinterest, Threads, Snapchat, Vimeo, SoundCloud and more behind a single key.
- YouTube from 144p to 4K —
2160,1440,1080,720… ormp3audio, with no yt-dlp, ffmpeg, proxies or cookies to maintain. - Built for Telegram bots — get a ready
file_idfor your own bot and send a YouTube video instantly, without downloading or re-uploading it. - Sync, async and CLI —
SaverAPI(requests),AsyncSaverAPI(httpx, for aiogram / FastAPI) and asaverapiterminal command. - Production ready — automatic retries, typed exceptions, type hints, Python 3.8–3.13.
Contents: Quick start · Supported platforms · Examples · Async · Command line · Errors and retries · FAQ · Changelog
Quick start
from saverapi import SaverAPI
api = SaverAPI(api_key="YOUR_API_KEY") # or export SAVERAPI_KEY=...
media = api.download("https://www.instagram.com/reel/DPOi9V-CAqH/")
print(media["hosting"], media["type"], media["download_url"])
api.save_file(media["download_url"], "downloads/reel.mp4")
One call, one parameter: the All-in-One downloader recognises the platform from the link. The response's hosting field tells you which network it was, type is video or image, and download_url points at the file.
Supported platforms
| Platform | Method | REST endpoint |
|---|---|---|
| Instagram (posts, Reels) | api.download(url) |
/all-in-one-downloader-api |
| TikTok | api.download(url) |
/all-in-one-downloader-api |
api.download(url) |
/all-in-one-downloader-api |
|
| Twitter / X | api.download(url) |
/all-in-one-downloader-api |
| Snapchat, Pinterest, Likee, Threads, Twitch, Weibo, Vimeo, SoundCloud, Spotify | api.download(url) |
/all-in-one-downloader-api |
| YouTube video (144p–4K) / MP3 | api.youtube(url, format) |
/youtube-api |
YouTube as a Telegram file_id |
api.youtube_telegram(url, format, bot_username) |
/youtube-telegram-base |
| YouTube metadata | api.youtube_info(url) · api.youtube_info_basic(url) |
/youtube-info-v2 · /youtube-info |
| Instagram profile | api.instagram_profile(username) |
/instagram-profile |
| Shazam song recognition | api.shazam_recognize(url) |
/shazam-recognize |
| Shazam top charts | api.shazam_top(country) |
/shazam-music-top |
| Music search | api.music_search(query, limit) |
/music-search |
| NSFW scanner | api.nsfw_scan(url) |
/nsfw-scanner-api |
| Account balance (free) | api.info_balance() |
/infobalans |
| Key statistics (free) | api.api_keys_statistics() |
/api-keys/all-statistics |
Full parameter reference and response samples: saverapi.net/docs. Endpoints added to the catalog later can be called with api.request("/endpoint-path", {"param": "value"}).
Examples
Download a YouTube video (up to 4K) or MP3 in Python
video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")
api.save_file(video["url"], "video.mp4")
audio = api.youtube("https://youtu.be/OORSiK8ScTI", format="mp3")
uhd = api.youtube("https://youtu.be/OORSiK8ScTI", format="2160") # 4K, when the video has it
info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
print(info["title"], info["duration"])
format is one of 2160, 1440, 1080, 720, 480, 360, 240, 144 or mp3 (also available as saverapi.YOUTUBE_FORMATS).
YouTube straight into a Telegram bot (file_id)
Pass your bot's username and the response carries a file_id that is valid for that bot — send it without downloading or re-uploading anything, and store it to reuse later.
import time
res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
while res.get("status") == "processing": # a new video is still being prepared
time.sleep(res.get("retry_after", 5))
res = api.youtube_telegram("https://youtu.be/OORSiK8ScTI", format="720", bot_username="@MyBot")
if res["media_type"] == "video":
bot.send_video(chat_id, res["file_id"]) # your Telegram library's sendVideo
else:
bot.send_audio(chat_id, res["file_id"]) # format="mp3" → sendAudio
Formats here: 1080, 720, 480, 360, 240, 144 or mp3. The response also has title, author, duration, size, width, height and thumbnail_url. Your bot may receive service messages while the file is delivered — do not reply to them.
Download TikTok, Instagram, Facebook or X videos
for link in [
"https://www.tiktok.com/@user/video/7300000000000000000",
"https://www.facebook.com/watch/?v=1234567890",
"https://x.com/user/status/1234567890",
]:
media = api.download(link)
print(media["hosting"], media["download_url"])
Instagram profile data
profile = api.instagram_profile("cristiano")
print(profile["user"]["full_name"], profile["user"]["is_verified"])
Recognise a song, search music, read charts
song = api.shazam_recognize("https://example.com/clip.mp3")
print(song["track"]["title"], "—", song["track"]["subtitle"])
results = api.music_search("Hello Adele", limit=5)
top = api.shazam_top("united-states")
Check your plan and credits (free)
print(api.info_balance())
Async (aiogram, FastAPI, asyncio)
import asyncio
from saverapi import AsyncSaverAPI
async def main():
async with AsyncSaverAPI() as api: # reads SAVERAPI_KEY
results = await asyncio.gather(
api.download("https://www.instagram.com/reel/DPOi9V-CAqH/"),
api.youtube_info("https://youtu.be/OORSiK8ScTI"),
)
print(results)
asyncio.run(main())
Telegram downloader bot (aiogram 3)
from aiogram import Bot, Dispatcher, F
from aiogram.types import Message
from saverapi import AsyncSaverAPI, SaverAPIError
bot = Bot("TELEGRAM_BOT_TOKEN")
dp = Dispatcher()
api = AsyncSaverAPI() # SAVERAPI_KEY from the environment
@dp.message(F.text.startswith("http"))
async def on_link(message: Message):
try:
media = await api.download(message.text.strip())
except SaverAPIError as exc:
await message.answer(f"Could not download: {exc.message}")
return
if media.get("type") == "image":
await message.answer_photo(media["download_url"])
else:
await message.answer_video(media["download_url"])
dp.run_polling(bot)
Step-by-step guide: Build a Telegram video downloader bot.
Command line
export SAVERAPI_KEY=your_key
saverapi download https://www.instagram.com/reel/DPOi9V-CAqH/
saverapi youtube https://youtu.be/OORSiK8ScTI --format mp3
saverapi youtube-telegram https://youtu.be/OORSiK8ScTI --bot @MyBot
saverapi youtube-info https://youtu.be/OORSiK8ScTI
saverapi instagram cristiano
saverapi shazam https://example.com/clip.mp3
saverapi balance
Prints the JSON response; exits with status 1 on an API error.
Errors and retries
Rate limits (429) and temporary server errors (5xx) are retried automatically with exponential backoff (max_retries=2 by default). Failed 5xx calls are not charged. Everything else raises a specific exception:
from saverapi import (
SaverAPIError, AuthenticationError, InsufficientCreditsError,
RateLimitError, NotFoundError, ServerError, NetworkError,
)
try:
api.download(link)
except AuthenticationError: # 401/403 — wrong or disabled key
...
except InsufficientCreditsError: # 402 — top up or upgrade at saverapi.net/pricing
...
except RateLimitError as exc: # 429 after retries
...
except SaverAPIError as exc: # anything else; exc.status_code, exc.message, exc.payload
...
Options: SaverAPI(api_key=None, timeout=60, base_url=None, session=None, max_retries=2, backoff=1.0). Use it as a context manager (with SaverAPI() as api:) to close the HTTP session.
Tips
- Media links (
download_url) come from the networks' CDNs and expire — download them right after the call. - Only public content can be resolved; private accounts and deleted posts fail.
- Keep the API key on your server; mobile and web apps should call your backend.
- Respect each platform's terms of service and creators' rights.
FAQ
How do I download a YouTube video in Python?
Install saverapi-client, then call api.youtube(url, format="720") and save video["url"] with api.save_file(...). No yt-dlp or ffmpeg is needed — the API does the work. See the YouTube Downloader API page.
Can I download YouTube in 4K or 1440p?
Yes: format="2160" (4K) and format="1440" (2K) are supported alongside 1080, 720, 480, 360, 240 and 144, when the video has that quality.
How do I convert YouTube to MP3?
api.youtube(url, format="mp3") returns a link to the audio file.
How do I download Instagram Reels or TikTok videos in Python?
api.download(link) works for Instagram posts and Reels, TikTok, Facebook, X and the other supported networks — the platform is detected from the link. See the Instagram and TikTok API pages.
How do I send a YouTube video from a Telegram bot without uploading it?
Call api.youtube_telegram(url, format, bot_username="@YourBot") and pass the returned file_id to sendVideo / sendAudio. Works with aiogram, python-telegram-bot, pyTelegramBotAPI and any other library.
Is there a free plan? Yes — register at saverapi.net for a free key; paid plans and pay-as-you-go credits are on the pricing page.
Does it work with asyncio?
Yes: pip install "saverapi-client[async]" and use AsyncSaverAPI — same methods, awaited.
Links
- Website and free API key: https://saverapi.net
- API documentation: https://saverapi.net/docs
- YouTube Downloader API: https://saverapi.net/youtube-downloader-api
- Instagram Downloader API: https://saverapi.net/instagram-downloader-api
- TikTok Downloader API: https://saverapi.net/tiktok-downloader-api
- Facebook Video API: https://saverapi.net/facebook-video-api
- Twitter / X Video API: https://saverapi.net/twitter-video-api
- Shazam Song Recognition API: https://saverapi.net/shazam-api
- Social Media Downloader API: https://saverapi.net/social-media-downloader-api
- All-in-One Downloader API: https://saverapi.net/all-in-one-downloader-api
- Tutorials: https://saverapi.net/blog
- Pricing: https://saverapi.net/pricing
- Telegram: https://t.me/SaverAPI
Changelog
2.0.0
- YouTube:
api.youtube()now documents the new2160(4K) and1440(2K) formats; the full list is exported asYOUTUBE_FORMATS. - YouTube for Telegram:
api.youtube_telegram(url, format, bot_username="@MyBot")returns a readyfile_idfor your bot. New CLI commandsaverapi youtube-telegram URL --bot @MyBot. - Removed
youtube_subtitles()andphotolab()(and thesaverapi subtitlescommand): the/youtube-subtitlesand/photolab-apiendpoints were retired from the API and already answered 404. This is the only breaking change — if you do not call these two methods, upgrading from 1.x needs no code changes. formataccepts anintas well as astrin type hints (format=720).
1.1.0
- New methods covering the whole catalog:
youtube_telegram,youtube_info_basic,youtube_subtitles,instagram_profile,photolab, andrequest()for any endpoint. AsyncSaverAPIfor asyncio (pip install "saverapi-client[async]").saverapicommand line tool.- Automatic retries with backoff for 429 and 5xx; specific exception classes.
- API key from the
SAVERAPI_KEYenvironment variable; context-manager support; type hints (py.typed). - Fully backwards compatible with 1.0.x.
License
MIT © SaverAPI.NET
Metadata
Release files for saverapi-client 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| saverapi_client-2.0.0.tar.gz | 22.1 kB | Without provenance | Details for saverapi_client-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| saverapi_client-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for saverapi_client-2.0.0-py3-none-any.whl |
Total release size: 40.0 kB
Release files / saverapi_client-2.0.0.tar.gz
| Download URL | saverapi_client-2.0.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30a0be56f871f3b277228d8de55d8f64c22bf48dff1742a80545f6a4868942cc
|
|
BLAKE2b-256 checksum How to use checksums |
1d3429ce1c7d1b00641b91a013dfa74c6c2a413b50b100c170aeac7873c22673
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / saverapi_client-2.0.0-py3-none-any.whl
| Download URL | saverapi_client-2.0.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0904a3a303b7bb474b54a45f449e8521c91cc5f123baaf411e05b34ae0ea934b
|
|
BLAKE2b-256 checksum How to use checksums |
66788a6c58cf9c4d69209486d2541d29f1152c6039ae14696c6fc0a7b4bd9edc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for saverapi-client 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.