Skip to Content

X (Twitter) API

13 endpoints for accounts, posts and Spaces.

Every X (Twitter) endpoint, by group. Each is a GET under /v1/x.

Quick Reference

PropertyValue
Base path/v1/x
Endpoints13
CreditsSee Below
GuideX (Twitter)

Accounts

Communities

Posts

Discovery

Live

Example Request

Every X (Twitter) endpoint is called this way: its path, and what to read as query parameters.

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": []
    }
  }
}

Errors

A call that fails costs nothing. See Errors for every code.