Skip to Content

Platforms

X (Twitter)

Read X accounts with their posts and highlights, posts with their replies and transcripts, trends, communities, broadcasts and Spaces.

Read accounts with their posts, highlights and similar accounts, a post with its top replies and its video's transcript, what is trending in a country, communities with their top posts, live broadcasts and Spaces.

Quick Reference

PropertyValue
Endpoints13
Accounts byhandle or url
Posts byurl or id
Communities, broadcasts, Spaces byurl or id
Posts a page20
TranscriptsYes
CountsViews, likes, replies, reposts, quotes, bookmarks

Accounts

EndpointReturnsCredits
profileAn account with its follower and post counts.1
profile/highlightsThe posts an account highlighted, newest first.1
profile/postsAn account's posts and reposts, newest first.1
profile/similarAccounts like one, as X suggests them.1

Read a Profile

import { SocialAPI } from "@socialapihq/sdk";

const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });

const { data } = await client.x.profile({ handle: "NASA" });
Response
{
  "data": {
    "id": "11348282",
    "username": "NASA",
    "displayName": "NASA",
    "bio": "Making the seemingly impossible, possible. ✨",
    "avatarUrl": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",
    "url": "https://x.com/NASA",
    "verified": true,
    "private": false,
    "followers": 92078384,
    "following": 115,
    "likes": null,
    "posts": 74589,
    "externalUrl": "http://www.nasa.gov/",
    "createdAt": "2007-12-19T20:20:32.000Z",
    "ext": {
      "bannerUrl": "https://pbs.twimg.com/profile_banners/11348282/1788992290",
      "location": "Pale Blue Dot",
      "blueVerified": true,
      "verifiedType": "Government",
      "verifiedSince": "2009-08-07T19:53:50.941Z",
      "mediaPosts": 28267,
      "highlights": 296,
      "likesGiven": 17125,
      "pinnedPosts": []
    }
  }
}
  • A profile has its follower, following and post counts, and its media posts in ext.mediaPosts.
  • Its ext has its banner, location, checkmark (blueVerified, verifiedType), highlights, the likes it gave and its pinned posts.
  • A handle is taken with or without @.

Account Lists

  • Posts are the account's posts and reposts, newest first, 20 a page and about 600 in all. A repost has ext.repost, with who reposted it and when.
  • Highlights are the posts the account highlighted, every one of them, 20 a page.
  • Similar accounts are the 20 accounts X suggests beside it, each with its counts.
  • A protected account's posts return 403 PRIVATE, at no cost.

Posts

EndpointReturnsCredits
postOne post with its views, likes, replies and reposts.1
post/commentsThe top replies to a post.1
post/transcriptA video post's captions as text.10

Post Fields

  • A post's id is X's, the digits its link ends with.
  • The stats have views, likes, comments (its replies), shares (its reposts) and saves (its bookmarks).
  • Its ext.quotes is the posts quoting it, and ext.quoted the post it quotes.
  • Its text has its links written out in full, also listed in ext.links, and a long post's whole text.
  • Its media is its images, videos and GIFs. A video's url is its best MP4, and ext.playlists its HLS playlist.

Replies

A post's comments are its top replies, a few threads on one page. A reply to another reply names it as parentId, and a reply by the post's author has ext.byAuthor.

Transcripts

A video post's transcript is X's own caption track, as timed lines and as plain text. It is either the track uploaded with the video or the one X made from its speech, which has generated. A transcript costs 10 credits and is kept 30 days. A post without a video, or a video without captions, returns 404, at no cost.

Communities

EndpointReturnsCredits
communityA community with its members, rules and topic.1
community/postsA community's top posts.1
  • A community has its members, creation date, topic, rules, creator and the hashtags trending in it.
  • Its posts are its 20 top posts, ranked by X, on one page.

Discovery

EndpointReturnsCredits
trendingThe topics trending in a country, or worldwide.1
trending/postsThe posts trending on X today.1
  • Trending takes country, an ISO code (us, gb, tr), and is worldwide without one. Each topic has its search on X and, when X counts one, its volume of posts.
  • Trending posts are the day's trending posts worldwide, on one page.

Live

EndpointReturnsCredits
liveA live video broadcast, running or ended.1
spaceA Space with its hosts, speakers and audience.1
  • A broadcast is a live video, running or ended, with its viewers while it runs and its views in all.
  • A Space is a live audio conversation, with its hosts, speakers, listeners and replays.
  • Both have their stream's playlist in ext: live while they run, their recording after.