StockTwits API: Symbol Streams as JSON
To get StockTwits data as JSON, call GET /v1/stocktwits/stream-symbol with a symbol: the recorded call for AAPL with limit=30 returned 30 messages, each with body, created_at, a symbols array and, where the poster set one, a sentiment label, plus a cursor for the next page. Two more endpoints find symbols by keyword and list the trending ones. All three are standard-tier and cost 1 credit per successful call. This guide shows the requests, the parameters, real responses, a symbol-level Python job and the cost.
What does the StockTwits API on Perceptlayer cover?
The StockTwits API on Perceptlayer has three endpoints: the message stream for one symbol, a symbol search by keyword, and the list of trending symbols. All three are GET requests that return JSON, all are standard-tier, so they work with any key without extra terms, and each costs 1 credit per successful call. The stream is where most jobs start, because it carries the messages, their timestamps and sentiment labels.
| Method | Path | Returns | Credits | Required | Optional |
|---|---|---|---|---|---|
GET |
/v1/stocktwits/stream-symbol |
Messages for one symbol | 1 | symbol |
limit, max, since |
GET |
/v1/stocktwits/symbols-search |
Symbols matching a keyword | 1 | q |
none |
GET |
/v1/stocktwits/symbols-trending |
Trending symbols | 1 | none | none |
The data is collected from publicly available sources and returned as found at the time of the call. These are Perceptlayer endpoints, not StockTwits' own developer offering; if you're weighing the two, compare what each returns and its terms yourself. The StockTwits API page has all three endpoints and a playground.
This guide keeps every use case at the symbol level: message volume, sentiment counts and trending ranks per ticker. The stream's messages carry a user object with profile fields, and the code below doesn't read it. Nothing here is investment advice; the data shows what people posted, not what a security will do.
How do you find a symbol to query?
Call GET /v1/stocktwits/symbols-search with a keyword in q (up to 100 characters). It returns matching symbols with their exchange and watchlist count, so you can confirm the exact symbol string before you request a stream. A keyword can match more than stocks, so check the exchange field.
curl "https://api.perceptlayer.com/v1/stocktwits/symbols-search?q=apple" \
-H "X-API-Key: $API_KEY"
The recorded response for q=apple reported count: 12; the two results shown here were a NASDAQ stock and a crypto token:
{
"data": {
"results": [
{
"type": "symbol",
"title": "Apple Inc",
"symbol": "AAPL",
"exchange": "NASDAQ",
"weight_offset": 10,
"watchlist_count": 1002132,
"country": "US",
"id": 686
},
{
"type": "symbol",
"title": "dog with apple in mouth",
"symbol": "APPLE.X",
"exchange": "CRYPTO",
…
}
],
"count": 12
},
"success": true,
"meta": {
"endpoint_family": "stocktwits_symbols_search",
…
"credits_charged": 1,
"credits_remaining": 995
}
}
The symbol value AAPL is the same string the stream request below uses. Keys start with sk_live_ and go in the X-API-Key header, or the api_key query parameter where headers aren't possible; the authentication docs cover both.
Which parameters does the stream endpoint take?
stream-symbol takes one required parameter, symbol, and three optional ones, limit, max and since. The catalogue documents their types and nothing else, so it states no default page size and no maximum limit. The recorded call used limit=30 and got 30 messages back, which is the only evidence of how limit behaves.
| Parameter | Type | Required | What the recording shows |
|---|---|---|---|
symbol |
string | yes | AAPL returned messages tagged with AAPL |
limit |
integer | no | limit=30 returned count: 30, echoed in request.limit |
max |
string | no | A cursor field of the same name held 669418631 |
since |
string | no | A cursor field of the same name held 669436220 |
curl "https://api.perceptlayer.com/v1/stocktwits/stream-symbol?symbol=AAPL&limit=30" \
-H "X-API-Key: $API_KEY"
We don't have a recording of a call that passes max or since, so test them in the playground on the stream endpoint page before you build pagination on them.
What does a StockTwits stream response contain?
The response is a data object with a messages array, a count, the symbol, a cursor and the request echo. Each message has an id, the body text, created_at, the source app, a prices array, a symbols array and an entities object that can hold a sentiment label. This excerpt of the recorded AAPL response drops the user objects and trims the rest:
{
"data": {
"messages": [
{
"id": 669436220,
"body": "$AAPL a suit alleges face id scans irises and retinas without the written consent illinois law requires, per open class actions. lawsuit stage, nothing to claim…",
…
"created_at": "2026-11-18T04:09:52Z",
"source": {
"id": 2269,
"title": "StockTwits Web",
…
},
"prices": [
{ "id": 686, "symbol": "AAPL", "symbol_mic": "AAPL.XNAS", "price": "350.30" }
],
"entities": {},
…
"symbols": [
{
"id": 686,
"symbol": "AAPL",
"exchange": "NASDAQ",
"title": "Apple Inc",
"watchlist_count": 1002132,
…
"sentiment_change": -3.71,
"volume_change": 10.92
}
],
"created_at_iso": "2026-11-18T04:09:52Z"
},
{
"id": 669435710,
"body": "$AAPL pigs",
…
"created_at": "2026-11-18T03:56:42Z",
"entities": {
"sentiment": { "basic": "Bearish" }
},
…
"sentiment": "Bearish"
}
],
"count": 30,
"symbol": "AAPL",
"cursor": {
"more": true,
"since": 669436220,
"max": 669418631
},
"request": { "limit": 30 }
},
"success": true,
…
}
| Field | What a symbol-level job does with it |
|---|---|
id |
Deduplicates messages across runs |
created_at |
Buckets messages by hour or day |
entities.sentiment.basic, sentiment |
Counts sentiment labels per bucket (Bearish in the recording) |
symbols[].symbol |
Shows which tickers a message tagged |
prices[].price |
The price string attached to the message |
symbols[].sentiment_change, volume_change |
Figures reported per symbol, as returned |
cursor.more, cursor.since, cursor.max |
Where the next page starts |
Three details matter. The first message's entities is empty and it has no top-level sentiment key, so sentiment is optional per message. price is a string ("350.30"), so convert it yourself. And the first message's id (669436220) equals cursor.since, so since marks the newest message on the page.
What do trending symbols return?
GET /v1/stocktwits/symbols-trending takes no parameters and returns a ranked list of symbols. The recording returned count: 30. Each symbol carries its rank, a trending_score, a trends object with a short summary and summary_at, sector and industry, identifiers (cusip, isin) and a fundamentals object with figures such as MarketCapitalization, PERatio and Beta.
curl "https://api.perceptlayer.com/v1/stocktwits/symbols-trending" \
-H "X-API-Key: $API_KEY"
{
"data": {
"symbols": [
{
"id": 11200,
"symbol": "SLS",
"exchange": "NASDAQ",
"title": "SELLAS Life Sciences Group Inc",
…
"sector": "HealthTechnology",
"industry": "PharmaceuticalsMajor",
"trending": true,
"trending_score": 15.0616,
"trends": {
"all": 1,
…
"summary": "SELLASs positive Phase 3 REGAL readout for its AML vaccine GPS, which met its primary overall-survival endpoint, drove the surge in attention. Traders are debat…",
"summary_at": "2026-11-17T23:12:56-05:00"
},
…
"rank": 1,
"fundamentals": {
"Symbol": "SLS",
…
"MarketCapitalization": "1522.827893",
"PERatio": -96.04,
…
"LastUpdated": "11/17/2026",
…
}
},
…
],
"count": 30
},
…
}
Fundamentals mix types: MarketCapitalization is a string and PERatio is a number, and the NVDA entry has keys such as GrossIncomeMargin that the SLS entry lacks. Parse each value defensively and treat any key as optional. The summary is text as returned, not a judgement about the security.
How do you track message volume and sentiment per symbol?
A symbol-level tracker reads one stream page per symbol on a schedule and appends one row per message: the run time, the symbol, the message id, created_at and the sentiment label if present. Grouping rows by symbol and hour gives you message counts and label counts over time. The script uses Python, requests and csv, and reads only fields from the recorded responses; it never reads user.
import csv
import datetime
import os
import time
import requests
API_KEY = os.environ["API_KEY"]
BASE = "https://api.perceptlayer.com/v1/stocktwits"
SYMBOLS = ["AAPL", "NVDA"]
def get(path, params, attempts=3):
for _ in range(attempts):
r = requests.get(f"{BASE}/{path}", params=params,
headers={"X-API-Key": API_KEY}, timeout=60)
if r.status_code in (429, 503):
time.sleep(int(r.headers.get("Retry-After", "5")))
continue
r.raise_for_status()
return r.json()["data"]
raise RuntimeError(f"gave up on {path} {params}")
now = datetime.datetime.now(datetime.timezone.utc).isoformat()
with open("stocktwits-messages.csv", "a", newline="") as f:
out = csv.writer(f)
for symbol in SYMBOLS:
data = get("stream-symbol", {"symbol": symbol, "limit": 30})
for m in data.get("messages", []):
label = (m.get("entities") or {}).get("sentiment", {}).get("basic")
out.writerow([now, symbol, m.get("id"), m.get("created_at"), label or ""])
time.sleep(1)
Keep the id column and drop duplicates when you aggregate, because two runs can return overlapping pages. The one-second pause keeps a free account inside its 1 request a second. To add context, call symbols-trending once per run and store each symbol's rank and trending_score with the time.
What should the job do with errors?
Every error returns an HTTP status and a JSON body with code, message and request_id, and costs nothing. Retry rate_limited (429) and temporarily_unavailable (503) after the Retry-After seconds. Treat invalid_parameters (422) as a bug in your symbol list. Requests have no idempotency key, so a client timeout can hide a call that succeeded and was billed; keep the timeout generous. The errors docs list every code.
What does StockTwits data cost?
Every successful call to any of the three endpoints costs 1 credit, and failed calls cost nothing, returning X-Credits-Used: 0. A stream call returns a page of messages for that 1 credit (30 in the recording), so the cost follows the number of symbols and how often you poll, not the number of messages.
| Plan | Arithmetic | Credits a month |
|---|---|---|
| 10 symbols, hourly | 10 × 24 × 30 × 1 credit | 7,200 |
| 50 symbols, hourly | 50 × 24 × 30 × 1 credit | 36,000 |
| Trending list, hourly | 24 × 30 × 1 credit | 720 |
| 200 symbols, hourly | 200 × 24 × 30 × 1 credit | 144,000 |
The first fits the Starter pack's 10,000 credits, the second the Build pack's 50,000, and the last the Growth pack's 200,000. The 100 free credits on signup cover 100 calls: enough to run the two-symbol script above 50 times. Purchased credits last 12 months. See pricing for what credits cost and the credits docs for how calls are debited.
To try it, run symbol=AAPL in the playground on the StockTwits API page, then get a free API key. For prices and fundamentals from other sources, see the Yahoo Finance API guide, the TradingView API guide and the finance APIs.
APIs in this post
Frequently asked questions
Is this the official StockTwits API?
No. These are Perceptlayer endpoints that return public StockTwits data, collected from publicly available sources and returned as found at the time of the call. They read a symbol's message stream, search symbols and list trending ones. If you're deciding between them and StockTwits' own offering, compare the fields and terms yourself, and read StockTwits' terms before using the data commercially.
Are the StockTwits endpoints restricted?
No. All three StockTwits endpoints are standard-tier, so any key can call them without accepting extra terms. Stream messages still include a user object with profile fields. Keep your use at the symbol level, such as message counts and sentiment labels per ticker, and leave the user fields out of what you store.
How do I page through older StockTwits messages?
Each stream response has a cursor object with more, since and max, and the endpoint takes optional since and max parameters with the same names. In the recording, cursor.since equals the newest message id on the page. We have no recording of a call that passes either parameter, so confirm the paging behaviour in the playground first.
Does every StockTwits message have a sentiment label?
No. In the recorded AAPL stream, one message had entities.sentiment.basic set to Bearish and a top-level sentiment field, while the first message had an empty entities object and no label. Treat sentiment as optional, count unlabelled messages separately, and don't read a label as a forecast of price.
How fast can I poll StockTwits streams?
Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second, 60 a minute, so a 50-symbol run with a one-second pause takes at least 50 seconds. Paying accounts run at least 5 requests a second, 300 a minute, depending on the pack. The rate limits docs list each pack's rate.