把订单、服务、账单与工单接进你自己的系统。客户只读接口取数,服务商接口按 scope 读写;所有响应结构一致,排障只需一个 request_id。
krisp_cu_…客户密钥当前为受控开放:需联系客服开通后发放,会员中心的自助创建入口尚未开放。密钥仅提供读取权限,明文只显示一次。
Authorization: Bearer <key>
X-Api-Key: <key>
krisp_…平台/服务商密钥由管理员在后台「开放接口」创建,按 scope 授权,可读可写(写操作必须带幂等键)。
Authorization: Bearer <key>
X-Api-Key: <key>
成功与失败使用同一层结构,code=0 表示成功;HTTP 状态码与 code 一致。
{
"code": 0,
"msg": "ok",
"data": [],
"request_id": "本次请求 ID"
}
{
"code": 403,
"msg": "错误说明",
"data": null,
"request_id": "本次请求 ID"
}
| HTTP | 含义 |
|---|---|
401 | 密钥缺失、无效、已停用或已过期 |
403 | 密钥有效,但没有该接口所需的 scope |
404 | 动作 / 资源 / 单据不存在 |
405 | 请求方法不允许(客户接口仅支持 GET) |
429 | 超过速率限制,请降低频率后重试 |
入口 /api/customer_openapi.php,仅支持 GET;
速率 120 次 / 分钟 / 密钥;分页 page 默认 1;per 默认 50,最大 100。
| action | 说明 | 所需 scope | 参数 | 返回 |
|---|---|---|---|---|
account |
企业账户摘要 | profile.read |
无 | account{username, company, contact, email, status, created_at} |
services |
服务实例列表 | services.read |
page、per | items[]{id, order_id, server_id, name, status, os, ip_main, rdns, created_at, updated_at}、page、per、total |
orders |
订单列表 | orders.read |
page、per | items[]{id, plan, ips, amount, status, created_at, expires_at}、page、per、total |
invoices |
发票列表 | finance.read |
page、per | items[]{id, order_id, title, tax_no, amount, kind, status, created_at}、page、per、total |
tickets |
工单列表 | tickets.read |
page、per | items[]{id, subject, status, priority, category, created_at, updated_at, last_reply_at}、page、per、total |
curl -H "Authorization: Bearer krisp_cu_xxx" "https://你的域名/api/customer_openapi.php?action=orders&page=1&per=20"
curl -H "X-Api-Key: krisp_cu_xxx" "https://你的域名/api/customer_openapi.php?action=account"
入口 /api/openapi.php;查询参数:resource(必填,或填 me 自检)、id、kw、status、page(默认 1)、limit(默认 20,最大 200)。
| resource | 所需 scope | 说明 |
|---|---|---|
orders | orders.read | 订单;支持 id 精确查询 |
customers | customers.read | 客户;支持 kw 模糊搜索 |
products | products.read | 商品与价格 |
tickets | tickets.read | 工单;支持 status 过滤 |
invoices | invoices.read | 发票 |
finance | finance.read | 交易流水 |
| action | 所需 scope | 请求体 | 说明 |
|---|---|---|---|
orders.create |
orders.write |
product_id、cycle(month/quarter/year)、customer_id(代客下单时必填) | 创建待支付订单;受 KYC 与库存闸门约束 |
orders.approve |
orders.write |
id(订单号) | 审核通过订单 |
customers.upsert |
customers.write |
username(必填)、company、contact、email、phone | 按 username 新建或更新客户 |
写操作必须带 X-Idempotency-Key(≤ 80 字符);缺省时按「密钥 + 动作 + 请求体」哈希兜底,重复提交返回首次结果。
curl -H "Authorization: Bearer krisp_xxx" "https://你的域名/api/openapi.php?resource=orders&limit=20"
curl -X POST -H "Authorization: Bearer krisp_xxx" -H "X-Idempotency-Key: req-20261109-001" -H "Content-Type: application/json" -d '{"product_id":1,"cycle":"month","customer_id":3}' "https://你的域名/api/openapi.php?action=orders.create"
| scope | 说明 |
|---|---|
profile.read | 企业账户摘要 |
services.read | 服务实例 |
orders.read | 订单 |
finance.read | 发票与交易 |
tickets.read | 工单 |
服务商写入 scope:orders.write(建单 / 审核)、customers.write(新建 / 更新)。写入需显式勾选,且必须带幂等键。