Read any public X (Twitter) profile as JSON: exact follower count, following, post count, plus post metrics and the recent posts of a profile.
The SocialLens API is one generic API: you call an endpoint by data type and pass platform=x. The response schema is the same across every network. Authenticate with a Bearer key from /keys; start with 250 free reads, no card. Full reference, credits, rate limits and errors are on the main docs.
Reads the public X (Twitter) profile and returns normalized counters and identity (including the follower count).
curl "https://api.sociallens.dev/v1/profile?username=x&platform=x" \ -H "Authorization: Bearer sk_live_your_key"
import requests
res = requests.get(
"https://api.sociallens.dev/v1/profile",
params={ "username": "x", "platform": "x" },
headers={"Authorization": "Bearer sk_live_your_key"},
)
data = res.json()const res = await fetch("https://api.sociallens.dev/v1/profile?username=x&platform=x", {
headers: { Authorization: "Bearer sk_live_your_key" },
});
const data = await res.json();$ch = curl_init("https://api.sociallens.dev/v1/profile?username=x&platform=x");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer sk_live_your_key"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);Public metrics of a single X (Twitter) post: likes, views, comments, shares and author.
curl "https://api.sociallens.dev/v1/post?url=https://x.com/X/status/2121716160898994388&platform=x" \ -H "Authorization: Bearer sk_live_your_key"
import requests
res = requests.get(
"https://api.sociallens.dev/v1/post",
params={ "url": "https://x.com/X/status/2121716160898994388", "platform": "x" },
headers={"Authorization": "Bearer sk_live_your_key"},
)
data = res.json()const res = await fetch("https://api.sociallens.dev/v1/post?url=https://x.com/X/status/2121716160898994388&platform=x", {
headers: { Authorization: "Bearer sk_live_your_key" },
});
const data = await res.json();$ch = curl_init("https://api.sociallens.dev/v1/post?url=https://x.com/X/status/2121716160898994388&platform=x");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer sk_live_your_key"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);Recent posts of a X (Twitter) profile, one page per credit.
curl "https://api.sociallens.dev/v1/profile-posts?username=x&platform=x" \ -H "Authorization: Bearer sk_live_your_key"
import requests
res = requests.get(
"https://api.sociallens.dev/v1/profile-posts",
params={ "username": "x", "platform": "x" },
headers={"Authorization": "Bearer sk_live_your_key"},
)
data = res.json()const res = await fetch("https://api.sociallens.dev/v1/profile-posts?username=x&platform=x", {
headers: { Authorization: "Bearer sk_live_your_key" },
});
const data = await res.json();$ch = curl_init("https://api.sociallens.dev/v1/profile-posts?username=x&platform=x");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer sk_live_your_key"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);See also, guides on the blog: X (Twitter) Follower Count API: Exact Counts, Following and Post Totals, Social Media Data for Academic Research After CrowdTangle, Data365 and EnsembleData Alternatives, and all guides.