Skip to content

Status WebSocket ​

Receive deposit and purchase status changes live over a WebSocket — the same notifications Webhooks deliver, without a public endpoint on your side.

The socket and webhooks work side by side: connected sockets always receive status events, and webhooks are still sent while a webhook URL is set in your merchant settings. Clear the URL to receive statuses over the socket only.

Connect ​

WSS wss://api.skinslink.com/ws/

Authenticate with your merchant API key — the same one you use for the REST endpoints — in the X-Api-Key header of the WebSocket handshake.

ParameterInRequiredDescription
X-Api-Keyheader✅Your merchant API key
sincequery—The seq of the last event you processed. Events after it are sent first, then live ones. See Resuming

A since that is not a non-negative integer is rejected with HTTP 400 before the upgrade.

The same access rules as the REST endpoints apply: the merchant must be enabled and, if you set an IP whitelist, the connection must come from a whitelisted IP. On connect we send one of:

  • {"event":"auth_success"} — authenticated; events start streaming
  • {"event":"auth_failed"} — the API key is invalid, the merchant is disabled or the IP is not whitelisted; we then close the socket

Access is re-checked every 30 seconds. If the merchant is disabled, the API key is regenerated or the IP leaves the whitelist, we close the socket with code 1008 and reason auth_failed.

Events ​

EventWhenseqDetails
auth_successRight after connecting, once authenticated—Connect
auth_failedAuthentication on connect failed; the socket is then closed—Connect
deposit_status_changeA deposit changed status✅What we send
deposit_offer_status_changeOne offer of a deposit with several trade offers changed status✅What we send
purchase_status_changeA purchase changed status✅What we send
balance_changeRight after auth_success, then on every balance change—Balance
resetYour position is no longer covered by the kept events—Reset

We may add events later — skip any event that is not in this list. An event you skip still has its seq: store it as processed, or the next event looks like a gap.

What we send ​

Every status change arrives as one event:

json
{
  "event": "purchase_status_change",
  "seq": 42,
  "event_id": 918273,
  "occurred_at": "2026-10-16T12:44:51.091139Z",
  "data": {
    "sign": "b64EncodedSHA256Signature==",
    "status": "hold",
    "purchase_id": 30950,
    "trade_date": "2026-10-16T12:44:30Z",
    "merchant_tx_id": "order-12345",
    "steam_id": "76561198338314767",
    "asset_id": "38029384123",
    "offer_id": "6912345678",
    "amount": 45.99,
    "amount_currency": "usd",
    "hold_end_date": "2026-10-23T12:44:51Z"
  }
}
FieldTypeDescription
eventstringdeposit_status_change, deposit_offer_status_change or purchase_status_change
seqintegerYour event sequence number: starts at 1 and grows by exactly 1 with every event of your merchant
event_idintegerUnique event ID
occurred_atstringWhen the status changed (ISO 8601)
dataobjectThe webhook body of that operation — see Deposit Webhooks, Offer Status Webhooks and Purchase Webhooks. status is the status this event announces; for deposit_offer_status_change it is the deposit status, and data.offer is the offer that changed

data is exactly what the webhook carries, sign included, so the code that handles your webhooks can handle socket events as they are. Events are sent for the same statuses as webhooks and in the order they happened.

Balance ​

Right after auth_success we also send your current balance, and then every balance change, as:

json
{
  "event": "balance_change",
  "data": { "available_balance": 120.5, "hold_balance": 20, "hold_spent": 0 }
}

balance_change has no seq and is not replayed — it is the latest value, not a history.

Resuming ​

The socket does not lose events while you are away. Store the seq of the last event you processed and pass it as since when you (re)connect:

wss://api.skinslink.com/ws/?since=42

We first send every event after 42, then live events. Check each event against your stored seq:

  • seq is your stored seq + 1 — process it, then store its seq.
  • seq is at or below your stored seq — you already have it; skip it.
  • seq jumps further — an event was missed. Read the gap from Status Events after your stored seq, then continue.

Without since, delivery continues after the last seq you acknowledged. If you never acknowledged, you receive live events only.

Acknowledging ​

Optionally send an acknowledgement after processing events:

json
{ "action": "ack", "seq": 42 }

It covers every event up to and including 42. You do not have to acknowledge every event — once in a while is enough. We remember the last acknowledged seq so that a reconnect without since resumes after it.

Reset ​

We keep events for 7 days. If since (or your last acknowledgement) is older than that, or ahead of your latest event, we first send:

json
{ "event": "reset", "data": { "seq": 120 } }

Events you missed are no longer available. Check your open deposits and purchases with Deposit Status and Purchase Status, store data.seq as your position and process the events that follow.

Keep-alive & reconnect ​

We send a WebSocket Ping frame every 30 seconds; your client must answer with Pong within 60 seconds or we close the connection — most libraries do this automatically. There is no text heartbeat message.

Read the socket promptly. If you fall too far behind, we close the socket with code 1013; you lose nothing — reconnect with since and continue.

When we close the socket ​

CodeReasonWhen
1012server restartWe deploy or restart the service
1008auth_failedAccess was revoked: merchant disabled, API key or secret regenerated, IP left the whitelist
1013slow consumer, reconnect with sinceYou fell too far behind
1011keepalive timeoutNo Pong arrived within 60 seconds

The network between you and us can also break the connection with no close frame at all — your client then reports 1006 (abnormal closure). Treat it like any other close.

After any close, reconnect with a growing backoff (for example 1 s, 2 s, 4 s, up to 30 s) and pass since with the last seq you processed: everything you missed is delivered first. For 1008, fix the access first; reconnecting with the same credentials fails again with auth_failed.

Example (Python) ​

python
import json
import websocket  # pip install websocket-client

api_key = "your-merchant-api-key"
last_seq = load_last_seq()  # None on the very first run

def on_message(ws, raw):
    global last_seq
    msg = json.loads(raw)
    event = msg["event"]

    if event == "reset":                     # missed events are gone: reconcile, move on
        reconcile_open_operations()
        last_seq = msg["data"]["seq"]
        save_last_seq(last_seq)
        return
    if "seq" not in msg:
        return                               # auth_success, balance_change

    if last_seq is not None and msg["seq"] <= last_seq:
        return                               # already processed
    if last_seq is not None and msg["seq"] != last_seq + 1:
        last_seq = pull_status_events(last_seq)  # read the gap from /merchant/events

    if event in ("deposit_status_change", "purchase_status_change"):
        handle_status(event, msg["data"])    # same handler as for webhooks
    elif event == "deposit_offer_status_change":
        show_offer_progress(msg["data"])     # progress only, never credit here
    last_seq = msg["seq"]                    # every event with a seq moves you on, even one you skip
    save_last_seq(last_seq)
    ws.send(json.dumps({"action": "ack", "seq": last_seq}))

def on_close(ws, status, message):
    reconnect_with_backoff()

url = "wss://api.skinslink.com/ws/"
if last_seq is not None:
    url += f"?since={last_seq}"

ws = websocket.WebSocketApp(
    url,
    header={"X-Api-Key": api_key},
    on_message=on_message,
    on_close=on_close,
)
ws.run_forever()  # answers server pings with pongs automatically