X/Twitter API docs

X/Twitter API: Search — Posts by query

Discover Search data on X/Twitter from a user query and connect the results to search, catalog, or research interfaces.

Use “Posts by query” when an exact object ID is not known and relevant candidates must be found first.

Method GET
Entity Search
Versions 2
What this endpoint does

What you can build with this API method

Review the result and common workflows first, then move to parameters and a working request example.

What this endpoint helps with

The response includes matching Search, public context, and pagination data when more results are available.

When to use it

Use “Posts by query” when an exact object ID is not known and relevant candidates must be found first.

Common use cases

In-product search

Add X/Twitter data search to customer-facing and internal interfaces.

Catalog building

Find candidates by query and save relevant objects for later enrichment.

Market research

Collect result sets for topic, creator, and competitive analysis.

Available versions

Response version

Both versions solve the same job and accept the same parameters. Use the switch to compare the response structure and choose the version your client expects.

Response version V2

Switch versions on this page to compare response structures while keeping the same documentation URL.

What stays the same

Authentication, required parameters, and the request shape stay the same across V1 and V2. In practice, you choose the version when you build the endpoint path and when you parse the response.

What changes between versions

The main difference is the response envelope. Use V2 for new integrations and keep V1 only when you need compatibility with an existing client contract.

How to use it

How to call the method

Use the same API key header and the same query parameters for both versions. This documentation shows the shared parameter set first, then version-specific endpoint paths and code snippets.

Input parameters

Shared parameters
Parameter Required Type Example Description
query Yes str technology User-entered search query.
all_of_these_words No str | None AI robotics Optional words that must all appear in matching Twitter/X posts. Example: AI robotics.
any_of_these_words No str | None launch release Optional words where any one may appear in matching Twitter/X posts. Example: launch release.
cursor No str | None DAABCgABF4ABCD... Next-page cursor returned by the previous response. Omit it for the first page.
exact_phrase No str | None machine learning Optional exact phrase that must appear in matching Twitter/X posts. Example: machine learning.
from_accounts No str | None technews xai Optional source accounts without or with @, separated by spaces or commas. Example: technews xai.
hashtags No str | None #TechNews #AI Optional hashtags to require, separated by spaces or commas. Example: #TechNews #AI.
language No str | None en Optional Twitter/X language code. Use 'any' to omit language filtering. Example: en.
link_filter No include | only | exclude | None only Optional link filter: include all posts, only posts with links, or exclude links. Example: only.
mentioning_accounts No str | None technews elonmusk Optional mentioned accounts without or with @, separated by spaces or commas. Example: technews elonmusk.
min_likes No int | None 100 Optional minimum like count. Example: 100.
min_replies No int | None 10 Optional minimum reply count. Example: 10.
min_retweets No int | None 25 Optional minimum repost/retweet count. Example: 25.
none_of_these_words No str | None rumor leak Optional words to exclude from matching Twitter/X posts. Example: rumor leak.
reply_filter No include | only | exclude | None exclude Optional reply filter: include all posts, only replies, or exclude replies. Example: exclude.
since_date No date | None 2026-01-01 Optional earliest post date in ISO YYYY-MM-DD format. Example: 2026-01-01.
tag No Top | Latest | People | Photos | Videos | None Latest Optional Twitter/X search product filter. Example: Latest.
to_accounts No str | None technews Optional reply target accounts without or with @, separated by spaces or commas. Example: technews.
until_date No date | None 2026-01-31 Optional latest post date in ISO YYYY-MM-DD format. Example: 2026-01-31.

Version-specific request path

V2

Choose a version when you copy the exact endpoint path, example URL, and code snippet. The parameter list above stays the same.

GET /api/v2/twitter.com/search/tweets-by-query

Normalized format

Code examples

curl --request GET \
  --url "https://www.scrapestorm.net/api/v2/twitter.com/search/tweets-by-query" \
  --header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
  --get --data-urlencode 'query=technology' \
  # Optional parameters:
  # --data-urlencode 'all_of_these_words=AI robotics'
  # --data-urlencode 'any_of_these_words=launch release'
  # --data-urlencode 'cursor=DAABCgABF4ABCD...'
  # --data-urlencode 'exact_phrase=machine learning'
  # --data-urlencode 'from_accounts=technews xai'
  # --data-urlencode 'hashtags=#TechNews #AI'
  # --data-urlencode 'language=en'
  # --data-urlencode 'link_filter=only'
  # --data-urlencode 'mentioning_accounts=technews elonmusk'
  # --data-urlencode 'min_likes=100'
  # --data-urlencode 'min_replies=10'
  # --data-urlencode 'min_retweets=25'
  # --data-urlencode 'none_of_these_words=rumor leak'
  # --data-urlencode 'reply_filter=exclude'
  # --data-urlencode 'since_date=2026-01-01'
  # --data-urlencode 'tag=Latest'
  # --data-urlencode 'to_accounts=technews'
  # --data-urlencode 'until_date=2026-01-31'
Response example

Live response by version

The preview keeps key fields and the first collection items so you can scan the response shape quickly. Switching versions changes the JSON format.

Response example

V2 response JSON

Verified example

This compact JSON example comes from the latest successful verification run for V2.

{
  "success": true,
  "status": "ok",
  "pagination": {
    "cursor": "QVFB...",
    "has_more": true
  },
  "search_context": {
    "query": "Python code",
    "tag": "Top"
  },
  "data": {
    "tweets": {
      "count": 20,
      "items": [
        {
          "url": "https://x.com/clcoding/status/1698437458546028664",
          "tweet_id": "1698437458546028664",
          "text": "What is the output of the following Python code? #coding #python #pythonquiz https://t.co/NbrvId3g4W",
          "hashtags": [
            "coding",
            "python",
            {
              "_more_items": 1
            }
          ],
          "emails": [],
          "created_at": "2023-09-03T20:47:00Z",
          "language": "en",
          "source": null,
          "author": {
            "url": "https://x.com/clcoding",
            "user_id": "1322566336367636482",
            "username": "clcoding",
            "display_name": "Python Coding",
            "description": "Lets Learn #Python with tips and tricks. Free Python Course: https://t.co/l9NKxZWrh7 biz : [email protected] AI Community Partner. DM for Everything.",
            "emails": [
              "[email protected]"
            ],
            "external_links": [
              "…"
            ],
            "location": "Earth🌎",
            "created_at": "2020-10-31T15:49:39Z",
            "is_verified": false,
            "is_blue_verified": true,
            "is_protected": false,
            "possibly_sensitive": false,
            "default_profile": true,
            "default_profile_image": false,
            "followers_count": 654700,
            "following_count": 155,
            "tweet_count": 17608,
            "media_count": 12272,
            "listed_count": 3166,
            "like_count": 1068,
            "professional_type": "Creator",
            "professional_category_name": [
              "Education"
            ],
            "affiliated_account": null,
            "_more_fields": "5 more fields"
          },
          "is_from_automated_account": null,
          "media": {
            "images": [
              "…"
            ],
            "videos": [],
            "gifs": []
          },
          "external_links": [],
          "user_mentions": [],
          "is_reply": false,
          "reply": null,
          "is_quote": false,
          "quote_tweet_id": null,
          "is_retweet": false,
          "retweeted_tweet_id": null,
          "reply_count": 209,
          "retweet_count": 108,
          "quote_count": 7,
          "like_count": 1035,
          "bookmark_count": 91,
          "_more_fields": "2 more fields"
        },
        {
          "url": "https://x.com/PythonPr/status/2109611213974028338",
          "tweet_id": "2109611213974028338",
          "text": "VS Code isn't disappearing, it's just evolving. https://t.co/ffQkOQEjfJ",
          "hashtags": [],
          "emails": [],
          "created_at": "2026-10-12T11:44:42Z",
          "language": "en",
          "source": null,
          "author": {
            "url": "https://x.com/PythonPr",
            "user_id": "855384627975831553",
            "username": "PythonPr",
            "display_name": "Python Programming",
            "description": "#python #programming",
            "emails": [],
            "external_links": [],
            "location": "United States",
            "created_at": "2017-04-21T11:36:02Z",
            "is_verified": false,
            "is_blue_verified": true,
            "is_protected": false,
            "possibly_sensitive": false,
            "default_profile": true,
            "default_profile_image": false,
            "followers_count": 221500,
            "following_count": 1161,
            "tweet_count": 10712,
            "media_count": 4805,
            "listed_count": 1268,
            "like_count": 23751,
            "professional_type": null,
            "professional_category_name": null,
            "affiliated_account": null,
            "_more_fields": "5 more fields"
          },
          "is_from_automated_account": null,
          "media": {
            "images": [],
            "videos": [
              "…"
            ],
            "gifs": []
          },
          "external_links": [],
          "user_mentions": [],
          "is_reply": false,
          "reply": null,
          "is_quote": false,
          "quote_tweet_id": null,
          "is_retweet": false,
          "retweeted_tweet_id": null,
          "reply_count": 13,
          "retweet_count": 22,
          "quote_count": 3,
          "like_count": 282,
          "bookmark_count": 60,
          "_more_fields": "2 more fields"
        },
        {
          "_more_items": 18
        }
      ]
    }
  }
}
What to do next

Continue the evaluation

Use this documentation as the first decision point, then move into pricing, platform coverage, and integration rules before you connect the endpoint for recurring use.

Open the X/Twitter platform page

Compare adjacent entities, API method groups, and related docs before implementation.

Open platform page

Compare API method pricing

Check where this API method sits inside the public price table before you scale usage.

View pricing

Review integration rules

Use the starter docs to confirm authentication, versioning, retries, and mock vs live behavior.

Open docs
FAQ

Questions teams ask before implementation

Use these answers to decide whether this API method fits your workflow, versioning choice, and rollout plan.

What data does this X/Twitter API method return?

The method performs “Posts by query” for Search. The compact response example below shows the exact field structure.

Should I choose V1 or V2?

Choose V2 for new integrations because it provides a normalized structure. Use V1 only for compatibility with clients that already consume the platform-native format.

What do I need for the first request?

Create an API key, send it in the request header, and provide the required parameters from the table. The code samples already contain the correct path and request structure.