TweetAPI Documentation

Access comprehensive X/Twitter data through our developer-friendly REST API.

Base URL

All API requests should be made to:

https://api.tweetapi.com/tw-v2/

Authentication

Include your API key in the X-API-Key header:

headers: {
  'X-API-Key': 'YOUR_API_KEY'
}

Key Features

  • Rich Data Access: Comprehensive user profiles, tweets, followers, and engagement metrics
  • Interaction Capabilities: Post tweets, manage likes, retweets, bookmarks, and direct messages
  • Advanced Search: Search tweets, users, and media with powerful filtering options
  • Real-time Data: Get up-to-date metrics and engagement counts
  • Efficient Pagination: Cursor-based pagination for seamless data retrieval
  • Media Support: Full support for images, videos, and GIFs

Available Endpoints

User Endpoints

  • Get user by username
  • Get user by ID
  • Get multiple users by IDs
  • Followers and following lists
  • User tweets and replies
  • Subscription information

Tweet Endpoints

  • Tweet details and conversation threads
  • Quote tweets and retweets
  • Tweet translation
  • Engagement metrics

Interaction Endpoints

  • Create, reply, and delete posts
  • Like and bookmark tweets
  • Retweet and quote tweet
  • List management

List & Community Endpoints

  • List details and members
  • Community information
  • Timeline tweets

Search Endpoints

  • Search tweets, users, and media
  • Advanced search operators
  • Filtering and sorting options

Rate Limits

The v2 API has the following rate limits:

  • Pro: 60 requests per minute
  • Ultra: 120 requests per minute
  • Mega: 180 requests per minute

Error Handling

TweetAPI uses standard HTTP status codes to indicate success or failure.

Common Error Codes

400s Errors

400BAD_REQUESTBad Request - Invalid parameters
401UNAUTHORIZEDUnauthorized - Invalid API key
404NOT_FOUNDNot Found - Resource doesn't exist
429RATE_LIMITToo Many Requests - Rate limit exceeded

500s Errors

500INTERNAL_ERRORInternal Server Error

Error Response Format

All errors follow a consistent format:

{
  "statusCode": 400,
  "message": "Invalid username parameter"
}

Best Practices

  1. Always check the response status code
  2. Log error responses for debugging
  3. Implement exponential backoff for retries
  4. Handle rate limits gracefully

Security Best Practices

  • Never share your API key publicly or commit it to version control
  • Rotate your keys regularly for enhanced security
  • Use environment variables to store API keys in your applications
  • Monitor usage through your dashboard to detect any unusual activity

Support

If you need help or have questions: