xdataapi.io

SDKs

Typed clients for TypeScript and Python.

Both clients are generated from the API's OpenAPI document, so they carry every endpoint, parameter and response type, and they update with the API. They are thin: one HTTP call per method, no retries or state, the same credits_charged and balance_remaining fields as the raw API.

TypeScript

npm install xdataapi
import { xdataapi } from 'xdataapi';

const api = xdataapi({ apiKey: process.env.XDATAAPI_KEY! });

const { data: profile } = await api.getUser({ path: { handle: 'x' } });
console.log(profile?.data?.followers, profile?.credits_charged);

const { data: page } = await api.searchTweets({ query: { q: 'from:x since:2026-09-01', count: 20 } });
for (const t of page?.data ?? []) console.log(t.id, t.text);

Every call returns { data, error, response }. Node 18+, Bun, Deno, browsers, edge runtimes.

Python

pip install xdataapi
from xdataapi import AuthenticatedClient
from xdataapi.api.users import get_user
from xdataapi.api.tweets import search_tweets

client = AuthenticatedClient(base_url="https://api.xdataapi.io", token=KEY, prefix="", auth_header_name="x-api-key")

profile = get_user.sync(client=client, handle="x")
print(profile.data.followers, profile.credits_charged)

page = search_tweets.sync(client=client, q="from:x since:2026-09-01", count=20)
for t in page.data:
    print(t.id, t.text)

Every operation has sync, sync_detailed, asyncio and asyncio_detailed forms.

Methods

MethodEndpoint
getMe / get_meGET /v1/me
getUser / get_userGET /v1/users/{handle}
getUsers / get_usersPOST /v1/users/batch
getUserTweets / get_user_tweetsGET /v1/users/{user}/tweets
getFollowers / get_followersGET /v1/users/{user}/followers
getFollowerIds / get_follower_idsGET /v1/users/{user}/followers/ids
getFollowing / get_followingGET /v1/users/{user}/following
searchTweets / search_tweetsGET /v1/tweets/search
getTweet / get_tweetGET /v1/tweets/{id}
getTweets / get_tweetsPOST /v1/tweets/batch
getThread / get_threadGET /v1/tweets/{id}/thread
getReplies / get_repliesGET /v1/tweets/{id}/replies
getQuotes / get_quotesGET /v1/tweets/{id}/quotes
getRetweeters / get_retweetersGET /v1/tweets/{id}/retweeters
listPacks, createCheckoutbilling

Other languages: the OpenAPI document works with any generator, and the MCP server covers agents without code.

On this page