Skip to content

Insurance API Methods


Insurance Company Methods

MethodURLDescription
GET/dicts/insurance-companyGet list of insurance companies
POST/dicts/insurance-companyCreate insurance company
GET/dicts/insurance-company/idsGet list of insurance company IDs
GET/dicts/insurance-company/qtyGet 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}/programsGet all insurance programs by insurance company ID

Insurance Program Methods

MethodURLDescription
GET/dicts/insurance-programGet list of insurance programs
POST/dicts/insurance-programCreate insurance program
GET/dicts/insurance-program/idsGet list of insurance program IDs
GET/dicts/insurance-program/qtyGet 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

MethodURLDescription
GET/main/contracts/{id}/insuranceGet insurance object by contract ID
GET/main/insuranceGet list of insurance objects
POST/main/insuranceCreate insurance object
GET/main/insurance/idsGet list of insurance object IDs
GET/main/insurance/qtyGet 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}/insuranceGet insurance object by application ID

Wallet Methods

MethodURLDescription
GET/main/insurance-accounts/find/{ids}Find insurance wallets by ID
GET/main/insurance-accounts/qtyGet 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}/accountGet insurance wallet by insurance ID
POST/main/insurance/{id}/accountCreate 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)

bash
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 contractId field, as it is not filled when creating insurance (only when editing).

2. Updating Insurance (PUT)

bash
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 a GET request 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.

bash
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

json
{
  "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
  }
}