Twitter Search API: Search Tweets by Keyword, User and Date

The Twitter (X) search API is a pair of endpoints that return posts matching a query: recent search covers the last 7 days, and full-archive search reaches back to March 2006.

Cover card reading 'Twitter Search API: Search Tweets by Keyword, User and Date'

The Twitter (X) search API is a pair of endpoints that return posts matching a query: recent search covers the last 7 days, and full-archive search reaches back to March 2006. Both charge $0.005 per post read on pay-per-use plans. A scraper API such as apidojo’s Tweet Scraper V2 covers the same history for $0.40 per 1,000 tweets.

This guide explains both X endpoints, their query operators, limits and costs, then shows how to run the same searches through apidojo’s actors on Apify.

What Are the X API Search Endpoints?

The X API has two search endpoints: GET /2/tweets/search/recent for the last 7 days and GET /2/tweets/search/all for the full archive. Recent search is available to all developers; full-archive search is available to pay-per-use and Enterprise customers (X API docs).

Endpoint Time range Posts per request Query length Access
/2/tweets/search/recent Last 7 days Up to 100 512 characters (4,096 Enterprise) All developers
/2/tweets/search/all Back to March 2006 Up to 500 1,024 characters (4,096 Enterprise) Pay-per-use, Enterprise

Full-archive search returns the last 30 days by default; set start_time and end_time to reach older posts (X API quickstart). The 7-day window is explained in the recent search API 7-day limit, and archive retrieval in how to get historical tweets with an API.

How Much Does the X Search API Cost?

The X search API costs $0.005 for each post returned, billed per resource, with a cap of 3 million post reads per monthly billing cycle on pay-per-use plans. Requests for the same post within one 24-hour UTC window are charged once, and higher volumes require an Enterprise plan (X API pricing).

Posts read X API cost at $0.005 each Tweet Scraper V2 at $0.40 per 1,000
10,000 $50 $4
100,000 $500 $40
1,000,000 $5,000 $400
3,000,000 (X monthly cap) $15,000 $1,200

One recent search call that returns 100 posts costs $0.50. Credits are prepaid in the Developer Console, where you can also set a spending limit per billing cycle.

How Do You Build an X API Search Query?

You build an X API search query from keywords and operators joined by spaces, where a space means AND, OR means either, and - negates. The API’s operators differ from X web search; for example, the API uses -is:retweet where the web uses -filter:retweets (X API docs).

(AI OR "artificial intelligence") lang:en -is:retweet has:links
Goal X API operator X web search operator
Posts by an account from:NASA from:NASA
Exclude reposts -is:retweet -filter:retweets
Only replies is:reply filter:replies
Posts with links has:links filter:links
Posts with media has:media filter:media
Verified authors is:verified filter:verified
One thread conversation_id:ID conversation_id:ID
Date range start_time, end_time parameters since:, until:

The web operators, which apidojo’s actors use, are listed in the Twitter advanced search operators reference.

How Do You Call the X Search API?

You call the X search API with an HTTP GET request that carries your query and an app bearer token. A recent search for NASA’s original posts:

curl "https://api.x.com/2/tweets/search/recent?query=from%3ANASA%20-is%3Aretweet&max_results=100" \
  -H "Authorization: Bearer $BEARER_TOKEN"

The response returns up to 100 posts and a next_token for the next page. Before the first call you need a developer account, a Project and App in the Developer Console, and your app’s keys and tokens (X API docs).

How Do You Search Tweets Through apidojo’s API?

You search tweets through apidojo’s API by running Tweet Scraper V2 on Apify with your X web search query in searchTerms, and reading the results from the run’s dataset. The query uses web operators, so since: and until: set the dates (Apify).

curl -X POST "https://api.apify.com/v2/acts/apidojo~tweet-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchTerms": ["from:NASA since:2015-01-01 until:2016-01-01 -filter:retweets"], "sort": "Latest", "maxItems": 500}'

The call waits for the run and returns the posts as JSON, each with id, url, text, createdAt, engagement counts and an author object. Tweet Scraper V2 needs at least 50 tweets per query and a paid Apify plan for API use; small queries, single posts and threads go to Twitter Scraper Unlimited.

The X API suits apps that must use X’s official data contract; Tweet Scraper V2 suits research and data collection where cost and archive depth matter more. The table compares them on 5 points.

Point X API search Tweet Scraper V2
Price $0.005 per post $0.40 per 1,000 tweets
History 7 days, or full archive on pay-per-use Same history as X web search, back to 2006
Monthly volume 3 million post reads cap No monthly cap; 1 concurrent run
Operators API operator set X web search operators
Setup Developer account, app, bearer token Apify account and token

The full decision guide is X API vs Twitter scraper API, and fetching one post by its ID is covered in how to get tweet data by ID with an API.

Questions people ask

Is the Twitter search API free?

No, new developers pay per use: $0.005 per post read, from prepaid credits (X API pricing).

Can the Twitter search API return tweets older than 7 days?

Yes, through full-archive search on pay-per-use or Enterprise access. Recent search stops at 7 days.

Does the X API support min_faves?

No, min_faves: is an X web search operator. apidojo's actors accept it because they run web search queries.

Where do you start building?

Start with how to scrape Twitter data in 2026 for the actor choice, or the apidojo Twitter Scraper page.