WebSocket
Endpoint
This endpoint provides a real-time stream of marketplace offers via WebSocket. Once connected and subscribed, you receive live item listings as they are detected across supported marketplaces.
Authentication
Include your API key as the apiKey query parameter when connecting.
wss://marketplaceapi.steamapis.com/ws/v2/offers?apiKey=YourSecretAPIKey
websocketAccess enabled. Contact support if you need this permission added to your key.Compression
The server requires the permessage-deflate WebSocket extension. Most clients negotiate this automatically. If yours does not, send the extension header explicitly when connecting:
Sec-WebSocket-Extensions: permessage-deflate
Without it, the handshake fails with 400 Bad Request and the message permessage-deflate is required.
Limits
Each API key is limited to 2 concurrent connections. Opening a third connection closes it with code 1008 (Policy Violation).
Subscription message
After connecting, send a JSON message to subscribe to specific marketplaces and games. subscribeTo and games are required; newFloorOnly is optional.
all or -1 to subscribe to all marketplaces. Case-insensitive. See Reference for the full list.all or -1 to subscribe to all games. Case-insensitive. See Reference for the full list.false. When true, only offers that set a new lowest price for their item on their marketplace are pushed.Subscription example
const ws = new WebSocket('wss://marketplaceapi.steamapis.com/ws/v2/offers?apiKey=YOUR_API_KEY');
ws.onopen = () => {
ws.send(JSON.stringify({
subscribeTo: ['Buff163', 'CSFloat', 'SkinPort'],
games: ['CS2', 'Dota2'],
newFloorOnly: true
}));
};
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
if (message.type === 'subscribed') {
console.log('Subscribed to:', message.marketplaces, message.games);
} else if (message.type === 'offer') {
console.log('New offer:', message.data.name, '$' + message.data.priceUSD);
} else if (message.type === 'error') {
console.error('Error:', message.error);
}
};
ws.onerror = (error) => console.error('WebSocket error:', error);
ws.onclose = () => console.log('Disconnected');
Confirmation message
On successful subscription, you receive a confirmation message.
{
"type": "subscribed",
"marketplaces": ["Buff163", "CSFloat", "SkinPort"],
"games": ["CS2", "Dota2"],
"message": "Successfully subscribed to offer stream"
}
Error messages
Errors are returned as JSON messages with type: "error".
| Error | Cause |
|---|---|
Invalid API key | The provided API key was not found |
WebSocket access not enabled | Your API key does not have websocketAccess permission |
API key disabled | Your account has been disabled |
subscribeTo field is required | Missing the subscribeTo field in your subscription message |
games field is required | Missing the games field in your subscription message |
Unknown marketplace: X | Invalid marketplace name or ID |
Unknown game: X | Invalid game name or ID |