READ API LIVEBuild on /v1 for search, profiles, timelines, audience graph, and tweet context.READ DOCS

Compatibility

Migrate common official X API reads with familiar paths.

/2 is the focused compatibility layer for existing read integrations. It keeps official-style paths, query names, and response envelopes for the users, tweets, search, and lists surface xfetch can honor accurately. It does not cover writes, media, streaming, trends, or communities. New integrations should start at /v1 for workflow APIs, enriched reads, trend and community reads, and credits in meta.credits.

What /2 covers

xfetch /2 exposes 14 official-style read endpoints across users, tweets, search, and lists. Each maps 1:1 to a /v1 Basic Reads endpoint; see the mapping table on the API reference for /v1 parameter detail. For trends, community discovery, and community timelines, use /v1.

Users

/2 pathCapability→ /v1
GET /2/users/by/username/:usernameUser by usernameGET /v1/users/by-username/:username
GET /2/users/:idUser by idGET /v1/users/:id
GET /2/users?ids=...Users by idsGET /v1/users?ids=...
GET /2/users/:id/tweetsUser tweetsGET /v1/users/:id/tweets
GET /2/users/:id/followersFollowersGET /v1/users/:id/followers?mode=ids
GET /2/users/:id/followingFollowingGET /v1/users/:id/following?mode=ids

Tweets

/2 pathCapability→ /v1
GET /2/tweets/:idTweet by idGET /v1/tweets/:id
GET /2/tweets?ids=...Tweets by idsGET /v1/tweets?ids=...
GET /2/tweets/:id/quote_tweetsQuote tweetsGET /v1/tweets/:id/quotes
GET /2/tweets/:id/retweeted_byRetweetersGET /v1/tweets/:id/retweeters
/2 pathCapability→ /v1
GET /2/tweets/search/recentRecent searchGET /v1/search/recent

Lists

/2 pathCapability→ /v1
GET /2/lists/:id/tweetsList tweetsGET /v1/lists/:id/tweets
GET /2/lists/:id/membersList membersGET /v1/lists/:id/members
GET /2/lists/:id/followersList subscribers/followersGET /v1/lists/:id/subscribers

What /2 does not cover

The official X API surface is larger than xfetch /2. The items below are deliberately not exposed in this compatibility layer.

CapabilityStatus under /2
Trends and communitiesNot exposed under /2. Use /v1/trends, /v1/communities/search, or /v1/communities/:id.
Media/2 does not expose tweet media. A media-bearing tweet still returns text, metrics, entities, and URLs but no attachments.media_keys or includes.media. Use /v1 media reads when attachments matter.
Broad expansionsOnly expansions=author_id is honored, and only on tweet-returning endpoints. Other expansions, media.fields, place.fields, and poll.fields are not advertised as compatible.
WritesPosting, liking, reposting, following, and DMs are not exposed.
Authenticated-user endpointsEndpoints based on the caller's identity (such as /2/users/me) are not implemented.
Official streaming APIsFiltered stream, sampled stream, and replay are not supported under /2. Dashboard-configured account monitor webhooks are separate from this compatibility layer.
Compliance and account-activity APIsNot exposed.
Full edit historyedit_history_tweet_ids returns only the current version id; the historical chain is not exposed.

Need richer joins, trends, communities, or media-bearing reads? See /v1 workflows and read endpoints. Writes remain outside the launch product.

How /2 behaves differently

Even where /2 keeps official-style paths, behavior is intentionally narrower than the full official API. Plan for these differences before migrating.

AspectHow /2 does it
Credit metadata locationResponse headers x-request-id, x-credits-charged, and x-credits-remaining. /v1 instead returns credits in meta.credits.
PaginationRequests accept opaque pagination_token or next_token; responses return meta.next_token. Tokens are opaque and must not be parsed or constructed by clients.
max_resultsSupported on paginated /2 collection endpoints using endpoint-specific official-style ranges. xfetch returns at most that many primary items from the provider page and charges only for returned items.
expansions=author_idHonored on tweet endpoints when the same response contains author objects. includes.users is built from those embedded authors; xfetch does not make extra fetches or fabricate missing authors. Non-tweet endpoints reject the parameter instead of accepting a no-op.
tweet.fields / user.fieldsHonored over the official-shaped tweet and user objects xfetch returns. Unselected fields are omitted; required base fields such as id stay present.
edit_history_tweet_idsReturned as [current_id] only. Full edit history is not exposed.
MediaNot exposed under /2. A media-bearing tweet still returns text, metrics, entities, and URLs but no attachments.media_keys or includes.media.
ErrorsPublic error envelope with stable codes: invalid_request, invalid_api_key / revoked_api_key, insufficient_credits, endpoint_not_found, rate_limited, internal_error, service_unavailable. No upstream provider names or raw error strings. Batch user/tweet lookups return successful data plus an official-style errors array when some requested IDs are not returned.

Migration examples

Three examples cover single-object reads, paginated collections, and the supported expansion. The response body stays official-style; request IDs and credit details are returned in headers. All samples use $XFETCH_API_KEY as the bearer token placeholder so they are safe to screen-share.

A · Tweet by ID

GET /2/tweets/2055734812669865997
Authorization: Bearer $XFETCH_API_KEY
{
  "data": {
    "id": "2055734812669865997",
    "text": "hello world",
    "edit_history_tweet_ids": ["2055734812669865997"],
    "author_id": "44196397",
    "created_at": "2024-01-15T18:30:00.000Z",
    "lang": "en",
    "public_metrics": {
      "retweet_count": 12,
      "reply_count": 3,
      "like_count": 88,
      "quote_count": 1,
      "bookmark_count": 5
    },
    "entities": { "hashtags": [], "urls": [], "mentions": [] }
  }
}

C · expansions=author_id

GET /2/tweets/2055734812669865997?expansions=author_id
Authorization: Bearer $XFETCH_API_KEY
{
  "data": {
    "id": "2055734812669865997",
    "text": "hello world",
    "author_id": "44196397"
  },
  "includes": {
    "users": [
      {
        "id": "44196397",
        "name": "Example",
        "username": "example",
        "public_metrics": {
          "followers_count": 1000,
          "following_count": 200,
          "tweet_count": 5000
        }
      }
    ]
  }
}

includes.users is populated only from author objects already present in the same response. Non-tweet endpoints reject the parameter; if a tweet response does not carry an author object, xfetch does not fabricate one.

Try it with your own key.

Sign in with Google to mint a key and call /2 against your own credits. Free signups receive 1,000 credits; failed validation, auth failures, insufficient credits, rate limits, and service-side failures are not charged.