Search

Search tweets

Search tweets or people with the same query syntax as the X search box.

This is the Search tab of X. The query supports X search operators, and the optional filters object adds operators for you. Results come one page at a time.

Also answers on: POST /search (same handler; the request body is ignored, parameters go in the query string); GET /search/{searchItem} (query as a URL-encoded path segment instead of ?searchItem); POST /search/{searchItem}; GET /search_v2 (same, but skips the control-character check); POST /search_v2.

Paginated: pass the bottom cursor of one page as cursor to get the next. Each page is one billed call.

An empty page from X is retried automatically, up to 9 times. You are billed once.

Mutually exclusive filter pairs (for example removeReplies and onlyReplies) return 422 when both are true.

Reference: https://www.twittrapi.com/docs/reference/search

get/search

Request

  • Base URL: https://api.twittrapi.com
  • URL: https://api.twittrapi.com/search
  • Auth: API key in header X-API-KEY

Query parameters

searchItemstring required

Search query, e.g. from:jack lang:en. Required unless filters is set. query is accepted as an alias. When the query contains operators, + is read as a space. Query plus filters may be at most 512 characters.

category'Top' | 'Latest' | 'People' | 'Photos' | 'Videos'

Search tab: Top, Latest, People, Photos or Videos. Any other value is treated as Top.

countinteger

Number of results to ask X for. Sent to X as is; X treats it as a hint and decides how many it returns (follower and following pages often hold 50 to 70 users for count=20). A value that is not a number falls back to 20.

cursorstring

Bottom cursor from the previous page. Leave it out for the first page. See Pagination.

filtersstring

Extra conditions as JSON, e.g. {"lang":"en","minimumLikesCount":100}. Each key becomes an operator that is appended to the query. Keys are listed below.

format'raw' | 'simple'

raw (default): X's JSON passed through. simple: flat camelCase JSON with a fixed schema and a {data, nextCursor, previousCursor, hasNextPage} envelope. Same price. The header X-Response-Format: simple does the same.

Response

Not the raw GraphQL object: {"category": "<tab>", "entries": [...]}, where entries is the instructions array of X's SearchTimeline (data.search_by_raw_query.search_timeline.timeline.instructions). Tweets and users are inside TimelineAddEntries; the bottom cursor is an entry with cursorType "Bottom".

With format=simple: Collection of Tweet objects: {data: [Tweet], nextCursor, previousCursor, hasNextPage}. With category=People: User objects.

OR
OR
RawPassthrough required

X's own JSON (raw format, the default), passed through unchanged. The shape is X's and can change; see https://www.twittrapi.com/docs/response-format.

Changes

No recorded changes to this operation across all 1 revision of this API.