Official Python SDK for the SocialAPI: profiles, posts, comments, transcripts,
searches and trends from TikTok, Instagram, Threads and Facebook, in one schema. See the docs for every endpoint.
Python 3.10+. Typed with Pydantic.
Installation
pip install socialapihq
Usage
Each platform is an attribute of the client and each endpoint a method on it. Create an API key in the dashboard; it is sent as Authorization: Bearer sapi_…, and every account starts with 100 free credits.
import os
from socialapihq import SocialAPI
client = SocialAPI(api_key=os.environ["SOCIALAPI_API_KEY"])
profile = client.tiktok.profile(handle="nike").data
print(profile.display_name, profile.followers) # Nike 9440793
for post in client.instagram.profile_posts(handle="natgeo").data:
print(post.url, post.stats.likes)
Methods take the endpoint's parameters as keyword arguments in snake case (secUid is sec_uid) and return typed models: .data for one item, .data and .pagination for a list. Every platform answers with the same field names, and what only one platform has sits under ext. api_key defaults to the SOCIALAPI_API_KEY environment variable.
Models are Pydantic: .model_dump() gives a dict, .to_json() the JSON.
Pagination
A list answers pagination.next_cursor while pagination.has_more is true. Pass it back as cursor for the next page:
cursor = None
while True:
page = client.tiktok.profile_posts(handle="nike", cursor=cursor)
for post in page.data:
print(post.id, post.stats.views)
if not page.pagination.has_more:
break
cursor = page.pagination.next_cursor
Each page costs credits like any call. A cached answer is free.
Transcripts
transcript = client.tiktok.post_transcript(
url="https://www.tiktok.com/@nike/video/7711414040114892045",
).data
print(transcript.language, transcript.text)
for cue in transcript.cues:
print(cue.start_seconds, cue.text) # 0.02 Pole or podium?
A transcript costs 5 credits and is cached for 30 days.
Error handling
A refused call raises a SocialAPIError. Its code is stable to build logic on, and refused calls cost no credits:
from socialapihq import SocialAPIError
try:
client.instagram.profile(handle="no-such-account")
except SocialAPIError as error:
print(error.status, error.code, error.message, error.request_id)
# 404 NOT_FOUND No Instagram account matches this handle. req_…
RATE_LIMITED errors carry retry_after in seconds. See Errors for every code.
Configuration
client = SocialAPI(
api_key="sapi_…",
base_url="https://api.socialapi.sh", # the default
timeout=30, # seconds to wait for each answer
)
with SocialAPI() as client: # closes its connections at the end
print(client.account.get_credits().balance)
The generated classes (TikTokApi, InstagramApi…) are exported too. Their …_with_http_info methods give the status and headers, such as X-Credits-Charged.
API reference
Bluesky
| Method | Description |
|---|---|
bluesky.batch_posts() |
Up to 25 posts at once |
bluesky.batch_profiles() |
Up to 25 accounts at once |
bluesky.feed() |
A feed with its description and likes |
bluesky.feed_posts() |
A feed's posts |
bluesky.hashtag_posts() |
A hashtag's posts |
bluesky.list() |
A list with its purpose and member count |
bluesky.list_members() |
A list's accounts |
bluesky.list_posts() |
The posts of a list's accounts |
bluesky.post() |
One post with its likes |
bluesky.post_comments() |
A post's replies |
bluesky.post_likes() |
The accounts that liked a post |
bluesky.post_quotes() |
The posts quoting a post |
bluesky.post_reposts() |
The accounts that reposted a post |
bluesky.profile() |
An account with its follower and post counts |
bluesky.profile_feeds() |
The feeds an account made |
bluesky.profile_followers() |
The accounts following an account |
bluesky.profile_following() |
The accounts an account follows |
bluesky.profile_lists() |
The lists an account made |
bluesky.profile_media() |
An account's posts with images or video |
bluesky.profile_posts() |
An account's posts and reposts |
bluesky.profile_replies() |
An account's posts with its replies |
bluesky.profile_starter_packs() |
The starter packs an account made |
bluesky.profile_videos() |
An account's posts with video |
bluesky.search() |
Posts matching a query |
bluesky.search_feeds() |
Feeds matching a query |
bluesky.search_starter_packs() |
Starter packs matching a query |
bluesky.search_users() |
Accounts matching a query |
bluesky.starter_pack() |
A starter pack with its accounts' list and feeds |
bluesky.trending() |
The posts of Bluesky's Discover feed |
bluesky.trending_topics() |
The topics trending now |
| Method | Description |
|---|---|
facebook.event() |
One event |
facebook.events() |
A city's upcoming events |
facebook.events_search() |
Events matching a query |
facebook.marketplace_item() |
One Marketplace listing |
facebook.marketplace_search() |
Marketplace listings for a query near a point |
facebook.post() |
One post |
facebook.post_comment_replies() |
The replies to one comment |
facebook.post_comments() |
A post's comments |
facebook.post_transcript() |
A video's captions as text with their times |
facebook.profile() |
A Page or a public person |
facebook.profile_photos() |
A Page's or person's photos |
facebook.profile_posts() |
A Page's or person's posts |
facebook.profile_videos() |
A Page's videos with their plays |
| Method | Description |
|---|---|
instagram.highlight() |
A story highlight's stories |
instagram.location() |
A place |
instagram.location_posts() |
A place's top posts with their likes and comments |
instagram.post() |
One post or reel with its counts |
instagram.post_comments() |
A post's comments with their likes |
instagram.profile() |
A profile with its follower and following counts |
instagram.profile_highlights() |
An account's story highlights |
instagram.profile_posts() |
An account's posts |
instagram.profile_reels() |
An account's reels with their plays |
instagram.profile_similar() |
Accounts like this one |
instagram.search() |
Popular posts for a word or hashtag |
instagram.sound() |
A sound |
instagram.sound_posts() |
The reels that use a sound |
instagram.trending() |
The reels feed Instagram gives a visitor |
instagram.trending_topics() |
The explore page's trending keywords and accounts |
| Method | Description |
|---|---|
pinterest.board() |
A board with its pin and follower counts |
pinterest.board_posts() |
A board's pins |
pinterest.board_section_posts() |
A board section's pins |
pinterest.board_sections() |
A board's sections with their pin counts |
pinterest.post() |
One pin with its saves |
pinterest.post_comment_replies() |
A comment's replies |
pinterest.post_comments() |
A pin's comments |
pinterest.profile() |
A profile with its follower and pin counts |
pinterest.profile_boards() |
An account's boards |
pinterest.profile_posts() |
The pins an account created |
pinterest.search() |
Pins matching a query |
pinterest.search_boards() |
Boards matching a query |
pinterest.search_suggestions() |
What the search box suggests for a few letters |
pinterest.search_users() |
Accounts matching a query |
pinterest.search_videos() |
Video pins matching a query |
pinterest.topic() |
A topic's Ideas page with its followers and searches |
pinterest.topic_posts() |
A topic's top pins |
pinterest.trending() |
What a country searches for on Pinterest Trends |
pinterest.url() |
How many times a web page was saved to Pinterest |
| Method | Description |
|---|---|
reddit.post() |
One post with its score |
reddit.post_comment_replies() |
A comment's replies |
reddit.post_comments() |
A post's comments with their replies |
reddit.post_transcript() |
A video post's captions as text |
reddit.profile() |
A profile with its karma and trophies |
reddit.profile_comments() |
An account's comments |
reddit.profile_posts() |
An account's posts |
reddit.search() |
Posts matching a query across Reddit |
reddit.search_comments() |
Comments matching a query across Reddit |
reddit.search_media() |
Image and video posts matching a query |
reddit.search_subreddits() |
Communities matching a query |
reddit.search_users() |
Accounts matching a name |
reddit.subreddit() |
A community with its members |
reddit.subreddit_posts() |
A community's posts |
reddit.subreddit_search() |
Posts in one community matching a query |
reddit.trending() |
What is hot on Reddit now |
reddit.trending_searches() |
The searches Reddit shows as trending now |
Threads
| Method | Description |
|---|---|
threads.post() |
One thread with its counts |
threads.post_comments() |
A thread's replies |
threads.profile() |
A profile with its follower count |
threads.profile_media() |
An account's threads with photos or videos |
threads.profile_posts() |
An account's threads |
threads.profile_replies() |
An account's replies to other threads |
threads.profile_reposts() |
Other people's threads an account reposted |
threads.search() |
Threads matching a query |
threads.search_users() |
Accounts matching a name |
threads.trending() |
The feed Threads gives a visitor now |
TikTok
| Method | Description |
|---|---|
tiktok.collection_posts() |
The posts of a public saved collection |
tiktok.hashtag() |
A hashtag with its post and view counts |
tiktok.hashtag_posts() |
Posts under a hashtag |
tiktok.live() |
Whether an account is live |
tiktok.playlist_posts() |
The posts of a playlist |
tiktok.post() |
One post with its counts |
tiktok.post_comment_replies() |
The replies to one comment |
tiktok.post_comments() |
A post's top-level comments |
tiktok.post_related() |
Posts TikTok recommends beside one post |
tiktok.post_transcript() |
A post's captions as text with their times |
tiktok.profile() |
A profile with its exact follower and like counts |
tiktok.profile_followers() |
An account's followers |
tiktok.profile_following() |
The accounts an account follows |
tiktok.profile_liked() |
Posts an account liked |
tiktok.profile_playlists() |
The playlists an account made |
tiktok.profile_posts() |
An account's posts |
tiktok.profile_reposts() |
Other people's posts an account reposted |
tiktok.search() |
Posts matching a query |
tiktok.search_users() |
Accounts matching a query |
tiktok.sound() |
A sound |
tiktok.sound_posts() |
Posts that use a sound |
tiktok.trending() |
What the explore page shows now |
Twitch
| Method | Description |
|---|---|
twitch.batch_live() |
Up to 100 channels' live status at once |
twitch.batch_profiles() |
Up to 50 channels at once |
twitch.category() |
A category with its viewers |
twitch.category_clips() |
A category's clips |
twitch.category_lives() |
A category's live channels |
twitch.category_posts() |
A category's videos |
twitch.live() |
Whether a channel is live |
twitch.post() |
One video or clip with its views and a link to play it |
twitch.post_comments() |
A video's chat replay |
twitch.profile() |
A channel with its follower count and links |
twitch.profile_clips() |
A channel's clips |
twitch.profile_posts() |
A channel's videos |
twitch.profile_schedule() |
A channel's coming broadcasts |
twitch.search() |
Videos matching a query |
twitch.search_categories() |
Categories matching a query |
twitch.search_lives() |
Live channels matching a query |
twitch.search_suggestions() |
What the search box suggests for a few letters |
twitch.search_users() |
Channels matching a query |
twitch.trending() |
The live channels most watched now |
twitch.trending_categories() |
The categories most watched now |
YouTube
| Method | Description |
|---|---|
youtube.batch_posts() |
Up to 50 videos at once |
youtube.batch_profiles() |
Up to 20 channels at once |
youtube.batch_transcripts() |
Up to 20 videos' captions at once |
youtube.community() |
One community post with its likes and images |
youtube.hashtag() |
A hashtag with its video and channel counts |
youtube.hashtag_posts() |
A hashtag's videos or Shorts |
youtube.playlist() |
A playlist with its owner and video count |
youtube.playlist_posts() |
A playlist's videos in order |
youtube.post() |
One video or Short with its views |
youtube.post_comment_replies() |
A comment's replies |
youtube.post_comments() |
A video's comments |
youtube.post_related() |
The videos YouTube suggests beside one |
youtube.post_transcript() |
A video's captions as text |
youtube.profile() |
A channel with its subscribers |
youtube.profile_community() |
A channel's community posts |
youtube.profile_lives() |
A channel's live streams |
youtube.profile_playlists() |
A channel's playlists |
youtube.profile_podcasts() |
A channel's podcasts |
youtube.profile_posts() |
A channel's videos |
youtube.profile_search() |
A search within one channel's videos |
youtube.profile_shorts() |
A channel's Shorts |
youtube.search() |
Videos matching a query |
youtube.search_channels() |
Channels matching a query |
youtube.search_playlists() |
Playlists matching a query |
youtube.search_suggestions() |
What the search box suggests for a few letters |
youtube.trending() |
What is trending in a country |
Account
| Method | Description |
|---|---|
account.get_credits() |
The credits left in your workspace |
Query parameters are keyword arguments of the method, such as handle="nike", cursor=cursor. Every endpoint, with its parameters and a real answer, is in the API Reference.
Links
License
Apache-2.0
Metadata
Release files for socialapihq 0.1.4
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 |
|---|---|---|---|---|
| socialapihq-0.1.4.tar.gz | 166.8 kB | With provenance | Details for socialapihq-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| socialapihq-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for socialapihq-0.1.4-py3-none-any.whl |
Total release size: 634.7 kB
Security for socialapihq 0.1.4
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.
Full provenance
Both files in this release have been 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.
Release files / socialapihq-0.1.4.tar.gz
How to use checksums
d71e5d6fe724ae8425a6129e52a6e94a0bc985e26a2f520ce88c5f548d1095b7How to use checksums
4d46d01036ee1ed809dfc543f673d231c9eb5e6ecccc11459683d488f20db415What is trusted publishing?
twine/7.0.0 CPython/3.13.16Provenance
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logIdentity
Workflow
Artifact
socialapihq-0.1.4.tar.gzd71e5d6fe724ae8425a6129e52a6e94a0bc985e26a2f520ce88c5f548d1095b7Verifying attestations