跳至文档正文
DEVELOPER PLATFORMIntegration V1

BUILT FOR PARTNER INTEGRATIONS

Connect with confidence.

通过清晰的 API 合同接入保单审核。提交、查询与报告由博险通权威审核流程控制。

OpenAPI 3.1TypeScript SDK 0.1.0Webhook V1 协议
技术文档与 SDK 下载

本页面提供合作伙伴技术规范与SDK下载。页面可访问不代表正式Partner API、Webhook投递或在线Sandbox已对外开通。生产接入地址、API Key、展会授权及Webhook订阅均需平台另行审核与开通。Production Sandbox及在线Try It当前未开放。

01 / ACCESS

Authentication & authorization

每次请求使用 Bearer Partner API Key。平台另行审核与开通后,通过受控渠道提供 Live 地址、凭据、API Scope 与公开展会 ID;Bearer 身份不代表可以访问所有展会。

Live

正式接入需单独授权,Live Key 不会因页面可访问而签发。获准后使用显式 HTTPS baseURL 与 Live Key;结果由正式 Core 决定。不要在浏览器或共享日志保存完整凭据。

Local Sandbox

独立的 127.0.0.1:55880 运行时与临时 Test Key。无正式数据库、OSS 或模型调用;模拟 PASS 不是保险审核凭证。

资源属于原 Application;每次读取和报告下载都会复核当前 API/展会 Scope 与原审核版本有效性。Key 撤销、主体停用或授权变化可能使原资源不可访问。

02 / CONTRACT

Five focused endpoints

只有以下 Integration V1 接口属于公开规范。Webhook 订阅需平台单独审核与开通,本次首发不开放真实 Webhook 投递。

POST/api/integration/v1/reviews

提交 PDF 审核

Required scope: review.submit

multipart/form-data:file(application/pdf,.pdf 文件名,最多2MiB)、exhibitionId、companyName、contactName、phone;email可选。必须携带Idempotency-Key。

Response status codes

200 · 201 · 202 · 400 · 401 · 403 · 404 · 409 · 413 · 415 · 429 · 503 · 504

GET/api/integration/v1/reviews/{publicId}

查询原审核资源

Required scope: review.read

使用公开资源ID;成功响应为strict External DTO。

Response status codes

200 · 401 · 403 · 404 · 429 · 503

GET/api/integration/v1/reviews/{publicId}/report

下载当前可用报告

Required scope: report.read

报告未就绪或原版本变化返回409;成功返回application/pdf。

Response status codes

200 · 401 · 403 · 404 · 409 · 429 · 503 · 504

GET/api/integration/v1/exhibitions

列出已授权展会

Required scope: exhibition.read

limit 1–50,默认20;nextCursor为opaque cursor,传回cursor继续分页。

Response status codes

200 · 400 · 401 · 403 · 429 · 503

GET/api/integration/v1/exhibitions/{id}

查询已授权展会

Required scope: exhibition.read

使用公开资源ID;成功响应为strict External DTO。

Response status codes

200 · 401 · 403 · 404 · 429 · 503

03 / RESULTS

Separate transport from decision.

accepted→processing→completed / error

HTTP 200/201/202 代表请求处理状态,不代表审核通过。completed 的 decision 可以是 passed、failed、needs_manual_review、manual_passed 或 manual_failed;failed 是业务结果。error 资源已终结,不会自动重新审核。

{
  "state": "completed",
  "decision": "needs_manual_review",
  "reportAvailable": true
}

以上是字段说明片段,不是完整 DTO。获取完整资源并检查 reportAvailable 后再下载报告。

04 / RELIABILITY

One request. One stable key.

首次提交前保存 Idempotency-Key。重试时保持原 Key、元数据、PDF bytes 和 Application;文件名不参与身份指纹。不同内容复用同 Key 返回409。

SDK 默认不自动重试 POST,尤其不会因503/504换 Key 创建新审核。处理结果不确定时查询原资源,或在原 Key/原内容条件下安全重放。

import { readFile } from 'node:fs/promises';
import { BxtIntegrationClient, IntegrationSdkError, type SubmitInput } from '@bxt/integration-sdk';

const fixturePath = process.argv[2];
if (!fixturePath) throw new Error('Pass the private local fixture path');
const fixture = JSON.parse(await readFile(fixturePath, 'utf8'));
const client = new BxtIntegrationClient({
  environment: 'sandbox',
  baseURL: 'http://127.0.0.1:55880',
  credentialProvider: () => fixture.credential,
});
const key = crypto.randomUUID(); // 保存这次提交的 key,重试时复用
const input: SubmitInput = {
  exhibitionId: fixture.exhibitionId,
  companyName: 'sandbox:passed', contactName: 'Synthetic',
  phone: '13900000000', email: 'synthetic@partner.invalid',
  file: new Blob(['%PDF-1.4\nSynthetic input only\n%%EOF'], { type: 'application/pdf' }),
};
try {
  const review = await client.submitReview(input, key);
  const replay = await client.submitReview(input, key);
  if (replay.id !== review.id) throw new Error('Idempotency mismatch');
  const current = await client.getReview(review.id);
  // HTTP成功与审核决定分别处理
  if (current.state === 'completed' && current.reportAvailable) {
    await client.getReport(current.id);
  }
  await client.getExhibition(fixture.exhibitionId);
  let cursor: string | undefined;
  do {
    const page = await client.listExhibitions({ limit: 20, cursor });
    cursor = page.nextCursor ?? undefined;
  } while (cursor);
} catch (error) {
  if (error instanceof IntegrationSdkError) {
    console.error(error.code, error.status, error.requestId);
  } else {
    console.error('LOCAL_EXAMPLE_FAILED');
  }
  process.exitCode = 1;
}
// 遇到503/504,不要换key重新审核;查询原资源或同key/同内容重放。
const review = await client.getReview(publicReviewId);
// accepted / processing → 保留原ID,按Retry-After等待并查询。
// completed → 根据decision处理;failed不是HTTP失败。
// error → 原请求已终结,不自动重新审核。
if (review.reportAvailable) await client.getReport(review.id);

05 / LIMITS

Errors you can act on.

错误 envelope 含 code、固定 message、requestId;响应头含 X-Request-Id。每个请求受 Application request rate 约束,仅首次新建资源消耗 new-review quota。

HTTPCodeMessage
401AUTH_INVALIDAPI凭据无效。
401AUTH_REVOKEDAPI凭据已撤销。
401AUTH_EXPIREDAPI凭据已过期。
403PARTNER_DISABLED合作方已停用。
403APPLICATION_DISABLED应用已停用。
403SCOPE_DENIED缺少所需API权限。
403EXHIBITION_NOT_ALLOWED无权提交到该展会。
404EXHIBITION_NOT_FOUND展会不存在或不可访问。
409EXHIBITION_CLOSED该展会当前不接受提交。
400VALIDATION_ERROR请求格式或字段无效。
413FILE_TOO_LARGEPDF文件或请求超出限制。
415FILE_INVALID请上传有效PDF文件。
409IDEMPOTENCY_CONFLICT该幂等键已用于不同请求。
429RATE_LIMITED请求过于频繁。
429REVIEW_QUOTA_EXHAUSTED新审核额度不足。
404REVIEW_NOT_FOUND审核资源不存在或不可访问。
409REPORT_NOT_READY报告当前不可用。
503SERVICE_UNAVAILABLE服务暂不可用。
504PROCESSING_TIMEOUT处理超时。

429/503若提供Retry-After,使用有界等待;不会因此自动重审。支持Request ID关联排查,不记录凭据或PDF原文。

try {
  await client.getReview(publicReviewId);
} catch (error) {
  if (error instanceof IntegrationSdkError) {
    // 只记录code/status/requestId,避免记录credential或原始response。
    recordSafeError(error.code, error.status, error.requestId);
    // 429按有界Retry-After等待;503/504不自动重提POST。
  }
}

06 / EVENTS

Verify bytes. Deduplicate events.

Webhook V1 仅作为协议能力展示,本次首发不开放真实 Webhook 投递。将来完成单独开通与验收后,review.completed 与 review.decision.updated 的 payload 为不可变 External DTO snapshot,稳定 Event ID 用于去重;at-least-once 仅描述正式启用后的投递语义。

X-BXT-Webhook-Id: <EVENT_ID>
X-BXT-Webhook-Timestamp: <UNIX_SECONDS>
X-BXT-Webhook-Signature: v1,kid=<VERSION>,sha256=<HEX>

HMAC-SHA256(eventId + "." + timestamp + "." + exactBodyBytes)

将来正式启用后,接收方须先按kid与±300秒窗口验签原始body bytes,确认body.id与header一致,再在业务事务内按Event ID原子去重。不要parse/re-serialize后验签。前版本密钥只在最多5分钟overlap内有效;旧sourceSequence晚到不得回退新决定。

下载 Node.js 验签示例 ↗

07 / TOOLING

A typed foundation.

SDK 包含从本地 OpenAPI 1.0.0 生成的 TypeScript 类型,以及独立的fetch调用封装。支持timeout、AbortSignal、五个接口、binary report与typed errors;无独立审核逻辑。

npm install ./bxt-integration-sdk-0.1.0.tgz
// 不要手工修改生成DTO。应用代码只保留credentialProvider。

SDK 0.x 与合同版本分开治理;新增兼容字段须重新生成并验证,breaking change 需新版本与迁移说明。

08 / ISOLATION

Sandbox is a separate runtime.

Production Sandbox 未开放 · Try It 关闭

没有可执行的在线入口或凭据输入框。接入测试只在显式启动的本地合成运行时进行,不通过Header/Query/Host/Cookie切换正式Core。

pnpm run sandbox:build
pnpm run sandbox:local -- --local-synthetic
# 凭据仅写入临时私有fixture文件,不打印Key。
# 使用SDK environment: 'sandbox',baseURL: http://127.0.0.1:55880

合成场景通过companyName选择:sandbox:accepted、processing、passed、failed、needs-manual-review、manual-passed、manual-failed、processing-error、rate-limited。模拟状态可由本地fixture控制;不是正式保单审核。重启清除数据和凭据。

下载 Node.js 本地接入示例 ↗