AI-bid CN
开发者

数据 API 文档

三个只读 / 写入接口,覆盖榜单查询、条目详情与竞价下单。所有金额字段单位为美分(integer),避免浮点误差。

版本 v1 · 最近更新:2026-09-10 · 基础地址 https://api.pubutang.cn/v1

Developers

Data API documentation

Three read / write endpoints covering leaderboard queries, item detail, and bid creation. All monetary fields are integers in minor units (cents) to avoid floating-point error.

Version v1 · Updated 2026-09-10 · Base URL https://api.example.com/v1

当前状态:规范草案。本站为演示版本,尚未开放真实 API 服务。以下接口定义可直接用于对接评估,正式上线前不会发生重大变更。

一、快速开始

所有请求使用 HTTPS,响应格式为 JSON,字符集 UTF-8。时间戳均为 Unix 秒级整数,金额均为(integer)。

bash
curl https://api.pubutang.cn/v1/leaderboard?category=seo&limit=10 \
  -H "Authorization: Bearer pt_live_xxxxxxxxxxxx"

二、鉴权

商家中心创建 API Key,通过 Authorization 头传递。Key 分为 pt_live_(生产)与 pt_test_(沙箱)两种前缀,沙箱环境不产生真实扣款。

权限范围说明适用接口
read只读榜单与条目接口 1、2
write创建竞价订单接口 3
stats读取自有条目曝光数据接口 2 扩展字段

API Key 等同于付款凭证,请仅存放于服务端,切勿写入前端代码、小程序包或 Git 仓库。

三、接口 1 · 榜单查询

GET /v1/leaderboard — 分页返回指定榜单的条目列表。

参数类型必填说明
categorystring分类 key,默认 all
periodstringall / today,默认 all
limitinteger1–100,默认 50
cursorstring游标分页,取上一页 next_cursor
json
{
  "code": 0,
  "data": {
    "total": 2705,
    "next_cursor": "eyJvIjoxMDB9",
    "items": [
      {
        "id": "itm_8fJ2kQ",
        "rank": 1,
        "name": "Outrank · AI 自动化 SEO 流量",
        "desc": "用 AI 自动优化你的 SEO",
        "category": "seo",
        "amount_cents": 1300500,
        "url": "https://example.com",
        "ad_label": "广告",
        "created_at": 1757000000
      }
    ]
  }
}

四、接口 2 · 条目详情

GET /v1/items/{id} — 返回单个条目的完整信息。带 stats 权限时额外返回自有条目的曝光与点击数据。

json
{
  "code": 0,
  "data": {
    "id": "itm_8fJ2kQ",
    "rank": 1,
    "amount_cents": 1300500,
    "next_bid_cents": 1313505,  // 超越本名次所需最低金额
    "category": "seo",
    "status": "active",     // active | reviewing | removed
    "impressions": 12840,
    "clicks": 847
  }
}

五、接口 3 · 创建竞价

POST /v1/claims — 对目标名次下单,返回支付二维码地址。订单 15 分钟内未支付自动关闭。

bash
curl -X POST https://api.pubutang.cn/v1/claims \
  -H "Authorization: Bearer pt_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","target_rank":3,"category":"seo","period_days":30}'
字段类型必填说明
urlstring目标网址,会被归一化处理
target_rankinteger目标名次,1–1000
categorystring分类 key
period_daysinteger展示周期,默认 30

成功响应返回 order_idamount_centspay_url(MoR 收单商结账页)与 expires_at。支付结果通过 webhook 回调通知,回调签名算法为 HMAC-SHA256,签名放在 X-PT-Signature 头。

六、错误码

HTTPcode含义处理建议
4001001参数缺失或格式错误检查字段类型
4012001API Key 无效或已吊销重新签发 Key
4032003权限范围不足申请对应 scope
4033005内容未通过机检(违禁词 / 黑名单)修改描述后重试
4033006类目需前置资质上传资质
4094001名次已被抢占重新查询后按新金额下单
4295001触发限流Retry-After 退避
5009001服务内部错误携带 request_id 提交工单

七、限流与配额

接口类型默认配额突发上限
只读接口60 次 / 分钟120
写入接口10 次 / 分钟20
Webhook 重试失败后按 1 / 5 / 30 / 120 分钟退避,共 4 次

响应头 X-RateLimit-RemainingX-RateLimit-Reset 实时反映配额状态。需要更高配额请通过工单申请。

Current status: draft specification. This is a demonstration build and no live API is open yet. The definitions below are stable enough for integration scoping; no breaking changes are planned before launch.

1. Quick start

All requests use HTTPS. Responses are JSON, charset UTF-8. Timestamps are Unix seconds (integer); all amounts are integers in minor units (cents, 1/100 USD).

bash
curl https://api.example.com/v1/leaderboard?category=seo&limit=10 \
   -H "Authorization: Bearer pt_live_xxxxxxxxxxxx"

2. Authentication

Create an API key in the Merchant Center and pass it in the Authorization header. Keys come in two prefixes: pt_live_ (production) and pt_test_ (sandbox). The sandbox never charges real money.

ScopeWhat it allowsApplies to
readRead-only leaderboard and itemsEndpoints 1, 2
writeCreate bid ordersEndpoint 3
statsRead impression data for your own itemsEndpoint 2 extended fields

An API key is equivalent to payment credentials. Keep it server-side only — never in front-end code, a client bundle, or a Git repository.

3. Endpoint 1 · List leaderboard

GET /v1/leaderboard — returns a paginated list of entries for the given board.

ParameterTypeRequiredNotes
categorystringNoCategory key; defaults to all
periodstringNoall / today; defaults to all
limitintegerNo1–100; defaults to 50
cursorstringNoCursor pagination; pass the previous page's next_cursor
json
{
  "code": 0,
  "data": {
    "total": 2705,
    "next_cursor": "eyJvIjoxMDB9",
    "items": [
      {
        "id": "itm_8fJ2kQ",
        "rank": 1,
        "name": "Outrank · AI-driven SEO traffic",
        "desc": "Automate your SEO with AI",
        "category": "seo",
        "amount_cents": 1300500,
        "url": "https://example.com",
        "ad_label": "Ad",
        "created_at": 1757000000
      }
    ]
  }
}

4. Endpoint 2 · Item detail

GET /v1/items/{id} — returns full information for a single item. With the stats scope it additionally returns impressions and clicks for your own items.

json
{
  "code": 0,
  "data": {
    "id": "itm_8fJ2kQ",
    "rank": 1,
    "amount_cents": 1300500,
    "next_bid_cents": 1313505,  // minimum amount to take this rank
    "category": "seo",
    "status": "active",     // active | reviewing | removed
    "impressions": 12840,
    "clicks": 847
  }
}

5. Endpoint 3 · Create a bid

POST /v1/claims — places an order for a target rank and returns a checkout URL. Unpaid orders close automatically after 15 minutes.

bash
curl -X POST https://api.example.com/v1/claims \
   -H "Authorization: Bearer pt_live_xxxxxxxxxxxx" \
   -H "Content-Type: application/json" \
   -d '{"url":"https://example.com","target_rank":3,"category":"seo","period_days":30}'
FieldTypeRequiredNotes
urlstringYesTarget URL; normalised server-side
target_rankintegerYesTarget rank, 1–1000
categorystringYesCategory key
period_daysintegerNoDisplay period; defaults to 30

A successful response returns order_id, amount_cents, pay_url (the merchant-of-record checkout URL), and expires_at. Payment outcome is delivered by webhook, signed with HMAC-SHA256 in the X-PT-Signature header.

6. Error codes

HTTPcodeMeaningSuggested handling
4001001Missing or malformed parameterCheck field types
4012001API key invalid or revokedIssue a new key
4032003Insufficient scopeRequest the matching scope
4033005Content failed automated screening (prohibited words / blacklist)Revise the description and retry
4033006Category needs a prior licenceUpload the licence
4094001Rank already takenRe-query, then order at the new amount
4295001Rate limitedBack off per Retry-After
5009001Internal server errorOpen a ticket with the request_id

7. Rate limits & quotas

Endpoint typeDefault quotaBurst ceiling
Read endpoints60 / minute120
Write endpoints10 / minute20
Webhook retriesOn failure, retry after 1 / 5 / 30 / 120 minutes — 4 attempts in total

The X-RateLimit-Remaining and X-RateLimit-Reset response headers reflect quota status in real time. For a higher quota, open a ticket.