APIs / Social media / X (Twitter)
1 credit per call22 endpointsChecked working 6 Dec 2026
X (Twitter) API
X (Twitter) API for public profiles, user tweets, tweets, conversations, quotes, reposts, communities and trends as JSON. 1 credit per successful call.
curl "https://api.perceptlayer.com/v1/x/user-tweets?handle=nasa" \
-H "X-API-Key: $API_KEY"Playground
Run this API
curl "https://api.perceptlayer.com/v1/x/user-tweets?handle=nasa" \
-H "X-API-Key: $API_KEY"X (Twitter) · 22 endpoints
Endpoints
Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.
| Endpoint | Required parameters | Returns | Cost |
|---|---|---|---|
GET/v1/x/community | community_idNeeds terms | community | 1 credit |
GET/v1/x/community-posts | community_idNeeds terms | community_idresultsorderpagination | 1 credit |
GET/v1/x/notes | idNeeds terms | idhas_note | 1 credit |
GET/v1/x/profile | none+3 optionalNeeds terms | usercounters_provenance | 1 credit |
GET/v1/x/profile-articles | handle+2 optionalNeeds terms | typeurlidtextraw_textauthor+13 more | 1 credit |
GET/v1/x/profile-followers | handle+2 optionalNeeds terms | screen_nameurlidfollowersfollowinglikes+13 more | 1 credit |
GET/v1/x/profile-following | handle+2 optionalNeeds terms | screen_nameurlidfollowersfollowinglikes+13 more | 1 credit |
GET/v1/x/profile-media | handle+2 optionalNeeds terms | typeurlidtextraw_textauthor+16 more | 1 credit |
GET/v1/x/search-tweets | q+3 optionalNeeds terms | typeurlidtextraw_textauthor+15 more | 1 credit |
GET/v1/x/search-typeahead | q+1 optionalNeeds terms | idnamescreen_nameavatar_urldescriptionraw_description+11 more | 1 credit |
GET/v1/x/search-users | q+3 optionalNeeds terms | screen_nameurlidfollowersfollowinglikes+13 more | 1 credit |
GET/v1/x/trends | none+2 optionalNeeds terms | namecontext | 1 credit |
GET/v1/x/tweet | idNeeds terms | tweet | 1 credit |
GET/v1/x/tweet-conversation | id+5 optionalNeeds terms | typeurlidtextraw_textauthor+14 more | 1 credit |
GET/v1/x/tweet-media | idNeeds terms | typeurl | 1 credit |
GET/v1/x/tweet-quotes | id+2 optionalNeeds terms | typeurlidtextraw_textauthor+15 more | 1 credit |
GET/v1/x/tweet-reposts | id+2 optionalNeeds terms | screen_nameurlidfollowersfollowinglikes+12 more | 1 credit |
GET/v1/x/tweet-text | idNeeds terms | idurlauthor_nameauthor_urltexthtml+1 more | 1 credit |
GET/v1/x/tweet-thread | idNeeds terms | idthread | 1 credit |
GET/v1/x/tweet-transcript | idNeeds terms | idformatplaylistsegmenttranscript | 1 credit |
GET/v1/x/tweet-video | idNeeds terms | idvideo | 1 credit |
GET/v1/x/user-tweets | handle+5 optionalNeeds terms | typeurlidtextraw_textauthor+16 more | 1 credit |
Overview
About the X (Twitter) API
What you can get
The X (Twitter) API returns public X data as JSON through 20 endpoints. These are restricted endpoints: the restricted-endpoint terms apply, and they don't permit collecting personal data without a lawful basis or using it to contact people.
- Profiles:
profilebyhandle,rest_idortweet_id;user-tweetsbyhandle, withcount,cursor,with_replies,groupthreadsandsince;profile-media,profile-articles,profile-followersandprofile-followingbyhandle, withcountandcursor. - Tweets:
tweet,tweet-text,tweet-thread,tweet-media,tweet-videoandtweet-transcripttake a tweetid. - Around a tweet:
tweet-conversationbyid, withcount,cursor,ranking_mode,about_accountandlang;tweet-quotesandtweet-repostsbyid, withcountandcursor. - Communities:
communityandcommunity-postsbycommunity_id. - Discovery:
search-typeaheadfor a partialq, withresult_type;trendswithtypeandcount;notesbyid.
How a call works
Most calls start from a handle or a tweet id: GET /v1/x/user-tweets?handle=... with your key in the X-API-Key header, or GET /v1/x/tweet?id=... for one post. The list endpoints page with cursor. Every successful call costs 1 credit; failed calls cost nothing.
More social media APIs
Use cases
Follow what a set of public accounts post
Use the X (Twitter) API to follow what a set of public accounts postMeasure how a public post spreads through quotes and reposts
Use the X (Twitter) API to measure how a public post spreads through quotes and repostsRead the replies under an announcement
Use the X (Twitter) API to read the replies under an announcementWatch trends for a topic or market
Use the X (Twitter) API to watch trends for a topic or marketFAQ
Questions
Do I need an X developer account?
No. You call this X (Twitter) API with your Perceptlayer key in the `X-API-Key` header, so there's no X developer app to register. You do need to accept the restricted-endpoint terms first.
How much does the X (Twitter) API cost?
Each successful call costs one credit. New accounts get free credits to start, and credit packs bring the price down as you scale.
What format are responses in?
Every endpoint returns JSON, with no HTML parsing on your side.
Is this the official X (Twitter) API?
No. Perceptlayer is an independent service and is not affiliated with X (Twitter). It returns X (Twitter) data as JSON with a Perceptlayer key, so there is no X (Twitter) developer account, app review or partner approval to get first. It only reads data: if X (Twitter) has an official API and you need to act on your own X (Twitter) account, such as posting, managing orders or reading private data, use that one.
Should I build a X (Twitter) scraper instead?
You can, but a X (Twitter) scraper is code you maintain: page changes break it, requests get blocked, and X (Twitter)'s terms govern how you collect data. The X (Twitter) API gives you 22 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first. Some of these endpoints return social or personal data and need the restricted-endpoint terms; collect only what you have a lawful basis for.
Try the X (Twitter) API with 100 free credits
No credit card. Failed calls are never billed.