CEOACC API 对接文档
Bearer API Key 可统一对接账号商品、刷粉服务、代理 IP 与账号查活,并提供 ACGV3 Shared API 和 Dujiao-Next 兼容入口。
https://ceoacc.com/api/v1
- ACGV3 Shared API:余额、商品/规格价格、库存价格和订单金额统一返回
人民币
CNY。 - Dujiao-Next API:余额、商品/SKU 价格和订单金额统一返回
美元
USD。
快速开始
- 登录用户中心的“API 接入管理”提交申请;管理员审核通过后,由用户在该页领取只显示一次的专属 API Key。
- 使用服务端程序通过 HTTPS 请求;不要在浏览器前端或公开代码中保存 Key。
- 先读取对应目录,只对
orderable=true的商品或服务下单。 - 每笔新订单生成新的
Idempotency-Key;同一订单超时重试必须复用原 Key,并保存返回的订单号查询状态。
连通与余额测试
以下内容全部是占位符,不包含真实 Key。将 API_KEY 替换为您在“API 接入管理”一次性领取并安全保存的密钥。
API_BASE='https://ceoacc.com/api/v1'
API_KEY='sk_live_请替换为您的API_KEY'
curl --request GET "$API_BASE/" \
--header 'Accept: application/json' \
--header "Authorization: Bearer $API_KEY"
curl --request GET "$API_BASE/balance" \
--header 'Accept: application/json' \
--header "Authorization: Bearer $API_KEY"
接口总览
| 方法 | 路径 | 用途 | 所需 Scope |
|---|---|---|---|
| GET | / | API 版本和接口索引 | 任一有效 Key |
| GET | /balance | 查询本站余额 | balance:read |
| GET | /catalog/accounts | 账号商品目录 | account:read |
| GET | /catalog/accounts/{product_id}/selections | 查询可公开的自选库存与自选单价 | account:read |
| GET | /catalog/social | 刷粉服务目录 | social:read |
| GET | /catalog/proxy | 代理类型、周期和地区 | proxy:read |
| GET | /catalog/proxy/ips | 查询支持自选的 IP | proxy:read |
| POST | /catalog/proxy/quote | 查询实时站内余额价 | proxy:read |
| POST | /catalog/proxy/renew/quote | 代理续费报价 | proxy:read |
| POST | /orders/proxy/renew | 幂等提交代理续费 | proxy:write |
| POST | /orders | 三类业务统一下单 | 对应业务的 account:write、social:write 或 proxy:write |
| GET | /orders | 订单列表 | orders:read + 业务读取权限 |
| GET | /orders/{order_id} | 订单详情与交付结果 | orders:read + 对应业务的读取权限 |
| GET | /checker/capabilities | 查活平台和实时限额 | checker:read |
| POST | /checker/checks | 创建账号查活检测 | checker:write |
| GET | /checker/checks/{check_id} | 查询自己的检测结果 | checker:read |
认证、请求头与 Scope
所有 /api/v1 接口(包括 v1 根索引)都要求 Bearer 认证。Key 只能放在请求头,不能放入 URL、查询参数、日志或网页源码。
Authorization: Bearer sk_live_请替换为您的API_KEY
Accept: application/json
创建订单还必须加入:
Content-Type: application/json
Idempotency-Key: reseller-order-20260723-000001
可用 Scope
balance:read orders:read account:read account:write social:read social:write proxy:read proxy:write checker:read checker:write
这里的权限必须填写上方列出的完整名称,不支持字面通配符。各业务的 :read 用于读取目录、交付或检测结果,:write 用于创建订单或检测;订单列表还需要 orders:read。
403 insufficient_scope 或 403 ip_not_allowed 时,请联系平台方核对 Key 配置。余额
GEThttps://ceoacc.com/api/v1/balance
{
"success": true,
"data": {
"balance": 12800,
"currency": "site_balance"
},
"meta": {
"api_version": "v1",
"request_id": "示例请求ID"
}
}
商品与服务目录
orderable=true 的条目。账号和刷粉价格取目录返回值;代理 IP 价格以 POST /catalog/proxy/quote 的实时报价为准。账号商品
GET/catalog/accounts?limit=100&cursor=0
返回商品 ID、分类、名称、说明、价格、购买上下限、库存、规格和图标。本地库存商品以及已启用、已适配连接中的商品均可级联下单;库存未知、缺货或连接未适配时返回 orderable=false。
刷粉服务
GET/catalog/social?limit=100&cursor=0
返回服务 ID、分类、类型、价格、最小/最大数量及补单、取消、渐进投放能力。下单前必须按目录中的 type 组织参数。
代理 IP
GET/catalog/proxy
返回 kinds、periods、数量范围和地区。支持自选 IP 的类型可请求 /catalog/proxy/ips?kind=dedicated_ipv4&country=us&city=123;购买前用 POST /catalog/proxy/quote 查询实时站内余额价。
fulfillment 为 local 或 connected;两者使用相同的本站商品 id 下单。无规格商品检查条目级 stock_known、stock 与 orderable。多规格商品还必须在 variants 中选择 stock_known=true、stock>0 且 orderable=true 的精确 key;库存未知或为 0 的规格不可下单。
GET /catalog/accounts/{product_id}/selections,再把返回的
items[].choice 原样放入下单字段 selection_token。响应中的
select_unit_price 已包含所选规格、自选加价和适用的会员折扣;最终扣款仍以
POST /orders 返回的 order.amount 为准。未提交
selection_token 的请求属于普通随机购买,不会收取自选加价。
{
"id": 1001,
"fulfillment": "connected",
"stock": 12,
"stock_known": true,
"variants": [
{
"key": "美国",
"price": 120,
"stock": 12,
"stock_known": true,
"orderable": true,
"availability_reason": null
}
],
"orderable": true,
"availability_reason": null
}
目录请求示例
API_BASE='https://ceoacc.com/api/v1'
API_KEY='sk_live_请替换为您的API_KEY'
curl "$API_BASE/catalog/accounts?limit=20&cursor=0" \
--header 'Accept: application/json' \
--header "Authorization: Bearer $API_KEY"
curl "$API_BASE/catalog/accounts/1001/selections?variant_key=%E7%BE%8E%E5%9B%BD&limit=20" \
--header 'Accept: application/json' \
--header "Authorization: Bearer $API_KEY"
curl "$API_BASE/catalog/social?limit=20&cursor=0" \
--header 'Accept: application/json' \
--header "Authorization: Bearer $API_KEY"
curl "$API_BASE/catalog/proxy" \
--header 'Accept: application/json' \
--header "Authorization: Bearer $API_KEY"
目录分页
账号和刷粉目录支持 limit(1–200)及 cursor。读取响应中的 meta.pagination.next_cursor;为 null 时表示已到末页。
"meta": {
"api_version": "v1",
"request_id": "示例请求ID",
"pagination": {
"limit": 100,
"next_cursor": 2100
}
}
统一下单
POSThttps://ceoacc.com/api/v1/orders
通过 JSON 字段 type 区分业务:account、social 或 proxy。下单需要对应的写权限。
Idempotency-Key 幂等规则
- 长度必须为 16–64 位,首字符为字母或数字,其余可使用字母、数字、点、下划线、冒号和短横线。
- 同一用户使用相同幂等键和完全相同的 JSON 重试,只返回原订单,不会重复购买。
- 相同幂等键配合不同 JSON 会返回
409 idempotency_conflict。 - 网络超时后先用原幂等键重试或按订单号查询;若状态为
upstream_pending,不要换新键重复下单。 - 账号或代理存在完全相同且未结束的请求时,换新键会返回
HTTP 422 pending_order_conflict;本次未创建新单、未扣款。请读取error.details.existing_order_id查询原单,不会将原单卡密当作本次新单的交付。
1. 账号商品
{
"type": "account",
"product_id": 1001,
"quantity": 2
}
product_id、数量范围和可选 variant_key 来自账号目录。无规格商品不要发送 variant_key。账号订单交付时(含已支持的分批发货),delivery 包含 product_id、quantity、variant_key 和仅属于当前代理的 accounts;无规格商品的 variant_key 为空字符串。本文档不展示任何卡密示例。
variant_key 必须逐字使用目录 variants[].key,并且购买数量不能超过该规格的 stock。自选购买
{
"type": "account",
"product_id": 1001,
"quantity": 1,
"variant_key": "美国",
"selection_token": "从 selections 接口取得的 items[].choice"
}
selection_token 与商品、规格、API Key 严格绑定且会过期。
请勿把公开预览字段当作卡密,也不要直接猜测库存 ID。自选加价只会在提交有效
selection_token 时计入;不带该字段就是普通购买。
2. 刷粉服务
{
"type": "social",
"service_id": 2104,
"url": "https://example.com/post/1",
"quantity": 100
}
Default:使用url和quantity。Package:仍传quantity,计费数量固定为 1。Custom Comments:仍需传一个正整数quantity,并额外传comments(每行一条);实际计费和范围校验以非空评论行数为准。Mentions/Comment Likes:额外传usernames。
3. 代理 IP
下单前可使用 POST/catalog/proxy/quote 获取实时站内余额价。该接口只读,需要 proxy:read,不需要 Idempotency-Key,不扣款也不创建订单。
curl --request POST 'https://ceoacc.com/api/v1/catalog/proxy/quote' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sk_live_请替换为您的API_KEY' \
--data '{"kind":"dedicated_ipv4","country":"us","period":30,"quantity":2}'
{
"success": true,
"data": {
"kind": "dedicated_ipv4",
"country": "us",
"period": 30,
"quantity": 2,
"amount": 1200,
"currency": "site_balance",
"price_locked": false,
"notice": "报价仅供购买前参考;创建订单时会重新计算并按当时金额扣款"
}
}
报价请求与代理下单使用相同参数规则:quantity 和 ip_list 必须且只能提交一种。如使用 ip_list,类型必须支持自选 IP,列表必须是 1–1000 个不重复的正整数 ID。price_locked=false 表示下单时会再次询价,实际扣款以下单当时为准。
{
"type": "proxy",
"kind": "dedicated_ipv4",
"country": "us",
"period": 30,
"quantity": 2
}
kind、国家、周期和数量必须使用目录实时返回值。对 supports_ip_selection=true 的类型,可先查询 IP;该查询单次最多返回 2000 项且当前不分页。下单时使用返回的正整数 ID 组成 ip_list 来替换 quantity,ID 不能重复且最多 1000 个。其他类型不要传 ip_list,仍需传 quantity:
{
"type": "proxy",
"kind": "dedicated_ipv4",
"country": "us",
"period": 30,
"ip_list": [90101, 90102]
}
代理续费
代理订单完成后,每个 delivery.items[] 会包含仅属于当前 API 用户的 renewal_token。先调用 /catalog/proxy/renew/quote 获取报价,再向 /orders/proxy/renew 提交相同凭证和周期;实际续费请求必须使用新的 Idempotency-Key,超时重试必须复用原值。一次最多续费同一订单中的 100 个代理。
curl --request POST 'https://ceoacc.com/api/v1/orders/proxy/renew' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sk_live_请替换为您的API_KEY' \
--header 'Idempotency-Key: proxy-renew-20260804-000001' \
--data '{"renewal_tokens":["pr1.请替换为交付中的续费凭证"],"period":30}'
完整 curl 示例
curl --request POST 'https://ceoacc.com/api/v1/orders' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sk_live_请替换为您的API_KEY' \
--header 'Idempotency-Key: social-20260723-000001' \
--data '{"type":"social","service_id":2104,"url":"https://example.com/post/1","quantity":100}'
订单查询与交付
订单列表
GET/orders?limit=50&before_id=9999&type=account
limit 为 1–100,默认 50;下一页使用 meta.pagination.next_before_id 作为新的 before_id。列表会根据已确认的本地交付和退款凭据同步账号订单状态;列表查询不重新向上游采购。type 可选 account、social 或 proxy。省略时只返回当前 Key 具有对应读取 Scope 的订单。
订单详情
GET/orders/DO2607230123456789ABCDEF
订单详情只允许当前 API Key 所属用户读取。完成后,不同业务会在 delivery 中返回账号交付、刷粉进度或代理连接信息。请将交付内容视为敏感数据并加密保存。
延迟发货、人工核对与重试规则
- 每笔下级业务订单先生成并持久保存唯一的
Idempotency-Key;同一业务订单的 JSON 和幂等键在超时、重启或断线后必须保持不变。 - HTTP 202 表示订单已受理但未结束。保存
data.id,调用GET /orders/{order_id}查询;可按 15、30、60 秒逐步降低查询频率,并遵守限流。人工核对可能需要平台工作人员在线处理,不能因本地等待超时自行判定失败、退款或换新键再次采购。 upstream_pending显示“等待发货”;reconciliation_pending显示“待平台核对”;refund_pending显示“退款处理中”。这些状态必须保存在下级数据库中,重启后继续查询,不能用永久失败标记停止后续状态同步。- 普通账号订单仅在
completed或seller_pending且存在有效delivery时交付;已声明fulfillment.mode=incremental的订单,按下方分批协议接收upstream_pending中的累计交付。refunded表示 CEOACC 已确认退回 API 账户余额,下级再按自己的原订单账本处理客户退款并防止重复入账。failed需结合错误码核对后处理。 - 若创建请求网络超时、返回 5xx 或未拿到
data.id,优先用原幂等键和原 JSON 重放;也可分页读取自己的GET /orders查找原单。meta.request_id是排障请求编号,不是业务订单号。 - 收到下述 422 时,先区分这是同一业务订单的重试,还是另一笔真正的新订单。原单的交付只属于原单,不得因拿到原单号就交付给本次新客户。本次拒绝确实未扣款,下级应按自己的新单流程处理或等待原单结束后再提交,不要自动换键循环采购。
- Bearer v1 当前没有订单取消接口,也不会把不确定的采购仅因超时自动取消。长时间未结束时,请向平台提供
existing_order_id、自己的幂等键和meta.request_id,不要提供 API Key。
相同参数待处理冲突(本次未扣款)
{
"success": false,
"error": {
"code": "pending_order_conflict",
"message": "相同商品已有待处理订单,本次未创建新订单且未扣款,请查询原订单",
"details": {
"existing_order_id": "DO2607230123456789ABCDEF",
"existing_status": "reconciliation_pending",
"new_order_created": false,
"charged": false,
"next_action": "query_existing_order",
"order_url": "/api/v1/orders/DO2607230123456789ABCDEF",
"poll_after_seconds": 15
}
},
"meta": { "api_version": "v1", "request_id": "示例排障请求编号" }
}
统一订单字段
{
"success": true,
"data": {
"id": "DO2607230123456789ABCDEF",
"type": "social",
"status": "processing",
"amount": 1200,
"currency": "site_balance",
"error": null,
"created_at": "2026-07-23 12:00:00",
"updated_at": "2026-07-23 12:00:01"
},
"meta": {
"api_version": "v1",
"request_id": "示例请求ID"
}
}
账号分批交付与发货检测同步(v1 扩展)
/api/v1。旧字段和订单状态保留;新增字段不会让旧客户端自动支持分批。接收端需要一次通用兼容升级。ACGV3 Shared、Dujiao-Next 和历史 username/password 协议不能直接套用本节。- 先请求
GET /api/v1,查看capabilities.account_incremental_delivery与capabilities.delivery_checks。 upstream_pending/ HTTP 202 也可能已经交付部分账户;读取delivery.accounts,不能只在 completed 时收件。delivery.accounts和delivery.items始终是当前累计结果,不是本次新增量。用delivery.items[].id去重,position从 0 开始对应delivery.accounts[position],只追加未保存的项目;同一 ID 内容不一致时停止自动处理。fulfillment.requested_quantity为原购买数量;delivered_quantity为累计已发;remaining_quantity为待发;is_final才表示交付结束。pending 期间不能因为数量少就退款或重新采购。- 最终少发:顶层仍为
completed(或 seller_pending),fulfillment.state=partial;已交付部分正常可用。全量未发且已全退则为refunded。 fulfillment.refunded_amount是本 API 买家已退到供货站余额的累计金额,单位与currency=site_balance相同,不是美元,也不是退款指令。下游退自己的客户时按自己原成交金额和少发比例计算,并使用本地幂等流水,不能直接照搬供货退款金额或每次查询重复加钱。- 每次查询使用同一订单号,按
poll_after_seconds(默认 15 秒)轮询;网络/429 异常退避。不可更换幂等键或重复 POST 订单。
{
"fulfillment": {
"version": 1,
"mode": "incremental",
"state": "partial",
"is_final": true,
"requested_quantity": 2000,
"delivered_quantity": 1800,
"remaining_quantity": 0,
"refunded_quantity": 200,
"refunded_amount": 1000,
"refund_currency": "site_balance",
"delivery_semantics": "cumulative",
"poll_after_seconds": 0
}
}
发货检测通过 delivery_check 返回,独立于交付状态:enabled、state=ready|pending|unsupported、summary,以及逐项 items[].delivery_item_id、line_no、status=live|die|unknown|pending、checked_at。同一交付项目可能包含多行,按项目 ID + 行号对应。未知/未检测不能当死亡。
只同步主站已有结果,分站无需重复查活,也不接收检测服务密钥。页面标注“检测于”时使用原 checked_at,不能把本次同步时间替换成检测时间;时间字段按 timezone=Asia/Shanghai 解读。结果为交付检测历史记录,不代表当前实时存活或保证登录。
delivery_check.state=pending 时继续查询,即使交付已 completed。enabled=false 或 unsupported 时隐藏发货检测。未开启的分类不会显示检测状态。
GET /orders/{order_id}?status_only=1 返回订单状态、累计数量/退款及检测结果,不返回 delivery、账户密码、Cookie 或 2FA。默认 GET 仍返回当前累计交付。订单列表只提供元数据,不包含卡密。
订单状态
| 状态 | 含义 | 建议 |
|---|---|---|
processing | 本站正在处理 | 稍后使用同一订单号查询 |
completed | 订单已完成 | 读取并安全保存 delivery |
seller_pending | 商品已交付,销售分成待补处理 | 交付可用;平台后台继续处理 |
upstream_pending | 外部连接发货中或结果待确认;可能已有部分交付 | 禁止换幂等键重复下单,继续查询 |
reconciliation_pending | 待平台核对,结果尚未结束 | 保存原单并继续查询,不自动退款或重购;联系平台提供订单号和 request_id |
failed | 未扣款或安全失败 | 检查 error 后决定是否用新键重下 |
refunded | 失败且已退款 | 核对余额后可按需重新下单 |
refund_pending | 退款待处理 | 不要重复下单,联系平台方核对 |
processing、upstream_pending、reconciliation_pending、refund_pending 和 seller_pending 返回 HTTP 202;其他已结束状态返回 HTTP 200。ACGV3 待处理订单由计划任务自动查询;没有可靠查询接口的其他连接在结果不确定时会等待管理员核对,期间禁止换 Key 重复下单。
账号查活 API
checker:read /
checker:write 权限。旧 Key 不会自动增加查活权限。
当前开放 Facebook UID 检测。只有取得可靠存活证据时才返回
live,其余返回 unknown;不会把网络异常猜成存活或失效。
1. 读取平台与限额
GET/checker/capabilities
返回当前支持的平台、单批上限、每分钟检测数量、结果保留天数和结果枚举。
当前平台为 facebook,检测对象必须是纯数字 UID。
2. 创建检测
POST/checker/checks
必须发送 16–64 位 Idempotency-Key。同一个检测超时重试时复用原键,
不会重复执行;同一幂等键配合不同内容会返回
409 idempotency_conflict。checker:write 允许读取本次创建请求的同步结果;
后续按编号查询仍需 checker:read。
curl --request POST 'https://ceoacc.com/api/v1/checker/checks' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sk_live_请替换为您的API_KEY' \
--header 'Idempotency-Key: checker-20260727-000001' \
--data '{"platform":"facebook","identifiers":["100000000000001","100000000000002"]}'
3. 查询检测结果
GET/checker/checks/{check_id}
{
"success": true,
"data": {
"check_id": "CK2607270123456789ABCDEF",
"platform": "facebook",
"status": "partial",
"submitted_count": 2,
"unique_count": 2,
"summary": {"live": 1, "dead": 0, "unknown": 1},
"results": [
{"position": 0, "identifier": "100000000000001", "status": "live"},
{"position": 1, "identifier": "100000000000002", "status": "unknown"}
]
}
}
live:本次取得了可信的存活证据。dead:为后续可靠失效检测预留;当前 Facebook 检测不会返回此值。unknown:远端限制、网络异常或页面结构无法可靠判断;应稍后重试,不能归入 live/dead。- 重复检测对象会按规范化值去重;
submitted_count是原数量,unique_count是实际检测数量。 - 普通
unknown建议采用指数退避重试;只有 HTTP 429 才按响应头Retry-After等待。 - 任务异常中断并超过处理时限后会变为
failed;确认失败后如需重试,请生成新的幂等键。 - 检测任务和明细默认保留 14 天,实际天数以 capabilities 返回值为准。
统一响应、错误与限流
成功响应
{
"success": true,
"data": {},
"meta": {
"api_version": "v1",
"request_id": "示例请求ID"
}
}
请求层失败响应
认证、权限、JSON、路由或幂等键格式等问题会返回 HTTP 4xx/5xx,并使用 success=false:
{
"success": false,
"error": {
"code": "invalid_json",
"message": "JSON 请求内容无效"
},
"meta": {
"api_version": "v1",
"request_id": "示例请求ID"
}
}
订单业务失败仍是订单响应
只要请求已通过基础校验并创建了订单记录,库存不足、余额不足、业务参数错误或上游明确拒绝等结果会返回 success=true;此时必须继续检查 data.status 和 data.error,不能只看 HTTP 200/202 或顶层 success。
{
"success": true,
"data": {
"id": "DO2607230123456789ABCDEF",
"type": "account",
"status": "failed",
"amount": 0,
"currency": "site_balance",
"error": {
"code": "insufficient_stock",
"message": "商品库存不足"
}
},
"meta": {
"api_version": "v1",
"request_id": "示例请求ID"
}
}
请同时记录 HTTP 状态码、订单 data.status、相应错误码和 meta.request_id。联系平台方排查时只提供订单号和 request_id,不要发送完整 API Key。
常见 HTTP 状态
| HTTP | 常见错误码 | 处理方式 |
|---|---|---|
| 400 | invalid_json、invalid_idempotency_key | 修正 JSON 或幂等键格式 |
| 401 | invalid_api_key、api_key_expired | 检查 Bearer 请求头或申请新 Key |
| 403 | insufficient_scope、ip_not_allowed、demo_mode | 核对权限、来源 IP 或站点模式 |
| 404 | endpoint_not_found、order_not_found | 核对路径和订单归属 |
| 409 | idempotency_conflict、order_busy、checker_busy | 保持原请求内容并稍后重试;检测忙时不要并发重放同一幂等键 |
| 413 / 415 | payload_too_large、unsupported_media_type | 缩小内容并使用 application/json |
| 422 | invalid_order_type、invalid_proxy_filter、invalid_proxy_quantity_choice、invalid_ip_list、unsupported_platform、invalid_identifiers、batch_too_large | 按实时目录或 capabilities 校验请求类型、筛选参数及检测对象;报价/代理下单只能传 quantity 或 ip_list 之一 |
| 422 | pending_order_conflict | 本次未创建新单、未扣款;按 error.details.existing_order_id 查询原单。HTTP 422 是已收到的业务响应,不是网络断线。 |
| 429 | rate_limit_exceeded、checker_concurrency_exceeded、checker_quota_exceeded | 按 Retry-After 延迟,并降低并发 |
| 500 / 503 | internal_error、proxy_downstream_disabled、provider_not_configured、quote_unavailable、checker_schema_not_ready、checker_runtime_unavailable、checker_disabled、checker_failed | 保留 request_id,指数退避后查询/重试;配置类错误请联系平台方 |
限流响应头包括 X-RateLimit-Limit、X-RateLimit-Remaining、X-RateLimit-Reset;超限时另有 Retry-After。
Dujiao-Next 上游协议兼容
API Key / API Secret。
USD。
balance、Product/SKU 的 price_amount、订单
amount、unit_price 和 total_price 均为美元金额;
响应中的 currency 字段返回 USD。
Dujiao-Next 会在“站点地址”后自动拼接兼容接口路径,因此连接管理中只填写本站根地址:
https://ceoacc.com
实际签名和请求使用的接口基地址为:
https://ceoacc.com/api/v1/upstream
成功响应统一包含 "ok": true;失败响应包含
"ok": false、error_code 和
error_message。
请求签名
每个请求必须携带以下三个 Header。时间戳为 Unix 秒,允许偏差 ±60 秒。
| Header | 内容 |
|---|---|
Dujiao-Next-Api-Key | 用户中心生成的 API Key |
Dujiao-Next-Timestamp | Unix 秒级时间戳 |
Dujiao-Next-Signature | 下面签名串的 HMAC-SHA256 小写十六进制结果 |
BODY_MD5 = md5(raw_request_body)
SIGN_STRING = METHOD + "\n" + PATH + "\n" + TIMESTAMP + "\n" + BODY_MD5
SIGNATURE = hex_lower(hmac_sha256(SIGN_STRING, API_SECRET))
METHOD 必须大写;PATH 包含
/api/v1/upstream,但不含域名和查询参数;MD5 必须基于实际发送的原始请求体。
GET 或无请求体时,使用空字符串的 MD5
d41d8cd98f00b204e9800998ecf8427e。
接口列表
| 方法 | 路径 | 用途 | Scope |
|---|---|---|---|
| POST | /ping | 连通性、美元余额和币种(USD) | balance:read |
| GET | /categories | 账号商品分类 | account:read |
| GET | /products?page=1&page_size=20 | 商品和 SKU 列表,价格为 USD;每页 1–100 条 | account:read |
| GET | /products/:id | 商品详情 | account:read |
| POST | /orders | 余额创建订单 | account:write |
| GET | /orders/:id | 查询状态和交付内容 | orders:read |
| POST | /orders/:id/cancel | 尝试取消;不满足安全取消条件时返回 409 | orders:read + account:write |
创建与查询订单
必须使用商品列表中 is_active=true 且库存可用的
skus[].id。创建订单必须提交全局唯一的
downstream_order_no;同一 API Key 下重复提交相同值会返回原订单,
网络超时重试时不能换值重复下单。
{
"sku_id": 1,
"quantity": 1,
"downstream_order_no": "your-order-202607290001",
"trace_id": "your-order-202607290001",
"callback_url": "https://your-dujiao.example/api/v1/upstream/callback"
}
{
"ok": true,
"order_id": 101,
"order_no": "API202607290001",
"status": "paid",
"amount": "9.90",
"currency": "USD"
}
保存返回的 order_id,并继续通过
GET /orders/:id 轮询作为回调失败时的兜底。完成后响应中的
fulfillment.payload 和
fulfillment.delivery_data.items 才是交付内容。
downstream_order_no;
提交 callback_url 时同样不能省略。回调地址只能是可公开访问的 HTTPS 地址,
不能使用 localhost、内网或保留地址。本站会使用同一 API Key / Secret 按上述规则
签名 POST 回调;接收端应按 order_id 和
downstream_order_no 幂等处理,并返回
{"ok":true,"message":"received"}。网络失败会退避重试,
但 Dujiao-Next 仍应轮询到 completed 或 canceled。
manual_form_data 仅接受空对象。
409 cancel_not_allowed。这能防止已发货后重复退款或重复交付。
安全与生产接入要求
- 仅通过 HTTPS 从服务端请求;此 API 不支持浏览器跨域预检,不要在 JavaScript、App 安装包或公开仓库中嵌入 Key。
- 为测试和生产使用不同 Key,并申请最小 Scope;能够固定出口 IP 时启用 IP/CIDR 白名单。
- Key 泄露时立即联系平台方撤销并换新。日志只记录 Key 前缀,绝不记录完整
Authorization请求头。 - 每个业务订单使用唯一幂等键;网络异常时不要盲目换键重下,先查询原订单。
- 账号卡密及代理账号密码均属于敏感交付数据,应加密保存、限制访问并设置合理保留期限。
- 请遵守适用法律、第三方平台规则和本站条款,不得将 API 用于欺诈、骚扰、侵权或其他违法用途。