Developer tutorial
How to scrape Twitter (X) tweets with Node.js (2026)
This tutorial shows how to scrape Twitter (X) tweets in Node.js using the SocialCrawl API. You get a user's recent tweets with text, media, timestamp, and reply, retweet, and like counts, paginated by cursor from one GET request, with no X developer account, proxies, or HTML parsing. The code below is runnable as-is, and the response underneath it is a real, unedited call.
Code tested July 2026
How it works
- 1Get a free API keyCreate a SocialCrawl account and copy your API key from the dashboard. Every new account starts with free credits.
- 2Set up Node.jsUse Node.js 18 or newer, which includes the fetch API with no extra packages.
- 3Call the X User Tweets endpointSend a GET request to /v1/twitter/user/tweets with your API key in the x-api-key header and the `handle` parameter.
- 4Read the responseParse the JSON. SocialCrawl returns a user's recent tweets with text, media, timestamp, and reply, retweet, and like counts, paginated by cursor in one normalized schema, so you write no HTML parsing or proxy code.
The code
A real, unedited response from the request above.
const params = new URLSearchParams({
"handle": "NASA",
});
const response = await fetch(
`https://www.socialcrawl.dev/v1/twitter/user/tweets?${params}`,
{ headers: { "x-api-key": "YOUR_API_KEY" } },
);
const data = await response.json();
console.log(data);[ RESPONSE ]
{
"success": true,
"platform": "twitter",
"endpoint": "/v1/twitter/user/tweets",
"data": {
"items": [
{
"post": {
"id": "2078226501024227542",
"url": "https://x.com/NASA/status/2078226501024227542",
"content": {
"text": "RT @NASASpox: Full steam ahead this week at @NASA π\n\nπ§βπ @Astro_Anil arrives at the ISS\nπͺ Dragonfly progress\nβοΈ Future of autonomous flightβ¦",
"media_urls": null,
"thumbnail_url": null,
"duration_seconds": null
},
"author": {
"username": "NASA",
"display_name": "NASA",
"avatar_url": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"verified": true
},
"engagement": {
"views": 64929,
"likes": 0,
"comments": 0,
"shares": 92,
"saves": 0
},
"flags": {
"nsfw": null,
"spoiler": null,
"pinned": false,
"deleted": false
},
"published_at": "Fri Jul 17 21:13:04 +0000 2026"
},
"computed": {
"engagement_rate": 0.001417,
"language": "en",
"content_category": "other",
"estimated_reach": 77915
}
},
{
"post": {
"id": "2078214686453985351",
"url": "https://x.com/NASA/status/2078214686453985351",
"content": {
"text": "RT @NASADepAdmin: The Artemis Accords continue to bring the world together around a shared vision for the peaceful future of exploration.β¦",
"media_urls": null,
"thumbnail_url": null,
"duration_seconds": null
},
"author": {
"username": "NASA",
"display_name": "NASA",
"avatar_url": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"verified": true
},
"engagement": {
"views": 66502,
"likes": 0,
"comments": 0,
"shares": 79,
"saves": 0
},
"flags": {
"nsfw": null,
"spoiler": null,
"pinned": false,
"deleted": false
},
"published_at": "Fri Jul 17 20:26:07 +0000 2026"
},
"computed": {
"engagement_rate": 0.001188,
"language": "en",
"content_category": "other",
"estimated_reach": 79802
}
}
],
"total": null,
"dropped": 0
},
"credits_used": 1,
"credits_remaining": 9999,
"request_id": "req_example000000",
"cached": false,
"pagination": {
"next_cursor": null,
"has_more": false,
"page_size": 14
}
}Prefer another language?
FAQ
Have a question? We got answers
Find answers to frequently asked questions about SocialCrawl's API, pricing, and capabilities.
Contact usDo I need a X developer account to scrape Twitter (X) tweets?
No. SocialCrawl handles authentication and proxies upstream, so you never register a X app, manage OAuth tokens, or run your own scrapers. One API key returns X data directly.
What does the X User Tweets endpoint return?
It returns a user's recent tweets with text, media, timestamp, and reply, retweet, and like counts, paginated by cursor. The response is normalized into SocialCrawl's unified schema, identical in shape across every platform.
How much does it cost to scrape Twitter (X) tweets?
Each call costs a small number of credits, and new accounts start with free credits. There are no monthly minimums, so you pay only for the calls you make.
Can I use this Node.js code in production?
Yes. The snippet on this page is the real request against the live API. For production, add error handling and follow the response cursor to paginate through large result sets.
Ask AI about SocialCrawl
