X/Twitter SDKs & CLI
Install TwexAPI SDKs and CLI tools for tweet search, follower exports, MCP handoff, and public X data reads.
Official TwexAPI SDKs wrap the REST API with generated request types, response models, retries, pagination helpers, and consistent Bearer authentication. Use this page to choose the right SDK, CLI, or MCP handoff for tweet search, follower scraping, and agent workflows.
TypeScript / Node.js
Use typed REST calls for Node.js, Bun, Next.js route handlers, and tweet search.
Python
Build sync or async jobs for tweet search, follower exports, and scheduled REST automation.
Go
Add tweet search and follower workers to Go services with context-aware calls.
Java
Use Maven or Gradle to add the Java SDK to Spring, worker, and JVM backend applications.
Kotlin
Use idiomatic Kotlin types, nullable values, and suspend-friendly client methods.
C# / .NET
Install from NuGet for .NET services and worker applications.
Ruby
Use the Ruby gem with typed request objects, retries, and connection pooling.
PHP
Add the Composer package to PHP 8.1+ applications with named parameters and typed exceptions.
CLI
Run terminal workflows for tweet search, JSON output, and scripted API calls.
Terraform provider
Use data sources for profile and tweet reads with an API key.
Choose an SDK
TypeScript / Node.js
Install with npm install @twexapi-dev/x-api-scraper; source:
twexapi-dev/x-api-scraper-typescript.
Open the TypeScript SDK guide.
Python
Install with pip install x_api_scraper; source:
twexapi-dev/x-api-scraper-python.
Open the Python SDK guide.
Go
Install with go get github.com/twexapi-dev/x-api-scraper-go; source:
twexapi-dev/x-api-scraper-go.
Open the Go SDK guide.
Java
Maven Central publication is pending. Build from source at twexapi-dev/x-api-scraper-java. Open the Java SDK guide.
Kotlin
Maven Central publication is pending. Build from source at twexapi-dev/x-api-scraper-kotlin. Open the Kotlin SDK guide.
C# / .NET
Install with dotnet add package XapiScraper; source:
twexapi-dev/x-api-scraper-csharp.
Open the C# SDK guide.
Ruby
Install with gem "x_api_scraper"; source:
twexapi-dev/x-api-scraper-ruby.
Open the Ruby SDK guide.
PHP
Install with composer require twexapi/x-api-scraper; source:
twexapi-dev/x-api-scraper-php.
Open the PHP SDK guide.
CLI
Install with
npm install -g @twexapi-dev/x-api-scraper-cli; source:
twexapi-dev/x-api-scraper-cli.
Open the CLI guide.
Terraform provider
Install twexapi-dev/x-api-scraper from the Terraform Registry when published.
Open the Terraform guide.
Choose by job
Tweet search exports
Start with TypeScript, Python,
Go, or CLI plus
Advanced Twitter Search. Hand off
tweet rows, has_next_page, next_cursor, and JSON Lines files for downstream CSV or XLSX.
Follower & following lists
Start with TypeScript, Python, Go, or
CLI. Call v3 follower and following endpoints, paginate with cursors, and store
username, user_id, and next_cursor for resumable exports.
Global trending tweets
Start with Get Global Trending Tweets through TypeScript, Python, or CLI. Filter by country, topic, and content tag.
Agent handoff
Use the MCP Server for tool calls, or SDKs for direct code. Return JSON objects with the endpoint path, request parameters, result fields, pagination cursor, and credit balance.
Authentication
All SDKs accept the same API credentials as the REST API:
export X_API_SCRAPER_KEY="YOUR_API_KEY"
Bearer tokens are supported where the generated SDK exposes bearerAuth or bearer_auth. See Authentication for REST header details.
Common workflows
- Search tweets through Advanced Twitter Search. Keep JSON Lines or language-specific export files as the downstream handoff.
- Inspect threads through Get Tweet Thread by ID and reply pages.
- Look up profiles and relationships through Get Twitter User About, Get Followers (v3), and Get Following (v3).
- Connect agents through the MCP Server when you need tool use instead of direct SDK calls.
Error handling & pagination
Generated SDKs map HTTP errors into language-native exception or error types. Check each language page for idiomatic handling patterns.
Paginated endpoints return a page object with a next-page marker such as has_next_page, hasNextPage, or HasNextPage depending on language casing. Use the SDK’s generated pagination helpers when available, or pass the cursor fields documented on each endpoint.
See Error Handling and Rate Limits for retry and backoff patterns.