Skip to main content

SaverAPI Python SDK

Social media downloader API for Python — Instagram, TikTok, YouTube, Facebook, X and more

Official client for SaverAPI.NET: download videos, Reels and audio, read YouTube metadata and subtitles, 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.

PyPI Python License Docs

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.


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
Facebook 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 / MP3 api.youtube(url, format) /youtube-api
YouTube for Telegram bots api.youtube_telegram(url, format) /youtube-telegram-base
YouTube metadata api.youtube_info(url) · api.youtube_info_basic(url) /youtube-info-v2 · /youtube-info
YouTube subtitles api.youtube_subtitles(url) /youtube-subtitles
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
PhotoLab effects api.photolab(effect_id, photo_url) /photolab-api
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 or MP3

video = api.youtube("https://youtu.be/OORSiK8ScTI", format="720")   # 1080|720|480|360|240|144|mp3
api.save_file(video["url"], "video.mp4")

info = api.youtube_info("https://youtu.be/OORSiK8ScTI")
print(info["title"], info["duration"])

Download TikTok, 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

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-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.

Changelog

1.1.0

  • New methods covering the whole catalog: youtube_telegram, youtube_info_basic, youtube_subtitles, instagram_profile, photolab, and request() for any endpoint.
  • AsyncSaverAPI for asyncio (pip install "saverapi-client[async]").
  • saverapi command line tool.
  • Automatic retries with backoff for 429 and 5xx; specific exception classes.
  • API key from the SAVERAPI_KEY environment 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 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for saverapi-client 1.1.0
File Size Uploaded Provenance
saverapi_client-1.1.0.tar.gz 17.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for saverapi-client 1.1.0
File Interpreter ABI Platform
saverapi_client-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.6 kB

Release files / saverapi_client-1.1.0.tar.gz

Download URL saverapi_client-1.1.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c5ab0406959df0cac04592fd984a9bc0ee60a7a9ccda8ef2049f6e3da9ffff3c
BLAKE2b-256 checksum
How to use checksums
4a24fd5677a8ab00298b2085d97a2eee9b49ed95edde4bfc01e6a029f04f74c4
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-1.1.0-py3-none-any.whl

Download URL saverapi_client-1.1.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afde982476b8c268c01216b09255d8c1beb9547f03df6b1d9f02a1191cf13c21
BLAKE2b-256 checksum
How to use checksums
7d95c678e25ce5c8438e893cc220b3863e889d4f2f8f286bee055e18decdb9f4
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 1.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page