X API

Get X data as clean JSON with one key: 18 endpoints, 1 to 5 credits per call, the same response shape as every other platform.

What you get#

Onekey exposes X as 18 endpoints behind one API key: 8 endpoints return one record (data is an object) and 10 endpoints return a list (data is an array). Every answer uses the same envelope (success, data, metadata, error), the cost is reported in metadata.credits_charged, and fields are mapped onto the unified schema so the code you write for X also works for the rest of the social networks category.

Endpoints#

EndpointWhat it doesParametersCreditsStatus
ai_searchAI-assisted search across X posts, returning matching posts.query*3beta needs a pack
communityGet X community details.url*2beta needs a pack
community_tweetsList X community tweets.url*2beta needs a pack
followersFollowers of an X user (first page).handle*2stable may need a pack
followingAccounts followed by an X user (first page).user_id*, query_id5beta needs a pack
oembedoEmbed for a public tweet: author, embed text and date (official publish.twitter.com).id*1stable
profileFetch an X (Twitter) user's public profile.handle*2beta may need a pack
profile_fullX (X) profile, recent posts, and computed analytics in one call.handle*2beta needs a pack
retweetersAccounts that retweeted a tweet (first page).id*, query_id, cursor3beta needs a pack
searchSearch recent tweets by keyword or hashtag.q*2stable may need a pack
search_usersSearch X users.query*, cursor2beta needs a pack
statusA tweet with full engagement counts (likes, replies, reposts, bookmarks, quotes, views).id*1stable may need a pack
threadThe conversation thread around a tweet (author's self-thread / replies chain).id*2stable may need a pack
tweetA single public tweet via X syndication: text, author, likes, reply count, date.id*1stable may need a pack
tweet_transcriptGet X video transcript.url*2beta needs a pack
userPublic profile for an X handle: followers, following, bio, avatar.handle*1stable may need a pack
user_mediaList X user media tweets.handle*, cursor2beta needs a pack
user_tweetsRecent tweets posted by an X user.handle*2stable may need a pack

A * marks a required parameter. Each endpoint name links to its reference page with the full parameter table, caching window and a recorded response.

Make a request#

This calls x.oembed (1 credit, stable). Replace YOUR_API_KEY with your key; sign up, no card. 1,000 free credits cover the open-platform endpoints. Hard-to-reach platforms (X, TikTok, Instagram, Reddit, and others marked on their page) need a verified email and a purchased pack.

curl "https://api.onekey.dev/v1/x/oembed?id=20" \
  -H "x-api-key: YOUR_API_KEY"

Fields you get back#

These unified fields come back from X, with the same names as on every other platform. The count is how many of its 18 mapped endpoints return the field; a field the source lacks is null, never missing. 5 platform-specific fields (ext.<name>) come on top, documented on each endpoint page.

FieldTypeEndpoints
author.usernamestring15
content.textstring14
author.displayNamestring13
author.idstring12
author.followersinteger11
author.avatarUrlURL10
engagement.commentsinteger10
author.verifiedboolean9
engagement.likesinteger9
content.createdAtISO 8601 date8
content.idstring8
content.urlURL8
engagement.sharesinteger7
engagement.viewsinteger7
content.languagestring6
author.followinginteger4
author.urlURL4
engagement.bookmarksinteger4
engagement.quotesinteger4
content.titlestring3
media.thumbnailUrlURL3
author.biostring1
author.contentCountinteger1
entity.createdAtISO 8601 date1
entity.descriptionstring1
entity.idstring1
entity.namestring1
entity.urlURL1
media.durationSecondsnumber1

The full schema is in Unified schema.

Pricing#

X calls cost 1 to 5 credits, flat per endpoint. Free when served from cache (0.2 credit for a cached response over 100 KB). Invalid, failed or not-found calls are not charged. See pricing for credit packs.