Twitter Search API - Search Tweets by Keyword

Search X/Twitter by keyword

Search X by keyword, hashtag or phrase on one of its tabs, narrowed by author, date range, language, minimum engagement, media, replies and reposts if you like. Top, Latest, Media and Lists return tweets in tweets, each with its text, author and counts; People returns the matching accounts in profiles, with tweets empty.

POST /search Search
https://api.fetchlayer.dev/twitter/search
OpenAPI JSON

Headers

Authorization string required

Bearer token — your FetchLayer API key.

Parameters

query string optional

Search text: a keyword, hashtag or phrase. Required unless at least one filter below is given. A date limit typed into the text itself (until:2026-10-15) also returns posts from that day; the until parameter cuts off at 00:00 UTC.

product string optional

The tab to search: Top, Latest, People, Media or Lists. People returns accounts (profiles); the others return tweets. (default: Top)

count integer optional

Results per page, at most 20: a higher value still returns 20. Use nextCursor for more. (default: 25)

cursor string optional

A previous response’s nextCursor, with the same other parameters, for the next page.

maxItems integer optional

Collect up to this many results in one call (1-500), following the pages for you. Each page of results returned bills one credit, and the last page comes back whole, so itemCount can exceed maxItems by less than a page. A call stops early at the end of the list or after about 90 seconds; hasMore and nextCursor then continue it. Leave it out for one page, billed one credit. Works with cursor and count.

from string optional

Only posts by this handle (with or without @).

to string optional

Only replies to this handle.

mentioning string optional

Only posts mentioning this handle.

since string optional

Only posts from this moment on: a date YYYY-MM-DD (00:00 UTC that day) or an ISO 8601 time with a zone, e.g. 2026-10-01T12:00:00Z.

until string optional

Only posts before this moment (exclusive), in the same forms as since. Must be later than since.

sinceTime integer optional

Only posts from this Unix time (seconds) on.

untilTime integer optional

Only posts before this Unix time (seconds). Must be later than sinceTime.

lang string optional

Only posts in this language: a two-letter ISO 639-1 code, e.g. en.

minLikes integer optional

Only posts with at least this many likes. Counts can lag slightly behind the live post, so a result may show a little under the minimum.

minRetweets integer optional

Only posts with at least this many reposts. Counts can lag slightly behind the live post, so a result may show a little under the minimum.

minReplies integer optional

Only posts with at least this many replies. Counts can lag slightly behind the live post, so a result may show a little under the minimum.

hasMedia boolean optional

true: only posts with media; false: only posts without.

hasImages boolean optional

true: only posts with images; false: only posts without.

hasVideos boolean optional

true: only posts with video; false: only posts without.

hasLinks boolean optional

true: only posts with links; false: only posts without.

verifiedOnly boolean optional

true: only posts by verified accounts.

excludeReplies boolean optional

true: leave replies out.

excludeRetweets boolean optional

true: leave reposts out.

sinceId string optional

Only posts newer than this post id.

maxId string optional

Only posts up to and including this post id.

timeoutMs integer optional

Time limit for the whole request, in milliseconds (1000–120000; values outside are brought into that range). It can only shorten the time a request may take, which is about 90 seconds at most. With maxItems, a call that runs out returns the pages it has, billed for those, with hasMore and nextCursor; a call with nothing to return yet fails with a 503 you can retry. We answer at the latest about 2 seconds before timeoutMs runs out (15% of it, at least 0.75 s, for limits under 13 seconds), so you can set it to your own client’s timeout. Left out, the request takes the time it needs.

Response Fields

search

Search X/Twitter by keyword

scrapedAt string

ISO 8601 time the result was produced.

transport string

The data source: always the platform id, "twitter".

listingType string

Which list this is, e.g. twitter-user-tweets.

itemCount integer

Number of items returned on this page.

nextCursor string | null

Pass as cursor, with the same other parameters, for the next page; null when there is none.

hasMore boolean

Whether more results follow: repeat the call with cursor set to nextCursor while it is true. Always present on followers, following and verified-followers; on the other lists, present with maxItems.

pagesFetched integer

With maxItems: the pages of results in this response, one credit each. Absent without maxItems (one page, one credit).

note string

With maxItems, why the call stopped before maxItems (the end of the list, or the time or page limit of one call, in which case hasMore is true and nextCursor continues). On search, also present when nothing was found.

query string

The query text you sent; "" when you sent filters only.

effectiveQuery string

With filters: the search we ran, your query and filters combined. Absent without filters.

product string

The tab searched: Top, Latest, People, Media or Lists.

tweets object[]

The tweets found, on every tab but People; empty on People.

tweets[].id string | null

Tweet id, as a string (it does not fit a JavaScript number).

tweets[].conversationId string | null

Id of the thread’s first tweet.

tweets[].createdAt string | null

When it was posted, as X writes it: "Fri Oct 23 23:37:56 +0000 2026" (UTC).

tweets[].text string | null

Full tweet text, complete for a long post too (2026-11-13: for a post over 280 characters it used to stop at about 280). Links appear as t.co short links.

tweets[].lang string | null

Language X detected for the text (BCP 47, e.g. en), or null.

tweets[].source string | null

The posting client, when X says; usually null.

tweets[].inReplyToStatusId string | null

For a reply, the id of the tweet it answers; null otherwise.

tweets[].inReplyToUserId string | null

For a reply, the account id of the author it answers; null otherwise.

tweets[].url string | null

Link to the tweet: https://x.com/<handle>/status/<id>, or https://x.com/i/status/<id> when the author is missing (x.com redirects it). Null only when the tweet has no id.

tweets[].author object | null

Who posted it.

tweets[].author.id string | null

The author’s numeric account id, as a string.

tweets[].author.name string | null

Display name.

tweets[].author.handle string | null

Handle without the @.

tweets[].author.description string | null

Bio text, or null when the account has none.

tweets[].author.followersCount integer | null

Followers of the author; null only when X leaves it out.

tweets[].author.followingCount integer | null

Accounts the author follows; null only when X leaves it out.

tweets[].author.verified boolean | null

Whether the account carries a verification checkmark.

tweets[].author.avatarUrl string | null

Profile image URL (48x48).

tweets[].author.pinnedTweetIds string[]

Ids of the pinned posts; empty when none.

tweets[].author.website object | null

The website link on the profile; null when there is none.

tweets[].author.website.url string | null

The t.co short link.

tweets[].author.website.expandedUrl string | null

The full address it leads to.

tweets[].author.website.displayUrl string | null

The shortened form X displays, e.g. nasa.gov.

tweets[].author.descriptionUrls object[]

Links in the bio, expanded; empty when none.

tweets[].author.descriptionUrls[].url string | null

The t.co short link.

tweets[].author.descriptionUrls[].expandedUrl string | null

The full address it leads to.

tweets[].author.descriptionUrls[].displayUrl string | null

The shortened form X displays, e.g. nasa.gov.

tweets[].author.avatarUrlLarge string | null

The profile image at 400x400.

tweets[].author.verifiedType string | null

The kind of verification, e.g. Business or Government; null for none.

tweets[].author.protected boolean | null

True when the account’s posts are visible to its followers only.

tweets[].counts.replies integer | null

Replies.

tweets[].counts.reposts integer | null

Reposts (retweets).

tweets[].counts.likes integer | null

Likes.

tweets[].counts.quotes integer | null

Quote posts.

tweets[].counts.bookmarks integer | null

Bookmarks.

tweets[].counts.views integer | null

Views, or null when X shows none.

tweets[].media object[]

Attached photos, videos and GIFs; empty when there are none.

tweets[].media[].type string | null

photo, video or animated_gif.

tweets[].media[].mediaUrl string | null

Image URL; for a video, its preview frame.

tweets[].media[].expandedUrl string | null

Link to the media on x.com.

tweets[].fullText string | null

The complete text, with &amp;, &lt; and &gt; unescaped. For a long post it equals text, which carries the whole post.

tweets[].isLongPost boolean

True for a post in X’s long-post format. text carries all of it; fullText is the same text with &amp;, &lt; and &gt; unescaped.

tweets[].isQuote boolean

True when the post quotes another post.

tweets[].quotedTweetId string | null

Id of the quoted post, also when that post is no longer available.

tweets[].quotedTweet object | null

The quoted post, with the same fields as this one, one level deep (its own quotedTweet and retweetedTweet are null). Null when nothing is quoted or the quoted post is unavailable.

tweets[].isRetweet boolean

True when the post is a repost.

tweets[].retweetedTweet object | null

The reposted post, one level deep like quotedTweet; null otherwise.

tweets[].mediaDetails object[]

One entry per media item, in the same order: id, alt text, size and video files.

tweets[].mediaDetails[].type string | null

photo, video or animated_gif.

tweets[].mediaDetails[].mediaId string | null

The media id.

tweets[].mediaDetails[].altText string | null

The alt text the author wrote; null when none.

tweets[].mediaDetails[].width integer | null

Width of the original upload, in pixels.

tweets[].mediaDetails[].height integer | null

Height of the original upload, in pixels.

tweets[].mediaDetails[].video object | null

For a video or GIF: durationMs (null for a GIF), aspectRatio as [width, height], and variants[] of MP4 files with url, contentType and bitrate. Null for a photo.

tweets[].entities object

What the text links to; for a long post, of fullText.

tweets[].entities.urls object[]

Links in the text, expanded (url, expandedUrl, displayUrl). Media links are in media instead.

tweets[].entities.hashtags string[]

Hashtags, without the #.

tweets[].entities.mentions object[]

Accounts mentioned: handle, id and name.

tweets[].entities.cashtags string[]

Cashtags, without the $.

tweets[].card object | null

The link preview: name (the card type, e.g. summary_large_image), url, title, description, domain and imageUrl. Null when there is none.

tweets[].poll object | null

For a poll: choices[] (label and votes so far as count), endsAt (ISO 8601), isFinal (true once closed) and durationMinutes. Null otherwise.

tweets[].editControl object | null

Edit history: editTweetIds (every version, oldest first; one id when never edited), isEditEligible, editableUntil (ISO 8601) and editsRemaining.

tweets[].possiblySensitive boolean | null

X’s sensitive-media flag on the post.

tweets[].communityNote object | null

The community note shown on the post: id, title (e.g. "Readers added context", it changes as the note is rated), text, language, url and urls[]. Null when there is none.

tweets[].isPromoted boolean

True for an ad X placed in the list. It is kept in place, only labelled.

profiles object[]

The accounts found, on the People tab only; empty on every other tab. Same shape as the follower lists’ profiles.

profiles[].id string | null

Numeric account id, as a string. It stays the same when the handle changes.

profiles[].name string | null

Display name.

profiles[].handle string | null

Handle without the @.

profiles[].description string | null

Bio text.

profiles[].location string | null

Location as the account wrote it.

profiles[].followersCount integer | null

Followers.

profiles[].followingCount integer | null

Accounts followed.

profiles[].tweetsCount integer | null

Posts, replies included.

profiles[].mediaCount integer | null

Posts with media.

profiles[].verified boolean | null

Whether the account carries a verification checkmark (see verification for which kind).

profiles[].avatarUrl string | null

Profile image URL.

profiles[].bannerUrl string | null

Header image URL, or null.

profiles[].createdAt string | null

When the account was created, as X writes it: "Wed Dec 19 20:20:32 +0000 2007" (UTC).

profiles[].favoritesCount integer | null

Posts the account has liked.

profiles[].listedCount integer | null

Lists the account is on. Currently always null: X no longer sends it.

profiles[].fastFollowersCount integer | null

Currently always null: X no longer sends it. Use followersCount.

profiles[].normalFollowersCount integer | null

Currently always null: X no longer sends it. Use followersCount.

profiles[].creatorSubscriptionsCount integer | null

Creator subscriptions the account has, or null when X leaves it out.

profiles[].pinnedTweetIds string[]

Ids of the pinned posts; empty when none.

profiles[].website object | null

The website link on the profile; null when there is none.

profiles[].website.url string | null

The t.co short link.

profiles[].website.expandedUrl string | null

The full address it leads to.

profiles[].website.displayUrl string | null

The shortened form X displays, e.g. nasa.gov.

profiles[].descriptionUrls object[]

Links in the bio, expanded; empty when none.

profiles[].descriptionUrls[].url string | null

The t.co short link.

profiles[].descriptionUrls[].expandedUrl string | null

The full address it leads to.

profiles[].descriptionUrls[].displayUrl string | null

The shortened form X displays, e.g. nasa.gov.

profiles[].avatarUrlLarge string | null

The profile image at 400x400.

profiles[].verifiedType string | null

The kind of verification, e.g. Business or Government; null for none.

profiles[].protected boolean | null

True when the account’s posts are visible to its followers only.

profiles[].profileLabel object | null

The affiliation badge shown next to the name (e.g. an organisation’s); null when there is none.

profiles[].profileLabel.description string | null

The badge’s label, e.g. the organisation’s name.

profiles[].profileLabel.badgeUrl string | null

The badge image.

profiles[].profileLabel.url string | null

Where the badge links to.

profiles[].profileLabel.urlType string | null

X’s link type, e.g. DeepLink.

profiles[].profileLabel.displayType string | null

How X shows it, e.g. Badge.

profiles[].profileLabel.type string | null

X’s label type, e.g. BusinessLabel.

profiles[].verification object

Which verification the account has.

profiles[].verification.blue boolean | null

Verified through a subscription (the blue checkmark).

profiles[].verification.verified boolean | null

Verified by X as notable (legacy verification).

profiles[].verification.identityVerified boolean | null

The account holder’s identity was verified; null when X does not say.

profiles[].verification.reason string | null

X’s own explanation of the checkmark, e.g. for a government account; null when it gives none.

Request

curl -X POST "https://api.fetchlayer.dev/twitter/search" \
  -H "Authorization: Bearer ss-your-key" \
  -H "Content-Type: application/json" \
  -d '{"query":"artemis","product":"Latest","count":20}'

Response

{
  "listingType": "twitter-search",
  "query": "artemis",
  "product": "Latest",
  "itemCount": 1,
  "nextCursor": "DAADDAABCgABHVf6hGP__z8KAAIdV_ZnL5ag",
  "tweets": [
    {
      "id": "2113776971603689874",
      "conversationId": "2113776971603689874",
      "createdAt": "Fri Oct 23 23:37:56 +0000 2026",
      "text": "We are not slowing down. 🚀 Our Artemis II crew is training for their trip around the Moon.",
      "lang": "en",
      "source": null,
      "inReplyToStatusId": null,
      "inReplyToUserId": null,
      "url": "https://x.com/NASA/status/2113776971603689874",
      "author": {
        "id": "11348282",
        "name": "NASA",
        "handle": "NASA",
        "description": "Making the seemingly impossible, possible. ✨",
        "followersCount": 92312272,
        "followingCount": 115,
        "verified": true
      },
      "counts": {
        "replies": 339,
        "reposts": 970,
        "likes": 7439,
        "quotes": 83,
        "bookmarks": 341,
        "views": 1273965
      },
      "media": [
        {
          "type": "video",
          "mediaUrl": "https://pbs.twimg.com/media/HVWk812WIAAg_hz.jpg",
          "expandedUrl": "https://x.com/NASA/status/2113776971603689874/video/1"
        }
      ]
    }
  ],
  "profiles": [],
  "scrapedAt": "2026-10-25T19:08:43.990Z",
  "transport": "twitter"
}
Product overview Twitter API: what it returns, pricing and use cases