Shell pip install socialtap
Zero dependencies (the standard library's urllib); Python 3.10+; fully typed (py.typed, checked with mypy --strict).
Models are frozen dataclasses with the API's field names; None means unknown, lists are never None.
Nothing is invented: a required member that is missing or of the wrong type raises APIDecodeError, as does a
2xx that is not the API's envelope; with fields= the data is a dict of the selected members (typed overloads). Every
result keeps raw (the decoded body), members this version doesn't model included. A retry-after longer than
MAX_RETRY_AFTER_S raises RetryAfterExceededError instead of retrying early. Event.data is the model of its type;
job items are TypedDicts per endpoint.
Async: AsyncSocialTap has the same methods as coroutines (async for over iterate). It runs the stdlib
transport in a worker thread (asyncio.to_thread), which is plenty for API calls that take about a second; pass
transport= (anything with send(Request) -> Response) to bring another HTTP stack.
Python import asyncio
from socialtap import AsyncSocialTap
async def main() -> None :
client = AsyncSocialTap()
res = await client.tiktok.profile.get(handle="nasa" )
print(res.data)
asyncio.run(main())
The client reads your API key from SOCIALTAP_API_KEY, or takes it as an option. Requests send it in the
x-api-key header. Get a key at https://socialtap.dev/signup/?ref=sdk : every account starts with 100 free credits.
TikTok Profile API (tiktok.profile). Exact follower and like counts, bio and country.
Python from socialtap import SocialTap
client = SocialTap() # api_key defaults to os.environ["SOCIALTAP_API_KEY"]
res = client.tiktok.profile.get(handle="nasa" )
print(res.data)
print(res.credits.charged, res.meta.request_id)
data is a Profile (example response, truncated):
JSON {
"approximate_fields": [],
"avatar_url": "https://p16-common-sign.tiktokcdn-us.com/tos-useast5-avt-0068-tx/e5143212a59c09a008bf50f487d54d1f~tplv-tiktokx-cropcenter:1080:1080.jpeg?dr=9640\u0026refresh_token=13f3c5e3\u0026x-expires=4070908800\u0026x-signature=SCRUBBED\u0026t=4d5b0474\u0026ps=13740610\u0026shp=a5d48078\u0026shcp=81f88b70\u0026idc=useast8",
"banner_url": null,
"bio": "Making the seemingly impossible, possible.✨",
"category": null,
"country_code": "JP",
"created_at": "2026-07-20T15:55:49Z",
"display_name": "NASA",
"external_links": [
{
"title": null,
"url": "https://go.nasa.gov/3WyvlQi"
}
],
"id": "7664638705177150477",
"is_private": false,
"is_verified": true,
"location": null,
"metrics": {
"follower_count": 2217556,
"following_count": 23,
"post_count": 70,
"total_like_count": 11877309,
"total_view_count": null
},
"platform": "tiktok",
"platform_specific": {
"tiktok": {
"display_name_changed_at": "2026-07-20T15:58:00Z",
"friend_count": 17,
"is_business_account": false,
"is_shop_seller": false,
"language": "en",
"liked_post_count": null,
"sec_uid": "MS4wLjABAAAAU9BRVzC8oCaegVnia8IbqWhPb_-dbU7s00Y3wS1_Nx8g5RUaYvyXrpejgjdxTwd6"
}
},
"type": "organization",
"unknown_fields": [],
"url": "https://www.tiktok.com/@nasa",
"username": "nasa"
}
Every result also carries the envelope meta (request ID, source, cache status, fetch time) and credits
(charged by this request, and the balance after it when the API reports it). Failed requests and cache hits are free.
Amazon (10) endpoint method cost amazon.deal_productsclient.amazon.deal_products.list()1 credit amazon.offersclient.amazon.offers.list()1 credit amazon.productclient.amazon.product.get()1 credit amazon.reviewsclient.amazon.reviews.list()1 credit amazon.search_productsclient.amazon.search_products.list()1 credit amazon.sellerclient.amazon.seller.get()1 credit amazon.shopclient.amazon.shop.get()1 credit amazon.shop_listsclient.amazon.shop_lists.list()1 credit amazon.shop_postsclient.amazon.shop_posts.list()1 credit amazon.top_productsclient.amazon.top_products.list()1 credit
Apple Music (10) endpoint method cost applemusic.albumclient.applemusic.album.get()1 credit applemusic.artistclient.applemusic.artist.get()1 credit applemusic.search_albumsclient.applemusic.search_albums.list()1 credit applemusic.search_artistsclient.applemusic.search_artists.list()1 credit applemusic.search_playlistsclient.applemusic.search_playlists.list()1 credit applemusic.search_tracksclient.applemusic.search_tracks.list()1 credit applemusic.top_albumsclient.applemusic.top_albums.list()1 credit applemusic.top_playlistsclient.applemusic.top_playlists.list()1 credit applemusic.top_tracksclient.applemusic.top_tracks.list()1 credit applemusic.trackclient.applemusic.track.get()1 credit
Bluesky (5) endpoint method cost bluesky.commentsclient.bluesky.comments.list()1 credit bluesky.postclient.bluesky.post.get()1 credit bluesky.postsclient.bluesky.posts.list()1 credit bluesky.profileclient.bluesky.profile.get()1 credit bluesky.search_postsclient.bluesky.search_posts.list()1 credit
Facebook Ad Library (6) endpoint method cost facebook.adclient.facebook.ad.get()1 credit facebook.ad_transcriptclient.facebook.ad_transcript.get()2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true) facebook.adsclient.facebook.ads.list()1 credit facebook.advertiserclient.facebook.advertiser.get()1 credit facebook.search_adsclient.facebook.search_ads.list()1 credit facebook.search_advertisersclient.facebook.search_advertisers.list()1 credit
Facebook (14) endpoint method cost facebook.commentsclient.facebook.comments.list()1 credit facebook.engagementclient.facebook.engagement.get()1 credit facebook.groupclient.facebook.group.get()1 credit facebook.group_postsclient.facebook.group_posts.list()1 credit facebook.photosclient.facebook.photos.list()1 credit facebook.postclient.facebook.post.get()1 credit facebook.postsclient.facebook.posts.list()1 credit facebook.profileclient.facebook.profile.get()1 credit facebook.reelsclient.facebook.reels.list()1 credit facebook.repliesclient.facebook.replies.list()1 credit facebook.search_groupsclient.facebook.search_groups.list()1 credit + 1 per result filled in (with fill=true) facebook.search_postsclient.facebook.search_posts.list()1 credit + 1 per result filled in (with fill=true) facebook.search_profilesclient.facebook.search_profiles.list()1 credit + 1 per result filled in (with fill=true) facebook.transcriptclient.facebook.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
Facebook Events (4) endpoint method cost facebook.eventclient.facebook.event.get()1 credit facebook.eventsclient.facebook.events.list()1 credit facebook.place_eventsclient.facebook.place_events.list()1 credit facebook.search_eventsclient.facebook.search_events.list()1 credit
Facebook Marketplace (3) endpoint method cost facebook.listingclient.facebook.listing.get()1 credit facebook.search_listingsclient.facebook.search_listings.list()1 credit facebook.search_placesclient.facebook.search_places.list()1 credit
GitHub (20) endpoint method cost github.activityclient.github.activity.list()1 credit github.contributionsclient.github.contributions.get()1 credit github.followersclient.github.followers.list()1 credit github.followingclient.github.following.list()1 credit github.issueclient.github.issue.get()1 credit github.issue_commentsclient.github.issue_comments.list()1 credit github.issuesclient.github.issues.list()1 credit github.pinned_repositoriesclient.github.pinned_repositories.list()1 credit github.profileclient.github.profile.get()1 credit github.profile_pull_requestsclient.github.profile_pull_requests.list()1 credit github.readmeclient.github.readme.get()1 credit github.releasesclient.github.releases.list()1 credit github.repositoriesclient.github.repositories.list()1 credit github.repositoryclient.github.repository.get()1 credit github.repository_contributorsclient.github.repository_contributors.list()1 credit github.search_issuesclient.github.search_issues.list()1 credit github.search_profilesclient.github.search_profiles.list()1 credit github.search_repositoriesclient.github.search_repositories.list()1 credit github.trending_profilesclient.github.trending_profiles.list()1 credit github.trending_repositoriesclient.github.trending_repositories.list()1 credit
Google Ads Transparency Center (6) endpoint method cost google.adclient.google.ad.get()1 credit google.adsclient.google.ads.list()1 credit google.advertiserclient.google.advertiser.get()1 credit google.search_adsclient.google.search_ads.list()1 credit google.search_advertisersclient.google.search_advertisers.list()1 credit google.search_suggestionsclient.google.search_suggestions.list()1 credit
Hacker News (11) endpoint method cost hackernews.commentclient.hackernews.comment.get()1 credit hackernews.commentsclient.hackernews.comments.list()1 credit hackernews.feed_storiesclient.hackernews.feed_stories.list()1 credit hackernews.search_commentsclient.hackernews.search_comments.list()1 credit hackernews.search_storiesclient.hackernews.search_stories.list()1 credit hackernews.storyclient.hackernews.story.get()1 credit hackernews.userclient.hackernews.user.get()1 credit hackernews.user_commentsclient.hackernews.user_comments.list()1 credit hackernews.user_favoritesclient.hackernews.user_favorites.list()1 credit hackernews.user_storiesclient.hackernews.user_stories.list()1 credit hackernews.whoishiring_jobsclient.hackernews.whoishiring_jobs.list()1 credit
Instagram (29) endpoint method cost instagram.commentclient.instagram.comment.get()1 credit instagram.commentsclient.instagram.comments.list()1 credit instagram.embedclient.instagram.embed.get()1 credit instagram.engagementclient.instagram.engagement.get()1 credit instagram.hashtagclient.instagram.hashtag.get()1 credit instagram.hashtag_postsclient.instagram.hashtag_posts.list()1 credit instagram.highlightsclient.instagram.highlights.list()1 credit instagram.placeclient.instagram.place.get()1 credit instagram.place_postsclient.instagram.place_posts.list()1 credit instagram.playlist_storiesclient.instagram.playlist_stories.list()1 credit instagram.popular_trendsclient.instagram.popular_trends.list()1 credit instagram.postclient.instagram.post.get()1 credit instagram.postsclient.instagram.posts.list()1 credit instagram.profileclient.instagram.profile.get()1 credit instagram.reelsclient.instagram.reels.list()1 credit instagram.search_hashtagsclient.instagram.search_hashtags.list()1 credit instagram.search_placesclient.instagram.search_places.list()1 credit + 1 per result filled in (with fill=true) instagram.search_postsclient.instagram.search_posts.list()1 credit instagram.search_profilesclient.instagram.search_profiles.list()1 credit + 1 per result filled in (with fill=true) instagram.search_soundsclient.instagram.search_sounds.list()1 credit + 1 per result filled in (with fill=true) instagram.search_suggestionsclient.instagram.search_suggestions.list()1 credit instagram.similar_profilesclient.instagram.similar_profiles.list()1 credit instagram.soundclient.instagram.sound.get()1 credit instagram.sound_postsclient.instagram.sound_posts.list()1 credit instagram.storyclient.instagram.story.get()1 credit instagram.topicclient.instagram.topic.get()1 credit instagram.transcriptclient.instagram.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true) instagram.trending_postsclient.instagram.trending_posts.list()1 credit instagram.usernameclient.instagram.username.get()1 credit
Kick (2) endpoint method cost kick.postclient.kick.post.get()1 credit kick.transcriptclient.kick.transcript.get()2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
Komi (1) endpoint method cost komi.pageclient.komi.page.get()1 credit
Kwai (3) endpoint method cost kwai.postclient.kwai.post.get()1 credit kwai.postsclient.kwai.posts.list()1 credit kwai.profileclient.kwai.profile.get()1 credit
Lnk.Bio (1) endpoint method cost linkbio.profileclient.linkbio.profile.get()1 credit
LinkedIn Ad Library (2) endpoint method cost linkedin.adclient.linkedin.ad.get()1 credit linkedin.search_adsclient.linkedin.search_ads.list()1 credit
LinkedIn (19) endpoint method cost linkedin.commentsclient.linkedin.comments.list()1 credit (public page) or 5 credits (data partner) linkedin.employeesclient.linkedin.employees.list()5 credits linkedin.engagementclient.linkedin.engagement.get()1 credit (public page) or 15 credits (data partner) linkedin.followingclient.linkedin.following.list()5 credits linkedin.jobclient.linkedin.job.get()1 credit linkedin.job_related_jobsclient.linkedin.job_related_jobs.list()1 credit linkedin.jobsclient.linkedin.jobs.list()1 credit linkedin.liked_postsclient.linkedin.liked_posts.list()1 credit (public page) or 10 credits (data partner) linkedin.postclient.linkedin.post.get()1 credit linkedin.post_reactionsclient.linkedin.post_reactions.list()1 credit (public page) or 5 credits (data partner) linkedin.post_repostsclient.linkedin.post_reposts.list()1 credit (public page) or 5 credits (data partner) linkedin.postsclient.linkedin.posts.list()1 credit (public page) or 10 credits (data partner) linkedin.profileclient.linkedin.profile.get()1 credit (public page or web search) or 5 credits (data partner) linkedin.profile_commentsclient.linkedin.profile_comments.list()10 credits linkedin.profile_groupsclient.linkedin.profile_groups.list()5 credits linkedin.search_jobsclient.linkedin.search_jobs.list()1 credit linkedin.search_postsclient.linkedin.search_posts.list()1 credit + 1 per result filled in (with fill=true) linkedin.search_profilesclient.linkedin.search_profiles.list()1 credit + 1 per result filled in (with fill=true) linkedin.transcriptclient.linkedin.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
Linkme (1) endpoint method cost linkme.profileclient.linkme.profile.get()1 credit
Linktree (1) endpoint method cost linktree.profileclient.linktree.profile.get()1 credit
Pillar (1) endpoint method cost pillar.pageclient.pillar.page.get()1 credit
Pinterest (10) endpoint method cost pinterest.boardclient.pinterest.board.get()1 credit pinterest.board_pinsclient.pinterest.board_pins.list()1 credit pinterest.boardsclient.pinterest.boards.list()1 credit pinterest.pinclient.pinterest.pin.get()1 credit pinterest.pinsclient.pinterest.pins.list()1 credit pinterest.profileclient.pinterest.profile.get()1 credit pinterest.search_pinsclient.pinterest.search_pins.list()1 credit pinterest.top_trendsclient.pinterest.top_trends.list()1 credit pinterest.topicclient.pinterest.topic.get()1 credit pinterest.web_pageclient.pinterest.web_page.get()1 credit
Reddit (13) endpoint method cost reddit.commentsclient.reddit.comments.list()1 credit reddit.engagementclient.reddit.engagement.get()1 credit reddit.postclient.reddit.post.get()1 credit reddit.postsclient.reddit.posts.list()1 credit reddit.profileclient.reddit.profile.get()1 credit reddit.profile_commentsclient.reddit.profile_comments.list()1 credit reddit.search_commentsclient.reddit.search_comments.list()1 credit reddit.search_postsclient.reddit.search_posts.list()1 credit reddit.search_profilesclient.reddit.search_profiles.list()1 credit reddit.search_subredditsclient.reddit.search_subreddits.list()1 credit reddit.subredditclient.reddit.subreddit.get()1 credit reddit.subreddit_postsclient.reddit.subreddit_posts.list()1 credit reddit.transcriptclient.reddit.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
Rumble (7) endpoint method cost rumble.commentsclient.rumble.comments.list()1 credit rumble.engagementclient.rumble.engagement.get()1 credit rumble.postclient.rumble.post.get()1 credit rumble.postsclient.rumble.posts.list()1 credit rumble.profileclient.rumble.profile.get()1 credit rumble.search_postsclient.rumble.search_posts.list()1 credit rumble.transcriptclient.rumble.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
Snapchat (3) endpoint method cost snapchat.commentsclient.snapchat.comments.list()1 credit snapchat.profileclient.snapchat.profile.get()1 credit snapchat.spotlightclient.snapchat.spotlight.get()1 credit
SoundCloud (3) endpoint method cost soundcloud.artistclient.soundcloud.artist.get()1 credit soundcloud.trackclient.soundcloud.track.get()1 credit soundcloud.tracksclient.soundcloud.tracks.list()1 credit
Spotify (12) endpoint method cost spotify.albumclient.spotify.album.get()1 credit spotify.artistclient.spotify.artist.get()1 credit spotify.playlistclient.spotify.playlist.get()1 credit spotify.playlist_tracksclient.spotify.playlist_tracks.list()1 credit spotify.podcastclient.spotify.podcast.get()1 credit spotify.podcast_episodesclient.spotify.podcast_episodes.list()1 credit spotify.search_albumsclient.spotify.search_albums.list()1 credit spotify.search_artistsclient.spotify.search_artists.list()1 credit spotify.search_playlistsclient.spotify.search_playlists.list()1 credit spotify.search_podcastsclient.spotify.search_podcasts.list()1 credit spotify.search_tracksclient.spotify.search_tracks.list()1 credit spotify.trackclient.spotify.track.get()1 credit
Telegram (4) endpoint method cost telegram.channelclient.telegram.channel.get()1 credit telegram.channel_postsclient.telegram.channel_posts.list()1 credit telegram.postclient.telegram.post.get()1 credit telegram.search_channelsclient.telegram.search_channels.list()1 credit + 1 per result filled in (with fill=true)
Threads (6) endpoint method cost threads.commentsclient.threads.comments.list()1 credit threads.postclient.threads.post.get()1 credit threads.postsclient.threads.posts.list()1 credit threads.profileclient.threads.profile.get()1 credit threads.search_postsclient.threads.search_posts.list()1 credit threads.search_profilesclient.threads.search_profiles.list()1 credit
TikTok Ad Library (3) endpoint method cost tiktok.adclient.tiktok.ad.get()1 credit tiktok.search_adsclient.tiktok.search_ads.list()1 credit tiktok.top_adsclient.tiktok.top_ads.list()1 credit
TikTok (31) endpoint method cost tiktok.commentclient.tiktok.comment.get()1 credit tiktok.commentsclient.tiktok.comments.list()1 credit tiktok.downloadclient.tiktok.download.get()1 credit tiktok.effectclient.tiktok.effect.get()1 credit tiktok.effect_postsclient.tiktok.effect_posts.list()1 credit tiktok.engagementclient.tiktok.engagement.get()1 credit tiktok.followersclient.tiktok.followers.list()1 credit tiktok.followingclient.tiktok.following.list()1 credit tiktok.hashtagclient.tiktok.hashtag.get()1 credit tiktok.hashtag_postsclient.tiktok.hashtag_posts.list()1 credit tiktok.liked_postsclient.tiktok.liked_posts.list()1 credit tiktok.liveclient.tiktok.live.get()1 credit tiktok.place_postsclient.tiktok.place_posts.list()1 credit tiktok.playlist_postsclient.tiktok.playlist_posts.list()1 credit tiktok.playlistsclient.tiktok.playlists.list()1 credit tiktok.postclient.tiktok.post.get()1 credit tiktok.postsclient.tiktok.posts.list()1 credit tiktok.profileclient.tiktok.profile.get()1 credit tiktok.repliesclient.tiktok.replies.list()1 credit tiktok.search_hashtagsclient.tiktok.search_hashtags.list()1 credit + 1 per result filled in (with fill=true) tiktok.search_postsclient.tiktok.search_posts.list()1 credit tiktok.search_profilesclient.tiktok.search_profiles.list()1 credit + 1 per result filled in (with fill=true) tiktok.search_soundsclient.tiktok.search_sounds.list()1 credit + 1 per result filled in (with fill=true) tiktok.search_suggestionsclient.tiktok.search_suggestions.list()1 credit tiktok.search_topclient.tiktok.search_top.list()1 credit + 1 per result filled in (with fill=true) tiktok.soundclient.tiktok.sound.get()1 credit tiktok.sound_postsclient.tiktok.sound_posts.list()1 credit tiktok.top_postsclient.tiktok.top_posts.list()1 credit tiktok.transcriptclient.tiktok.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true) tiktok.trending_hashtagsclient.tiktok.trending_hashtags.list()1 credit tiktok.trending_postsclient.tiktok.trending_posts.list()1 credit
TikTok Shop (4) endpoint method cost tiktokshop.productclient.tiktokshop.product.get()1 credit tiktokshop.productsclient.tiktokshop.products.list()1 credit tiktokshop.reviewsclient.tiktokshop.reviews.list()1 credit tiktokshop.search_productsclient.tiktokshop.search_products.list()1 credit
Truth Social (3) endpoint method cost truthsocial.postclient.truthsocial.post.get()1 credit truthsocial.postsclient.truthsocial.posts.list()1 credit truthsocial.profileclient.truthsocial.profile.get()1 credit
Twitch (5) endpoint method cost twitch.profileclient.twitch.profile.get()1 credit twitch.scheduleclient.twitch.schedule.list()1 credit twitch.transcriptclient.twitch.transcript.get()2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true) twitch.videoclient.twitch.video.get()1 credit twitch.videosclient.twitch.videos.list()1 credit
X (17) endpoint method cost x.commentsclient.x.comments.list()1 credit x.communityclient.x.community.get()1 credit x.community_postsclient.x.community_posts.list()1 credit x.engagementclient.x.engagement.get()1 credit x.friendshipclient.x.friendship.get()1 credit x.listclient.x.list.get()1 credit x.list_followersclient.x.list_followers.list()1 credit x.postclient.x.post.get()1 credit x.postsclient.x.posts.list()1 credit x.profileclient.x.profile.get()1 credit x.profile_mentionsclient.x.profile_mentions.list()1 credit x.search_communitiesclient.x.search_communities.list()1 credit + 1 per result filled in (with fill=true) x.search_hashtagsclient.x.search_hashtags.list()1 credit x.search_postsclient.x.search_posts.list()1 credit + 1 per result filled in (with fill=true) x.search_profilesclient.x.search_profiles.list()1 credit + 1 per result filled in (with fill=true) x.spaceclient.x.space.get()1 credit x.transcriptclient.x.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
YouTube (10) endpoint method cost youtube.commentsclient.youtube.comments.list()1 credit youtube.engagementclient.youtube.engagement.get()1 credit youtube.hashtag_postsclient.youtube.hashtag_posts.list()1 credit youtube.postclient.youtube.post.get()1 credit youtube.postsclient.youtube.posts.list()1 credit youtube.profileclient.youtube.profile.get()1 credit youtube.search_postsclient.youtube.search_posts.list()1 credit youtube.search_profilesclient.youtube.search_profiles.list()1 credit youtube.search_suggestionsclient.youtube.search_suggestions.list()1 credit youtube.transcriptclient.youtube.transcript.get()1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
A version has a method for every endpoint the API had when it was released. For a newer one, update the
package, or send the request yourself: the raw request adds your key and retries and raises errors like a method,
and returns the status, headers and body (the envelope, data and meta). Each endpoint's docs page has its path
and params.
Python r, body = client.request("GET" , "/v1/tiktok/profile" , query={"handle" : "nasa" })
print(r.status, body["data" ])
Every API error is an APIError subclass named after its code, with status, code, retryable, remediation,
request_id and credits_charged (0: errors are free). Codes this SDK version doesn't know arrive as a plain
APIError with their code; no response at all is an APIConnectionError (APITimeoutError for timeouts).
Python from socialtap import APIError, NotFoundError
try:
client.tiktok.profile.get(handle="nasa" )
except NotFoundError:
... # Check the link or ID. Do not retry.
except APIError as err:
print(err.code, err.status, err.retryable, err.remediation, err.request_id)
code class status retried invalid_inputInvalidInputError400 no invalid_cursorInvalidCursorError400 no unauthorizedUnauthorizedError401 no forbiddenForbiddenError403 no insufficient_creditsInsufficientCreditsError402 no spend_limit_reachedSpendLimitReachedError402 no rate_limitedRateLimitedError429 yes request_too_largeRequestTooLargeError413 no method_not_allowedMethodNotAllowedError405 no endpoint_retiredEndpointRetiredError410 no idempotency_key_reusedIdempotencyKeyReusedError422 no idempotency_key_in_progressIdempotencyKeyInProgressError409 yes job_not_foundJobNotFoundError404 no unknown_endpointUnknownEndpointError404 no not_foundNotFoundError404 no private_or_unavailablePrivateOrUnavailableError403 no no_transcriptNoTranscriptError404 no no_liveNoLiveError404 no no_mediaNoMediaError404 no no_readmeNoReadmeError404 no unavailable_for_legal_reasonsUnavailableForLegalReasonsError451 no upstream_blockedUpstreamBlockedError503 yes upstream_errorUpstreamError502 yes overloadedOverloadedError503 yes internalInternalError500 yes
Retryable failures (the codes above, connection errors, timeouts) are retried 2 times by default with
exponential backoff and jitter, honoring retry-after. A GET retry sends max_age set to the seconds since the first
attempt: if the first response was lost in transit, the retry is served free from the cache. Timeouts are per
attempt: 60 s by default, and 300 s for endpoints that may transcribe audio (facebook.ad_transcript, facebook.transcript, instagram.transcript, kick.transcript, linkedin.transcript, reddit.transcript, rumble.transcript, tiktok.transcript, twitch.transcript, x.transcript, youtube.transcript), because speech-to-text on long
media takes minutes, and for create-and-wait's long-polls. Most requests answer in a few seconds. A timeout you set, on the client or on one request,
applies to every endpoint, and so does maxRetries.
List endpoints return one page (data, page.has_more, page.next_cursor). iterate() returns a Paginator (for over items, .by_page() for pages; async for on
the async client) with two guards, max_pages and max_credits; afterwards pages_fetched, credits_charged, stop_reason ("end", or the
guard that stopped it) and end_reason (the API's page.end_reason) say what happened.
Each page is checked against its catalog price before it is fetched, and an empty page with has_more is not the end.
Python items = client.tiktok.posts.iterate(handle="@khaby.lame" , max_pages=10 , max_credits=100 )
for item in items:
print(item)
print(items.pages_fetched, items.credits_charged, items.stop_reason, items.end_reason)
The gateway's own routes (account, usage, credit ledger, API keys, jobs, webhook endpoints, events) are free and
have methods too, named from their operation IDs (<noun>.<verb>, or <noun>.<sub>.<verb> for a sub-resource). They
answer the same envelope (data, meta, credits) with their own meta; cursor-paged list routes have iterate like
list endpoints. Every POST sends an idempotency-key header (yours, or a new UUID kept for the call's retries), so it is
retried like a GET and a retry never repeats the work; replayed says when the API answered from an earlier request
with the same key, and status is 202 when accepted work continues. Each route needs a key with the scope below (a key
never gets a scope its creator lacks).
Python res = client.account.get()
print(res.data, res.meta.request_id)
operation method scope account.getclient.account.get()account:readaccount.updateclient.account.update(...)adminusage.listclient.usage.list(...)account:readusage.rate.listclient.usage.rate.list(...)account:readcredit_transactions.listclient.credit_transactions.list(...)account:readbilling.checkout.getclient.billing.checkout.get(id)account:readbilling.subscription.getclient.billing.subscription.get()account:readbilling.auto_topup.getclient.billing.auto_topup.get()account:readbilling.purchases.listclient.billing.purchases.list(...)account:readbilling.purchases.receiptclient.billing.purchases.receipt(id)account:readrequests.listclient.requests.list(...)account:readrequests.getclient.requests.get(id)account:readrequests.get_responseclient.requests.get_response(id)account:readapi_keys.createclient.api_keys.create(...)adminapi_keys.listclient.api_keys.list(...)account:readapi_keys.getclient.api_keys.get(id)account:readapi_keys.updateclient.api_keys.update(id, ...)adminapi_keys.rotate_secretclient.api_keys.rotate_secret(id, ...)adminapi_keys.revokeclient.api_keys.revoke(id)adminjobs.createclient.jobs.create(...)jobsjobs.listclient.jobs.list(...)jobs:readjobs.getclient.jobs.get(id, ...)jobs:readjobs.results.listclient.jobs.results.list(id, ...)jobs:readjobs.cancelclient.jobs.cancel(id)jobswebhook_endpoints.createclient.webhook_endpoints.create(...)adminwebhook_endpoints.listclient.webhook_endpoints.list(...)account:readwebhook_endpoints.getclient.webhook_endpoints.get(id)account:readwebhook_endpoints.updateclient.webhook_endpoints.update(id, ...)adminwebhook_endpoints.deleteclient.webhook_endpoints.delete(id)adminwebhook_endpoints.rotate_secretclient.webhook_endpoints.rotate_secret(id, ...)adminwebhook_endpoints.testclient.webhook_endpoints.test(id)adminwebhook_endpoints.deliveries.listclient.webhook_endpoints.deliveries.list(id, ...)account:readevents.listclient.events.list(...)account:readevents.getclient.events.get(id)account:readevents.redeliverclient.events.redeliver(id, ...)adminnotification_preferences.getclient.notification_preferences.get()account:readnotification_preferences.updateclient.notification_preferences.update(...)admin
Many requests (or one long list walk) run as a background job at the synchronous prices; failed items are
free. The create-and-wait helper creates one, long-polls it until it ends and returns every result; one Idempotency-Key
covers the create's retries, so a retry never runs a job twice. Webhook deliveries are signed per Standard Webhooks:
verify the raw body with your endpoint's secret before trusting it, and deduplicate on the event ID.
Python out = client.jobs.create_and_wait(requests=[{"custom_id" : "row-1" , "endpoint" : "tiktok.profile" , "params" : {"handle" : "nasa" }}])
for r in out.results:
print(r.custom_id, r.status, r.error.code if r.error else None )
# A webhook delivery: the raw body, the request headers, your endpoint's secret.
event = client.webhooks.verify(raw_body, request.headers, os.environ["SOCIALTAP_WEBHOOK_SECRET" ])
The SDK hands the SocialTap MCP server's tools to a model: each tool's name, description (its price
and rules included) and input JSON Schema, and a call that sends one stateless MCP request with your key. A tool
behaves exactly as it does for an MCP client: concise results (detail: "full" for every field), next_cursor to
continue, and failures returned as the tool's output (error with retryable and remediation) so the model can
act on them. Transport failures raise as for any request, and tools that may be repeated are retried.
Python # LangChain: pip install "socialtap[langchain]"; the default tools, or SocialTapToolkit(tools=[...] or "all").
from langchain.agents import create_agent
from socialtap.langchain import SocialTapToolkit
agent = create_agent(model, tools=SocialTapToolkit().get_tools()) # any LangChain chat model
# Any other tool-calling API: hand TOOLS (name, description, input_schema) to the model, run its calls with call_tool.
from socialtap import SocialTap
from socialtap.tools import TOOLS, call_tool
r = call_tool(SocialTap(), "find_endpoint" , {"query" : "TikTok profile" }) # acall_tool with AsyncSocialTap
print(r.is_error, r.output)
tool what it does find_endpointFind an endpoint get_postPost by link list_postsPosts of a profile get_profileProfile by handle list_commentsComments of a post get_transcriptTranscript by link get_engagementEngagement by handle searchSearch by query call_endpointCall any endpoint search_docsSearch the docs read_docRead a docs page get_accountGet account balance buy_creditsBuy credits (checkout link) get_storyStory by link list_community_postsCommunity posts list_hashtag_postsHashtag posts list_liked_postsLiked posts of a profile list_place_postsPlace posts list_playlist_postsPlaylist posts list_reelsReels of a profile list_sound_postsSound posts list_top_postsTop posts list_trending_postsTrending posts list_channel_postsChannel posts of a profile list_effect_postsEffect posts list_feed_postsFeed posts list_photosPhotos of a profile list_pinsPins of a profile list_playlist_storiesPlaylist stories list_playlist_tracksPlaylist tracks list_podcast_episodesPodcast episodes list_post_repostsPost reposts list_profile_mentionsProfile mentions list_shop_postsShop posts of a profile list_tracksTracks of a profile list_user_favoritesUser favorites of a profile list_user_storiesUser stories of a profile list_videosVideos of a profile get_advertiserAdvertiser by handle get_sellerSeller by handle get_shopShop by handle list_followingFollowing of a profile list_followersFollowers of a profile list_employeesEmployees of a profile list_playlist_followersPlaylist followers list_post_reactionsPost reactions list_repository_contributorsRepository contributors list_similar_profilesSimilar profiles of a profile list_trending_profilesTrending profiles get_commentComment by link list_profile_commentsProfile comments list_repliesReplies of a post list_issue_commentsIssue comments get_ad_transcriptAd transcript by link get_adAd by link list_adsAds of a profile list_top_adsTop ads get_hashtagHashtag by link list_trending_hashtagsTrending hashtags get_communityCommunity by link get_playlistPlaylist by link get_productProduct by link get_albumAlbum by link get_soundSound by link get_topicTopic by link get_contributionsContributions by handle get_downloadDownload by link get_effectEffect by link get_embedEmbed by link get_eventEvent by link get_issueIssue by link get_job_postingJob posting by link get_liveLive by handle get_placePlace by link get_podcastPodcast by link get_readmeReadme by link get_relationshipRelationship by handle get_repositoryRepository by link get_spaceSpace by link get_usernameUsername by handle get_web_pageWeb page by link list_reviewsReviews of a product list_activityActivity of a profile list_boardsBoards of a profile list_deal_productsDeal products list_eventsEvents of a profile list_highlightsHighlights of a profile list_issuesIssues of a repository list_job_related_jobsJob related jobs list_jobsJobs of a profile list_offersOffers of a product list_pinned_repositoriesPinned repositories of a profile list_place_eventsPlace events list_playlistsPlaylists of a profile list_popular_trendsPopular trends list_productsProducts of a profile list_profile_groupsProfile groups list_profile_pull_requestsProfile pull requests list_releasesReleases of a repository list_repositoriesRepositories of a profile list_scheduleSchedule of a profile list_shop_listsShop lists of a profile list_top_albumsTop albums list_top_playlistsTop playlists list_top_productsTop products list_top_trendsTop trends list_trending_repositoriesTrending repositories list_whoishiring_jobsWhoishiring jobs create_background_jobCreate a background job get_background_jobGet a background job list_background_job_resultsList a background job's results
The version is derived from the API contract: major = API version, minor = the contract's revision (it grows
with every additive change, a new endpoint included), patch = the SDK generator's revision. Questions and bug reports: support@socialtap.dev .