API 参考
接口域名以部署环境为准,下文用
https://your-domain.com占位。鉴权方式分两类:
- 终端用户相关(换 token、拉项目表):
Authorization: Bearer <access_token>- 积分相关(查余额、充值、流水):由贵方 服务端 携带
X-API-Key调用,勿把 Key 下发到客户端
接口清单
| 方法 | 接口 | 路径 | 鉴权 |
|---|---|---|---|
| POST | 用 API Key 换取 Access Token | /api/v1/apihub/apikeys/token | X-API-Key |
| GET | 获取全部标签 | /api/v1/apihub/projects/published-tags | Bearer |
| GET | 按标签筛选项目表 | /api/v1/apihub/projects/published-list?tags= | Bearer |
| GET | 获取所有已发布项目表 | /api/v1/apihub/projects/published-list | Bearer |
| GET | 查询终端用户积分余额 | /api/v1/apihub/points/users/balance | X-API-Key |
| POST | 给终端用户充值积分 | /api/v1/apihub/points/users/recharge | X-API-Key |
| GET | 查询终端用户积分流水 | /api/v1/apihub/points/users/logs | X-API-Key |
用 API Key 换取 Access Token
POST /api/v1/apihub/apikeys/token
通过 X-API-Key 获取 Bearer access_token,后续业务接口均使用该 token。详见 鉴权。
请求头
| 名称 | 必填 | 说明 |
|---|---|---|
X-API-Key | 是 | 控制台生成的完整明文 Key(列表仅展示掩码) |
Content-Type | 是 | application/json |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
client_user_id | string | 是 | 终端用户唯一标识,token 将绑定该用户身份 |
curl -X POST "https://your-domain.com/api/v1/apihub/apikeys/token" \
-H "Content-Type: application/json" \
-H "X-API-Key: sk-xxxxxxxx" \
-d '{"client_user_id": "u_10001"}'成功响应
| 字段 | 类型 | 说明 |
|---|---|---|
data.access_token | string | 调用业务 API 的访问令牌 |
data.expires_in | number | token 过期秒数 |
{
"code": 200,
"message": "success",
"data": {
"access_token": "eyJhbGciOi...",
"expires_in": 7200
}
}注意
- API Key 须为 active、未过期,且属于 APIHub 用户。
client_user_id仅在本接口 Body 传入;后续 Bearer 请求无需再传。- 无效 / 禁用 / 过期 Key 返回 401。
获取全部标签
GET /api/v1/apihub/projects/published-tags
返回平台上已发布项目表使用的标签集合,已去重并排序。
curl "https://your-domain.com/api/v1/apihub/projects/published-tags" \
-H "Authorization: Bearer <access_token>"返回字段
| 字段 | 类型 | 说明 |
|---|---|---|
data.list | string[] | 标签数组 |
{
"code": 200,
"message": "success",
"data": {
"list": ["制造业", "供应链"]
}
}获取已发布项目表
GET /api/v1/apihub/projects/published-list
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
tags | string | 否 | 标签列表,英文逗号分隔;命中任一即返回,支持模糊匹配 |
limit | number | 否 | 返回数量上限。传 tags 时:匹配结果优先,不足部分自动从其他项目补足 |
# 全部
curl "https://your-domain.com/api/v1/apihub/projects/published-list?limit=20" \
-H "Authorization: Bearer <access_token>"
# 按标签筛选
curl "https://your-domain.com/api/v1/apihub/projects/published-list?tags=租房&limit=20" \
-H "Authorization: Bearer <access_token>"返回字段(data.list[])
| 字段 | 类型 | 说明 |
|---|---|---|
short_code | string | 当前表短链接码,用于 WebView 打开填表页 |
name | string | A 表为供给侧名,B 表为需求侧名 |
industry | string | 行业分类 |
icon | string | 项目图标 URL |
tags | string[] | 当前表标签 |
total | number | 本次返回的记录数 |
一条记录即一张表。在 APP WebView 打开填表页:
https://<表单域名>/{short_code}?token={access_token}short_code 与 token 均建议 URL 编码。完整说明见 快速接入。
查询终端用户积分余额
GET /api/v1/apihub/points/users/balance
由贵方 App 服务端携带 X-API-Key 调用,查询指定终端用户当前积分余额(与换 token 时使用的 client_user_id 一致)。
请求头
| 名称 | 必填 | 说明 |
|---|---|---|
X-API-Key | 是 | 开发者 API Key |
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
client_user_id | string | 是 | 终端用户唯一标识 |
curl "https://your-domain.com/api/v1/apihub/points/users/balance?client_user_id=u_10001" \
-H "X-API-Key: sk-xxxxxxxx"返回字段
| 字段 | 类型 | 说明 |
|---|---|---|
data.client_user_id | string | 终端用户 ID |
data.user_id | number | 平台内部 scoped 用户 ID |
data.balance_cents | number | 当前积分余额(单位:分,100 分 = 1 元展示价值) |
{
"code": 200,
"message": "success",
"data": {
"client_user_id": "u_10001",
"user_id": 123456789,
"balance_cents": 5000
}
}注意
- 开发者须先在控制台「充值」页为积分池充值,再通过充值接口给用户入账。
- 积分单位均为「分」,与表单扣费一致。
给终端用户充值积分
POST /api/v1/apihub/points/users/recharge
用户在贵方 App 完成支付后,由贵方服务端调用本接口:从开发者积分池扣减,并给该终端用户加积分。
请求头
| 名称 | 必填 | 说明 |
|---|---|---|
X-API-Key | 是 | 开发者 API Key |
Content-Type | 是 | application/json |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
client_user_id | string | 是 | 终端用户唯一标识 |
amount_cents | number | 是 | 充值积分(分),正整数。例如 1000 分 = 10 元面值 |
external_order_id | string | 否 | 贵方支付单号,便于对账 |
reason | string | 否 | 备注说明 |
curl -X POST "https://your-domain.com/api/v1/apihub/points/users/recharge" \
-H "Content-Type: application/json" \
-H "X-API-Key: sk-xxxxxxxx" \
-d '{
"client_user_id": "u_10001",
"amount_cents": 1000,
"external_order_id": "pay_20260408123456"
}'返回字段
| 字段 | 类型 | 说明 |
|---|---|---|
data.amount_cents | number | 本次充值积分 |
data.user_balance_cents | number | 用户充值后余额 |
data.developer_balance_cents | number | 开发者积分池剩余 |
data.external_order_id | string | 贵方支付单号(若传入) |
{
"code": 200,
"message": "success",
"data": {
"client_user_id": "u_10001",
"to_user_id": 123456789,
"amount_cents": 1000,
"external_order_id": "pay_20260408123456",
"developer_balance_cents": 90000,
"user_balance_cents": 6000
}
}典型流程
- 用户在 App 内完成支付
- 贵方支付回调确认成功
- 服务端调用本接口入账
注意
- 开发者积分池余额不足时返回 402,需先在控制台「充值」页为积分池充值。
- 与换 token、拉项目列表一样,本接口由贵方服务端调用,请勿把 API Key 下发到客户端。
查询终端用户积分流水
GET /api/v1/apihub/points/users/logs
查询指定终端用户的积分变动记录,包含用户充值入账、表单扣费、退款等。
请求头
| 名称 | 必填 | 说明 |
|---|---|---|
X-API-Key | 是 | 开发者 API Key |
查询参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
client_user_id | string | 是 | 终端用户唯一标识 |
page | number | 否 | 页码,默认 1 |
page_size | number | 否 | 每页条数,默认 20,最大 100 |
curl "https://your-domain.com/api/v1/apihub/points/users/logs?client_user_id=u_10001&page=1&page_size=20" \
-H "X-API-Key: sk-xxxxxxxx"返回字段(data.list[])
| 字段 | 类型 | 说明 |
|---|---|---|
source | string | transfer = 用户充值;billing = 表单扣费/退款 |
record_type | string | recharge 充值入账;deduct 扣费;refund 退款;reward 奖励;failed 扣费失败 |
change_cents | number | 对用户余额的变动:正数入账,负数出账 |
amount_cents | number | 变动绝对值(分) |
balance_after | number | 变动后余额(分) |
reason | string | 说明 |
short_code | string | 关联项目短码(扣费时可能有值) |
project_id | number | 关联项目 ID |
created_at | string | 记录时间 |
{
"code": 200,
"message": "success",
"data": {
"client_user_id": "u_10001",
"user_id": 123456789,
"list": [
{
"id": 42,
"source": "transfer",
"record_type": "recharge",
"change_cents": 1000,
"amount_cents": 1000,
"balance_after": 6000,
"reason": "用户充值(订单 pay_20260408123456)",
"status": "success",
"short_code": null,
"project_id": null,
"created_at": "2026-04-08T15:30:00Z"
},
{
"id": 18,
"source": "billing",
"record_type": "deduct",
"change_cents": -100,
"amount_cents": 100,
"balance_after": 5000,
"reason": "解锁查看详情",
"status": "success",
"short_code": "aB3kZ9",
"project_id": 12,
"created_at": "2026-04-08T14:20:00Z"
}
],
"total": 2,
"page": 1,
"page_size": 20
}
}展示给用户时可用 change_cents 正负区分入账 / 出账。
积分模型说明
平台采用两层积分:
- 开发者积分池:在 APIHub 控制台「充值」页为池子充值(模拟支付,1 元 = 100 积分)
- 终端用户积分:用户在你的 App 支付后,由你的服务端调用「给终端用户充值积分」接口,从池中划转到该用户
用户在表单内发布、解锁、抢单等操作时,扣的是终端用户自己的积分。
控制台还提供「积分管理」页,可手动查池余额、划转到用户、查看划转流水(控制台登录态操作,非开放 API)。
在线调试
API开放平台 控制台提供 接口测试 与 模拟器,可直接试跑以上接口;完整参数说明也可在控制台「文档 → API 文档」查看。