↑↓ 切换 ↵ 打开 esc 关闭
REST · OpenAPI 3.1

政府合同 API,全功能对等。

Every screen on Sell to State is backed by a documented REST endpoint under /api/v1. Search, drill into a buyer or supplier, export CSV, and keep saved lists — with one API key and the same paywall the MCP server and CLI share.

# 60 秒快速上手

# 1. Create a key in the dashboard
#    Account → API keys
# 2. Verify it
curl -s https://staging-app.selltostate.com/api/v1/whoami \
  -H "x-api-key: sts_xxxxxxxx"

# 3. Search
curl -s "https://staging-app.selltostate.com/api/v1/search\
?scope=tenders&q=cybersecurity" \
  -H "x-api-key: sts_xxxxxxxx"

Same key works for the MCP server and the selltostate CLI.

认证与 402 付费墙

Two credential types resolve to one entitlement check. Humans and backends send an API key as x-api-key: sts_…. Autonomous agents self-register over RFC 7591 DCR and present Authorization: Bearer client:<id>.

Until your subject has an active subscription, every data call returns 402 with a payment_link (humans) and a machine_payment affordance (agents can pay off-session via POST /api/v1/pay and continue without a browser). GET /api/v1/whoami is the exception — it returns 200 with active:false so you can decide to pay before doing work.

Plan caps: monthly and annual = 5,000 rows/page; the 3-day pass = 10,000 rows in total. Rate limit: 120 data calls/min per credential (faceted search has its own 300/min budget). Saved lists and saved searches are owner-scoped — they require a user x-api-key; an OIDC client token gets 403.

端点。

All under /api/v1. Full params, schemas and "Try it" live in the reference.

GET /api/v1/whoami 认证 + 权限 + 作用域。对有效但未订阅的密钥返回 200 active:false(而非 402)—— 在消费前先检查。
GET /api/v1/search 对单一作用域(tenders | buyers | suppliers | sectors)进行分面 Typesense 检索:命中 + 分面计数 + 分页。
GET /api/v1/awards 按金额排序的分页、可筛选授标行。CSV 位于 /api/v1/awards.csv。
GET /api/v1/buyers/{slug} 采购方(机构)详情:摘要、逐年支出趋势、行业分布、主要供应商。
GET /api/v1/suppliers/{slug} 供应商详情:摘要、逐年中标趋势、行业分布、主要采购方。
GET /api/v1/sectors/{slug} 行业详情:摘要、逐年趋势、活跃合作方(?kind=buyers|suppliers)。
GET /api/v1/tenders/{id} 按数字 id 或公开招标 id 获取单份授标,并附相关授标。
CRUD /api/v1/lists* 已保存的授标列表。归属受限 —— 需要用户 x-api-key。
CRUD /api/v1/saved-searches* 已保存的检索。归属受限 —— 需要用户 x-api-key。

示例。

Python —— 检索授标

import requests

H = {"x-api-key": "sts_xxxxxxxx"}
r = requests.get(
    "https://staging-app.selltostate.com/api/v1/search",
    params={"scope": "tenders", "q": "cybersecurity", "year_min": 2023},
    headers=H,
)
if r.status_code == 402:
    print("subscribe:", r.json()["payment_link"]); raise SystemExit
data = r.json()
print(data["found"], "matches")
for hit in data["hits"]:
    print(hit)

Node —— 采购方详情 + CSV 导出

const H = { "x-api-key": process.env.STS_API_KEY };

const buyer = await fetch(
  "https://staging-app.selltostate.com/api/v1/buyers/ministry-of-education",
  { headers: H },
).then((r) => r.json());
console.log(buyer.buyer, buyer.yearly);

// Stream the entitlement-capped CSV
const csv = await fetch(
  "https://staging-app.selltostate.com/api/v1/awards.csv?supplier=ACME",
  { headers: H },
).then((r) => r.text());

已保存列表(用户密钥)

# Create a list, add a tender, read it back
LID=$(curl -s -X POST https://staging-app.selltostate.com/api/v1/lists \
  -H "x-api-key: sts_xxxxxxxx" -H "content-type: application/json" \
  -d '{"name":"Cyber FY24"}' | jq -r .id)

curl -s -X POST https://staging-app.selltostate.com/api/v1/lists/$LID/items \
  -H "x-api-key: sts_xxxxxxxx" -H "content-type: application/json" \
  -d '{"tender_no":"MOE000ETT24300001"}'

Poll for new tenders.

A job in your scheduler, Zapier or n8n can ask for the tenders added to Sell to State since its last run. Keep the time of each run and send it as added_after. Remove duplicates by slug.

LAST=$(cat last_run 2>/dev/null || echo 0)
NOW=$(date +%s)
curl -s "https://staging-app.selltostate.com/api/v1/search?scope=tenders&country=united-kingdom&q=software&sort=added_desc&added_after=$LAST&per_page=50"   -H "x-api-key: sts_xxxxxxxx"
echo "$NOW" > last_run
ParamValues
sortadded_desc (newest in Sell to State first), published_desc (newest publish date first), deadline, relevance
added_afterUnix seconds. Only tenders added after this time.
published_days1, 7, 30, 90, 365

The search limit is 300 calls a minute per key. A poll every 5 minutes or more is enough for tenders. Integrations

获取 API 密钥。

Pick a plan, create a key under Account → API keys, and you're querying in minutes. The full reference — every parameter, response schema, and a live "Try it" — is at docs.selltostate.com.

Start for free →
注册