跳转到主要内容

创建流程

该端点处理两种用例,它们共享相同的路径,但在请求体参数、功能和响应字段上有所不同:

  • Onboarding — 通过将用户面部与 Unico 的身份数据库进行比对来验证用户身份(需要 subject.code)。
  • Transactional — 通过面对面比对来验证与之前流程是否为同一人(需要 referenceProcessId 或包含自拍/流程 ID 的 references 数组)。

激活的用例由请求头中发送的 APIKEY 决定。

完整集成流程请参阅 API 概览

端点

环境URL
生产环境POST https://api.id.unico.app/processes/v1
沙盒环境POST https://api.id.uat.unico.app/processes/v1

请求

请求头
请求头
AuthorizationBearer <access_token>(参见身份验证
APIKEY已配置的 API 密钥——定义激活的用例和启用的能力。
Content-Typeapplication/json
请求体参数
字段类型必填描述
subject.codestringCPF(巴西)或 CURP(墨西哥)。
subject.namestring全名。
subject.genderstringMF
subject.birthDatestring (ISO 8601)出生日期(YYYY-MM-DD)。
subject.emailstring电子邮件地址。
subject.phonestringE.164 格式电话号码。
useCasestring操作上下文,例如 Onboarding
imageBase64string前端采集的自拍图像,base64 格式。
图像要求
  • 最低分辨率:640 × 480(HD 标准)
  • 最大文件大小:800 KB(推荐使用 JPEG92 压缩)
  • 支持格式:PNG、JPEG、WebP
  • SDK 生成的 JWT 令牌在 10 分钟后过期,且只能使用一次

示例

curl -X POST https://api.id.unico.app/processes/v1 \
-H "Authorization: Bearer $TOKEN" \
-H "APIKEY: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": {
"code": "12345678909",
"name": "Luke Skywalker",
"gender": "M",
"birthDate": "2000-05-20",
"email": "[email protected]",
"phone": "5519725570707"
},
"useCase": "Onboarding",
"imageBase64": "/9j/4AAQSkZJR..."
}'

响应

200 OK
{
"id": "80371b2a-3ac7-432e-866d-57fe37896ac6",
"status": 3,
"unicoId": { "result": "yes" },
"identityFraudsters": { "result": "inconclusive" },
"government": { "serpro": 87 },
"liveness": 1
}
字段类型描述
idstring (UUID)流程标识符。与获取流程配合使用可进行二次查询。
statusinteger1(处理中),3(成功完成),5(错误)。所有可能的值请参阅获取流程
unicoId.resultstringyesnoinconclusive——参见身份验证
identityFraudsters.resultstringyesinconclusive——参见欺诈风险分类
government.serprointegerSerpro 相似度评分(0–100、-1、-2)。参见Serpro 相似度返回
livenessinteger1(通过),2(失败)——参见活体检测
信息

unicoId.result = inconclusive 且欺诈风险分类编排处于激活状态时,流程可能返回 status: 1(处理中)。请轮询获取流程或使用 webhook 获取最终结果。

400 Bad Request

请求体格式错误、图像无效或缺少必填字段。参见下方错误代码

403 Forbidden

Bearer 令牌或 APIKEY 缺失、已过期或无效。参见身份验证

409 Conflict

提供的 processId 在此租户中已存在。参见下方错误代码

429 Too Many Requests

已达到速率限制。请在 Retry-After 响应头指示的时间间隔后重试。参见速率限制

错误代码

代码消息描述
20900O base64 informado não é válido.base64 参数无效。可能原因:不是图像或是注入攻击。
20807A imagem precisa estar no padrão HD ou possuir uma resolução superior a 640 x 480.上传图像的分辨率过低。
20513The referenced process was not found.referenceProcessId 指向的流程不存在或不再可访问。
20512The referenced process is not available for reuse.引用的流程存在但不可用于复用。
20509The subject.name field is invalid.subject.name 包含无效字符。
20508The subject.gender field is invalid.subject.gender 必须为 MF
20507O parâmetro subject.code é inválido.CPF 格式非标准或不存在。
20506O base64 informado é muito grande. O tamanho máximo suportado é até 800kb.图像大小超过 800 KB;请压缩为 JPEG92。
20505O base64 informado não é suportado. Os formatos aceitos são png, jpeg e webp.base64 格式无效或不支持。
20065The referenceProcessId field is invalid.referenceProcessId 不是有效的 UUID。
20062The useCase field is invalid.useCase 字段中的值无法识别。
20024The referenceProcessId field is missing.未提供 referenceProcessId 参数,且未以 references 作为替代方案发送。
20021The subject.phone field is invalid.subject.phone 格式无效(国际区号 + 区号 + 号码,共 13 位字符)。
20019The subject.birthDate field is invalid.subject.birthDate 不符合 ISO 8601 格式(YYYY-MM-DD)。
20009O parâmetro imagebase64 não foi informado.缺少自拍图像参数。
20008The subject.email field is invalid.subject.email 中的邮箱格式无效。
20006O parâmetro subject.name não foi informado.缺少 subject.name 参数。
20005O parâmetro subject.code não foi informado.缺少 subject.code 参数。
20004O parâmetro subject não foi informado.缺少 subject 参数。
20003The request body is missing or invalid.负载为空或无效。
20002O parâmetro APIKey não foi informado.请求头中缺少 APIKEY 参数。
20001O parâmetro authtoken não foi informado.请求头中缺少集成令牌参数。
10508The JWT with the captured face has already been used.JWT 只能使用一次。
10507The JWT with the captured face is expired.JWT 已过期;必须在 10 分钟内发送。
10506The imageBase64 field is not a valid JWT from SDK.imageBase64 不是 SDK 生成的有效 JWT。

下一步

  • 查询 Onboarding 流程结果,请参阅获取流程
  • Document 和年龄验证操作,请参阅本节中的对应页面。