Docs menu: Search

Search

Search public posts and accounts with X's query syntax, or read the posts behind a trend.

Endpoints

EndpointReturns and price
GET /v1/search
Search posts
Page of posts
· $0.20 per 1,000 results
GET /v1/search/users
Search accounts
Page of accounts
· $0.20 per 1,000 results
GET /v1/search/trend
Search a trend
Page of posts
· $0.20 per 1,000 results

All routes take Authorization: Bearer $TWITTERXAPI_KEY and level. Collections return one page; continue with the cursor.

Write the query

  • q takes X search syntax, for example from:marclou since:2026-01-01 until:2026-02-01.
  • URL-encode the whole query with curl -G --data-urlencode or URLSearchParams, and keep it unchanged while following the cursor.

Preview an account and date range

GET/v1/searchPage of posts

Search posts

One page of public posts matching an X search query. POST /v1/search accepts the same values as a JSON body (query, cursor, level) for long queries.

ParameterInDescription
q required
string
queryX search query, 1–500 characters. URL-encode the whole value.
cursor
string
queryValue of pagination.next_cursor from the previous page. Omit for the first page.
level
raw | moderate | contentful
queryResponse level. Defaults to moderate.

Returns: Page of posts · Price: $0.20 per 1,000 results

cURL
curl -G "https://twitterxapi.com/api/v1/search" \
  -H "Authorization: Bearer $TWITTERXAPI_KEY" \
  --data-urlencode "q=from:marclou since:2026-01-01 until:2026-02-01"
GET/v1/search/usersPage of accounts

Search accounts

One page of accounts matching a name, username or query text.

ParameterInDescription
q required
string
queryX search query, 1–500 characters. URL-encode the whole value.
cursor
string
queryValue of pagination.next_cursor from the previous page. Omit for the first page.
level
raw | moderate | contentful
queryResponse level. Defaults to moderate.

Returns: Page of accounts · Price: $0.20 per 1,000 results

cURL
curl -G "https://twitterxapi.com/api/v1/search/users" \
  -H "Authorization: Bearer $TWITTERXAPI_KEY" \
  --data-urlencode "q=indie hackers"
GET/v1/search/trendPage of posts

Search a trend

The search X runs when someone opens a trend. Pass the trend's name as q.

ParameterInDescription
q required
string
queryX search query, 1–500 characters. URL-encode the whole value.
cursor
string
queryValue of pagination.next_cursor from the previous page. Omit for the first page.
level
raw | moderate | contentful
queryResponse level. Defaults to moderate.

Returns: Page of posts · Price: $0.20 per 1,000 results

cURL
curl -G "https://twitterxapi.com/api/v1/search/trend" \
  -H "Authorization: Bearer $TWITTERXAPI_KEY" \
  --data-urlencode "q=#AI"