Tweet Data
Retrieve specific tweet information, content, and engagement metrics by tweet ID or search for tweets based on criteria.Get Tweet by ID
HTTP Request
Path Parameters
tweet_id
- Type: String
- Description: Unique tweet identifier
- Example:
1234567890123456789
Query Parameters
fields
- Type: String
- Description: Comma-separated list of fields to include
- Options:
id,text,created_at,author_id,public_metrics,entities,attachments,geo,context_annotations - Default: All fields
- Example:
?fields=id,text,public_metrics
include_user
- Type: Boolean
- Description: Include author information in response
- Default:
false - Example:
?include_user=true
Search Tweets
HTTP Request
Query Parameters
query
- Type: String
- Description: Search query string
- Example:
?query=javascript programming
max_results
- Type: Integer
- Description: Maximum number of results to return
- Default: 10
- Maximum: 100
- Example:
?max_results=50
sort_order
- Type: String
- Description: Sort order for results
- Options:
relevance,recent - Default:
relevance - Example:
?sort_order=recent
lang
- Type: String
- Description: Language code for results
- Example:
?lang=en
since_id
- Type: String
- Description: Return tweets newer than this tweet ID
- Example:
?since_id=1234567890123456789
until_id
- Type: String
- Description: Return tweets older than this tweet ID
- Example:
?until_id=1234567890123456789
Response Format
Get Tweet Response (200 OK)
Search Response (200 OK)
Error Response (404 Not Found)
Implementation Examples
JavaScript (Node.js)
Python
cURL
Advanced Search
Complex Search Queries
Hashtag Analysis
Error Handling
Rate Limit Handling
Best Practices
For Efficient Queries
- Specific Fields: Request only the fields you need
- Pagination: Use pagination for large result sets
- Caching: Cache frequently accessed tweets
- Batch Processing: Process multiple tweets together
For Search Optimization
- Specific Queries: Use specific search terms
- Language Filtering: Filter by language when possible
- Time Constraints: Use time-based constraints for recent data
- Result Limits: Limit results to reduce data transfer
For Data Management
- Data Validation: Validate tweet data before processing
- Error Handling: Handle tweet not found and rate limit errors
- Storage Planning: Plan appropriate storage for tweet data
- Privacy Compliance: Respect user privacy and content rights
This completes the REST API Reference documentation. For streaming capabilities, see the Streams documentation.