11---
22title : Tools & Libraries
3- icon : toolbox
4- description : Official SDKs, community libraries, and developer tools for the X API
5- keywords : ["tools", "libraries", "SDK", "XDK", "client libraries", "Postman", "xurl", "developer tools", "API tools", "code libraries", "Python SDK", "TypeScript SDK"]
3+ sidebarTitle : Overview
4+ description : Official SDKs, developer tools, AI integrations, and community libraries for the X API
5+ keywords : ["tools", "libraries", "SDK", "XDK", "client libraries", "Postman", "xurl", "playground", "XMCP", " developer tools", "API tools", "code libraries", "Python SDK", "TypeScript SDK", "AI tools", "MCP "]
66---
77
88import { Button } from ' /snippets/button.mdx' ;
99
10- Speed up your development with official SDKs, community libraries , and developer tools .
10+ Speed up your development with official SDKs, developer tools , and community libraries .
1111
1212---
1313
1414## Official SDKs
1515
16- X provides official SDKs for TypeScript and Python with full X API v2 support.
17-
1816<CardGroup cols = { 2 } >
1917 <Card title = " Python SDK" icon = " python" href = " /xdks/python/overview" >
2018 Async support, type hints, and automatic token refresh. Perfect for data analysis and automation.
@@ -24,57 +22,36 @@ X provides official SDKs for TypeScript and Python with full X API v2 support.
2422 </Card >
2523</CardGroup >
2624
27- ### Why use the official SDKs?
28-
29- | Benefit | Description |
30- | :--------| :------------|
31- | ** Always up-to-date** | Maintained by X, updated with new endpoints |
32- | ** Type safety** | Full type definitions for all objects and methods |
33- | ** Built-in auth** | OAuth 2.0 and OAuth 1.0a support |
34- | ** Automatic pagination** | Iterate through results without manual token handling |
35-
3625### Quick start
3726
3827<Tabs >
3928 <Tab title = " Python" >
40- #### Installation
41-
4229``` bash
4330pip install xdk
4431```
4532
46- #### Basic usage
47-
4833``` python
4934from xdk import Client
5035
5136client = Client(bearer_token = " YOUR_BEARER_TOKEN" )
5237
53- # Search for posts (returns an iterator)
5438for page in client.posts.search_recent(query = " api" , max_results = 10 ):
5539 if page.data and len (page.data) > 0 :
56- first_post = page.data[0 ]
57- print (first_post.text)
40+ print (page.data[0 ].text)
5841 break
5942```
6043
6144<Button href = " /xdks/python/overview" >Full Python guide</Button >
6245 </Tab >
6346 <Tab title = " TypeScript" >
64- #### Installation
65-
6647``` bash
6748npm install @xdevplatform/xdk
6849```
6950
70- #### Basic usage
71-
7251``` typescript
7352import { Client } from ' @xdevplatform/xdk' ;
7453
7554const client = new Client ({ bearerToken: ' YOUR_BEARER_TOKEN' });
76-
77- // Look up a user
7855const userResponse = await client .users .getByUsername (' XDevelopers' );
7956console .log (userResponse .data ?.username );
8057```
@@ -83,140 +60,29 @@ console.log(userResponse.data?.username);
8360 </Tab >
8461</Tabs >
8562
86- ### Authentication
87-
88- Both SDKs support multiple authentication methods:
89-
90- <Tabs >
91- <Tab title = " Bearer Token (App-only)" >
92- Simplest option for reading public data.
93-
94- ** Python:**
95- ``` python
96- from xdk import Client
97-
98- client = Client(bearer_token = " YOUR_BEARER_TOKEN" )
99- ```
100-
101- ** TypeScript:**
102- ``` typescript
103- import { Client } from ' @xdevplatform/xdk' ;
104-
105- const client = new Client ({ bearerToken: ' YOUR_BEARER_TOKEN' });
106- ```
107- </Tab >
108- <Tab title = " OAuth 2.0 (User Context)" >
109- For actions on behalf of users (posting, following, etc.).
110-
111- ** Python:**
112- ``` python
113- from xdk import Client
114- from xdk.oauth2_auth import OAuth2PKCEAuth
115-
116- auth = OAuth2PKCEAuth(
117- client_id = " YOUR_CLIENT_ID" ,
118- redirect_uri = " YOUR_CALLBACK_URL" ,
119- scope = " tweet.read users.read offline.access"
120- )
121-
122- # Get authorization URL
123- auth_url = auth.get_authorization_url()
124-
125- # After user authorizes, exchange code for tokens
126- tokens = auth.fetch_token(authorization_response = callback_url)
127- client = Client(bearer_token = tokens[" access_token" ])
128- ```
129-
130- ** TypeScript:**
131- ``` typescript
132- import { Client , OAuth2 , generateCodeVerifier , generateCodeChallenge } from ' @xdevplatform/xdk' ;
133-
134- const oauth2 = new OAuth2 ({
135- clientId: ' YOUR_CLIENT_ID' ,
136- clientSecret: ' YOUR_CLIENT_SECRET' ,
137- redirectUri: ' https://your-app.com/callback' ,
138- scope: [' tweet.read' , ' users.read' , ' offline.access' ],
139- });
140-
141- const codeVerifier = generateCodeVerifier ();
142- const codeChallenge = await generateCodeChallenge (codeVerifier );
143- oauth2 .setPkceParameters (codeVerifier , codeChallenge );
144- const authUrl = await oauth2 .getAuthorizationUrl (' state' );
145-
146- // After authorization, exchange code
147- const tokens = await oauth2 .exchangeCode (authCode , codeVerifier );
148- const client = new Client ({ accessToken: tokens .access_token });
149- ```
150- </Tab >
151- <Tab title = " OAuth 1.0a (User Context)" >
152- For legacy applications or specific use cases.
153-
154- ** Python:**
155- ``` python
156- from xdk import Client
157- from xdk.oauth1_auth import OAuth1
158-
159- oauth1 = OAuth1(
160- api_key = " YOUR_API_KEY" ,
161- api_secret = " YOUR_API_SECRET" ,
162- access_token = " YOUR_ACCESS_TOKEN" ,
163- access_token_secret = " YOUR_ACCESS_TOKEN_SECRET"
164- )
165-
166- client = Client(auth = oauth1)
167- ```
168-
169- ** TypeScript:**
170- ``` typescript
171- import { Client , OAuth1 } from ' @xdevplatform/xdk' ;
172-
173- const oauth1 = new OAuth1 ({
174- apiKey: ' YOUR_API_KEY' ,
175- apiSecret: ' YOUR_API_SECRET' ,
176- accessToken: ' YOUR_ACCESS_TOKEN' ,
177- accessTokenSecret: ' YOUR_ACCESS_TOKEN_SECRET'
178- });
179-
180- const client = new Client ({ oauth1: oauth1 });
181- ```
182- </Tab >
183- </Tabs >
184-
185- ### Available methods
186-
187- The SDKs provide methods for all X API v2 endpoints:
63+ ---
18864
189- | Category | Python | TypeScript |
190- | :---------| :-------| :-----------|
191- | ** Posts** | ` client.posts.search_recent() ` | ` client.posts.search() ` |
192- | ** Users** | ` client.users.get_me() ` | ` client.users.getMe() ` |
193- | ** Spaces** | ` client.spaces.get() ` | ` client.spaces.findSpaceById() ` |
194- | ** Lists** | ` client.lists.get() ` | ` client.lists.getList() ` |
195- | ** DMs** | ` client.direct_messages.get() ` | ` client.directMessages.lookup() ` |
65+ ## Developer tools
19666
19767<CardGroup cols = { 2 } >
198- <Card title = " Python SDK Docs " icon = " book " href = " /xdks/python/overview " >
199- Complete Python documentation .
68+ <Card title = " Postman Collection " icon = " server " href = " https://www.postman.com/xapidevelopers/x-api-public-workspace/collection/34902927-2efc5689-99c6-4ab6-8091-996f35c2fd80 " >
69+ Interactive API testing for all v2 endpoints .
20070 </Card >
201- <Card title = " TypeScript SDK Docs " icon = " book " href = " /xdks/typescript/overview " >
202- Complete TypeScript documentation .
71+ <Card title = " xurl " icon = " terminal " href = " /tools/xurl " >
72+ curl-like CLI for the X API with built-in OAuth authentication. No manual token management .
20373 </Card >
204- <Card title = " Python GitHub " icon = " github " href = " https://github.com/xdevplatform/xdk-py " >
205- Source code and issues .
74+ <Card title = " API Playground " icon = " flask " href = " https://github.com/xdevplatform/playground " >
75+ Local mock server for testing X API v2 endpoints without using real credits .
20676 </Card >
207- <Card title = " TypeScript GitHub " icon = " github " href = " https://github.com/xdevplatform/twitter-api-typescript-sdk " >
208- Source code and issues .
77+ <Card title = " AI & LLM Resources " icon = " sparkles " href = " /tools/ai-docs " >
78+ XMCP, llms.txt, skill.md, docs MCP server, and resources for AI-powered development .
20979 </Card >
21080</CardGroup >
21181
212- ---
213-
214- ## Official tools
82+ ### Other tools
21583
21684| Tool | Description |
21785| :-----| :------------|
218- | [ Postman Collection] ( https://www.postman.com/xapidevelopers/x-api-public-workspace/collection/34902927-2efc5689-99c6-4ab6-8091-996f35c2fd80 ) | Interactive API testing for all v2 endpoints |
219- | [ xurl] ( https://github.com/xdevplatform/xurl ) | Command line tool for the X APIs that handles authentication for you |
22086| [ OpenAPI Spec] ( https://api.x.com/2/openapi.json ) | Machine-readable API specification |
22187| [ twitter-text] ( https://github.com/twitter/twitter-text ) | Parse and validate post text, count characters |
22288| [ Embed Generator] ( https://publish.x.com/# ) | Build embeddable posts, timelines, or buttons for your site |
@@ -225,7 +91,7 @@ The SDKs provide methods for all X API v2 endpoints:
22591
22692## Community libraries
22793
228- These community -maintained libraries support X API v2. Check each library's documentation for current API coverage.
94+ Community -maintained libraries with X API v2 support . Check each library's documentation for current coverage.
22995
23096<Tabs >
23197 <Tab title = " Python" >
@@ -289,35 +155,14 @@ Community libraries are not maintained by X. Check their repositories for suppor
289155
290156---
291157
292- ## X Ads API libraries
293-
294- For tools and libraries specific to the X Ads API, see the [ Ads API tools and libraries] ( /x-ads-api/tools-and-libraries ) page.
295-
296- ---
297-
298158## Code samples
299159
300- Find examples on GitHub:
301-
302- - [ X API v2 Sample Code] ( https://github.com/xdevplatform/Twitter-API-v2-sample-code ) - Examples in Python, JavaScript, Ruby, and more
303- - [ X Developer GitHub] ( https://github.com/xdevplatform ) - Official repos and tools
304- - [ Code Samples Repo] ( https://github.com/xdevplatform/samples ) - Examples using the official XDKs
305- - [ Glitch Examples] ( https://glitch.com/@twitter ) - Interactive, remixable apps
306- - [ Replit Examples] ( https://replit.com/@twitter ) - Browser-based coding
307-
308- ---
309-
310- ## Building a library?
311-
312- If you have built an X API library, share it with the community:
313-
314- 1 . Post in the [ Libraries and SDKs forum] ( https://devcommunity.x.com/c/libraries-and-sdks/63 )
315- 2 . We may add it to this page!
160+ - [ X API v2 Sample Code] ( https://github.com/xdevplatform/Twitter-API-v2-sample-code ) — Examples in Python, JavaScript, Ruby, and more
161+ - [ Code Samples Repo] ( https://github.com/xdevplatform/samples ) — Examples using the official XDKs
162+ - [ X Developer GitHub] ( https://github.com/xdevplatform ) — Official repos and tools
316163
317164---
318165
319- ## Getting help
166+ ## X Ads API libraries
320167
321- <Card title = " Developer Forum" icon = " comments" href = " https://devcommunity.x.com" >
322- Get help from the community.
323- </Card >
168+ For tools and libraries specific to the X Ads API, see the [ Ads API tools and libraries] ( /x-ads-api/tools-and-libraries ) page.
0 commit comments