交易
POST /v1/orders/:id/claim — 领取处于持有中的订单
在持有窗口结束后释放处于持有(托管)状态订单的交付。部分持有订单会自动交付,其他订单则需要通过此接口显式领取。
POST
/
orders
/
{id}
/
claim
Claim a held order
curl --request POST \
--url https://csboard.com/v1/orders/{id}/claim \
--header 'Authorization: Bearer <token>'import requests
url = "https://csboard.com/v1/orders/{id}/claim"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://csboard.com/v1/orders/{id}/claim', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://csboard.com/v1/orders/{id}/claim",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://csboard.com/v1/orders/{id}/claim"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://csboard.com/v1/orders/{id}/claim")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://csboard.com/v1/orders/{id}/claim")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"order_id": "ord_01J9Z3K8Q2",
"status": "delivering",
"claimed": true,
"steam_trade_offer_id": "5512345678"
}
部分订单会进入 持有 状态:物品处于市场托管窗口中,在该窗口结束前无法交付。持有中的订单在
GET /v1/orders 和 GET /v1/orders/{id} 中会显示为 status: "hold" 并带有 hold_until 时间戳。
当 hold_until 已过:
- 部分持有订单会自动交付 —— 您无需做任何事,调用此接口会返回
claimed: false(无害的空操作)。 - 其他持有订单必须被领取 —— 您需要调用此接口来释放交易。如果不领取,它们会一直停留在持有状态。
hold_until 过后调用一次 claim。 如果订单属于自动交付类型,您会得到一个空操作;如果它需要领取,则会被释放。
不想为每个订单轮询和领取?将账户级
autoclaim 标志设为 true,每个持有订单会在其持有窗口结束的瞬间自动释放 —— 无需调用 claim。推荐流程
- 使用
POST /v1/orders或POST /v1/market/buy下单购买。 - 轮询
GET /v1/orders/{id}。当订单显示为status: "hold"时,检查hold_until。 - 一旦
hold_until已过,调用POST /v1/orders/{id}/claim。 - 当返回
claimed: true时,市场会向您的 trade URL 发送一个 Steam 交易报价。您的机器人必须在约 15 分钟内接受,否则交易将被取消,余额会退回。
响应一览
| 状态 | 含义 |
|---|---|
200 claimed: true | 交易已释放;返回 steam_trade_offer_id。请在约 15 分钟内接受。 |
200 claimed: false | 该订单会自动交付;无需任何操作。 |
409 not_claimable | 订单不在持有状态(已在交付/已完成/已失败)。 |
425 hold_not_cleared | 仍在持有窗口内 —— 请在返回的 hold_until 之后重试。 |
502 delivery_failed | 市场拒绝了释放请求。如果上游取消了持有,则 refunded: true。 |
404 order_not_found | 此账户下不存在该订单。 |
在释放进行中期间,claim 是幂等的 —— 重复调用会返回冲突,绝不会导致重复交付。网络超时后重试是安全的。
授权
Send your key as a Bearer token on every request: Authorization: Bearer csb_pub_.... Generate keys in your CSBoard profile.
路径参数
CSBoard order id of the held order to claim.
响应
Claim accepted. claimed: true means the trade was released now; claimed: false means this order delivers automatically and no action was needed.
⌘I
Claim a held order
curl --request POST \
--url https://csboard.com/v1/orders/{id}/claim \
--header 'Authorization: Bearer <token>'import requests
url = "https://csboard.com/v1/orders/{id}/claim"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://csboard.com/v1/orders/{id}/claim', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://csboard.com/v1/orders/{id}/claim",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://csboard.com/v1/orders/{id}/claim"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://csboard.com/v1/orders/{id}/claim")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://csboard.com/v1/orders/{id}/claim")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"order_id": "ord_01J9Z3K8Q2",
"status": "delivering",
"claimed": true,
"steam_trade_offer_id": "5512345678"
}