# Live listings WebSocket

Get every new CS2 listing on **Skinport, CSFloat and SkinBaron** the second it goes up, instead of asking the API again and again. Good for snipers, deal alerts and trading bots.

- **Address:** `wss://api.cspriceapi.com/v1/ws/listings`
- **Who can use it:** customers on **Trader Pro** or **Trader Enterprise** ([pricing](/pricing)). You can also try it with a free 2-day test key from our [Discord](https://discord.gg/XT3rpfH4Tx) (#get-testkey). Trader Basic can't connect.
- **What you get per listing:** item name, price (in the market's currency and in USD), float, pattern, Doppler phase, stickers, charms and a link to the listing.

## How it works in 3 steps

1. **Connect** to the address with your API key.
2. **Tell us what you want** (optional): which markets, which price range, which items.
3. **Receive listings.** Every new listing that fits arrives as one message. The connection stays open.

## Step 1: connect

Put your key in the `x-api-key` header. In a browser you can't set headers, so add it to the address instead: `?key=YOUR_API_KEY`.

**JavaScript** (browser or Node.js 22+):

```js
const ws = new WebSocket("wss://api.cspriceapi.com/v1/ws/listings?key=YOUR_API_KEY");

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "listing") {
    console.log(msg.data.market_hash_name, msg.data.price_usd, msg.data.url);
  }
};
```

**Python** (`pip install websockets`):

```python
import asyncio, json, websockets

async def main():
    async with websockets.connect(
        "wss://api.cspriceapi.com/v1/ws/listings",
        additional_headers={"x-api-key": "YOUR_API_KEY"},
    ) as ws:
        async for raw in ws:
            msg = json.loads(raw)
            if msg["type"] == "listing":
                print(msg["data"]["market_hash_name"], msg["data"]["price_usd"])

asyncio.run(main())
```

That's all you need: without a filter you get every new listing from all three markets.

## Step 2: choose what you want

Send a message after connecting. Examples:

| You want | Send this |
|---|---|
| Only CSFloat and Skinport | `{"action":"subscribe","markets":["csfloat","skinport"]}` plus `{"action":"unsubscribe","markets":["skinbaron"]}` |
| Only items between $100 and $5,000 | `{"action":"filter","min_price_usd":100,"max_price_usd":5000}` |
| Only knives and gloves | `{"action":"filter","search":["★"]}` |
| Only specific items | `{"action":"filter","items":["AK-47 \| Redline (Field-Tested)","AWP \| Asiimov (Field-Tested)"]}` |
| Everything again | `{"action":"filter"}` |

Good to know:

- You can also pick markets right away in the address: `?markets=csfloat,skinport`.
- `search` finds any part of the name, upper or lower case doesn't matter. With several words, a listing matches if **one** of them fits.
- `items` needs the exact item name.
- You can combine price, search and items in one filter. **A new filter replaces the old one**, so always send everything you want in one message.

## Step 3: what a listing looks like

```json
{
  "type": "listing",
  "data": {
    "market": "csfloat",
    "market_hash_name": "AK-47 | Redline (Field-Tested)",
    "price": 12.34,
    "currency": "USD",
    "price_usd": 12.34,
    "float": 0.2512,
    "paint_seed": 661,
    "phase": null,
    "stickers": [{ "name": "...", "slot": 0, "wear": 0 }],
    "url": "https://csfloat.com/item/1043899891010636772",
    "listed_at": "2026-11-20T14:45:28.739Z"
  }
}
```

| Field | Meaning |
|---|---|
| `market` | `skinport`, `csfloat` or `skinbaron` |
| `price` / `currency` | Price as the market shows it (SkinBaron in EUR, the others in USD) |
| `price_usd` | Price in USD, so you can compare markets |
| `float`, `paint_seed` | Wear and pattern (SkinBaron sends no pattern and no image) |
| `phase` | Doppler phase, otherwise empty |
| `stickers`, `charms` | What's applied to the item |
| `url` | Link to buy it (on Skinport: the item page) |
| `listed_at` | When it was listed |

The full message also has `id`, `paint_index`, `stattrak`, `souvenir`, `inspect_link`, `image` and `tradable_at`.

## More commands

| Send | You get |
|---|---|
| `{"action":"recent","market":"csfloat","limit":50}` | The last 50 listings we already have (up to 200 per market), with your filter |
| `{"action":"status"}` | Whether each market feed is running |
| `{"action":"ping"}` | `pong`, to test the connection |

Right after connecting you get a `welcome` message with your markets, filter and limits. After every change you get `subscribed` with the new settings. If a message is wrong you get `error` with a short explanation, and the connection stays open.

## When the connection closes

| Code | What it means | What to do |
|---|---|---|
| `4001` | Key missing, wrong or expired | Check your key |
| `4003` | Your plan doesn't include the live feed (Trader Basic) | Upgrade to Trader Pro or Enterprise |
| `4029` | More than 5 connections with the same key | Close other connections |
| `4008` | Your program read the messages too slowly | Process messages faster |
| `1012` | We restarted the server | Reconnect after a few seconds |

**Tip:** reconnect automatically (wait a few seconds, a bit longer each time), except after `4001` and `4003`. Send your filter again after reconnecting.

Limits: up to **5 connections per key**. We check your key every 5 minutes, so the feed stops when a plan ends.

## Related

- [Pricing](/pricing): plans with the live feed
- [Quickstart](/docs/quickstart): API keys and the REST endpoints
- [Data coverage](/docs/data-coverage): all markets and refresh rates
