All endpoints
Twitter Posts

Twitter Posts API

Search Twitter/X posts by keyword. Returns the tweet content, author username, URL, and publication date for each result. Supports fetching multiple pages of results in a single API call.

Price: $0.006 per page
Free tier: 50 requests/month
Endpoint
GET /v1/twitter/posts

Parameters

query *
Search keyword (max 500 characters)
pages
Number of pages to fetch, 1-10 (default: 1)
sort_by
Sort order: most_recent or relevance (default: most_recent)

Response fields

posts
Array of matching tweets
title
Tweet title (format: @username on X)
url
Direct link to the tweet
date
Publication date and time
author
Twitter username
source
Platform name (Twitter (X))
snippet
Tweet content text
pages
Number of pages fetched
count
Total results returned

Example Request

curl "https://api.apidirect.io/v1/twitter/posts?query=AI&pages=2&sort_by=most_recent" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "posts": [
    {
      "title": "@username on X",
      "url": "https://twitter.com/username/status/...",
      "date": "2024-01-15 14:30:00",
      "author": "username",
      "source": "Twitter (X)",
      "snippet": "Tweet content here..."
    }
  ],
  "pages": 2,
  "count": 40
}

Frequently asked questions

How recent is the data?

The posts are sourced in real-time from Twitter's public search engine, so you can access tweets from the last few years up to the last few seconds.

Does the Twitter Search API include comments and replies?

Yes, the API includes posts, comments and replies.

How does pricing work?

You only pay for successful requests. The Twitter Posts API costs $0.006 per page. There are no monthly fees or commitments. You get 50 free requests per endpoint every month.

Do I need a credit card to start?

No. You can sign up and use the free tier (50 requests/endpoint/month) without adding a payment method. You only need to add a card when you want to exceed the free tier.

Are there rate limits?

Yes, there's a concurrency limit of 3 simultaneous requests per endpoint per user. If you need more, just get in touch.

Start using the Twitter Posts API

Get your API key and start making requests in minutes. 50 requests/month free every month.

Get API Key