TweetHub API Documentation

Welcome to the TweetHub API. This documentation will help you get up and running with our fastest and most affordable Twitter/X data API.

Authentication

All requests to the TweetHub API require authentication using an API key. Include your API key in the request headers.

curl -H "x-api-key: your_api_key_here" \ https://api.TweetHub.io/twitter/user/info?userName=twitterdev

Get User Info

Retrieve detailed information about a Twitter user by username or ID.

Request

GET /twitter/user/info?userName=elonmusk

Response

{ "id": "44196397", "name": "Elon Musk", "userName": "elonmusk", "description": "CEO of Tesla, SpaceX, Neuralink, Boring Co", "followers": 156234567, "following": 123, "tweets": 45678, "verified": true, "createdAt": "2009-06-17T23:57:11.000Z" }

Parameters

userName
string
The Twitter username
id
string
The Twitter user ID

Post Tweet

Post a new tweet to a Twitter account. Requires user authentication.

Request

POST /twitter/tweet/create Content-Type: application/json x-api-key: your_api_key { "text": "Hello from TweetHub API!", "login_cookie": "your_login_cookie" }

WebSocket Real-time Streaming

Connect to real-time tweet streams using WebSocket.

const socket = new WebSocket('wss://stream.TweetHub.io/v1/tweets/filter'); socket.onopen = () => { socket.send(JSON.stringify({ track: ["AI", "machine learning"], follow: ["44196397"], api_key: "your_api_key" })); }; socket.onmessage = (event) => { const tweet = JSON.parse(event.data); console.log('New tweet:', tweet); };

Rate Limits

Rate limits vary based on your account balance and plan.

Account BalanceQPS LimitMonthly Requests
Free ($0.10)0.21,000
>= $10310M
>= $501050M
>= $10020100M