Skip to main content

captapi

Official typed Python SDK for the Captapi social media API — 178 endpoints across 32 platforms (YouTube, TikTok, Instagram, Facebook, X/Twitter, Reddit, Threads, Bluesky, Pinterest, LinkedIn, Twitch, Spotify, SoundCloud, GitHub, and more).

  • Sync and async clients (Captapi / AsyncCaptapi), built on httpx
  • Typed, documented method for every endpoint — great autocomplete for humans and AI coding agents
  • Errors always raise CaptapiError with status code and detail — no silent failures
  • One bounded retry on 502/503 (skipped when the API says the failure is persistent or already cached)

Install

pip install captapi

Quick start

from captapi import Captapi

client = Captapi(api_key="YOUR_KEY")  # or set CAPTAPI_API_KEY

transcript = client.youtube.transcript(url="https://youtube.com/watch?v=dQw4w9WgXcQ")
print(transcript["data"])

profile = client.tiktok.channel_details(url="https://tiktok.com/@nba")
posts = client.reddit.subreddit_posts(url="https://reddit.com/r/programming", limit=25)
ads = client.google_ad_library.company_ads(advertiser="nike.com")

Async

from captapi import AsyncCaptapi

async with AsyncCaptapi() as client:
    result = await client.instagram.channel_details(url="https://instagram.com/nba")

Error handling

Every failed request raises — nothing fails silently:

from captapi import Captapi, CaptapiError

try:
    client.instagram.channel_details(url="https://instagram.com/whoever")
except CaptapiError as err:
    print(err.status_code, err.code, err.detail)

Responses

All methods return the standard Captapi envelope as a dict:

{ "success": true, "data": { ... } }

Links

Metadata

Release files for captapi 0.2.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 captapi 0.2.0
File Size Uploaded
captapi-0.2.0.tar.gz 34.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for captapi 0.2.0
File Interpreter ABI Platform
captapi-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 68.7 kB

Release files / captapi-0.2.0.tar.gz

Download URL captapi-0.2.0.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
71f3623d42544ebdddb2b1874844f76178f39d3882c507a8424df7449a27a860
BLAKE2b-256 checksum
How to use checksums
250088a1b24c5a646324ae34d924f8c81d09123dfc829116b0a72f25ed0656ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / captapi-0.2.0-py3-none-any.whl

Download URL captapi-0.2.0-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaf4a43c29325934a39b168678733d5e412a1776b639148890ef21a3e04b722b
BLAKE2b-256 checksum
How to use checksums
b660f7e3f7e24e4df0b3f8853e550387158305ee9b0bf8e471ce0948e118425f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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