Quick start · Binance Square
Binance Square WebSocket API quick start
Connect to your Binance Square stream and receive posts and pin changes from the creators you track as JSON. This page gets a consumer running; the API reference holds every field.
- WebSocket
wss://binance.1322.io/{ws_path}?key={ws_key}- REST base
https://binance.1322.io- Auth
- X-Api-Key header (REST), ?key= (WebSocket)
- Updated
What you get
Posts, replies, quotes, polls and pin changes from the Binance Square creators on your list, with sentiment (tendency, bullish and bearish ratios), coin pairs, hashtags and engagement counts. Every frame is { type, data }: binance.post or binance.pin.update.
Events arrive in under a second.
Price: From $300/month for 5 accounts; WebSocket +$100/month. Plans: Lite $300/month (5 accounts), Standard $450/month (15 accounts), Premium $700/month (30 accounts). Pay monthly, or prepay 3 months (10% off), 6 months (15% off) or a year (25% off). See Binance Square pricing.
Authentication
- REST calls send your API key in the
X-Api-Keyheader. - The WebSocket takes your WS key as
?key=on your account's own path:wss://binance.1322.io/{ws_path}?key={ws_key}. - The API key,
ws_pathand WS key are on the API access page in your dashboard; its Copy URL button gives the complete WebSocket URL.
Connect to the WebSocket
Set these environment variables, then run either consumer from your server:
BINANCE_WS_PATH: your ws_pathBINANCE_WS_KEY: your WS keyBINANCE_API_KEY: your API key (REST only)
# pip install "websockets>=13" (Python 3.9+)
import asyncio, json, os
from websockets.asyncio.client import connect
# ws_path and WS key: the API access page in your dashboard
WS_PATH = os.environ["BINANCE_WS_PATH"].strip("/")
WS_URL = "wss://binance.1322.io/" + WS_PATH + "?key=" + os.environ["BINANCE_WS_KEY"]
def handle(frame):
kind = frame.get("type")
data = frame.get("data") or {}
if kind == "binance.post":
print(data.get("username"), data.get("tendency") or "-", (data.get("text") or "")[:80])
elif kind == "binance.pin.update":
print("pins changed:", data.get("username"),
len(data.get("added") or []), "added,", len(data.get("removed") or []), "removed")
async def main():
backoff = 1
while True:
try:
async with connect(WS_URL) as ws:
backoff = 1
async for raw in ws:
try:
event = json.loads(raw)
except ValueError:
continue
if isinstance(event, dict):
handle(event)
except Exception as exc:
print("disconnected:", exc)
await asyncio.sleep(backoff)
backoff = min(backoff * 2, 30)
asyncio.run(main())// npm install ws, save as consumer.mjs, run: node consumer.mjs (Node 18+)
import WebSocket from "ws"
// ws_path and WS key: the API access page in your dashboard
const WS_PATH = (process.env.BINANCE_WS_PATH ?? "").split("/").filter(Boolean).join("/")
const WS_KEY = process.env.BINANCE_WS_KEY
if (!WS_PATH || !WS_KEY) throw new Error("Set BINANCE_WS_PATH and BINANCE_WS_KEY")
const WS_URL = "wss://binance.1322.io/" + WS_PATH + "?key=" + encodeURIComponent(WS_KEY)
function handle(frame) {
const data = frame.data ?? {}
if (frame.type === "binance.post") {
console.log(data.username, data.tendency || "-", (data.text ?? "").slice(0, 80))
} else if (frame.type === "binance.pin.update") {
console.log("pins changed:", data.username, (data.added ?? []).length, "added,", (data.removed ?? []).length, "removed")
}
}
let backoff = 1000
function connect() {
const ws = new WebSocket(WS_URL)
ws.on("open", () => { backoff = 1000 })
ws.on("message", (raw) => {
let event
try { event = JSON.parse(raw.toString()) } catch { return }
if (event && typeof event === "object" && !Array.isArray(event)) handle(event)
})
ws.on("error", (err) => console.error("socket error:", err.message))
ws.on("close", () => {
setTimeout(connect, backoff)
backoff = Math.min(backoff * 2, 30000)
})
}
connect()- Branch on
type;datais a post or a pin update. - Events are not queued while you are disconnected, so reconnect promptly with a capped backoff, as above.
One example frame
Illustrative values for fictional accounts, trimmed to the fields most consumers read first. A real frame carries the full set for your tracked accounts.
{
"type": "binance.post",
"data": {
"id": "356349125025001",
"username": "examplecrypto",
"display_name": "Example Crypto",
"content_type": "post",
"is_reply": false,
"text": "Watching #bitcoin hold the weekly level.",
"tendency": "bullish",
"coin_pairs": [
"BTCUSDT"
],
"hashtags": [
"bitcoin"
],
"like_count": 12,
"view_count": 940,
"published_at": "2026-10-15T14:03:20Z",
"detected_at": "2026-10-15T14:03:21Z"
}
}content_typeispost,video,spaceorarticle;tendencyisbullish,bearishor an empty string.- A reply sets
is_replyand puts the parent underreply_to; a quote puts the quoted post underquote. Abinance.pin.updatelistsaddedandremovedposts.
Manage the list over REST
REST base https://binance.1322.io. Each call below sends X-Api-Key with your API key.
| Method | Path | What it does |
|---|---|---|
| GET | /v1/dashboard | Tracked accounts, status and limits. |
| POST | /v1/track | Add a Binance Square creator by username. |
| POST | /v1/untrack | Remove a creator by username. |
curl "https://binance.1322.io/v1/dashboard" \
-H "X-Api-Key: $BINANCE_API_KEY"
curl -X POST "https://binance.1322.io/v1/track" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $BINANCE_API_KEY" \
-d '{ "username": "examplecrypto" }'
curl -X POST "https://binance.1322.io/v1/untrack" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $BINANCE_API_KEY" \
-d '{ "username": "examplecrypto" }'- Errors use standard HTTP status codes (401, 403, 429).
Full reference
Every field, endpoint and edge case for Binance Square lives in the API reference. Jump straight to the part you need:
Common questions
What does a pin change event contain?
A binance.pin.update frame whose data names the creator and lists the newly pinned posts in added and the unpinned ones in removed (with removed_ids).
How do I read sentiment on a post?
tendency is bullish, bearish or empty, with bullish_ratio and bearish_ratio when Binance Square provides them. coin_pairs lists the trading pairs the post mentions, such as BTCUSDT.
Other quick starts
- X (Twitter) WebSocket quick start: Tweets, deletes, profile and follow events
- Truth Social WebSocket quick start: Posts, retruths, quotes and media
- Instagram WebSocket quick start: Posts, Reels, carousels and Stories
- YouTube WebSocket quick start: Uploads, Shorts and deletions
- TikTok WebSocket quick start: Uploads, reposts, LIVE start and end
- News WebSocket quick start: Full-text articles from news feeds
Related: