Advanced Search option
Priority Search for Twitter Advanced Search
Priority Search is an optional mode of the Twitter (X) Advanced Search API. Add priority=true to a search and it runs through a separate, higher-capacity lane with its own reserved capacity, for workloads where search results can't wait. Same endpoint, same query syntax, same response.
At a glance
- Price: $0.40 per 1,000 tweets returned, with a $0.0020 minimum per call.
- Credits: purchased (top-up) credits only. Free, sign-up, promo and referral credits don't apply.
- How to turn it on:
priority=trueon/twitter/tweet/advanced_search, or call/twitter/tweet/advanced_search_priority. - Rate: 1 priority request a second per account. Extra calls are never rejected; they run as normal search at the normal price.
- Normal Advanced Search is unchanged at $0.15 per 1,000 tweets.
When to use it
Normal Advanced Search fits the bulk of search work: research pulls, backfills, dashboards that refresh every few minutes. Priority Search is the premium option for the searches where a delay costs you something:
- Alerting on a brand, ticker or incident keyword, where a late result is a missed alert.
- Customer-facing features that run a search while a user waits on the page.
- Agents and scheduled jobs that need a result inside a fixed time budget during busy periods.
A common pattern is to send only the time-sensitive queries with priority=true and leave the rest on normal search, so you pay the priority price only where it matters to you.
How to call it
There is no new endpoint to learn. Use the Advanced Search endpoint with one extra parameter, or the alias path /twitter/tweet/advanced_search_priority, which takes the same parameters with priority implied. Authenticate with the X-API-Key header from your dashboard, as for any other endpoint.
curl -G "https://api.twitterapi.io/twitter/tweet/advanced_search" \
-H "X-API-Key: $TWITTERAPI_KEY" \
--data-urlencode 'query="product launch" lang:en' \
-d queryType=Latest \
-d priority=true \
-D - -o page1.json # -D - prints the headers, including X-Search-PriorityIn Python, read the X-Search-Priority header on each page and follow next_cursor. Pages after the first stay in the priority lane without repeating the parameter.
import os, requests
URL = "https://api.twitterapi.io/twitter/tweet/advanced_search"
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_KEY"]}
def priority_search(query, pages=3):
params = {"query": query, "queryType": "Latest", "priority": "true"}
for _ in range(pages):
r = requests.get(URL, headers=HEADERS, params=params, timeout=30)
r.raise_for_status()
mode = r.headers.get("X-Search-Priority") # applied / over_qps / paid_credits_required / off
data = r.json()
yield mode, data["tweets"]
if not data.get("has_next_page"):
break
# later pages stay in the priority lane; only the cursor is needed
params = {"query": query, "queryType": "Latest", "cursor": data["next_cursor"]}
for mode, tweets in priority_search('"product launch" lang:en'):
print(mode, len(tweets))Price, with worked examples
Each priority call costs 40 credits per tweet returned or 200 credits, whichever is larger. 100,000 credits are $1, so that is $0.40 per 1,000 tweets with a $0.0020 minimum per call, including calls that return 0 tweets. A full page of 20 tweets costs 800 credits ($0.0080); a page with 3 tweets costs the 200-credit minimum ($0.0020).
| Tweets on the page | Priority credits | Priority cost | Normal search cost |
|---|---|---|---|
| 20 (a full page) | 800 | $0.0080 | $0.0030 |
| 3 | 200 | $0.0020 | $0.00045 |
| 0 | 200 | $0.0020 | $0.00015 |
Calls that fail with a 5xx error are not charged. When a call falls back to normal search (see the header table below), it is billed at the normal price. Every other endpoint price is on the pricing page.
The X-Search-Priority response header
The response body is identical to normal Advanced Search (tweets, has_next_page, next_cursor). Every priority request returns an X-Search-Priority header that tells you how that call was served and billed:
| Value | What it means |
|---|---|
applied | Served through the priority lane and billed at the priority price. |
over_qps | You sent more than 1 priority request a second, so this call ran as normal Advanced Search at the normal price. |
paid_credits_required | Your purchased-credit balance was below 200 credits, so this call ran as normal Advanced Search at the normal price. |
off | The priority lane was briefly unavailable, so this call ran as normal Advanced Search at the normal price. |
Log this header if you need to reconcile billing: every value other than applied means the call was billed at the normal search price.
Rate limit
Priority requests are limited to 1 per second per account by default. Requests above that are not rejected; they run as normal Advanced Search at the normal price and return over_qps. Your overall account rate limit doesn't change; the per-plan numbers are on the QPS limits page.
FAQ
- Can I use free or bonus credits for Priority Search?
- No. Priority calls only draw on credits you bought with a top-up. Sign-up credit, promo credit and referral rewards don't apply. If your purchased balance is below 200 credits, the call still runs, as normal Advanced Search at the normal price, and the X-Search-Priority header says paid_credits_required.
- What happens if I send more than one priority request a second?
- Nothing is rejected. Priority is limited to 1 request a second per account by default; calls above that run as normal Advanced Search at the normal price, with the header over_qps. Your overall account rate limit is unchanged.
- Do I need to add priority=true to every page of results?
- No. Pass the cursor from the previous response as usual. Pages after the first stay in the priority lane automatically.
- Am I charged when a priority call fails?
- Calls that fail with a 5xx error are not charged. A successful call that returns no tweets is charged the minimum.
- Is the response different from normal Advanced Search?
- No. The body is the same: tweets, has_next_page and next_cursor. Only the X-Search-Priority response header is added.
Try it on your own queries
Top up from the dashboard, then add priority=true to the searches that need it. For query operators, see the Advanced Search API guide; for plain search basics, the Twitter search API guide.