GET /v1/listings/stream — 上架与售出的实时推送
通过 Server-Sent Events 在 CS2 挂单出现和售出的那一刻订阅它们。取代轮询,并告诉您商品何时消失。
Authorization: Bearer csb_pub_... 发送。
查询参数
过滤在我们这一侧完成,在发送给您之前生效。它们的作用是节省您的带宽——一个流已经承载整个目录,因此您无需为不同细分开启多个连接。Rifle、Knife、Gloves。Classified、Covert。Factory New、Minimal Wear、Field-Tested、Well-Worn、Battle-Scarred。market_hash_name(不区分大小写)——只推送某一个特定商品。only 或 exclude。only 或 exclude。Last-Event-ID 请求头时使用——该请求头是标准机制,且更受推荐。事件
GET /v1/listings 返回的 Listing 对象,包含 listed_at。该事件既会在真正的新库存出现时触发,也会在重新上架时触发——来自已取消订单、已过期交易报价或已解除冻结的商品。重新上架的商品对您而言就是新的,即使它此前已经存在。{ "id": "..." }。请务必处理该事件。 在商品售出的那一刻将其移除,正是您的购买请求成功与购买请求发现商品已消失之间的区别。这是轮询在任何频率下都无法提供的那一半信息。Last-Event-ID 早于保留的历史记录,因此重放将不完整。负载为 { "reason": "last_event_id_expired", "detail": "..." }。请重新读取 GET /v1/listings?sort=newest 以重建您的视图,然后在不带 Last-Event-ID 的情况下重连。我们发送该事件,而不是默默地给您一份您会误认为完整的部分重放。无缝重连
每个事件都带有id。重连时把您处理过的最后一个 id 通过 Last-Event-ID 请求头发回,您就会收到恰好遗漏的那部分——包括我们发布新版本期间(发布会按设计断开已打开的连接)。
每 25 秒会收到一个 : heartbeat 注释帧。若静默时间更长,请视为连接已死并重连;浏览器的 EventSource 会自动完成这件事并自动重发 Last-Event-ID。
限制
每个 API 密钥最多 3 个并发流。连接本身不受速率限制——一旦建立,事件将以目录变化的速度推送。示例请求
示例流
客户端示例
EventSource 无法设置 Authorization 请求头——在服务端运行时请使用支持该功能的 SSE 客户端(或以您的 HTTP 客户端允许的方式传递密钥)。上面的代码片段展示的是事件处理,而非鉴权。
错误代码
授权
Send your key as a Bearer token on every request: Authorization: Bearer csb_pub_.... Generate keys in your CSBoard profile.
查询参数
Only stream listings at or above this USD price.
Only stream listings at or below this USD price.
e.g. Rifle, Knife, Gloves.
e.g. Classified, Covert.
Exact wear name.
Factory New, Minimal Wear, Field-Tested, Well-Worn, Battle-Scarred Exact market_hash_name (case-insensitive).
Filter StatTrak™ items.
only, exclude Filter Souvenir items.
only, exclude Narrow new events to one delivery bucket (instant or hold). gone events are never filtered — a missed removal is the ghost listing this feed exists to prevent.
instant, up_to_12h, hold Resume after this event id. Use only if your client cannot send the Last-Event-ID header.
Narrow new events to listings whose refund_percent is at least this (0-100). gone events are never filtered.
0 <= x <= 100响应
An open SSE stream. Stays open until you disconnect.
The response is of type string.