MarkdownCopies this page as Markdown, ready to paste into an AI assistant.
X / Twitter API
11 X / Twitter endpoints behind one key, priced in credits per call and routed to the cheapest healthy source.
On this page
Social · 11 endpoints · from 1 credit per call
Endpoints
- POSTTwitter Tweet Transcript
/v1/run/twitter.tweet_transcriptSpoken-word transcript of a public X / Twitter video post, from its URL.3 creditsper call - POSTX / Twitter Community
/v1/run/twitter.communityPublic details of an X (Twitter) Community by URL: name, description, member count, join policy, creator and rules.1 creditper call - POSTX / Twitter Community Posts
/v1/run/twitter.community_tweetsRecent posts in an X (Twitter) Community by URL, with author and engagement counts, newest first.2 creditsper call - POSTX / Twitter Followers
/v1/run/twitter.followersFollower list of a public X (Twitter) account with bio, counts and avatar per follower, cursor-paged up to 200 per page.2 creditsper call - POSTX / Twitter Following
/v1/run/twitter.followingAccounts a public X (Twitter) user follows, with bio, counts and avatar per account, cursor-paged.2 creditsper call - POSTX / Twitter Post
/v1/run/twitter.tweetOne public X (Twitter) post by URL: full text, author, media and engagement counts (likes, reposts, replies, quotes, bookmarks, views).1 creditper call - POSTX / Twitter Post Replies
/v1/run/twitter.repliesReplies to a public X (Twitter) post as structured records with author, text and engagement, cursor-paged about 20 per page.2 creditsper call - POSTX / Twitter Profile
/v1/run/twitter.profilePublic X (Twitter) profile for one handle: bio, follower and post counts, verification, links and pinned posts.1 creditper call - POSTX / Twitter User Posts
/v1/run/twitter.user_postsPosts-tab timeline of a public X account: pinned post first, then newest posts, about 20 per page with cursor paging.2 creditsper call - POSTX / Twitter User Search
/v1/run/twitter.search_usersSearch X (Twitter) accounts by keyword (the People tab) and get profile records with follower, following and post counts.2 creditsper call - POSTX / Twitter Community SearchPlanned
/v1/run/twitter.search_communitiesSearch X (Twitter) Communities by keyword: id, name, topic and member count.Planned
Calling them
Every endpoint on this page is one POST to https://api.primaryapi.com/v1/run/{sku} with your API key and a JSON body. Responses share one envelope, so code written for one endpoint handles the others. For example, twitter.tweet_transcript:
curl -sS -X POST "https://api.primaryapi.com/v1/run/twitter.tweet_transcript" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://x.com/TheoVon/status/1916982720317821050"}'const res = await fetch('https://api.primaryapi.com/v1/run/twitter.tweet_transcript', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PRIMARYAPI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://x.com/TheoVon/status/1916982720317821050',
}),
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.code}: ${body.error}`);
// found:false is a successful answer ("does not exist"), not an error
console.log(body.output.found ? body.output.data : body.output.reason, body.credits);import os
import requests
res = requests.post(
"https://api.primaryapi.com/v1/run/twitter.tweet_transcript",
headers={"Authorization": f"Bearer {os.environ['PRIMARYAPI_API_KEY']}"},
json={
"url": "https://x.com/TheoVon/status/1916982720317821050",
},
timeout=60,
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['code']}: {body['error']}")
# found=False is a successful answer ("does not exist"), not an error
print(body["output"]["data"] if body["output"]["found"] else body["output"]["reason"], body["credits"])New to PrimaryAPI? Start with the Quickstart, then read Making requests.