Insurance API Methods
Insurance Company Methods
| Method | URL | Description |
|---|---|---|
GET | /dicts/insurance-company | Get list of insurance companies |
POST | /dicts/insurance-company | Create insurance company |
GET | /dicts/insurance-company/ids | Get list of insurance company IDs |
GET | /dicts/insurance-company/qty | Get number of insurance companies |
GET | /dicts/insurance-company/{id} | Get insurance program by ID |
PUT | /dicts/insurance-company/{id} | Update insurance company by ID |
DELETE | /dicts/insurance-company/{id} | Delete insurance company |
GET | /dicts/insurance-company/{id}/programs | Get all insurance programs by insurance company ID |
Insurance Program Methods
| Method | URL | Description |
|---|---|---|
GET | /dicts/insurance-program | Get list of insurance programs |
POST | /dicts/insurance-program | Create insurance program |
GET | /dicts/insurance-program/ids | Get list of insurance program IDs |
GET | /dicts/insurance-program/qty | Get number of insurance programs |
GET | /dicts/insurance-program/{id} | Get insurance program by ID |
PUT | /dicts/insurance-program/{id} | Update insurance program by ID |
DELETE | /dicts/insurance-program/{id} | Delete insurance program by ID |
Insurance Methods
| Method | URL | Description |
|---|---|---|
GET | /main/contracts/{id}/insurance | Get insurance object by contract ID |
GET | /main/insurance | Get list of insurance objects |
POST | /main/insurance | Create insurance object |
GET | /main/insurance/ids | Get list of insurance object IDs |
GET | /main/insurance/qty | Get number of insurance objects |
GET | /main/insurance/{id} | Get insurance object by ID |
PUT | /main/insurance/{id} | Update insurance object by ID |
DELETE | /main/insurance/{id} | Delete insurance object by ID |
GET | /main/loan-apps/{id}/insurance | Get insurance object by application ID |
Wallet Methods
| Method | URL | Description |
|---|---|---|
GET | /main/insurance-accounts/find/{ids} | Find insurance wallets by ID |
GET | /main/insurance-accounts/qty | Get number of insurance wallets |
GET | /main/insurance-accounts/{id} | Get insurance wallet by ID |
PUT | /main/insurance-accounts/{id} | Update insurance wallet by ID |
DELETE | /main/insurance-accounts/{id} | Delete insurance wallet by ID |
GET | /main/insurance/{id}/account | Get insurance wallet by insurance ID |
POST | /main/insurance/{id}/account | Create insurance wallet by insurance ID |
Example of Adding Insurance to an Application for an Issued Contract
Test Client:
- Client:
https://-saas.brainysoft.ru/3/main/clients/4 - Application:
https://-saas.brainysoft.ru/3/main/loan-apps/212 - Contract:
https://-saas.brainysoft.ru/3/main/contracts/148
1. Creating Insurance (POST)
curl --location 'https://{{customerkey}}-saas.brainysoft.ru/bs-core/main/insurance' \
--header 'Content-Type: application/json' \
--header 'customer-key: {{customerkey}}' \
--header 'bsauth: ==' \
--data '{
"loanApplicationId": 212,
"contractId": 148,
"insuranceProgramId": 2,
"amount": 350.0,
"cost": 20.0,
"creationDate": "2023-08-24T19:44:33.000Z",
"expirationDate": "2023-09-24T19:44:33.000Z",
"includeInLoanAmount": false,
"signed": false,
"type": "LifeInsurance"
}'After creation, you need to set the insurance NUMBER (
code). In BrainySoft, the number is generated only when creating a contract, so number generation for a new insurance on an issued contract must be set manually on the personal account side.You also need to attach the
contractIdfield, as it is not filled when creating insurance (only when editing).
2. Updating Insurance (PUT)
curl --location 'https://{{customerkey}}-saas.brainysoft.ru/bs-core/main/insurance/67309' \
--header 'Content-Type: application/json' \
--header 'customer-key: {{customerkey}}' \
--header 'bsauth: ==' \
--data '{
"id": 67309,
"loanApplicationId": 212,
"insuranceAccountId": null,
"contractId": 148,
"insuranceProgramId": 2,
"amount": 350.0,
"cost": 20.0,
"creationDate": "2023-08-24T19:44:33.000Z",
"expirationDate": "2023-09-24T19:44:33.000Z",
"code": "123456",
"includeInLoanAmount": false,
"premium": 0.0,
"smsCode": "",
"signed": false,
"signDate": 1692819873000,
"newExpirationDate": null,
"terminationDate": null,
"type": "LifeInsurance"
}'Parameters for amount (
amount), fee (cost), insurance type (type) can be viewed from current insurances of the corresponding program (insuranceProgramId).There are only 5 insurance programs (
insuranceProgram) in the dictionary. To see which type (type) the insurance should belong to, you can make aGETrequest to'https://-saas.brainysoft.ru/bs-core/dicts/insurance-program'.
3. Creating a Wallet for Insurance (POST)
Next, you need to create a WALLET for the created insurance – this is analogous to a contract, but only for insurance. We will link cash flow records with the amount and number of successfully charged recurring payments to this wallet.
curl --location 'https://{{customerkey}}-saas.brainysoft.ru/bs-core/main/insurance/67309/account' \
--header 'Content-Type: application/json' \
--header 'customer-key: {{customerkey}}' \
--header 'bsauth: =='''Response
{
"status": "ok",
"timestamp": 1692883330826,
"data": {
"id": 90331,
"name": "",
"creationDate": "2023-08-24",
"issueDate": null,
"closeDate": null,
"branchId": 101301,
"subdivisionId": 101791,
"clientId": 4,
"contractLine": {
"id": 90331,
"lineLimit": null
},
"contractTypeId": 101916,
"createUserId": 1026,
"createSubdivisionId": 101791,
"relatedInsuranceId": 67309
}
}