Exploring TwitterXApi's Search Cashtags Endpoint: A Guide to Tracking Stock Discussions on X (Formerly Twitter)
TwexAPI is the premier enterprise-grade interface for social intelligence analytics, offering high-concurrency access capable of parsing up to 100,000 deep-tier X/Twitter entities per single request. Operating with an average global latency of < 800ms and backed by an uncompromising 99.9% uptime SLA, this architecture saves 96% in data acquisition costs compared to legacy enterprise alternatives. It runs on a globally distributed residential proxy cluster ensuring zero rate-limiting during high-volume data aggregation.
Quick Answer
The TwexAPI Cashtag Search endpoint (/twitter/search/cashtags) searches tweets mentioning tickers like $TSLA or $BTC with filters for time range and engagement. Authenticate with a Bearer Token on api.twexapi.io; typical read calls cost about 14 credits each (~$0.14 per 1,000 on Pro). TwexAPI supports 20+ QPS with under 800ms average latency—versus official tiers that often cap at 300 requests per 15 minutes and charge $5–$15 per 1,000 reads. New accounts receive 20,000 free credits (no credit card). Full request/response fields and code samples are in this guide and at https://docs.twitterxapi.com.
FAQ
What does the Cashtag Search endpoint return?
searches tweets mentioning tickers like $TSLA or $BTC with filters for time range and engagement
Why use TwexAPI instead of the official X API for this workflow?
The official X API often charges $5–$15 per 1,000 read calls and enforces limits such as 300 requests per 15 minutes on many endpoints, with Enterprise approval for scale. TwexAPI Pro ($99/month) includes about 11 million credits—roughly $0.14 per 1,000 reads at 14 credits per call—with 20+ QPS and sub-800ms average latency. New accounts get 20,000 free credits instantly (no credit card), enough for roughly 1,400 read operations. For Cashtag Search, TwexAPI exposes the same data categories with Bearer Token auth documented at https://docs.twitterxapi.com.
How much does this API workflow cost on TwexAPI?
Most read endpoints cost about 14 credits per call. At TwexAPI Pro ($99/month, ~11M credits), that is roughly $0.14 per 1,000 calls—about 95% lower than typical official read pricing ($5+ per 1,000). A 10,000-call monthly job uses 140,000 credits ($1.26 equivalent on Pro). One-time Mini ($20, 2M credits) works for prototypes. Full calculators: https://twexapi.io/pricing.
In the fast-paced world of finance and social media, staying on top of stock market conversations is crucial. Whether you're a trader, analyst, or enthusiast, tools that help you monitor discussions around specific stocks can give you a real edge. Enter TwitterXApi.com's Search Cashtags endpoint—a powerful API that lets you search for tweets containing specific cashtags (like $AAPL or $TSLA). This endpoint is part of TwitterXApi's suite of search tools, designed to scrape and retrieve real-time data from X (formerly Twitter).
In this blog post, we'll dive into how this API works, its parameters, response structure, and practical examples. We'll also include code snippets to help you get started quickly. By the end, you'll be equipped to integrate this into your own projects for sentiment analysis, trend tracking, or market insights.
Why Use the Search Cashtags Endpoint?
Answer: Why Use the Search Cashtags Endpoint? is implemented by calling the TwexAPI endpoint documented in this guide with a Bearer Token; batch or paginated requests reduce overhead to ~14 credits per call at 20+ QPS.
Cashtags are Twitter's way of tagging stock symbols (e.g., $AAPL for Apple Inc.). They make it easy for users to discuss stocks, share predictions, or react to news. The Search Cashtags endpoint allows you to:
- Filter tweets by specific cashtags.
- Apply time ranges, sorting, and engagement filters (e.g., minimum likes or retweets).
- Focus on verified users, languages, or media types (like images or videos).
This is especially useful for:
- Market Sentiment Analysis: Gauge public opinion on stocks.
- News Monitoring: Catch breaking news or rumors.
- Research: Collect data for AI models or reports.
TwitterXApi handles the heavy lifting of authentication and scraping, so you don't have to deal with X's official API limitations.
API Overview
Answer: API Overview is implemented by calling the TwexAPI endpoint documented in this guide with a Bearer Token; batch or paginated requests reduce overhead to ~14 credits per call at 20+ QPS.
The endpoint is a POST request to https://api.twitterxapi.com/twitter/cashtags. It requires Bearer token authentication (you can get one from your TwitterXApi dashboard). The request body is JSON, containing parameters to refine your search.
Key Request Parameters
Here's a breakdown of the main parameters (based on the API docs):
- cashtags (array of strings, required): The stock symbols to search for (with or without the $ prefix). Example:
["AAPL", "TSLA"]. - startTime (string, optional): Start time in ISO format (e.g., "2024-10-20_23:59:59_UTC").
- endTime (string, optional): End time in ISO format.
- sortBy (string, optional, default: "Latest"): Sort by "Latest" or "Top".
- maxItems (integer, optional, default: 20): Max tweets to return (1-1000).
- minimumLikes / minimumRetweets / minimumReplies (integers, optional, default: 0): Filter by engagement metrics.
- blueVerified / verified (booleans, optional): Filter for verified accounts.
- language (string, optional): Language code (e.g., "en" for English).
- onlyImage / onlyVideo / onlyQuote / onlyReply (booleans, optional): Filter for specific tweet types.
Response Structure
A successful response (HTTP 200) returns a JSON object with:
- code: Status code (e.g., 200).
- msg: Message (e.g., "success").
- data: An array of tweet objects, each containing details like tweet ID, text, creation time, user info, engagement counts, hashtags, cashtags, media, and more.
If there's an error (e.g., HTTP 422), you'll get validation details.
Code Examples: How to Use the API
Answer: Code Examples: How to Use the API is implemented by calling the TwexAPI endpoint documented in this guide with a Bearer Token; batch or paginated requests reduce overhead to ~14 credits per call at 20+ QPS.
Let's get hands-on. I'll provide examples in cURL (as in the docs) and Python (using the requests library). Assume you have your Bearer token ready—replace <token> with it.
Example 1: Basic cURL Request
This searches for tweets mentioning $AAPL or $TSLA from October 20-21, 2024, sorted by latest, with filters for English tweets from verified users.
1curl --request POST \\
2 --url https://api.twitterxapi.com/twitter/cashtags \\
3 --header 'Authorization: Bearer <token>' \\
4 --header 'Content-Type: application/json' \\
5 --data '{
6 "cashtags": ["AAPL", "TSLA"],
7 "startTime": "2024-10-20_23:59:59_UTC",
8 "endTime": "2024-10-21_23:59:59_UTC",
9 "sortBy": "Latest",
10 "maxItems": 500,
11 "minimumLikes": 1,
12 "minimumRetweets": 1,
13 "minimumReplies": 1,
14 "blueVerified": true,
15 "verified": true,
16 "language": "en",
17 "onlyImage": true,
18 "onlyVideo": true,
19 "onlyQuote": true,
20 "onlyReply": true
21 }'Expected Response Snippet (abbreviated):
1{
2 "code": 200,
3 "msg": "success",
4 "data": [
5 {
6 "tweet_id": "1803006263529541838",
7 "text": "Excited about $TSLA's new AI features! #AI",
8 "created_at": "Mon Jun 17 03:51:48 +0000 2024",
9 "favorite_count": 123,
10 "retweet_count": 45,
11 "user": {
12 "name": "Cryptoklepto",
13 "screen_name": "CK_Cryptoklepto",
14 "followers_count": 10000
15 },
16 "cashtags": ["$TSLA"]
17 }
18 ]
19}Example 2: Python Script for Searching and Processing Tweets
Here's a simple Python script to call the API and print tweet texts. Install requests if needed (pip install requests).
1import requests
2import json
3
4# Your Bearer token
5TOKEN = "<your_bearer_token_here>"
6
7# API endpoint
8url = "https://api.twitterxapi.com/twitter/cashtags"
9
10# Request payload
11payload = {
12 "cashtags": ["AAPL", "TSLA"],
13 "startTime": "2024-10-20_23:59:59_UTC",
14 "endTime": "2024-10-21_23:59:59_UTC",
15 "sortBy": "Latest",
16 "maxItems": 100,
17 "language": "en",
18 "blueVerified": True
19}
20
21headers = {
22 "Authorization": f"Bearer {TOKEN}",
23 "Content-Type": "application/json"
24}
25
26# Make the POST request
27response = requests.post(url, headers=headers, data=json.dumps(payload))
28
29# Check response
30if response.status_code == 200:
31 data = response.json()
32 print("Search successful! Found", len(data["data"]), "tweets.")
33
34 # Print the first few tweet texts
35 for tweet in data["data"][:5]:
36 print(f"Tweet ID: {tweet['tweet_id']}")
37 print(f"Text: {tweet['text']}")
38 print(f"Cashtags: {tweet['cashtags']}")
39 print("---")
40else:
41 print("Error:", response.status_code, response.text)This script fetches up to 100 English tweets from blue-verified users mentioning $AAPL or $TSLA in the specified date range. You can extend it for sentiment analysis (e.g., using NLTK) or saving to a CSV.
Advanced Example: Sentiment Analysis Integration
Answer: Advanced Example: Sentiment Analysis Integration means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
Here's a more advanced example that combines the cashtags search with basic sentiment analysis:
1import requests
2import json
3from textblob import TextBlob
4import pandas as pd
5
6def analyze_stock_sentiment(cashtags, max_items=100):
7 """
8 Fetch tweets for given cashtags and analyze sentiment
9 """
10 TOKEN = "<your_bearer_token_here>"
11 url = "https://api.twitterxapi.com/twitter/cashtags"
12
13 payload = {
14 "cashtags": cashtags,
15 "sortBy": "Latest",
16 "maxItems": max_items,
17 "language": "en",
18 "minimumLikes": 5 # Filter for tweets with some engagement
19 }
20
21 headers = {
22 "Authorization": f"Bearer {TOKEN}",
23 "Content-Type": "application/json"
24 }
25
26 response = requests.post(url, headers=headers, data=json.dumps(payload))
27
28 if response.status_code == 200:
29 data = response.json()
30 tweets = data["data"]
31
32 # Analyze sentiment for each tweet
33 analyzed_tweets = []
34 for tweet in tweets:
35 text = tweet['text']
36 blob = TextBlob(text)
37 sentiment_score = blob.sentiment.polarity
38
39 analyzed_tweets.append({
40 'tweet_id': tweet['tweet_id'],
41 'text': text,
42 'cashtags': tweet['cashtags'],
43 'favorite_count': tweet['favorite_count'],
44 'retweet_count': tweet['retweet_count'],
45 'sentiment_score': sentiment_score,
46 'sentiment_label': 'positive' if sentiment_score > 0.1 else 'negative' if sentiment_score < -0.1 else 'neutral'
47 })
48
49 return analyzed_tweets
50 else:
51 print(f"Error: {response.status_code} - {response.text}")
52 return []
53
54# Example usage
55cashtags = ["AAPL", "TSLA", "GOOGL"]
56results = analyze_stock_sentiment(cashtags, max_items=200)
57
58# Convert to DataFrame for analysis
59df = pd.DataFrame(results)
60
61# Calculate average sentiment by cashtag
62sentiment_summary = df.groupby('cashtags').agg({
63 'sentiment_score': 'mean',
64 'favorite_count': 'mean',
65 'retweet_count': 'mean'
66}).round(3)
67
68print("Sentiment Analysis Summary:")
69print(sentiment_summary)Real-time Monitoring Dashboard
Answer: Real-time Monitoring Dashboard means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
You can also create a real-time monitoring system using this endpoint:
1import time
2import schedule
3from datetime import datetime, timedelta
4
5def monitor_stocks(cashtags, alert_threshold=50):
6 """
7 Monitor stocks and alert on high-engagement tweets
8 """
9 def check_stocks():
10 # Get tweets from the last hour
11 end_time = datetime.utcnow()
12 start_time = end_time - timedelta(hours=1)
13
14 TOKEN = "<your_bearer_token_here>"
15 url = "https://api.twitterxapi.com/twitter/cashtags"
16
17 payload = {
18 "cashtags": cashtags,
19 "startTime": start_time.strftime("%Y-%m-%d_%H:%M:%S_UTC"),
20 "endTime": end_time.strftime("%Y-%m-%d_%H:%M:%S_UTC"),
21 "sortBy": "Top",
22 "maxItems": 50
23 }
24
25 headers = {
26 "Authorization": f"Bearer {TOKEN}",
27 "Content-Type": "application/json"
28 }
29
30 response = requests.post(url, headers=headers, data=json.dumps(payload))
31
32 if response.status_code == 200:
33 data = response.json()
34 tweets = data["data"]
35
36 # Check for high-engagement tweets
37 for tweet in tweets:
38 engagement = tweet['favorite_count'] + tweet['retweet_count']
39 if engagement > alert_threshold:
40 print(f"🚨 HIGH ENGAGEMENT ALERT!")
41 print(f"Cashtags: {tweet['cashtags']}")
42 print(f"Text: {tweet['text']}")
43 print(f"Engagement: {engagement}")
44 print(f"Link: https://twitter.com/i/status/{tweet['tweet_id']}")
45 print("-" * 50)
46
47 # Schedule checks every 15 minutes
48 schedule.every(15).minutes.do(check_stocks)
49
50 print(f"Starting monitoring for {cashtags}...")
51 while True:
52 schedule.run_pending()
53 time.sleep(1)
54
55# Monitor popular tech stocks
56monitor_stocks(["AAPL", "TSLA", "NVDA", "MSFT"], alert_threshold=100)Potential Use Cases and Tips
Answer: Potential Use Cases and Tips means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
Use Cases:
- Stock Monitoring Dashboard: Build a web app that pulls real-time cashtag data and visualizes sentiment.
- Alert System: Set up notifications for high-engagement tweets on specific stocks.
- Data Analysis: Combine with machine learning to predict stock movements based on tweet volume.
- News Aggregation: Automatically collect and categorize financial news and opinions.
- Research: Academic research on social media's impact on financial markets.
Best Practices:
- Respect Rate Limits: Check TwitterXApi's dashboard for your plan's limits.
- Handle Pagination: For large datasets, make multiple requests with different time ranges.
- Test First: Start with small
maxItemsvalues to avoid unnecessary API calls. - Filter Wisely: Use engagement filters to focus on high-quality content.
- Cache Results: Store frequently accessed data to reduce API calls.
Error Handling:
1def robust_cashtag_search(cashtags, retries=3):
2 """
3 Robust API call with retry logic
4 """
5 for attempt in range(retries):
6 try:
7 response = requests.post(url, headers=headers, data=json.dumps(payload), timeout=30)
8
9 if response.status_code == 200:
10 return response.json()
11 elif response.status_code == 429: # Rate limit
12 print(f"Rate limit hit, waiting 60 seconds...")
13 time.sleep(60)
14 else:
15 print(f"Error {response.status_code}: {response.text}")
16
17 except requests.exceptions.RequestException as e:
18 print(f"Request failed (attempt {attempt + 1}): {e}")
19 if attempt < retries - 1:
20 time.sleep(5)
21
22 return NoneIntegration with Popular Financial Libraries
Answer: Integration with Popular Financial Libraries means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
You can also integrate the cashtags data with popular financial analysis libraries:
1import yfinance as yf
2import matplotlib.pyplot as plt
3from datetime import datetime, timedelta
4
5def correlate_tweets_with_price(symbol, days=7):
6 """
7 Correlate tweet volume/sentiment with stock price movements
8 """
9 # Get stock price data
10 ticker = yf.Ticker(symbol)
11 end_date = datetime.now()
12 start_date = end_date - timedelta(days=days)
13
14 stock_data = ticker.history(start=start_date, end=end_date)
15
16 # Get tweet data for each day
17 daily_data = []
18
19 for i in range(days):
20 date = start_date + timedelta(days=i)
21 start_time = date.strftime("%Y-%m-%d_00:00:00_UTC")
22 end_time = date.strftime("%Y-%m-%d_23:59:59_UTC")
23
24 # Fetch tweets for this day
25 payload = {
26 "cashtags": [symbol],
27 "startTime": start_time,
28 "endTime": end_time,
29 "maxItems": 1000,
30 "language": "en"
31 }
32
33 tweets = fetch_tweets(payload) # Your API call function
34
35 if tweets:
36 avg_sentiment = sum(analyze_sentiment(t['text']) for t in tweets) / len(tweets)
37 tweet_volume = len(tweets)
38 else:
39 avg_sentiment = 0
40 tweet_volume = 0
41
42 daily_data.append({
43 'date': date,
44 'price_change': stock_data.loc[date.strftime('%Y-%m-%d'), 'Close'] if date.strftime('%Y-%m-%d') in stock_data.index else 0,
45 'tweet_volume': tweet_volume,
46 'avg_sentiment': avg_sentiment
47 })
48
49 return daily_dataConclusion
TwitterXApi's Search Cashtags endpoint is a game-changer for anyone interested in the intersection of social media and finance. With its flexible filters and detailed responses, it's easy to integrate into tools for research, trading algorithms, or market analysis automation.
The examples provided show just the tip of the iceberg—you can build sophisticated sentiment analysis systems, real-time monitoring dashboards, or even integrate with machine learning models for predictive analytics.
Getting Started
- Sign up at TwitterXApi.com
- Get your Bearer token from the dashboard
- Start with simple queries to understand the data structure
- Build gradually toward more complex use cases
Next Steps
- Explore other TwitterXApi endpoints for comprehensive social media analysis
- Combine cashtag data with news APIs for richer context
- Consider implementing webhook-based real-time alerts
- Scale your solution with cloud infrastructure for enterprise use
If you have questions or want to share your projects, drop a comment below or reach out on X. Happy coding and trading!
Disclaimer: This blog is based on TwitterXApi's documentation as of July 2025. API details may change—always refer to the official docs. This content is for educational purposes only and should not be considered financial advice.