Getting started

Free demo — no signup, no key

Run this now to get @elonmusk's live profile instantly. See the real response before you pay.

curl
curl "https://socialapi.tech/v1/demo/user/info"
Try it in one click

Jump straight to an endpoint with its test panel open. Parameters are pre-filled with real values; your key is filled in automatically once you're signed in.

Base URL
https://socialapi.tech
Authentication
-H"X-API-Key:your_key_here"
Example
curl
curl "https://socialapi.tech/v1/search/advanced?query=bitcoin" \
  -H "X-API-Key: KEY"

API Reference

40 read endpoints, grouped by what they do. Open any group for full parameters, response schemas and a live test panel.

WS/v1/stream/ws

Real-Time Stream (WebSocket)

Subscribe to any X accounts and receive their posts in real time over a single WebSocket — straight into your own server or app. One fetch, shared by all subscribers, billed per account by the hour.

Endpoint
wss://socialapi.tech/v1/stream/ws?api_key=YOUR_API_KEY

Auth: Pass your api_key as a query parameter (browser WebSockets can't send headers). The key is your identity — keep it secret.

What you receive: Only posts from accounts you've subscribed to. Add accounts via POST /v1/stream/subscriptions — changes take effect within seconds, no reconnect needed.

Message frames
// 1. on connect — handshake with your current subscriptions
{ "type": "connected", "subscribed": ["elonmusk", "vitalikbuterin"] }

// 2. a live post (NO "type" field; identified by tweet_id)
{ "kol": "elonmusk", "tweet_id": "1929...", "user": "elonmusk",
  "display_name": "Elon Musk", "content": "...", "url": "https://x.com/...",
  "like_count": 1203, "retweet_count": 88, "reply_count": 42,
  "view_count": 90512, "is_retweet": false, "is_reply": false }

// 3. backpressure notice (stream too fast; N messages dropped — you stay connected)
{ "type": "lagged", "dropped": 17 }

★ Frames with a "type" are control frames (connected / lagged). A frame with no "type" but a tweet_id is a post. The server sends a WebSocket Ping every 30s to keep the connection alive — your client just needs to auto-Pong (most libraries do this by default).

Connect from your code
Node.js
import WebSocket from "ws";   // npm i ws

function connect() {
  const ws = new WebSocket("wss://socialapi.tech/v1/stream/ws?api_key=YOUR_API_KEY");

  ws.on("open", () => console.log("connected"));
  ws.on("message", (raw) => {
    const msg = JSON.parse(raw.toString());
    if (msg.type === "connected") return;      // handshake
    if (msg.type === "lagged") return;         // server dropped N on backpressure
    // else: a live post from an account you subscribed to
    console.log("@" + msg.user, "→", msg.content);
  });
  ws.on("error", (e) => console.error("ws error:", e.message));
  // auto-reconnect on drop
  ws.on("close", () => setTimeout(connect, 1000));
}

connect();
Python
import json, websocket   # pip install websocket-client

def on_message(ws, raw):
    msg = json.loads(raw)
    if msg.get("type"):                       # connected / lagged control frames
        return
    print("@" + msg["user"], "→", msg["content"])

ws = websocket.WebSocketApp(
    "wss://socialapi.tech/v1/stream/ws?api_key=YOUR_API_KEY",
    on_message=on_message,
)
ws.run_forever(ping_interval=30, reconnect=5)  # keep-alive + auto-reconnect
Shell
# websocat (github.com/vi/websocat) — quick test from the shell
websocat "wss://socialapi.tech/v1/stream/ws?api_key=YOUR_API_KEY"
Production tips: (1) auto-reconnect on drop — network blips and restarts happen; (2) handle lagged frames (optionally backfill); (3) one connection covers all your subscribed accounts — no need for a connection per account.
GET/v1/usage · /v1/deposit/balance

Account · Balance & Usage

Check your credit balance and usage anytime. These endpoints are self-authenticated (X-API-Key) and are not billed.

GET /v1/usage — usage summary
{ "status": "success", "data": {
  "balance_credits": "998002",
  "today":  { "calls": 42,  "credits_spent": "812"   },
  "month":  { "calls": 903, "credits_spent": "17240" }
} }
GET /v1/deposit/balance — balance only
{ "status": "success", "data": { "user_id": 4, "credits": "998002" } }

★ Every billed call returns your balance in headers

x-credits-used: 19 x-credits-remaining: 998002

No extra request needed — every billed response tells you this call's cost and your remaining balance in real time (like Stripe / OpenAI).

Pricing & Credits

Pay per call, billed only on success (200). 1 USD = 100,000 credits. Top up to get credits — no monthly plan, no subscription, never expires.

Per-call cost (credits)
user/info · user/about · tweet/info19Single lookup
user/last_tweets · media · highlights · tweet/replies · thread · trends · explore25List / timeline
followers · followings · retweeters · list/*31Paginated
search/advanced · search/user44Search
batch/user_info50Batch (≤100)
user/whois63Composite

e.g. a single lookup is 15 credits ≈ $0.00015; list endpoints are 80 credits for the first 30 items, then 12 each — billed on what actually comes back, so a bigger limit costs nothing extra. Cache hits are billed the same (you get the same data).

Real-Time Stream billing

$0.08 per account, per day (= 333 credits/account/hour, billed hourly from credits)

Flat rate, subscribe to as many as you like. The stream carries posts only — for full author profiles (followers / bio / location) call /v1/user/info.

  • ·The first hour is charged the moment you subscribe.
  • ·After that each account is billed on its own hourly cycle — 333 credits per hour, never double-charged or skipped.
  • ·If your balance runs out, that account's subscription auto-pauses (stops streaming + billing); resubscribe after topping up to resume.
  • ·Cancel anytime — you're only charged for hours already started.
  • ·Subscribing to a non-existent / misspelled account is rejected outright (no record, no charge).