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.

X (Twitter)
GET/v1/x/user-tweets?handle=nasa
curl "https://api.perceptlayer.com/v1/x/user-tweets?handle=nasa" \
  -H "X-API-Key: $API_KEY"
cURL1 credit per successful call
Run this call below or from your dashboard to see a live response.

Playground

Run this API

cURLshell
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.

Note
Endpoints marked “Needs terms” return personal or social data. They work once you accept the restricted-endpoint terms in your dashboard.
EndpointRequired parametersReturnsCost
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: profile by handle, rest_id or tweet_id; user-tweets by handle, with count, cursor, with_replies, groupthreads and since; profile-media, profile-articles, profile-followers and profile-following by handle, with count and cursor.
  • Tweets: tweet, tweet-text, tweet-thread, tweet-media, tweet-video and tweet-transcript take a tweet id.
  • Around a tweet: tweet-conversation by id, with count, cursor, ranking_mode, about_account and lang; tweet-quotes and tweet-reposts by id, with count and cursor.
  • Communities: community and community-posts by community_id.
  • Discovery: search-typeahead for a partial q, with result_type; trends with type and count; notes by id.

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.

Social mediaJSONRESTMCPSome endpoints need terms

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 post

Measure how a public post spreads through quotes and reposts

Use the X (Twitter) API to measure how a public post spreads through quotes and reposts

Read the replies under an announcement

Use the X (Twitter) API to read the replies under an announcement

Watch trends for a topic or market

Use the X (Twitter) API to watch trends for a topic or market

FAQ

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.