Twitter analytics API: analyze X data with your AI
Most Twitter data analysis is the same three steps: pull the tweets, clean them up, then work out what they mean. Sourcelane does the first two and hands the data to Claude, ChatGPT or Cursor, which does the third. Pull an account's tweets or a keyword search, the replies under a post, who an account talks to and how two audiences overlap — then ask questions in plain English. For a ready-made scorecard instead, use the Twitter stats API.
From $0.001 per tweet · no API key · failed calls refunded
What you get
- Tweets by account or advanced search, with likes, retweets, replies and views
- Full engagement report per account: engagement rate, averages, top tweets
- Every reply under a post, for sentiment and theme analysis
- Viral tweets on any topic with virality scores
- Reply network: who an account replies to, quotes and mentions most
- Audience overlap between 2–5 accounts
Just ask your AI
“Pull @openai's last 300 tweets and tell me which topics and formats get the most engagement.”
“Get the replies to this tweet, classify the sentiment and summarise the top complaints.”
“How much do the audiences of @a16z and @ycombinator overlap?”
What people use the Twitter analytics API for
Content analysis
Pull an account's recent tweets and have your AI group them by topic and format, then rank each group by average engagement. You find out what actually works without exporting anything to a spreadsheet.
Sentiment and feedback
Scrape the replies to a launch tweet or a competitor's announcement, then ask for sentiment, recurring complaints and feature requests with example quotes.
Topic research
Search a keyword with operators like min_faves: and since:, or pull viral tweets on a topic, and ask what angles are getting traction this week. Combine it with Twitter trends to catch topics early.
Audience and network mapping
See who an account replies to and mentions most, and how much its followers overlap with a competitor's — useful for partnerships and ad targeting.
Sourcelane vs the X API
| X API | Sourcelane | |
|---|---|---|
| Analysis | Raw JSON — you write the code to analyse it | Your AI analyses it in the same conversation |
| Pricing | Pay-per-use credits per post read, enterprise contracts for high volume | Pay per tweet or report, failed calls refunded |
| Historical data | Full-archive search depends on your access level | Historical tweets between any two dates |
| Setup | Developer account, app and keys | Connect once from Claude, ChatGPT or Cursor |
Connectors behind it
Your AI picks the right one for the question. Each is priced per result and refunded if it fails.
tweetIdurltextcreatedAtlangsourceX (Twitter) Influencer Analytics$0.10 per resultGet a full engagement report for any X (Twitter) account - engagement rate, average likes and views, posting frequency, top tweets and hashtags.profilePictureusernameprofileUrlfollowersCountengagementRatePctavgLikesX (Twitter) Tweet Replies Scraper$0.001 per replyExtract every reply under any X (Twitter) post — full text, author, and engagement metrics. Perfect for sentiment analysis, brand monitoring, and community research.parentTweetIdtweetIdurltextcreatedAtlangX (Twitter) Viral Tweets Finder$0.004 per viral tweetFind viral tweets on any topic - set minimum likes and retweets, get engagement rates and virality scores for every result. No login required.topictweetIdurltextcreatedAtlangX (Twitter) Reply Network Analyzer$0.25 per reportMap who any X (Twitter) account replies to, quotes, retweets, and mentions most, with reply share, response times, and a ranked list of its closest contacts.typeanalyzedUsernameuserIdnamefollowersCountfollowingCountX (Twitter) Audience Overlap Analyzer$0.50 per reportCompare the followers of 2-5 X (Twitter) accounts - shared follower counts, overlap percentages, and enriched profiles of the common audience.recordTypeaccountAaccountBaccountAFollowerTotalaccountBFollowerTotalaccountAFollowersAnalyzedUse the Twitter analytics API from Claude, ChatGPT or Cursor
Pick your tool and connect in under a minute. Then just ask — for example: “Pull @openai's last 300 tweets and tell me which topics and formats get the most engagement.”
Connect Claude
Web, desktop and mobile. One click, then confirm.
- 1Click Add to Claude — claude.ai opens with Sourcelane filled in
- 2Click Continue to confirm — it then works in Claude desktop and mobile too
Manual setup (config files, REST, Python) +
Claude Code
Adds the Sourcelane MCP server with your key as a header.
claude mcp add --transport http sourcelane https://api.usesourcelane.com/mcp \
--header "Authorization: Bearer sl_live_your_agent_key"Claude Desktop (config file)
Alternative to the connector URL: add to claude_desktop_config.json, then restart Claude.
{
"mcpServers": {
"sourcelane": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://api.usesourcelane.com/mcp",
"--header",
"Authorization:${AUTH_HEADER}"
],
"env": {
"AUTH_HEADER": "Bearer sl_live_your_agent_key"
}
}
}
}Cursor & Windsurf
Add to ~/.cursor/mcp.json (or Windsurf's mcp_config.json).
{
"mcpServers": {
"sourcelane": {
"url": "https://api.usesourcelane.com/mcp",
"headers": {
"Authorization": "Bearer sl_live_your_agent_key"
}
}
}
}VS Code
Save as .vscode/mcp.json. VS Code prompts for your key once.
{
"servers": {
"sourcelane": {
"type": "http",
"url": "https://api.usesourcelane.com/mcp",
"headers": {
"Authorization": "Bearer ${input:sourcelane-key}"
}
}
},
"inputs": [
{
"type": "promptString",
"id": "sourcelane-key",
"description": "Sourcelane agent key",
"password": true
}
]
}ChatGPT Custom GPT (Actions)
Create a GPT → Actions → Import from URL, then Authentication: API Key, Bearer.
https://usesourcelane.com/openapi.jsonREST
One POST. Pass maxResults to cap cost.
curl -X POST https://api.usesourcelane.com/v1/call \
-H "Authorization: Bearer sl_live_your_agent_key" \
-H "Content-Type: application/json" \
-d '{"listing":"x-tweet-scraper","params":{"query":"from:elonmusk min_faves:1000","maxItems":5},"maxResults":10}'Python, LangChain, CrewAI, OpenAI Agents SDK…
Wrap the REST call as a tool, or point an MCP client at the endpoint.
import requests
res = requests.post(
"https://api.usesourcelane.com/v1/call",
headers={"Authorization": "Bearer sl_live_your_agent_key"},
json={
"listing": "x-tweet-scraper",
"params": {"query":"from:elonmusk min_faves:1000","maxItems":5},
"maxResults": 10,
},
timeout=300,
)
body = res.json()
print(body["receipt"]["chargedMicros"], "micro-USD for", body["receipt"]["results"], "results")
print(body["data"])Twitter analytics API — FAQ
Do I need to write code to analyse Twitter data?+
No. Connect Sourcelane to Claude, ChatGPT or Cursor and ask in plain English. Your AI calls the connectors, then does the analysis — tables, charts, summaries — itself. Developers can also call the same connectors over REST.
How many tweets can I analyse?+
As many as you need — you set the limit per call and pay per tweet returned. For an account's full history between two dates, use the historical tweets API.
Can I analyse tweets about a keyword rather than an account?+
Yes. The tweet scraper accepts X's advanced search syntax, so you can analyse any keyword, hashtag, language or date range.
Is this the same as Twitter's built-in analytics?+
No. X's own analytics only covers your account. This works on any public account or topic, so you can analyse competitors and markets too.
Do I need a X (Twitter) API key or developer account?+
No. Sourcelane runs the connectors for you. You top up a balance with a card, create an agent key, and your agent calls the connector — there is no X (Twitter) app review, OAuth setup or rate-limit juggling on your side.
Which AI tools can use it?+
Anything that speaks MCP (Claude Desktop, Claude Code, Cursor, VS Code, Windsurf) can connect to the Sourcelane MCP server with one config block. ChatGPT can use it through a Custom GPT Action, and any agent framework can call the REST endpoint directly.
Can I stop an agent from overspending?+
Yes. Every agent key has its own per-call cap, daily and monthly limits, an optional lifetime budget, an allowlist of connectors, and a kill switch.

