跳转到主要内容
POST
/
market
/
buy
Buy and deliver to a Steam trade URL
curl --request POST \
  --url https://csboard.com/v1/market/buy \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "item_ids": [
    "itm_8841201",
    "itm_8841340"
  ],
  "partner": "447383001",
  "token": "Ab3xZ9Qp",
  "max_price_usd": 30,
  "custom_id": "batch-2026-06-29-01",
  "skip_unavailable": false
}
'
{
  "data": {
    "purchase_id": "pur_01J9Z3K8Q2",
    "steam_id": "76561198000000000",
    "created_at": "2026-06-29T17:12:04Z",
    "custom_id": "batch-2026-06-29-01",
    "skins": [
      {
        "name": "AK-47 | Redline (Minimal Wear)",
        "price": 14.37,
        "status": "delivering",
        "return_reason": null,
        "steam_trade_offer_id": "5512345678"
      }
    ]
  }
}
此端点允许您将商品购买并直接交付到您提供的任意 Steam 交易链接——而不仅限于绑定到您账户的交易链接。交易链接由 partnertoken 字段组成。购买只能使用您的已结算(不可撤销)余额,因此适用于批发量与自动化交付工作流。 该端点通过 custom_id 请求体字段实现幂等性:使用相同的 custom_id 重试会重放原始的购买,而不会再次扣款;重放的响应会携带 Idempotent-Replayed: true 响应头。
此端点处于熔断开关保护之下,要求账户启用了交易且不可撤销状态干净。熔断开关关闭时,将返回 403 external_buy_disabled
需要身份验证。 请将密钥作为 Authorization: Bearer csb_pub_... 发送。 需要交易能力。 该密钥必须启用购买功能,且账户必须处于不可撤销状态干净。

请求体

item_ids
string[]
必填
1–100 个唯一的挂单 id。
partner
string
必填
Steam 交易链接中的 partner 值(1–32 个字符)。与 token 一起构成商品交付的目标交易链接。
token
string
必填
Steam 交易链接中的 token 值(1–32 个字符)。与 partner 一起构成目标交易链接。
max_price_usd
number
美元价格上限。如果实时总价超过该值,订单将以 price_moved 被拒绝且不扣款。强烈建议使用。
custom_id
string
幂等键(1–128 个字符)。使用相同 custom_id 重试会重放原始购买;重放响应会携带 Idempotent-Replayed: true
skip_unavailable
boolean
默认值:"false"
如果为 true,跳过已不再可用的商品而不会让整个请求失败。

响应字段

data
object
必填

示例请求

curl -X POST https://csboard.com/v1/market/buy \
  -H "Authorization: Bearer csb_pub_..." \
  -H "Content-Type: application/json" \
  -d '{
    "item_ids": ["itm_8841201", "itm_8841340"],
    "partner": "447383001",
    "token": "Ab3xZ9Qp",
    "max_price_usd": 30.00,
    "custom_id": "batch-2026-06-29-01",
    "skip_unavailable": false
  }'

示例响应

{
  "data": {
    "purchase_id": "pur_01J9Z3K8Q2",
    "steam_id": "76561198000000000",
    "created_at": "2026-06-29T17:12:04Z",
    "custom_id": "batch-2026-06-29-01",
    "skins": [
      {
        "name": "AK-47 | Redline (Minimal Wear)",
        "price": 14.37,
        "status": "delivering",
        "return_reason": null,
        "steam_trade_offer_id": "5512345678"
      }
    ]
  }
}

错误代码

HTTP 状态码代码含义
400invalid_request请求体格式错误(例如 item_ids 为空或超过 100)。
400unsupported_item一个或多个商品无法通过此端点交付(例如 ss_live_* id)。
400invalid_trade_urlpartner + token 无法组成有效的 Steam 交易链接。
401invalid_api_keyAPI 密钥缺失或无效。
402insufficient_settled_balance已结算余额低于订单总额。返回中包含 required_usdsettled_usd
402insufficient_balance余额低于订单总额。
403external_buy_disabled熔断开关已关闭;此端点当前已禁用。
403trading_not_enabled该密钥未启用购买功能。
403account_restricted此端点要求账户处于不可撤销状态干净。
409item_unavailable一个或多个商品已不再可用。返回中包含 unavailable_ids[]
409price_moved实时总价超过上限。返回中包含 quoted_max_usdcurrent_total_usd 以及 items[]
409idempotency_in_progress具有该 custom_id 的请求仍在处理中。
409price_updating价格正在刷新;请稍后重试。
429rate_limit_exceeded请求过多。请按照 Retry-After 响应头中的秒数退避。
500order_failed购买无法完成。
资金完全来自您的已结算余额。在大批量下单前,请检查 GET /v1/balance 上的 settled_balance_usd,并始终发送 max_price_usd 作为超额扣款保护。

授权

Authorization
string
header
必填

Send your key as a Bearer token on every request: Authorization: Bearer csb_pub_.... Generate keys in your CSBoard profile.

请求体

application/json
item_ids
string[]
必填

1–100 unique listing ids to buy.

Required array length: 1 - 100 elements
partner
string
必填

Steam trade URL partner value. With token, forms the destination trade URL.

Required string length: 1 - 32
token
string
必填

Steam trade URL token value. With partner, forms the destination trade URL.

Required string length: 1 - 32
max_price_usd
number

Total ceiling in USD. Order is rejected with price_moved if the live total exceeds it.

custom_id
string

Idempotency key. A retry with the same value replays the original purchase.

Required string length: 1 - 128
skip_unavailable
boolean
默认值:false

If true, skip items that are no longer available instead of failing the whole request.

响应

Purchase accepted and debited from settled balance.

data
object
必填