Skip to main content
The TypeScript XDK is the official client library for the X API v2. Full type safety, automatic pagination, and event-driven streaming.

GitHub repository

Source code, issues, and releases.

Installation

Requires Node.js 16+ and TypeScript 4.5+ (if using TypeScript).

Quick start


Key features

FeatureDescription
Type safetyComplete TypeScript definitions for all endpoints and parameters
AuthenticationBearer Token, OAuth 2.0 with PKCE, and OAuth 1.0a
Automatic paginationAsync iteration support for paginated endpoints
StreamingEvent-driven streaming with automatic reconnection
Full API coverageUsers, Posts, Lists, Bookmarks, Communities, and more

Authentication


Common methods

CategoryMethod
Postsclient.posts.search()
Usersclient.users.getMe()
Spacesclient.spaces.findSpaceById()
Listsclient.lists.getList()
DMsclient.directMessages.lookup()

Learn more

Installation

Package managers, TypeScript setup, and requirements.

Authentication

Detailed guide for all auth methods.

Pagination

Async iteration and paginated responses.

Streaming

Event-driven streaming with reconnection.

API Reference

Complete client, interface, and type reference.
For code examples, see the samples repo.