跳到主要内容

INSS 手册 - 新增信贷或再融资

注意!

QI Tech 的 webhook 不应以严格方式映射。 返回的 webhook payload 中可能会添加额外字段。

Webhook 重发

您可以按照文档中的详细说明查询并重发 webhook:Webhook 重发

授权条款有效期

授权条款自签署之日起有效期为 30 天。在有效期内,可以在无需重新发送客户授权的情况下查询福利数据。

1 - 通过合作方完成授权条款后查询福利列表:

Request

情形 1:福利持有人即为授权条款的签署人。

ENDPOINT
/social_security/benefits_request
MÉTODO
POST
在 Playground 中测试
Request Body
{
"document_number": "14950479032",
"authorization_term": {
"document_number": "14950479032",
"signature": {
"signer": {
"name": "Maria da Silva",
"email": "maria.silva@email.com",
"phone": {
"number": "999538380",
"area_code": "11",
"country_code": "55"
},
"document_number": "87237271016"
},
"authentication_type": "opt_in",
"authenticity": {
"timestamp": "2024-11-07T14:28:23.382748Z",
"ip_address": "179.145.48.219",
"fingerprint": {},
"third_party_additional_data": {},
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"signed_object": {
"document_key": "93a0f18b-f58f-4a22-ab63-2b796cbf7383"
}
}
}
}

情形 2:福利持有人不是授权条款的签署人(有法定代表人)。

ENDPOINT
/social_security/benefits_request
MÉTODO
POST
Request Body
{
"document_number": "14950479032",
"authorization_term": {
"document_number": "14950479032",
"legal_representative_document_number": "87237271016",
"signature": {
"signer": {
"name": "Maria da Silva",
"email": "maria.silva@email.com",
"phone": {
"number": "999538380",
"area_code": "11",
"country_code": "55"
},
"document_number": "87237271016"
},
"authentication_type": "opt_in",
"authenticity": {
"timestamp": "2024-11-07T14:28:23.382748Z",
"ip_address": "179.145.48.219",
"fingerprint": {},
"third_party_additional_data": {},
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"signed_object": {
"document_key": "93a0f18b-f58f-4a22-ab63-2b796cbf7383"
}
}
}
}
注意

在有法定代表人的情况下,需要在 "legal_representative_document_number" 字段中填写法定代表人的 CPF,且 "signer" 对象中的数据也应填写法定代表人的信息。


"document_key":使用 /upload 端点返回的 GUID。

除了在 "authorization_term.signed_object.document_key" 对象中使用已签署 PDF 文档的密钥外,也可以通过 "authorization_term.signed_object.raw_text" 对象发送授权条款的原始文本。

Response

ENDPOINT
/social_security/benefits_request
MÉTODO
POST
Response Body
{
"benefits_request_key": "\<GUID DA CONSULTA DE BENEFÍCIO\>",
"status": "pending_search"
}

福利列表查询成功时:

Webhooks

WEBHOOK_TYPE
social_security_benefits_request
STATUS
Success
Webhook Body
{
"webhook_type": "social_security_benefits_request",
"key": "\<GUID benefits_request_key\>",
"event_datetime": "\<DATA E HORA DO ENVIO DO WEBHOOK\>",
"status": "success",
"data": [{
"benefit_number": "\<No. DO BENEFÍCIO\>",
"benefit_status": "inelegible",
"grant_date": "2023-06-13"
}]
}
字段描述
benefit_status福利状态枚举值

福利列表查询失败时

WEBHOOK_TYPE
social_security_benefits_request
STATUS
Failure
Webhook Body
{
"webhook_type": "social_security_benefits_request",
"key": "\<GUID benefits_request_key\>",
"event_datetime": "\<DATA E HORA DO ENVIO DO WEBHOOK\>",
"status": "failure",
"data": {
"enumerator": "not_found_legal_representative",
"description": "no legal representative for the beneficiary"
}
}

失败 webhook 字段详解

字段描述
enumeratorDataprev 代码的映射返回值枚举值

在 Sandbox 中模拟福利查询的成功与失败场景:

场景模拟基于操作中提供的 CPF 的第一位数字。

11.1. 对于以数字 1 开头的 CPF,将通过 Webhook 返回异步成功响应。

11.2. 对于其他 CPF,将根据输入的 CPF 的第一位数字,按照下表返回异步错误响应。

CPF 首位数字枚举值描述
2inexistent_beneficiaryno beneficiary found
注意

所有第一位数字未映射到对应场景的 CPF,将收到一个包含未映射测试场景标准错误的 webhook。

枚举值描述
mock_errorInformed document number is not a valid mock on test environment

2 - 查询福利数据:

情形 1

使用已提交的授权条款查询福利数据。

Request

ENDPOINT
/social_security/balance_request
MÉTODO
POST
在 Playground 中测试
Request Body
{
"document_number": "14950479032",
"benefit_number": "22255220"
}

Response

ENDPOINT
/social_security/balance_request
MÉTODO
POST
Response Body
{
"balance_request_key": "\<GUID DA CONSULTA DE DADOS DO BENEFÍCIO\>",
"status": "pending_search"
}

情形 2

提交授权条款时查询福利数据。

Request

ENDPOINT
/social_security/balance_request
MÉTODO
POST
Request Body
{
"document_number": "14950479032",
"benefit_number": "22255220",
"authorization_term": {
"document_number": "14950479032",
"legal_representative_document_number": "87237271016",
"signature": {
"signer": {
"name": "Maria da Silva",
"email": "maria.silva@email.com",
"phone": {
"number": "999538380",
"area_code": "11",
"country_code": "55"
},
"document_number": "87237271016"
},
"authentication_type": "opt_in",
"authenticity": {
"timestamp": "2024-11-07T14:28:23.382748Z",
"ip_address": "179.145.48.219",
"fingerprint": {},
"third_party_additional_data": {},
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"signed_object": {
"document_key": "93a0f18b-f58f-4a22-ab63-2b796cbf7383"
}
}
}
}
授权条款有效期

授权条款自签署之日起有效期为 30 天。在有效期内,可以在无需重新发送客户授权的情况下查询福利数据。如果尚未发送授权,则需要在此请求中发送条款。

注意

在有法定代表人的情况下,需要在 "legal_representative_document_number" 字段中填写法定代表人的 CPF,且 "signer" 对象中的数据也应填写法定代表人的信息。


Response

ENDPOINT
/social_security/balance_request
MÉTODO
POST
Response Body
{
"balance_request_key": "\<GUID DA CONSULTA DE DADOS DO BENEFÍCIO\>",
"status": "pending_authorization"
}

成功 webhook

福利数据查询成功时

WEBHOOK_TYPE
social_security_balance_request
STATUS
Success
Webhook Body
{
"webhook_type": "social_security_balance_request",
"key": "\<GUID balance_request_key\>",
"event_datetime": "\<DATA E HORA DO ENVIO DO WEBHOOK\>",
"status": "success",
"data": {
"name": "IVOLANDO MIRANDA",
"state": "SP",
"alimony": "not_payer",
"birth_date": "07021961",
"grant_date": "2022-09-02",
"credit_type": "checking_account",
"block_type": "not_blocked",
"benefit_card": {
"limit": 2083.2,
"balance": 0
},
"benefit_number": "22255220",
"benefit_status": "elegible",
"payroll_card": {
"limit": 2083.2,
"balance": 0
},
"assistance_type": "retirement_by_age",
"document_number": "14950479032",
"benefit_end_date": "2020-12-01",
"consigned_credit": {
"balance": 1000
},
"benefit_situation": "active",
"max_total_balance": 2000,
"used_total_balance": 1000,
"politically_exposed": {
"type": "politically_exposed_level_1",
"is_politically_exposed": true
},
"has_power_of_attorney": false,
"available_total_balance": 1000,
"has_judicial_concession": false,
"number_of_portabilities": 0,
"disbursement_bank_account": {
"bank_code": "341",
"account_digit": "6",
"account_branch": "0155",
"account_number": "000059923"
},
"has_entity_representation": false,
"social_benefit_max_balance": 2000,
"social_benefit_used_balance": 1000,
"benefit_quota_expiration_date": null,
"number_of_active_reservations": 0,
"number_of_suspended_reservations": 0,
"number_of_refinanced_reservations": 0,
"number_of_active_suspended_reservations": 3
}
}

成功 webhook 字段详解

字段描述
assistance_type福利类型枚举值
benefit_status福利状态枚举值
has_entity_representation是否有代理实体(不允许批注)True 或 False
alimony_code赡养费分类not_payer, payer, benefit
has_judicial_concession福利是否通过临时禁令批准True 或 False
has_power_of_attorney是否有代理人?True 或 False
credit_type信贷类型 - 福利收款方式Magnetic_card, checking_account
benefit_situation福利状态枚举值
used_total_balance已用于贷款批注、保留用于可携性、再融资、变更、RMC 和 RCC 的总金额数值
max_total_balance对应福利种类可承诺的金额数值
available_total_balance所有方式下可用于贷款的总金额(max_total_balance 与 used_total_balance 的差值)数值
benefit_quota_expiration_date福利终止日期。该信息仅适用于部分遗属抚恤金福利。字符串或空值
block_type福利锁定类型枚举值
politically_exposed.type政治敏感人士枚举值
is_politically_exposed是否为政治敏感人士True 或 False

锁定 webhook

福利被锁定时

WEBHOOK_TYPE
social_security_balance_request
STATUS
Blocked
Webhook Body
{
"webhook_type": "social_security_balance_request",
"key": "\<GUID balance_request_key\>",
"event_datetime": "\<DATA E HORA DO ENVIO DO WEBHOOK\>",
"status": "blocked",
"data": {
"benefit_blocked": true,
"document_number": "12345678910",
"balance_request_date": "2025-12-01",
"block_date": "2025-11-17",
"assistance_type": "retirement_by_age",
"block_type": "blocked_by_benefitiary"
}
}

锁定 webhook 字段详解

字段描述
benefit_blocked锁定状态True
balance_request_date查询日期字符串
block_date锁定日期字符串或空值
block_type锁定类型枚举值

失败 webhook

福利列表查询失败时

WEBHOOK_TYPE
social_security_balance_request
STATUS
Failure
Webhook Body
{
"webhook_type": "social_security_balance_request",
"key": "\<GUID balance_request_key\>",
"event_datetime": "\<DATA E HORA DO ENVIO DO WEBHOOK\>",
"status": "failure",
"data": {
"enumerator": "not_found_legal_representative",
"description": "no legal representative for the beneficiary"
}
}

失败 webhook 字段详解

字段描述
enumeratorDataprev 代码的映射返回值枚举值

在 Sandbox 中模拟福利查询的成功与失败场景:

场景模拟基于操作中提供的 CPF 的第一位数字。

11.1. 对于以数字 1 开头的 CPF,将通过 Webhook 返回异步成功响应。

11.2. 对于其他 CPF,将根据输入的 CPF 的第一位数字,按照下表返回异步错误响应。

CPF 首位数字枚举值描述
2inexistent_beneficiaryno beneficiary found
注意

所有第一位数字未映射到对应场景的 CPF,将收到一个包含未映射测试场景标准错误的 webhook。

枚举值描述
mock_errorInformed document number is not a valid mock on test environment

3 - 债务模拟:

新增信贷 Request

ENDPOINT
/debt_simulation
MÉTODO
POST
在 Playground 中测试
Request Body
{
"borrower": {
"person_type": "natural"
},
"financial": {
"first_due_date": "2024-12-07",
"installment_face_value": 100,
"disbursement_date": "2024-11-05",
"limit_days_to_disburse": 3,
"number_of_installments": 4,
"monthly_interest_rate": 0.018,
"interest_type": "pre_price_days",
"fine_configuration": {
"monthly_rate": 0.01,
"interest_base": "calendar_days",
"contract_fine_rate": 0.02
},
"credit_operation_type": "ccb",
"interest_grace_period": 0,
"principal_grace_period": 0
},
"collaterals": [
{
"collateral_type": "social_security"
}
]
}

再融资 Request

ENDPOINT
/debt_simulation
MÉTODO
POST
{
"borrower": {
"person_type": "natural"
},
"financial": {
"first_due_date": "2024-12-07",
"installment_face_value": 100,
"disbursement_date": "2024-11-05",
"limit_days_to_disburse": 3,
"number_of_installments": 4,
"monthly_interest_rate": 0.018,
"interest_type": "pre_price_days",
"fine_configuration": {
"monthly_rate": 0.01,
"interest_base": "calendar_days",
"contract_fine_rate": 0.02
},
"credit_operation_type": "ccb",
"interest_grace_period": 0,
"principal_grace_period": 0
},
"collaterals": [
{
"collateral_type": "social_security"
}
],
"refinanced_credit_operations": [
{
"operation_key": "324caa35-ba10-4590-ae2b-5efef71709c3"
}
]
}
信息

上述请求中包含 2 次模拟。第一次固定客户的分期金额(放款金额可变),第二次固定放款金额(分期金额可变)。

Response

ENDPOINT
/debt_simulation
MÉTODO
POST
Response Body
{
"type": "debt",
"key": "8f01672d-9910-43a6-9e7d-07c031bc6fed",
"status": "finished",
"event_datetime": "2024-11-05 16:50:00",
"data": {
"interest_type": "pre_price_days",
"credit_operation_type": "ccb",
"interest_grace_period": 0,
"interest_payment_month_period": 1,
"principal_grace_period": 0,
"principal_amortization_month_period": 1,
"operation_type": "structured_operation",
"post_fixed_interest_base": "workdays",
"post_fixed_interest_rate": null,
"prefixed_interest_rate": {
"interest_base": "calendar_days_365",
"annual_rate": 0.23872053,
"monthly_rate": 0.018,
"daily_rate": 0.00058669
},
"issue_date": "2024-11-05",
"number_of_installments": 4,
"requester_key": "e5eb6a0a-e003-4cbd-b702-5a25bf71af0a",
"final_disbursement_amount": 0.0,
"disbursement_options": [
{
"iof_amount": 3.93,
"total_pre_fixed_amount": 17.8715883143,
"cet": 0.0257,
"annual_cet": 0.355163,
"contract_fees": [
{
"fee_type": "tac",
"amount_type": "percentage",
"amount": 0.6,
"fee_amount": 2.29
},
{
"fee_type": "ted_fee",
"amount_type": "absolute",
"amount": 1.0,
"fee_amount": 1.0
}
],
"external_contract_fees": [
{
"fee_type": "spread",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "insurance_premium",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "tac",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
}
],
"contract_fee_amount": 2.29,
"external_contract_fee_amount": 0.0,
"net_external_contract_fee_amount": 0.0,
"disbursement_date": "2024-11-05",
"first_due_date": "2024-12-09",
"installments": [
{
"calendar_days": 34,
"workdays": 23.0,
"business_due_date": "2024-12-09",
"due_date": "2024-12-09",
"due_principal": 382.13,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 7.6967422515,
"tax_amount": 0.257341482602818,
"total_amount": 100,
"principal_amortization_amount": 92.3032577485,
"installment_number": 1
},
{
"calendar_days": 29,
"workdays": 19.0,
"business_due_date": "2025-01-07",
"due_date": "2025-01-07",
"due_principal": 289.8267422515,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 4.9718040699,
"tax_amount": 0.4909156601748966,
"total_amount": 100,
"principal_amortization_amount": 95.0281959301,
"installment_number": 2
},
{
"calendar_days": 31,
"workdays": 23.0,
"business_due_date": "2025-02-07",
"due_date": "2025-02-07",
"due_principal": 194.7985463214,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 3.5742034136,
"tax_amount": 0.7432500400879712,
"total_amount": 100,
"principal_amortization_amount": 96.4257965864,
"installment_number": 3
},
{
"calendar_days": 28,
"workdays": 18.0,
"business_due_date": "2025-03-07",
"due_date": "2025-03-07",
"due_principal": 98.372749735,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 1.6288385793,
"tax_amount": 0.9841050988526828,
"total_amount": 100,
"principal_amortization_amount": 98.3711614207,
"installment_number": 4
}
],
"issue_amount": 382.13,
"disbursed_issue_amount": 374.91,
"assignment_amount": 382.13,
"final_disbursement_amount": 374.91,
"prefixed_interest_rate": {
"interest_base": "calendar_days_365",
"annual_rate": 0.23872053,
"monthly_rate": 0.018,
"daily_rate": 0.00058669
}
},
{
"iof_amount": 4.77,
"total_pre_fixed_amount": 24.2597288075,
"cet": 0.0243,
"annual_cet": 0.334037,
"contract_fees": [
{
"fee_type": "tac",
"amount_type": "percentage",
"amount": 0.6,
"fee_amount": 2.25
},
{
"fee_type": "ted_fee",
"amount_type": "absolute",
"amount": 1.0,
"fee_amount": 1.0
}
],
"external_contract_fees": [
{
"fee_type": "spread",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "insurance_premium",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "tac",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
}
],
"contract_fee_amount": 2.25,
"external_contract_fee_amount": 0.0,
"net_external_contract_fee_amount": 0.0,
"disbursement_date": "2024-11-06",
"first_due_date": "2025-01-07",
"installments": [
{
"calendar_days": 62,
"workdays": 41.0,
"business_due_date": "2025-01-07",
"due_date": "2025-01-07",
"due_principal": 375.74,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 13.9149280115,
"tax_amount": 0.437656505989534,
"total_amount": 100,
"principal_amortization_amount": 86.0850719885,
"installment_number": 1
},
{
"calendar_days": 31,
"workdays": 23.0,
"business_due_date": "2025-02-07",
"due_date": "2025-02-07",
"due_principal": 289.6549280115,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 5.3146959395,
"tax_amount": 0.722070128765373,
"total_amount": 100,
"principal_amortization_amount": 94.6853040605,
"installment_number": 2
},
{
"calendar_days": 28,
"workdays": 18.0,
"business_due_date": "2025-03-07",
"due_date": "2025-03-07",
"due_principal": 194.969623951,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 3.2283291407,
"tax_amount": 0.9601685182659746,
"total_amount": 100,
"principal_amortization_amount": 96.7716708593,
"installment_number": 3
},
{
"calendar_days": 31,
"workdays": 21.0,
"business_due_date": "2025-04-07",
"due_date": "2025-04-07",
"due_principal": 98.1979530917,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 1.8017757158,
"tax_amount": 1.2239426674782687,
"total_amount": 100,
"principal_amortization_amount": 98.1982242842,
"installment_number": 4
}
],
"issue_amount": 375.74,
"disbursed_issue_amount": 367.72,
"assignment_amount": 375.74,
"final_disbursement_amount": 367.72,
"prefixed_interest_rate": {
"interest_base": "calendar_days_365",
"annual_rate": 0.23872053,
"monthly_rate": 0.018,
"daily_rate": 0.00058669
}
},
{
"iof_amount": 4.74,
"total_pre_fixed_amount": 24.0392857898,
"cet": 0.0243,
"annual_cet": 0.334673,
"contract_fees": [
{
"fee_type": "tac",
"amount_type": "percentage",
"amount": 0.6,
"fee_amount": 2.26
},
{
"fee_type": "ted_fee",
"amount_type": "absolute",
"amount": 1.0,
"fee_amount": 1.0
}
],
"external_contract_fees": [
{
"fee_type": "spread",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "insurance_premium",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "tac",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
}
],
"contract_fee_amount": 2.26,
"external_contract_fee_amount": 0.0,
"net_external_contract_fee_amount": 0.0,
"disbursement_date": "2024-11-07",
"first_due_date": "2025-01-07",
"installments": [
{
"calendar_days": 61,
"workdays": 40.0,
"business_due_date": "2025-01-07",
"due_date": "2025-01-07",
"due_principal": 375.96,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 13.6944849939,
"tax_amount": 0.4317001860605122,
"total_amount": 100,
"principal_amortization_amount": 86.3055150061,
"installment_number": 1
},
{
"calendar_days": 31,
"workdays": 23.0,
"business_due_date": "2025-02-07",
"due_date": "2025-02-07",
"due_principal": 289.6544849939,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 5.3146959395,
"tax_amount": 0.714305933832412,
"total_amount": 100,
"principal_amortization_amount": 94.6853040605,
"installment_number": 2
},
{
"calendar_days": 28,
"workdays": 18.0,
"business_due_date": "2025-03-07",
"due_date": "2025-03-07",
"due_principal": 194.9691809334,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 3.2283291407,
"tax_amount": 0.952233241255512,
"total_amount": 100,
"principal_amortization_amount": 96.7716708593,
"installment_number": 3
},
{
"calendar_days": 31,
"workdays": 21.0,
"business_due_date": "2025-04-07",
"due_date": "2025-04-07",
"due_principal": 98.1975100741,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 1.8017757157,
"tax_amount": 1.2158904130882027,
"total_amount": 100,
"principal_amortization_amount": 98.1982242843,
"installment_number": 4
}
],
"issue_amount": 375.96,
"disbursed_issue_amount": 367.96,
"assignment_amount": 375.96,
"final_disbursement_amount": 367.96,
"prefixed_interest_rate": {
"interest_base": "calendar_days_365",
"annual_rate": 0.23872053,
"monthly_rate": 0.018,
"daily_rate": 0.00058669
}
},
{
"iof_amount": 4.71,
"total_pre_fixed_amount": 23.8187134405,
"cet": 0.0244,
"annual_cet": 0.335196,
"contract_fees": [
{
"fee_type": "tac",
"amount_type": "percentage",
"amount": 0.6,
"fee_amount": 2.26
},
{
"fee_type": "ted_fee",
"amount_type": "absolute",
"amount": 1.0,
"fee_amount": 1.0
}
],
"external_contract_fees": [
{
"fee_type": "spread",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "insurance_premium",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
},
{
"fee_type": "tac",
"amount_type": "absolute",
"amount": 0.0,
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0,
"csll_amount": 0,
"irrf_amount": 0,
"pis_amount": 0,
"cofins_amount": 0,
"amount_released": 0,
"description": null
}
],
"contract_fee_amount": 2.26,
"external_contract_fee_amount": 0.0,
"net_external_contract_fee_amount": 0.0,
"disbursement_date": "2024-11-08",
"first_due_date": "2025-01-07",
"installments": [
{
"calendar_days": 60,
"workdays": 39.0,
"business_due_date": "2025-01-07",
"due_date": "2025-01-07",
"due_principal": 376.18,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 13.4739126445,
"tax_amount": 0.42570834978906,
"total_amount": 100,
"principal_amortization_amount": 86.5260873555,
"installment_number": 1
},
{
"calendar_days": 31,
"workdays": 23.0,
"business_due_date": "2025-02-07",
"due_date": "2025-02-07",
"due_principal": 289.6539126445,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 5.3146959395,
"tax_amount": 0.706541738899451,
"total_amount": 100,
"principal_amortization_amount": 94.6853040605,
"installment_number": 2
},
{
"calendar_days": 28,
"workdays": 18.0,
"business_due_date": "2025-03-07",
"due_date": "2025-03-07",
"due_principal": 194.968608584,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 3.2283291407,
"tax_amount": 0.9442979642450494,
"total_amount": 100,
"principal_amortization_amount": 96.7716708593,
"installment_number": 3
},
{
"calendar_days": 31,
"workdays": 21.0,
"business_due_date": "2025-04-07",
"due_date": "2025-04-07",
"due_principal": 98.1969377247,
"has_interest": true,
"post_fixed_amount": null,
"pre_fixed_amount": 1.8017757158,
"tax_amount": 1.20783815869566,
"total_amount": 100,
"principal_amortization_amount": 98.1982242842,
"installment_number": 4
}
],
"issue_amount": 376.18,
"disbursed_issue_amount": 368.21,
"assignment_amount": 376.18,
"final_disbursement_amount": 368.21,
"prefixed_interest_rate": {
"interest_base": "calendar_days_365",
"annual_rate": 0.23872053,
"monthly_rate": 0.018,
"daily_rate": 0.00058669
}
}
]
}
}

4 - 发行操作:

注意

对于自福利发放日起未满 90 天且不允许批注的操作,需确保 disbursement_date 与 limit_days_to_disburse 之和所得日期晚于 90 天之后。 如果不满足此规则,操作将被永久取消,CancelReason 为:social_security_margin_release_after_disbursement_end_date。

"collateral_data" 对象中的 "assistance_type" 字段指贷款所使用的福利类型,该值在福利数据查询中返回。查看可能的值(枚举值),请参阅枚举值表

注意

credit_agent 对象代表信贷代理人,有时称为推销员,负责发起此债务。此字段在发行代扣贷款债务时为必填项。

Request

情形 1:无法定代表人的发行

ENDPOINT
/debt
MÉTODO
POST
在 Playground 中测试
Request Body
{
"borrower": {
"name": "Nome devedor",
"phone": {
"number": "999538380",
"area_code": "84",
"country_code": "055"
},
"gender": "female",
"is_pep": false,
"address": {
"city": "Natal",
"state": "RN",
"number": "1984",
"street": "Rua",
"complement": "complemento",
"postal_code": "59065720",
"neighborhood": "bairro"
},
"role_type": "issuer",
"birth_date": "1959-07-08",
"mother_name": "NOME DA MAE",
"nationality": "Brasileiro",
"person_type": "natural",
"marital_status": "single",
"attached_documents_list": [],
"individual_document_number": "14471835092",
"document_identification_date": "2015-10-02",
"document_identification_type": "rg",
"document_identification_number": "003709888"
},
"financial": {
"interest_type": "pre_price_days",
"first_due_date": "2023-09-20",
"disbursement_date": "2024-11-07",
"fine_configuration": {
"monthly_rate": 0.0166,
"interest_base": "calendar_days",
"contract_fine_rate": 0
},
"credit_operation_type": "ccb",
"interest_grace_period": 0,
"monthly_interest_rate": 0.0166,
"installment_face_value": 101.84,
"limit_days_to_disburse": 7,
"number_of_installments": 10,
"principal_grace_period": 0
},
"simplified": true,
"collaterals": [
{
"percentage": 1,
"collateral_data": {
"state": "SP",
"benefit_number": 2052711150,
"subcorban_document_number": "12123456000101"
},
"collateral_type": "social_security"
}
],
"additional_data": {
"contract": {
"contract_number": "TST0000644799"
}
},
"purchaser_document_number": "32402502000135",
"credit_agent": {
"document_number": "87237271016",
"name": "Agente de credito"
},
"disbursement_bank_accounts": [
{
"name": "NOME DEVEDOR",
"bank_code": "001",
"account_digit": "0",
"branch_number": "2874",
"account_number": "000057555",
"document_number": "14471835092",
"transfer_method": "pix",
"percentage_receivable": 100
}
]
}

情形 2:有法定代表人的发行

ENDPOINT
/debt
MÉTODO
POST
{
"borrower": {
"name": "Nome devedor",
"phone": {
"number": "999538380",
"area_code": "84",
"country_code": "055"
},
"gender": "female",
"is_pep": false,
"address": {
"city": "Natal",
"state": "RN",
"number": "1984",
"street": "Rua",
"complement": "complemento",
"postal_code": "59065720",
"neighborhood": "bairro"
},
"role_type": "issuer",
"birth_date": "1959-07-08",
"mother_name": "NOME DA MAE",
"nationality": "Brasileiro",
"person_type": "natural",
"marital_status": "single",
"attached_documents_list": [],
"individual_document_number": "14471835092",
"document_identification_date": "2015-10-02",
"document_identification_type": "rg",
"document_identification_number": "003709888"
},
"related_parties": [
{
"name": "Representante legal",
"email": "teste@qitech.com.br",
"phone": {
"number": "991294043",
"area_code": "55",
"country_code": "055"
},
"address": {
"street": "AV LEONOR",
"state": "SP",
"city": "GUARULHOS",
"neighborhood": "",
"number": "1",
"postal_code": "07025200",
"complement": ""
},
"role_type": "issuer_legal_representative",
"person_type": "natural",
"is_pep": false,
"individual_document_number": "19125869086",
"birth_date": "1970-04-20",
"mother_name": " Ana Lúcia"
}
],
"financial": {
"interest_type": "pre_price_days",
"first_due_date": "2024-09-20",
"disbursement_date": "2024-11-07",
"fine_configuration": {
"monthly_rate": 0.01,
"interest_base": "calendar_days",
"contract_fine_rate": 0
},
"credit_operation_type": "ccb",
"interest_grace_period": 0,
"monthly_interest_rate": 0.0166,
"installment_face_value": 1000,
"limit_days_to_disburse": 7,
"number_of_installments": 84,
"principal_grace_period": 0
},
"simplified": true,
"collaterals": [
{
"percentage": 1,
"collateral_data": {
"state": "SP",
"benefit_number": 2052711150,
"subcorban_document_number": "12123456000101"
},
"collateral_type": "social_security"
}
],
"additional_data": {
"contract": {
"contract_number": "TST0000644715"
}
},
"purchaser_document_number": "32402502000135",
"credit_agent": {
"document_number": "87237271016",
"name": "Agente de credito"
},
"disbursement_bank_accounts": [
{
"name": "NOME DEVEDOR",
"bank_code": "001",
"account_digit": "0",
"branch_number": "2874",
"account_number": "000057555",
"document_number": "14471835092",
"transfer_method": "pix",
"percentage_receivable": 100
}
]
}
含折扣的 financial 对象示例
{
"financial": {
"first_due_date": "2022-12-07",
"installment_face_value": 100,
"disbursement_date": "2022-11-03",
"limit_days_to_disburse": 3,
"number_of_installments": 24,
"disbursed_amount": 1876,
"interest_type": "pre_price_days",
"fine_configuration": {
"monthly_rate": 0.01,
"interest_base": "calendar_days",
"contract_fine_rate": 0.02
},
"credit_operation_type": "ccb",
"interest_grace_period": 0,
"principal_grace_period": 0,
"rebates": [
{
"amount": 20,
"rebate_bank_account": {
"name": "Teste Ltda",
"document_number": "18533555000164",
"account_digit": "0",
"account_number": "4290001",
"branch_number": "0001",
"bank_code": "329"
},
"amount_type": "percentage",
"fee_type": "spread"
}
]
}
}

Response

ENDPOINT
/debt
MÉTODO
POST
Response Body
{
"webhook_type": "debt",
"key": "eb859ebe-3a41-49bf-a6c3-d6902039ec00",
"status": "waiting_signature",
"event_datetime": "2024-11-07 23:19:22",
"data": {
"borrower": {
"name": "Nome devedor",
"document_number": "14471835092",
"related_party_key": "28b7fc16-6d1f-467d-9667-62a8c13daea6"
},
"contract": {
"number": "TST0000644710",
"urls": [
"https://storage.googleapis.com/sandbox-doc-api/documents/a2e9c83a-3666-4def-8b27-e96fabb8705c/NOME_DEVEDOR-CCB-TST0000644710-20241107231916.pdf"
],
"signature_information": [
{
"signer_name": "Nome devedor",
"signer_document_number": "14471835092",
"signer_role": "issuer",
"signer_email": null,
"signer_external_key": null,
"signature_url": null
}
]
},
"requester_identifier_key": "eb859ebe-3a41-49bf-a6c3-d6902039ec00",
"iof_charge_method": "financed",
"collaterals": [
{
"absolute_amount": null,
"collateral_constituted": false,
"collateral_data": {
"state": "SP",
"benefit_number": 2052711150,
"reservation_method": "issuing",
"subcorban_document_number": "12123456000101"
},
"collateral_key": "26c7f4f4-51f3-41fa-b880-9691211136aa",
"collateral_type": "social_security",
"created_at": "2024-11-07T23:19:16.413448",
"external_key": null,
"percentage": 1,
"reservation_method": {
"enumerator": "issuing"
},
"updated_at": "2024-11-07T23:19:16.413441"
}
],
"disbursement_options": [
{
"disbursement_date": "2024-11-07",
"contract_fees": [
{
"fee_type": "spread",
"fee_amount": 4.55
},
{
"fee_type": "ted_fee",
"fee_amount": 1.5
}
],
"external_contract_fees": [
{
"fee_type": "spread",
"fee_amount": 0.0,
"tax_amount": 0.0,
"net_fee_amount": 0.0
}
],
"contract_fee_amount": 6.05,
"external_contract_fee_amount": 0.0,
"net_external_contract_fee_amount": 0.0,
"assignment_amount": 914.3,
"issue_amount": 909.75,
"cet": "2,0100%",
"annual_cet": "27,0481%",
"base_iof": 16.259002146803677,
"additional_iof": 3.45705,
"total_iof": 19.72,
"total_pre_fixed_amount": 108.6508885851,
"installments": [
{
"additional_costs": [],
"business_due_date": "2025-01-20",
"calendar_days": 74,
"due_date": "2025-01-20",
"due_interest": 0.0,
"due_principal": 909.75,
"fine_amount": null,
"has_interest": true,
"installment_number": 1,
"post_fixed_amount": null,
"pre_fixed_amount": 37.1789024864,
"principal_amortization_amount": 64.6610975136,
"tax_amount": 0.3923635397125248,
"total_amount": 101.84,
"workdays": 49.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-02-20",
"calendar_days": 31,
"due_date": "2025-02-20",
"due_interest": 0.0,
"due_principal": 845.0889024864,
"fine_amount": null,
"has_interest": true,
"installment_number": 2,
"post_fixed_amount": null,
"pre_fixed_amount": 14.2997636051,
"principal_amortization_amount": 87.5402363949,
"tax_amount": 0.753721435360089,
"total_amount": 101.84,
"workdays": 23.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-03-20",
"calendar_days": 28,
"due_date": "2025-03-20",
"due_interest": 0.0,
"due_principal": 757.5486660915,
"fine_amount": null,
"has_interest": true,
"installment_number": 3,
"post_fixed_amount": null,
"pre_fixed_amount": 11.5685715131,
"principal_amortization_amount": 90.2714284869,
"tax_amount": 0.9845001990781314,
"total_amount": 101.84,
"workdays": 18.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-04-22",
"calendar_days": 33,
"due_date": "2025-04-22",
"due_interest": 0.0,
"due_principal": 667.2772376046,
"fine_amount": null,
"has_interest": true,
"installment_number": 4,
"post_fixed_amount": null,
"pre_fixed_amount": 12.025984633,
"principal_amortization_amount": 89.814015367,
"tax_amount": 1.222548377175604,
"total_amount": 101.84,
"workdays": 21.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-05-20",
"calendar_days": 28,
"due_date": "2025-05-20",
"due_interest": 0.0,
"due_principal": 577.4632222376,
"fine_amount": null,
"has_interest": true,
"installment_number": 5,
"post_fixed_amount": null,
"pre_fixed_amount": 8.8184725787,
"principal_amortization_amount": 93.0215274213,
"tax_amount": 1.4797864582180404,
"total_amount": 101.84,
"workdays": 19.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-06-20",
"calendar_days": 31,
"due_date": "2025-06-20",
"due_interest": 0.0,
"due_principal": 484.4416948163,
"fine_amount": null,
"has_interest": true,
"installment_number": 6,
"post_fixed_amount": null,
"pre_fixed_amount": 8.1972396908,
"principal_amortization_amount": 93.6427603092,
"tax_amount": 1.72770892770474,
"total_amount": 101.84,
"workdays": 22.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-07-21",
"calendar_days": 31,
"due_date": "2025-07-21",
"due_interest": 0.0,
"due_principal": 390.7989345071,
"fine_amount": null,
"has_interest": true,
"installment_number": 7,
"post_fixed_amount": null,
"pre_fixed_amount": 6.6127072945,
"principal_amortization_amount": 95.2272927055,
"tax_amount": 1.999011328473856,
"total_amount": 101.84,
"workdays": 21.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-08-20",
"calendar_days": 30,
"due_date": "2025-08-20",
"due_interest": 0.0,
"due_principal": 295.5716418016,
"fine_amount": null,
"has_interest": true,
"installment_number": 8,
"post_fixed_amount": null,
"pre_fixed_amount": 4.8387153664,
"principal_amortization_amount": 97.0012846336,
"tax_amount": 2.274874127227187,
"total_amount": 101.84,
"workdays": 22.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-09-22",
"calendar_days": 33,
"due_date": "2025-09-22",
"due_interest": 0.0,
"due_principal": 198.570357168,
"fine_amount": null,
"has_interest": true,
"installment_number": 9,
"post_fixed_amount": null,
"pre_fixed_amount": 3.5787172455,
"principal_amortization_amount": 98.2612827545,
"tax_amount": 2.570318634292211,
"total_amount": 101.84,
"workdays": 23.0,
"installment_status": null,
"installment_type": null
},
{
"additional_costs": [],
"business_due_date": "2025-10-20",
"calendar_days": 28,
"due_date": "2025-10-20",
"due_interest": 0.0,
"due_principal": 100.3090744135,
"fine_amount": null,
"has_interest": true,
"installment_number": 10,
"post_fixed_amount": null,
"pre_fixed_amount": 1.5318141716,
"principal_amortization_amount": 100.3081858284,
"tax_amount": 2.8541691195612935,
"total_amount": 101.84,
"workdays": 20.0,
"installment_status": null,
"installment_type": null
}
],
"first_due_date": "2025-01-20",
"prefixed_interest_rate": {
"monthly_rate": 0.0166,
"daily_rate": 0.00054142,
"annual_rate": 0.21843191,
"interest_base": "calendar_days_365"
}
}
]
}
}

如果操作在最后一个放款日期选项前未签署或批注,合作方将收到有关操作取消的 webhook:

WEBHOOK_TYPE
debt
STATUS
Canceled
Webhook Body
{
"key": "\<DEBT-KEY\>",
"data": {
"cancel_reason": "Operacao cancelada manualmente",
"cancel_reason_enumerator": "manual"
},
"status": "canceled",
"webhook_type": "debt",
"event_datetime": "2022-11-01 03:46:31"
}

在 Sandbox 中模拟批注成功与失败场景:

场景模拟基于操作中提供的 CPF 的第一位数字。

11.1. 对于以数字 1 开头的 CPF,将通过 Webhook 返回异步成功响应。

11.2. 对于其他 CPF,将根据输入的 CPF 的第一位数字,按照下表返回异步错误响应。

11.3. 操作为 "cancel" 的错误将收到包含操作最终结果的 webhook。

CPF 首位数字枚举值描述操作
2invalid_disbursement_accountInvalid disbursemente bank accountcancel
3operation_not_allowed_IROperation not allowed due to operation deadline greatter than benefit terminationcancel
注意

所有第一位数字未映射到对应场景的 CPF,将收到一个包含未映射测试场景标准错误的 webhook。

枚举值描述
mock_errorInformed document number is not a valid mock on test environment

5 - 文件提交

必须提交合同补充数据(根据 INSS 第 138 号规范性指令)。

文件应通过文件上传端点提交,并遵循以下格式规范:

验证项
格式JPEG
最小尺寸250 x 250 px
最大尺寸2 MB
注意

不符合最小或最大尺寸规定的关联文件的合同将被永久取消。

文件上传后,必须在操作创建的 payload 中或之后通过以下端点提供已提交文件的密钥:

ENDPOINT
/debt/DEBT-KEY/related_party/RELATED-PARTY-KEY/attached_document
MÉTODO
POST
在 Playground 中测试
Request Body
{
"document_identification": "2893fc74-88fd-4cc9-a5c6-8a63d9d00f41",
"document_identification_back": "e881ddf4-bc9a-48e0-9555-cac979f65431",
"selfie": "ca37979e-6f11-4465-bf3b-69cd8307549c"
}
信息

related_party_key 在债务创建的响应中,位于 borrower 对象内返回。

6 - 操作正式化

文件提交后,操作可以进行正式化。

若由法定代表人签署,在 "data.contract.signers[i]" 字段中将返回法定代表人的数据,且 "data.contract.signers[i].signer_role" 对象的值将为 "issuer_legal_representative"。

签署 payload 中必须包含与第 5 条中提交文件相关的必填字段。必填字段如下:ip_addresssignature_datetime

Request

ENDPOINT
/debt/DEBT-KEY/signed
MÉTODO
POST
在 Playground 中测试
Request Body
{
...,
"ip_address": "192.168.0.0",
"signature_datetime": "2020-03-20T14:28:23.382748Z",
"similarity_score": 0.98000,
"biometry_analysis_reference": "serpro",
"type": "data-signature"
}
注意

签署提交的 payload 因合作方的正式化流程而异,需与 QI Tech 集成团队对接确认。

Biometry Analysis Reference 枚举值

枚举值描述
serpro当 similarity_score 通过查询 Detran 带照片文件库(通过 Serpro 提供的服务)获得时使用
tse当 similarity_score 通过查询 TSE 带照片文件库获得时使用
not_found当面部生物识别在上述任何政府数据库(serpro 或 tse)中均未找到时填写。此时 similarity_score 应为 null 或合作方返回的自拍与带照片官方文件的相似度评分。
QI Sign

QI Tech 提供符合第 138 号规范性指令规定的签署服务,包含面部生物识别和文件提交。

如需报价,请联系我们的商务团队:

comercial@qitech.com.br 或 (11) 2339-4763

Response

ENDPOINT
/debt/DEBT-KEY/signed
MÉTODO
POST
Response Body
{
"data": {},
"event_datetime": "2022-11-07 15:24:47",
"key": "\<DEBT-KEY\>",
"status": "signature_received",
"webhook_type": "debt"
}

收到签署后,将对已提交文件和 assistance_type 字段进行验证。

如果提交了未映射的福利类型 (assistance_type),操作将被永久取消。

文件验证同样适用,如存在重复、缺失或不符合最低标准的文件,操作也将被永久取消。

在这两种情况下,都会发送包含以下 payload 的 webhook:

WEBHOOK_TYPE
debt
STATUS
Canceled Permanently
Webhook Body
{
"key": "<DEBT-KEY>",
"data": {},
"status": "canceled_permanently",
"webhook_type": "debt",
"event_datetime": "2022-11-01 03:46:31"
}

7 - 批注与取消批注

注意

要成功创建批注请求,需要事先对福利进行有效的数据查询。 为此,只需按照第 2 - 查询福利数据 条的步骤操作即可。

因超出额度导致批注失败

如果新受益人类别或薪资增长类别的预留在批注尝试时收到超额响应,批注请求的状态将变为"等待合作方操作",并将以以下格式发送 webhook 以通知相关情况:

WEBHOOK_TYPE
social_security_margin_exceeded_for_new_beneficiary 或 social_security_margin_exceeded_for_minimum_wage_increase
STATUS
Pending requester action
Webhook Body
{
"webhook": {
"key": "\<DEBT-KEY\>",
"data": {
"enumerator": "margin_exceeded_for_new_beneficiary",
"description": "The margin for this reservation has been exceeded. Reservation Amount: 551.18",
},
"status": "pending_requester_action",
"webhook_type": "social_security_margin_exceeded_for_new_beneficiary",
"event_datetime": "2024-10-15T15:33:59"
}
}

因缺少有效福利数据查询导致批注失败

如果在批注请求之前未成功完成福利数据查询,批注请求的状态将变为"等待合作方操作",并将以以下格式发送 webhook 以通知相关情况:

WEBHOOK_TYPE
social_security_success_balance_request_not_found
STATUS
Pending requester action
Webhook Body
{
"webhook": {
"key": "\<DEBT-KEY\>",
"data": {
"enumerator": "success_balance_request_not_found",
"description": "Success balance request not found for the specified benefit number"
},
"status": "pending_requester_action",
"webhook_type": "social_security_success_balance_request_not_found",
"event_datetime": "2024-10-15T15:33:59"
}
}

如需继续,应采取以下操作:

  1. 按照第 2 条 - 查询福利数据 的步骤查询相关福利数据;
  2. 按以下格式发送请求,告知查询已完成。
ENDPOINT
/social_security/reservation/external_key/DEBT-KEY/validate_reservation
MÉTODO
POST
在 Playground 中测试
重要

此请求不仅确认存在有效的福利数据查询,还会验证创建批注所发送的信息是否正确,从而允许流程继续进行。

请求优先级系统(插队)

由于 Dataprev 的限制,每秒最多允许 25 个请求,请求系统以异步方式运行,即批注尝试被组织到队列中进行处理。因此,请求将根据操作类型和成功概率进行优先排序。

在这种情况下,为了避免在批注成功概率高但下次批注尝试还需等待较长时间的情况下损失额度,开发了此系统,允许以同步方式(即无需等待队列)发出请求。

然而,为确保适当控制并防止该系统被滥用,实施了令牌桶机制,工作原理如下:

  • 每个请求消耗一个令牌;
  • 如果请求产生成功的批注,令牌将归还桶中;
  • 否则,令牌将被消耗;
  • 每个桶有最大令牌数量限制;
  • 定期启动令牌补充例程,将已消耗的令牌补充至最大限制;
  • 如果令牌耗尽,在例程补充新令牌之前将无法发出新请求。
令牌桶系统示例

在此示例中,桶的配置为:

  • 最大令牌数: 10
  • 补充时间: 30分钟

第 0 小时: 桶以最大容量创建;

第 9 分钟: 发出一个请求,但合同未批注(错误),导致消耗 1 个令牌;

第 17 分钟: 发出一个请求,合同批注成功(成功),令牌数量不变;

第 30 分钟: 第一次令牌补充,桶恢复至最大容量;

第 47 分钟: 成功发出 10 个请求,无令牌消耗;

第 1 小时: 第二次令牌补充,但由于桶已满,令牌数量保持不变;

第 1:12 小时: 5 个请求出错,消耗 5 个令牌;

第 1:30 小时: 第三次令牌补充,桶有 6 个令牌;

第 1:38 小时: 6 个请求出错,耗尽所有令牌;

第 1:51 小时: 尝试发出请求,但由于桶中没有令牌,请求被阻止;

第 2 小时: 第四次令牌补充,桶有 1 个令牌,允许新的请求尝试;

要发出优先请求,只需使用与要批注的操作对应的 DEBT-KEY 调用以下端点:

Request

ENDPOINT
/social_security/reservation/external_key/DEBT-KEY/priority_request
MÉTODO
POST
在 Playground 中测试

Response

Response Body - 成功
{
"max_bucket_capacity": 10,
"bucket_fill_rate_minutes": 30,
"available_tokens": 7,
"status": "pending_document_submission",
"next_refill_at": "2025-02-04T20:28:35Z"
}
Response Body - 错误
批注错误:
{
"title": "Reservation Failed",
"description": "Last Response: consignable_margin_excceded, Tokens Available: 9, Next Refill At: 2025-02-04T20:18:35Z",
"translation": "Ultima resposta: consignable_margin_excceded, Fichas disponiveis: 9, Proxima Recarga: 2025-02-04T20:18:35Z",
"extra_fields": {},
"code": "SSC000083"
}

无可用令牌错误:
{
"title": "Rate limit exceeded",
"description": "Request limit exceeded. No tokens available, next refill in 8 minutes.",
"translation": "Limite de solicitacoes excedido. Nenhuma ficha disponivel, proxima recarga em 8 minutos.",
"extra_fields": {},
"code": "SSC000080"
}

最后,可以在无需向优先端点发出请求的情况下查询桶的当前配置。为此,我们提供了以下查询端点:

Request

ENDPOINT
/social_security/bucket_configuration
MÉTODO
GET
在 Playground 中测试

Response

Response Body
{
"max_bucket_capacity": 10,
"bucket_fill_rate_minutes": 30,
"available_tokens": 7,
"next_refill_at": "2025-02-04T20:08:35Z"
}

批注成功

批注成功时,合作方将收到以下 webhook:

WEBHOOK_TYPE
credit_operation.collateral
STATUS
Success
Webhook Body
{
"key": "\<DEBT-KEY\>",
"data": {
"collateral_type": "social_security",
"collateral_constituted": true
},
"event_time": "2022-10-31 15:23:46",
"webhook_type": "credit_operation.collateral"
}

批注失败时更正数据

可以在批注尝试中更正银行数据、福利编号和合同名称。只需使用以下调用:

ENDPOINT
/debt/DEBT-KEY/collateral
MÉTODO
PATCH
在 Playground 中测试
Request Body
{
"disbursement_bank_account": {
"bank_code": "123",
"account_digit": "1",
"account_branch": "1234",
"account_number": "5678",
"document_number": "12345678901"
}
}

取消批注

合同的取消批注通过永久取消路由执行。该路由为合同设置最终状态,不可重试,并触发已批注额度的取消批注。

要执行永久取消,应使用以下端点:

ENDPOINT
/debt/DEBT-KEY/cancel_permanently
MÉTODO
POST
在 Playground 中测试

Webhooks

WEBHOOK_TYPE
debt
STATUS
canceled_permanently
Webhook Body
{
"key": "\<DEBT-KEY\>",
"data": {},
"status": "canceled_permanently",
"webhook_type": "debt",
"event_datetime": "2022-11-01 03:46:31"
}

8 - 放款失败

TED

TED 放款失败时

WEBHOOK_TYPE
debt
STATUS
canceled
Webhook Body
 {
"status": "canceled",
"key": "\<DEBT-KEY\>",
"data": {
"ted_refusal": {
"transaction_key": "16faabfc-3876-437d-a4f6-aae17a1d68c9",
"description": "341 0000 000000-7 12345678900 - NOME BENEFICIÁRIO",
"origin": {
"account_key": "a1d2dea5-fa90-4676-a125-da355fdc3ed0",
"account_number": "00086",
"bank_code": "329",
"name": "ACCOUNT TRANSITORY",
"type": "payment_account",
"document": "32402502000135",
"branch_digit": null,
"account_digit": "8",
"branch": "0001"
},
"fee": 0,
"reason_enumerator": "agencia_conta_invalida",
"timestamp": "2022-11-07T14:36:05",
"amount": 483.6,
"reason": "Agência ou Conta Destinatária do Crédito Inválida",
"destination": {
"branch": "0000",
"account_number": "000000",
"name": "NOME BENEFICIÁRIO",
"purpose": "Crédito em Conta",
"type": "checking_account",
"branch_digit": null,
"document": "12345678900",
"bank_code": "341",
"account_digit": "7"
}
},
"cancel_reason": "ted_refusal"
}
}

Pix

PIX 放款失败时

WEBHOOK_TYPE
debt
STATUS
canceled
Webhook Body
{
"webhook_type": "debt",
"data": {
"pix_refusal": {
"reason": "Número da conta de destino é inexistente ou inválido.",
"reason_enumerator": "invalid_account",
"cancel_reason_enumerator": "invalid_account"
},
"cancel_reason": "pix_refusal",
"cancel_reason_enumerator": "pix_refusal"
},
"status": "canceled",
"key": "\<DEBT-KEY\>",
"event_datetime": "2025-09-04 15:29:37"
}

9 - 重新呈现付款

更改放款日期而不影响操作的财务金额。

Request

ENDPOINT
/debt/DEBT-KEY/change_disbursement_date
MÉTODO
POST
在 Playground 中测试
Request Body
{
"disbursement_date": "2022-11-04",
"disbursement_bank_accounts": [
{
"branch_number": "1232",
"account_digit": "4",
"account_number": "412412412",
"account_type": "checking_account",
"document_number": "14950479032",
"bank_code": 184,
"ispb_number": "17298092",
"name": "Maria da Silva",
"percentage_receivable": 100
}
]
}

Response

ENDPOINT
/debt/DEBT-KEY/change_disbursement_date
MÉTODO
POST
Response Body
{
"disbursement_accounts": [
{
"account_branch": "1232",
"account_digit": "4",
"account_number": "412412412",
"account_type": "checking_account",
"amount_receivable": null,
"created_at": "2022-05-24T14:51:46",
"digitable_line": null,
"disbursement_type": "ted",
"document_number": "37197645832",
"financial_institutions": {
"code_number": 184,
"ispb": 17298092,
"name": "BCO ITAÚ BBA S.A."
},
"financial_institutions_code_number": 184,
"is_pix_disbursement": false,
"ispb": "17298092",
"name": "Márcio e Catarina Gráfica Ltda",
"percentage_receivable": 50.0,
"pix_key": null,
"pix_transfer_key": null,
"pix_type": null,
"qr_code_key": null,
"retry_counter": 0,
"retry_vector": null,
"transaction_key": null,
"webhook_key": null
}
],
"disbursement_date": "2022-11-04"
}

Competence Diagram

10 - 获取最后一次请求的响应

last response 是一种简单、客观地映射 QI 与 Dataprev 之间通信响应的方式,可以知道此次请求的时间及获得的返回值(通过枚举值)。枚举值与 Dataprev 的返回代码直接相关,分为两种形式:"errors"(错误)和 "success"(成功)。

每个枚举值都有详细描述和 Dataprev 的参考代码。我们可以在下面更详细地了解 last response 数据的呈现方式。

成功情形

Request

ENDPOINT
/debt/DEBT-KEY/collateral
MÉTODO
GET
在 Playground 中测试

Response

Response Body
{
"collateral_constituted": true,
"collateral_type": "type",
"updated_at": "2023-05-24 19:13:02",
"collateral_data": {
"state": "SP",
"benefit_number": 1976703155,
"status": "reserved",
"last_response": {
"success": [
{
"enumerator": "succesfully_included",
"reservation_method" : "new_credit"
}
]
},
"last_response_event_datetime": "2023-05-22T19:13:02Z"
}
}

请求返回字段详解

字段描述
enumeratorDataprev 代码的映射返回值枚举值
reservation_method预留批注方式portability, new_credit, refinancing

错误情形

Request

ENDPOINT
/debt/DEBT-KEY/collateral
MÉTODO
GET

Response

Response Body
{
"collateral_constituted": false,
"collateral_type": "type",
"updated_at": "2023-05-24 19:13:02",
"collateral_data": {
"state": "SP",
"benefit_number": 1976703155,
"status": "pending_reservation",
"last_response": {
"errors": [
{
"enumerator": "benefit_blocked_by_tbm",
"reservation_method" : "new_credit"
}
]
},
"last_response_event_datetime": "2023-05-22T19:13:02Z"
}
}

请求返回字段详解

字段描述
enumeratorDataprev 代码的映射返回值枚举值
reservation_method预留批注方式portability, new_credit, refinancing

11 - 获取最后一次福利查询

通过此端点可以查询最后一次在 Dataprev 查询福利的时间。

Request

ENDPOINT
/social_security/benefit/BENEFIT-NUMBER
MÉTODO
GET
在 Playground 中测试

Response

Response Body
{
"last_balance_check": "2025-08-22T19:13:02Z",
"status": "pending_balance_request"
}

12 - 最后一次批注尝试的响应 webhook

如果操作批注未成功,将进行重试,并发送以下 webhook,详述批注失败原因、此次尝试的时间及使用的批注方式:

WEBHOOK_TYPE
credit_operation.collateral

        Body:

body.json

{
"webhook_type": "credit_operation.collateral",
"key": "\<CREDIT-OPERATION-KEY\>",
"event_time": "2022-11-24T15:42:12",
"data": {
"collateral_type": "social_security",
"collateral_constituted": false,
"collateral_data": {
"status": "pending_reservation",
"last_response": {
"errors": [{
"enumerator": "consignable_margin_excceded"
}]
},
"last_response_event_datetime": "2023-05-22T19:13:02Z",
"reservation_method": "new_credit",
}
}
}

13. 枚举值映射

Dataprev 批注错误返回表

Dataprev 代码枚举值描述QI 操作
HWconsignable_margin_exccededExceeded consignable marginTeimosinha
ITbenefit_blocked_by_tbmBenefit blocked due to benefit transferTeimosinha
IEbenefit_blocked_by_beneficiaryBenefit blocked by beneficiaryTeimosinha
ANinvalid_disbursement_accountInvalid disbursement bank account取消
HXreservation_already_includedReservation already included确认批注
IFbenefit_blocked_by_granting_processBenefit blocked during granting processTeimosinha
AVprocessing_payrollOperation couldn`t be done during processing payroll periodTeimosinha
OFinvalid_cbcInvalid cbcTeimosinha
IAfirst_name_mismatchFirst name mismatch benefit owner or legal representativeTeimosinha
OSlegal_representative_document_number_mismatchDocument number mismatch legal representativeTeimosinha
AYinvalid_stateInvalid stateTeimosinha
HZoperation_not_allowed_on_this_reservation_statusOperation couldn`t be done with current reservation statusTeimosinha
APinvalid_contract_dateAccrual, end or start contract date is invalidTeimosinha
GArequired_fields_missingRequired fields are missingTeimosinha
BCcbc_missingCBC is missingTeimosinha
NCcontract_number_missingContract number is missingTeimosinha
NBbenefit_number_missingBenefit number is missingTeimosinha
CAinvalid_bank_codeInvalid bank codeTeimosinha
HRexceeded_number_of_allowed_contractsAmount of contracts is above the limitTeimosinha
PVinvalid_image_formatImage with wrong formatTeimosinha
IRoperation_not_allowed_IROperation date is greater than benefit expiration取消
PKwrong_bank_code_destinationPortability number was found with wrong bank code destinationTeimosinha
PHwrong_benefit_number_on_portabilityPortability number was found with wrong benefit numberTeimosinha
PIinvalid_contract_total_amountReservation contract total amount should be greater than Dataprev reference amountTeimosinha

批注成功返回表

Dataprev 代码枚举值描述
BDsuccessfully_includedInclusion has been successfully done
BFsuccessfully_removedRemoval has been successfully done
BRsuccessfully_reactivatedReactivation has been successfully done
BSsuccessfully_suspendedSuspension has been successfully done

余额查询错误返回表

代码枚举值描述
CRnot_found_legal_representativeno legal representative for the beneficiary
CDinexistent_beneficiaryno beneficiary found
ASbenefity_without_legal_representativebeneficiary does not have a legal representative
BIinexistent_benefitno benefit found
D1inconsistent_balance_benefit_dataThe balance benefit data registered is either inconsistent, null or incomplete.

福利查询错误返回表

代码枚举值描述
CRnot_found_legal_representativeno legal representative for the beneficiary
CDinexistent_beneficiaryno beneficiary found
ASbenefity_without_legal_representativebeneficiary does not have a legal representative

福利状况表

项目
active
excluded
terminated
suspended
suspended_by_CONPAG
terminated_by_SISOBI
receiving_monthly_recover_6_months
receiving_monthly_recover_18_months
suspended_by_name_error
suspended_by_credentialed_payer
suspended_by_inspection
suspended_by_audit
terminated_by_inspection
terminated_by_audit
receiving_monthly_recover_6_months_inspection
receiving_monthly_recover_18_months_inspection
suspended_by_SISOBI
canceled_by_audit

福利状态表

枚举值描述
Elegible有资格申请贷款
Inelegible福利不符合贷款资格
Blocked福利符合资格,但被锁定无法申请贷款

锁定类型表

枚举值描述
not_blocked无锁定
blocked_by_benefitiary被受益人锁定
blocked_by_tbm因 TBM 锁定
blocked_in_concession在授予过程中锁定

政治敏感人士类型表

枚举值描述
0非政治敏感人士
1政治敏感人士 - 第 1 级

福利类型表

代码福利
1pension_by_death_rural_worker
2pension_by_death_accident_rural_worker
3pension_by_death_rural_employer
4retirement_invalidity_rural_emploee
5retirement_invalidity_accident_rural_worker
6retirement_invalidity_rural_employer
7retirement_by_eldness_rural_worker
8retirement_by_age_rural_employer
9complement_by_work_accident_rural_worker
11support_invalidity_rural_worker
12support_by_age_rural_worker
13aid_sickness_rural_worker
15aid_time_off_rural_worker
16aid_federal
17international_agreement
18inclusion_benefit
19pension_student_law7004
20pension_by_death_diplomat
21pension_by_death
22pension_by_death_statute
23pension_by_death_veteran
24pension_special_institutional_act
25aid_time_off
26pension_by_death_special_law593
27pension_by_death_federal_emploee
28pension_by_death_general_regime_law20465
29pension_by_death_marine_veteran
30monthly_income_lifetime_invalidity
31aid_sickness
32retirement_invalidity_social_security
33retirement_invalidity_aeronautic
34retirement_invalidity_marine_law1756
35aid_sickness_veteran
36aid_social_security_accident
37retirement_capin_extra_emploee
38retirement_federal_extra_emploee
39aid_invalidity_student_law7004
40monthly_income_lifetime_by_age_upper70_law6179
41retirement_by_age
42retirement_by_contribution_time
43retirement_by_time_of_service_veteran
44retirement_special_aeronautic
45retirement_by_time_of_service_journalist
46retirement_special
47allowance_25
48allowance_20
49retirement_ordinary
50aid_sickness_extinct_basic_plan
51retirement_invalidity_extinct_basic_plan
52retirement_by_age_extinct_basic_plan
53aid_time_off_extinct_basic_plan
54pension_indemnity_federal
55pension_by_death_extinct_basic_plan
56pension_lifetime_syndrome_thalidomide
57retirement_by_teacher_labor_time
58retirement_anisty
59pension_by_death_amnesty
60indemnity
61aid_birth
62aid_funeral
63aid_funeral_rural_worker
64aid_funeral_rural_employer
65savings_special_autarchy
67savings_mandatory_ipase_law5128
68savings_special_retirement_ps_affiliated_upper60
69savings_student_law7004
70restitution
71monthly_income
72retirement_by_time_of_service_law1756
73monthly_income_family_statute
74complement_pension_federal
75complement_retirement_federal
76monthly_income_statute
77monthly_income_sinpas_family_statute
78retirement_by_age_law1756
79advantage
80monthly_income_maternity
81compulsory_retirement
82retirement_by_time_of_service_sasse
83retirement_invalidity_ex_sasse
84pension_by_death_sasse
85pension_lifetime_rubber_tapper_law7986
86pension_lifetime_rubber_tapper_dependent_law7986
87continuous_aid_physical_disabilities
88continuous_aid_eldness
89pension_special_hemodialysis_victim_caruaru
90medic_assistency_work_accident
91aid_sickness_by_work_accident
92retirement_invalidity_work_accident
93pension_by_death_work_accident
94aid_work_accident
95aid_additional_work_accident
96pension_special_leprosy_law11520
97savings_by_death_work_accident
98aid_longshoreman
99time_off_15