获取流程
警告
在获取流程之前,请查看我们的 webhook 配置和回退策略——点击此处。
在 API 合约中,POST /processes/v1 的响应已包含最终结果。此端点用于重新查询——例如,当您需要检索之前保存的流程,或对历史事务进行审计时。
端点
| 环境 | URL |
|---|---|
| 生产环境 | GET https://api.id.unico.app/processes/v1/{processId} |
| 沙盒环境 | GET https://api.id.uat.unico.app/processes/v1/{processId} |
请求
请求头
| 请求头 | 值 |
|---|---|
Authorization | Bearer <access_token> |
APIKEY | 已配置的 API 密钥。 |
路径参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
processId | string (UUID) | 是 | 由创建流程返回的流程标识符。 |
示例
- cURL
- Node.js
curl -X GET https://api.id.unico.app/processes/v1/$PROCESS_ID \
-H "Authorization: Bearer $TOKEN" \
-H "APIKEY: $API_KEY"
import fetch from 'node-fetch';
const res = await fetch(
`https://api.id.unico.app/processes/v1/${processId}`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
APIKEY: apiKey
}
}
);
const result = await res.json();
响应
200 OK
{
"id": "80371b2a-3ac7-432e-866d-57fe37896ac6",
"status": 3,
"unicoId": { "result": "yes" },
"identityFraudsters": { "result": "inconclusive" },
"government": { "serpro": 87 },
"liveness": 1
}
| 字段 | 类型 | 描述 |
|---|---|---|
id | string (UUID) | 流程标识符。 |
status | integer | 1(处理中)、2(存在差异)、3(成功完成)、4(已取消)、5(错误)。 |
unicoId.result | string | yes、no、inconclusive——参见身份验证。 |
identityFraudsters.result | string | yes、inconclusive——参见风险欺诈分类。 |
government.serpro | integer | Serpro 相似度评分(0–100、-1、-2)。参见 Serpro 相似度。 |
liveness | integer | 1(通过)、2(未通过)——参见活体检测。 |
score | integer | 概率风险评分。当 unicoId.result = inconclusive 且风险评分编排处于激活状态时出现。正值表示是持有人的概率较高;负值表示风险较高。 |
400 Bad Request
processId 路径参数缺失或格式不正确。请参见下方错误代码。
403 Forbidden
Bearer token 或 APIKEY 缺失、已过期或无效。
404 Not Found
processId 不存在或不属于已认证的租户。
410 Gone
流程存在但发生错误。仅返回 id 和 status: 5。
429 Too Many Requests
已达到速率限制。参见速率限制。
500 Internal Server Error
意外的服务器错误。
何时使用此端点
API 合约以同步方式返回结果,因此大多数集成无需使用此端点。在以下情况下使用:
- 您仅保存了
processId,需要在之后检索完整结果(用于审计或支持)。 - 您怀疑原始响应在传输过程中丢失(平台完成工作后发生网络错误)。
- 您正在构建一个用于查看历史流程的后台工具。
错误代码
- 400 Bad Request
- 404 Not Found
- 403 Forbidden
- 410 Gone
- 500 Internal Server Error
| 代码 | 消息 | 描述 |
|---|---|---|
20023 | O parâmetro processId não foi informado. | 缺少 process id 参数。 |
20002 | O parâmetro APIKey não foi informado. | 请求头中缺少 APIKEY 参数。 |
20001 | O parâmetro authtoken não foi informado. | 请求头中缺少集成 token 参数。 |
| 代码 | 消息 | 描述 |
|---|---|---|
50001 | O processo informado não foi encontrado. | 数据库中不存在该流程。 |
| 代码 | 消息 | 描述 |
|---|---|---|
30017 | User does not have permission to perform this action. | JWT 格式错误或用户无权执行此操作。 |
10502 | O token informado está expirado. | 使用的 access-token 已过期。 |
10501 | O token informado é inválido. | 身份验证 token 无 效。 |
10201 | O AppKey informado é inválido. | APIKEY 参数未填写或不存在。 |
流程存在但发生错误。仅返回 id 和 status: 5。
| 代码 | 消息 | 描述 |
|---|---|---|
99999 | Internal failure! Try again later | 发生内部错误。 |