@instabrain-sdks/api-client 2.3.3 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +573 -16
- package/dist/client/instabrain-client.d.ts +64 -3
- package/dist/client/instabrain-client.js +76 -2
- package/dist/services/application.service.d.ts +14 -3
- package/dist/services/application.service.js +14 -3
- package/dist/services/finalexpense.service.d.ts +129 -0
- package/dist/services/finalexpense.service.js +210 -0
- package/dist/types/enums.d.ts +3 -1
- package/dist/types/enums.js +3 -1
- package/dist/types/errors.js +1 -0
- package/dist/types/finalexpense.types.d.ts +459 -0
- package/dist/types/finalexpense.types.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/secure-sign.types.d.ts +25 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,28 +50,35 @@ Credentials (`userId` and `accessToken`) are provisioned during onboarding.
|
|
|
50
50
|
- [Integration flow](#integration-flow-3)
|
|
51
51
|
- [Get quote](#pure-term--get-quote)
|
|
52
52
|
- [Start application](#pure-term--start-application)
|
|
53
|
-
8. [
|
|
53
|
+
8. [Final Expense](#final-expense)
|
|
54
|
+
- [Integration flow](#integration-flow-4)
|
|
55
|
+
- [Get quote](#final-expense--get-quote)
|
|
56
|
+
- [Start application](#final-expense--start-application)
|
|
57
|
+
- [Get existing quote](#final-expense--get-existing-quote)
|
|
58
|
+
- [Update quote](#final-expense--update-quote)
|
|
59
|
+
- [Underwriting status (async)](#final-expense--underwriting-status-async)
|
|
60
|
+
9. [Shared methods — GIGDB, ADB & Final Expense](#shared-methods--gigdb-adb--final-expense)
|
|
54
61
|
- [Save EFT payment](#save-eft-payment)
|
|
55
62
|
- [Prepare docs & get delivery channels](#prepare-docs--get-delivery-channels)
|
|
56
63
|
- [Send PIN & get documents link](#send-pin--get-documents-link)
|
|
57
64
|
- [Resend PIN](#resend-pin)
|
|
58
65
|
- [Verify PIN](#verify-pin)
|
|
59
66
|
- [Final submit](#final-submit)
|
|
60
|
-
|
|
67
|
+
10. [Reporting](#reporting)
|
|
61
68
|
- [Request fields](#request-fields-shared-shape)
|
|
62
69
|
- [Filters (`SQLOperator`)](#filters--sqloperator-enum)
|
|
63
70
|
- [Response shapes](#response-shapes)
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
11. [Enums & Constants](#enums--constants)
|
|
72
|
+
12. [Beneficiary Reference](#beneficiary-reference)
|
|
66
73
|
- [No extra fields](#variant-1--no-extra-fields)
|
|
67
74
|
- [Named person](#variant-2--named-person)
|
|
68
75
|
- [Named entity](#variant-3--named-entity)
|
|
69
|
-
|
|
76
|
+
13. [Error Handling](#error-handling)
|
|
70
77
|
- [Error class hierarchy](#error-class-hierarchy)
|
|
71
78
|
- [Using `APIValidationError`](#using-apivalidationerror)
|
|
72
79
|
- [`BaseResponse<T>` envelope](#baseresponset-envelope)
|
|
73
80
|
- [Field-level error messages](#field-level-error-messages)
|
|
74
|
-
|
|
81
|
+
14. [Error codes (`APIErrorCode`)](#apierrorcode-reference)
|
|
75
82
|
- [Quote errors](#quote-errors)
|
|
76
83
|
- [Start application errors](#start-application-errors)
|
|
77
84
|
- [Payment & quote update errors](#payment--quote-update-errors)
|
|
@@ -79,10 +86,10 @@ Credentials (`userId` and `accessToken`) are provisioned during onboarding.
|
|
|
79
86
|
- [Final submit errors](#final-submit-errors)
|
|
80
87
|
- [Session](#session)
|
|
81
88
|
- [Deprecated codes (reference only)](#deprecated-codes-reference-only)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
15. [Environment Configuration](#environment-configuration)
|
|
90
|
+
16. [Token Management](#token-management)
|
|
91
|
+
17. [Examples Directory](#examples-directory)
|
|
92
|
+
18. [Support](#support)
|
|
86
93
|
|
|
87
94
|
---
|
|
88
95
|
|
|
@@ -1829,9 +1836,550 @@ console.log('Applicant link:', appResp.applicantLink);
|
|
|
1829
1836
|
|
|
1830
1837
|
---
|
|
1831
1838
|
|
|
1832
|
-
##
|
|
1839
|
+
## Final Expense
|
|
1833
1840
|
|
|
1834
|
-
|
|
1841
|
+
**InstaBrain Final Expense** — simplified-issue whole life product for end-of-life expenses.
|
|
1842
|
+
|
|
1843
|
+
This is a **full-flow product** like GIGDB and ADB: quote → start application → EFT payment → Secure Sign → final submit. The one difference is **asynchronous underwriting** — `finalSubmit()` returns `applicationStatus: 'InProgress'` (not an immediate `policyNumber`), and you poll `pollFinalExpenseUnderwritingStatus()` for the carrier decision.
|
|
1844
|
+
|
|
1845
|
+
- **Eligible ages:** 50–85
|
|
1846
|
+
- **Coverage:** $5,000–$50,000
|
|
1847
|
+
- **Tobacco:** uses `flagTobaccoUse` + `nicotineInfo` — **not** GIGDB's `isSmoker`
|
|
1848
|
+
- **Dedicated controller:** start application posts to `ThirdPartyFinalExpenseApplication` (not the generic `ThirdPartyStartApp`)
|
|
1849
|
+
|
|
1850
|
+
---
|
|
1851
|
+
|
|
1852
|
+
## Integration flow
|
|
1853
|
+
|
|
1854
|
+
```
|
|
1855
|
+
1. getFinalExpenseQuote() Get quote → quoteResponseId
|
|
1856
|
+
2. startFinalExpenseApplication() Start app → opportunityId
|
|
1857
|
+
└── isDeclined = true → STOP (knockout)
|
|
1858
|
+
3. saveEftPayment() Save bank details (shared method)
|
|
1859
|
+
4. Secure Sign flow prepareDocs → sendPin → verifyPin (shared)
|
|
1860
|
+
5. finalSubmit() → applicationStatus: 'InProgress' (async!)
|
|
1861
|
+
6. pollFinalExpenseUnderwritingStatus() Poll until terminal status
|
|
1862
|
+
├── Approved → policyNumber populated
|
|
1863
|
+
├── NotEligible / UnableToOffer / Closed / Abandoned / TimedOut → declined/closed
|
|
1864
|
+
└── (timeout) → resume manually with pingFinalExpenseUnderwritingStatus()
|
|
1865
|
+
```
|
|
1866
|
+
|
|
1867
|
+
Optional: `getFinalExpenseExistingQuote(opportunityId)` to re-fetch a quote, and `updateFinalExpenseQuote()` to change `faceAmount` / `paymentFreq` before payment.
|
|
1868
|
+
|
|
1869
|
+
---
|
|
1870
|
+
|
|
1871
|
+
## Final Expense — Get Quote
|
|
1872
|
+
|
|
1873
|
+
**Method:** `client.getFinalExpenseQuote(request)` · **Type:** `ThirdPartyFinalExpenseQuoteReq`
|
|
1874
|
+
|
|
1875
|
+
The response `selectedQuote.quoteResponseId` is the token for `startFinalExpenseApplication()`.
|
|
1876
|
+
|
|
1877
|
+
***
|
|
1878
|
+
|
|
1879
|
+
### Request Fields
|
|
1880
|
+
|
|
1881
|
+
| Field | Type | Required | Description | Validation Error |
|
|
1882
|
+
|---|---|---|---|---|
|
|
1883
|
+
| `faceAmount` | `number` | Yes | Coverage amount ($5,000–$50,000) | `Coverage amount (FaceAmount) is required.` |
|
|
1884
|
+
| `gender` | `Gender` | Yes | `Gender.Male`, `Gender.Female` | `Gender is required.` / `Invalid gender.` |
|
|
1885
|
+
| `stateCode` | `string` | Yes | 2-letter US state code; product must be available there | `State code is required.` / `State code is not valid.` / `This product is not available for the selected state.` |
|
|
1886
|
+
| `age` | `number` | Yes‡ | 50–85 | `Either age or date of birth must be provided.` / `Age must be between 50 and 85.` |
|
|
1887
|
+
| `dateOfBirth` | `string` (ISO 8601) | Yes‡ | Wins over `age` when both provided; derived age 50–85 | `Date of birth must be a valid date.` |
|
|
1888
|
+
| `paymentFreq` | `PaymentFrequency` | Yes | `"Monthly"` or `"Annually"` | `Payment frequency is required.` / `Invalid payment frequency.` |
|
|
1889
|
+
| `flagTobaccoUse` | `boolean` | Yes | Affects premium | `Nicotine use status is required.` |
|
|
1890
|
+
| `height` | `ThirdPartyQuoteReqHeight \| null` | No | `feet` (1–8), `inches` (0–11) — used for underwriting when provided | `Height is invalid.` |
|
|
1891
|
+
| `weightInLbs` | `number \| null` | No | Independent of `height` | — |
|
|
1892
|
+
| `firstName` | `string` | No | Alphabetic only — lead capture | `First name is invalid. Only alphabetic characters are allowed.` |
|
|
1893
|
+
| `lastName` | `string` | No | Alphabetic only — lead capture | `Last name is invalid. Only alphabetic characters are allowed.` |
|
|
1894
|
+
| `email` | `string` | No | Lead capture | `Please enter a valid email address.` |
|
|
1895
|
+
| `phoneNum` | `string` | No | 10 digits or E.164 — lead capture | `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` / `Phone number is invalid.` |
|
|
1896
|
+
|
|
1897
|
+
> **‡** Provide `age` OR `dateOfBirth`. When both are sent, `dateOfBirth` takes priority.
|
|
1898
|
+
|
|
1899
|
+
***
|
|
1900
|
+
|
|
1901
|
+
### Response
|
|
1902
|
+
|
|
1903
|
+
| Field | Type | Description |
|
|
1904
|
+
|---|---|---|
|
|
1905
|
+
| `productName` | `string \| null` | `"InstaFinalExpense"` |
|
|
1906
|
+
| `selectedQuote.quoteResponseId` | `string` | **Pass as `quoteResponseId` in start application** |
|
|
1907
|
+
| `selectedQuote.quoteAmount` | `number \| null` | Premium at the requested frequency |
|
|
1908
|
+
| `selectedQuote.premiumSaveWhenSelectingAnnual` | `number \| null` | Annual savings vs monthly; `null` when `Annually` |
|
|
1909
|
+
| `selectedQuote.maxQuoteAmount` / `minQuoteAmount` | `number \| null` | Premium bounds |
|
|
1910
|
+
| `selectedQuote.faceAmount` | `number` | Coverage amount from request |
|
|
1911
|
+
| `selectedQuote.paymentFrequency` | `'Monthly' \| 'Annually' \| null` | Payment frequency |
|
|
1912
|
+
|
|
1913
|
+
***
|
|
1914
|
+
|
|
1915
|
+
### Example
|
|
1916
|
+
|
|
1917
|
+
```typescript
|
|
1918
|
+
import { Gender, PaymentFrequency } from '@instabrain-sdks/api-client';
|
|
1919
|
+
|
|
1920
|
+
const quoteResp = await client.getFinalExpenseQuote({
|
|
1921
|
+
faceAmount: 15000,
|
|
1922
|
+
gender: Gender.Female,
|
|
1923
|
+
stateCode: 'TX',
|
|
1924
|
+
age: 65,
|
|
1925
|
+
paymentFreq: PaymentFrequency.Monthly,
|
|
1926
|
+
flagTobaccoUse: false,
|
|
1927
|
+
});
|
|
1928
|
+
|
|
1929
|
+
const { quoteResponseId } = quoteResp.selectedQuote;
|
|
1930
|
+
```
|
|
1931
|
+
|
|
1932
|
+
---
|
|
1933
|
+
|
|
1934
|
+
## Final Expense — Start Application
|
|
1935
|
+
|
|
1936
|
+
**Method:** `client.startFinalExpenseApplication(request)` · **Type:** `ThirdPartyFinalExpenseStartApplicationReq`
|
|
1937
|
+
|
|
1938
|
+
Uses the **dedicated** `ThirdPartyFinalExpenseApplication` controller. Runs pre-qualification health checks. Knockouts return HTTP 200 with `isDeclined: true` — they are **not** thrown.
|
|
1939
|
+
|
|
1940
|
+
***
|
|
1941
|
+
|
|
1942
|
+
### Top-Level Request Fields
|
|
1943
|
+
|
|
1944
|
+
| Field | Type | Required | Notes |
|
|
1945
|
+
|---|---|---|---|
|
|
1946
|
+
| `quoteResponseId` | `string` | Yes | From `getFinalExpenseQuote()`. Must belong to Final Expense |
|
|
1947
|
+
| `firstName` / `lastName` | `string` | Yes | Alphabetic only |
|
|
1948
|
+
| `email` | `string` | Yes | Valid email |
|
|
1949
|
+
| `phoneNumber` | `string` | Yes | 10-digit or `+1XXXXXXXXXX` |
|
|
1950
|
+
| `isUsCitizen` | `boolean` | Yes | — |
|
|
1951
|
+
| `isLegalUsResident` | `boolean \| null` | Cond. | Required when `isUsCitizen = false` |
|
|
1952
|
+
| `isPayerAlsoOwnerAndInsured` | `boolean` | Yes | `false` → **declined** |
|
|
1953
|
+
| `address` | `FinalExpenseAddress` | Yes | `state` must match the quote state |
|
|
1954
|
+
| `dateOfBirth` | `string` (YYYY-MM-DD) | Yes | Age 50–85 |
|
|
1955
|
+
| `socialSecurityNumber` | `string` | Yes | 9 digits |
|
|
1956
|
+
| `hasExistingCoverage` | `boolean` | Yes | Controls `existingCoverageData` |
|
|
1957
|
+
| `willOtherCoverageBeReplacedOrFinanced` | `boolean \| null` | Cond. | Required when `hasExistingCoverage = true`; must be `null` or `false` when false |
|
|
1958
|
+
| `willOtherCoverageBeReplacedOrFinancedData` | `object \| null` | Cond. | KS / WA replacement flows |
|
|
1959
|
+
| `existingCoverageData` | `object \| null` | Cond. | Required when `hasExistingCoverage = true`; `null` when false |
|
|
1960
|
+
| `beneficiaryDetails` | `FinalExpenseBeneficiaryDetails` | Yes | See allow-list below |
|
|
1961
|
+
| `height` | `ThirdPartyQuoteReqHeight` | Yes | `feet` 1–8, `inches` 0–11 |
|
|
1962
|
+
| `weight` | `number` | Yes | > 0 |
|
|
1963
|
+
| `isHoldingValidDriverLicense` | `boolean` | Yes | `false` → **declined** |
|
|
1964
|
+
| `birthJurisdiction` | `FinalExpenseBirthJurisdiction` | Yes | `country` + `state` (when US) |
|
|
1965
|
+
| `driverLicenseState` / `driverLicenseNumber` | `string \| null` | Cond. | Required when `isHoldingValidDriverLicense = true`; must be `null` when false |
|
|
1966
|
+
| `flagTobaccoUse` | `boolean` | Yes | Final Expense tobacco flag — **not** GIGDB `isSmoker` |
|
|
1967
|
+
| `nicotineInfo` | `object \| null` | Cond. | `{ lastUseDate: 'YYYY-MM' }`. Required when `flagTobaccoUse = true`; `null` when false |
|
|
1968
|
+
| `currentCareConditions` | `object` | Yes | 4 health booleans — see below |
|
|
1969
|
+
| `substanceUseAndMentalHealth` | `object` | Yes | 2 health booleans |
|
|
1970
|
+
| `testsAppointmentsAndLegalHistory` | `object` | Yes | 3 health booleans |
|
|
1971
|
+
| `heartStrokeOrganIssuesInPastTwoYears` | `object` | Yes | 4 health booleans |
|
|
1972
|
+
| `respiratoryDetails` | `RespiratoryDetails` | Yes | See respiratory rules below |
|
|
1973
|
+
| `includeSecondaryAddressee` | `boolean` | Yes | Controls `secondaryAddressee` |
|
|
1974
|
+
| `secondaryAddressee` | `FinalExpenseSecondaryAddressee \| null` | Cond. | Required when `includeSecondaryAddressee = true`; `null` when false — see sub-section below |
|
|
1975
|
+
|
|
1976
|
+
***
|
|
1977
|
+
|
|
1978
|
+
### Beneficiary allow-list
|
|
1979
|
+
|
|
1980
|
+
`beneficiaryDetails.beneficiaryType` (type `FinalExpenseBeneficiaryType`) accepts only: `Person`, `Insured Estate`, `All Children Of The Insured Equally`, `All Children Of The Marriage Equally`, `Trust`. Business / Corporation / Charitable Organization / Employer / Other are **rejected**.
|
|
1981
|
+
|
|
1982
|
+
When `beneficiaryType === 'Person'`, supply `beneficiaryPerson.relationship` (type `FinalExpenseRelationship`) — one of: Brother, Common Law Husband, Common Law Wife, Daughter, Domestic Partner, Father, Father Of Child, Fiance, Fiancee, Former Spouse, Granddaughter, Grandson, Husband, Life Partner, Mother, Mother Of Child, Sister, Son, Spouse, Wife. When `beneficiaryType === 'Trust'`, supply `namedEntity`.
|
|
1983
|
+
|
|
1984
|
+
***
|
|
1985
|
+
|
|
1986
|
+
### Health prequalification (knockout questions)
|
|
1987
|
+
|
|
1988
|
+
Every boolean below is **required**; setting any to `true` declines the application (`isDeclined: true`).
|
|
1989
|
+
|
|
1990
|
+
**Current Care & Serious Conditions** (`currentCareConditions`):
|
|
1991
|
+
- `isOnOxygenOrConfinedToFacility` — On oxygen, or confined to a nursing/assisted living facility?
|
|
1992
|
+
- `hasHospitalizationOrAdvisedAdmissionInPastSixMonths` — Hospitalized 2+ times, or advised to be admitted, in the past 6 months?
|
|
1993
|
+
- `hasLifeExpectancyTwentyFourMonthsOrLess` — Diagnosed with a life expectancy of 24 months or less?
|
|
1994
|
+
- `hasAidsArcOrHiv` — Ever diagnosed with AIDS, ARC, or tested positive for HIV?
|
|
1995
|
+
|
|
1996
|
+
**Substance Use & Mental Health** (`substanceUseAndMentalHealth`):
|
|
1997
|
+
- `hasReceivedDrugAlcoholAdviceInPastTwoYears` — Counseled/treated for illegal drugs, alcohol, or prescription drugs (last 2 years)?
|
|
1998
|
+
- `hasMentalDisorderHospitalizationInPastTwoYears` — Hospitalized for a mental disorder (last 2 years)?
|
|
1999
|
+
|
|
2000
|
+
**Tests, Appointments & Legal History** (`testsAppointmentsAndLegalHistory`):
|
|
2001
|
+
- `hasIncompleteMedicalAppointmentInPastTwoYears` — Advised of an incomplete medical appointment (last 2 years)?
|
|
2002
|
+
- `hasIncompleteMedicalTestInPastTwoYears` — Advised of an incomplete medical test, non-HIV (last 2 years)?
|
|
2003
|
+
- `hasFelonyOrDuiInPastFiveYears` — Convicted of a felony or DUI (last 5 years)?
|
|
2004
|
+
|
|
2005
|
+
**Heart, Stroke, Organ Issues** (`heartStrokeOrganIssuesInPastTwoYears`):
|
|
2006
|
+
- `hasHeartOrVascularConditionInPastTwoYears` — Heart attack, stroke, chest pain, TIA, myocarditis, or vascular disorder (last 2 years)?
|
|
2007
|
+
- `hasKidneyLiverOrganOrDiabeticComplicationsInPastTwoYears` — Kidney/liver disorder, organ transplant, or diabetic complications (last 2 years)?
|
|
2008
|
+
- `hasCognitiveOrNeurologicalConditionInPastTwoYears` — Alzheimer's, dementia, cognitive impairment, or ALS (last 2 years)?
|
|
2009
|
+
- `hasNonBasalCellCancerInPastTwoYears` — Cancer other than basal cell skin cancer (last 2 years)?
|
|
2010
|
+
|
|
2011
|
+
***
|
|
2012
|
+
|
|
2013
|
+
### Respiratory rules (`respiratoryDetails`)
|
|
2014
|
+
|
|
2015
|
+
`hasRespiratoryCondition` gates the block. When `true`, supply `conditions` (type `RespiratoryCondition[]`). Decline rules:
|
|
2016
|
+
|
|
2017
|
+
- Any `conditions` value **other than** `'sleep apnea'` declines (COPD, emphysema, ARDS, ventilator, other).
|
|
2018
|
+
- When only `'sleep apnea'` is selected, `isCurrentlyTreatedForSleepApnea` must be `true` or the applicant is declined.
|
|
2019
|
+
- `sleepApneaComorbidConditions` (type `SleepApneaComorbidCondition[]`) containing `'diabetes'` or `'heart attack/heart disease'` declines. `'hypertension'` alone does not.
|
|
2020
|
+
- `'none of the above'` cannot be combined with other values; all values must be unique.
|
|
2021
|
+
|
|
2022
|
+
***
|
|
2023
|
+
|
|
2024
|
+
### Secondary addressee (`secondaryAddressee`)
|
|
2025
|
+
|
|
2026
|
+
All six fields are required when `includeSecondaryAddressee = true`. When `includeSecondaryAddressee = false`, `secondaryAddressee` must be `null`.
|
|
2027
|
+
|
|
2028
|
+
| Field | Type | Validation Error |
|
|
2029
|
+
|---|---|---|
|
|
2030
|
+
| `firstName` | `string` | `Secondary addressee first name is required.` |
|
|
2031
|
+
| `lastName` | `string` | `Secondary addressee last name is required.` |
|
|
2032
|
+
| `street` | `string` | `Secondary addressee street is required.` |
|
|
2033
|
+
| `city` | `string` | `Secondary addressee city is required.` |
|
|
2034
|
+
| `state` | `string` | `Secondary addressee state is required.` / `Secondary addressee state code is invalid.` |
|
|
2035
|
+
| `zipCode` | `string` | `Secondary addressee zip code is required.` / `Zip code is invalid. It must be in 5-digit format.` |
|
|
2036
|
+
|
|
2037
|
+
> **Note:** `zipCode` uses a **capital C** here — this is intentional and mirrors the backend DTO property name. This differs from `FinalExpenseAddress.zipcode` (lowercase `c`). Do **not** normalize the casing.
|
|
2038
|
+
|
|
2039
|
+
***
|
|
2040
|
+
|
|
2041
|
+
### Knockout summary — returns `isDeclined: true` (not thrown)
|
|
2042
|
+
|
|
2043
|
+
- `isPayerAlsoOwnerAndInsured === false`
|
|
2044
|
+
- `isUsCitizen === false` AND `isLegalUsResident === false`
|
|
2045
|
+
- `isHoldingValidDriverLicense === false`
|
|
2046
|
+
- Any of the 13 health-prequalification booleans `=== true`
|
|
2047
|
+
- Respiratory decline rules above
|
|
2048
|
+
- Height/weight outside the Final Expense build chart (decline occurs after opportunity creation — `opportunityId` is a real GUID)
|
|
2049
|
+
|
|
2050
|
+
***
|
|
2051
|
+
|
|
2052
|
+
### Error Codes
|
|
2053
|
+
|
|
2054
|
+
| Code | When |
|
|
2055
|
+
|---|---|
|
|
2056
|
+
| `InvalidRequestFormat` | Field validation failure — inspect `value.fields` |
|
|
2057
|
+
| `ApplicationLimitReached` | Same SSN, email, or phone used on a Final Expense policy within the last 30 days |
|
|
2058
|
+
| `StateMismatchIdentified` | `address.state` differs from the quote state |
|
|
2059
|
+
| `AgentNotFound` / `InternalServerError` | Service-level failures |
|
|
2060
|
+
|
|
2061
|
+
**`ApplicationLimitReached` field-level messages:**
|
|
2062
|
+
|
|
2063
|
+
| Field | Message |
|
|
2064
|
+
|---|---|
|
|
2065
|
+
| `SocialSecurityNumber` | `An application with the same SSN has a policy generated within the last 30 days.` |
|
|
2066
|
+
| `Email` | `An application with the same email has a policy generated within the last 30 days.` |
|
|
2067
|
+
| `PhoneNumber` | `Two applications with the same phone have policies generated within the last 30 days.` |
|
|
2068
|
+
|
|
2069
|
+
***
|
|
2070
|
+
|
|
2071
|
+
### Response
|
|
2072
|
+
|
|
2073
|
+
| Field | Type | Description |
|
|
2074
|
+
|---|---|---|
|
|
2075
|
+
| `opportunityId` | `string` | All-zero GUID when declined before opportunity creation; real GUID otherwise |
|
|
2076
|
+
| `isDeclined` | `boolean` | `true` = knockout / underwriting decline; stop the flow |
|
|
2077
|
+
| `isQuoteChanged` | `boolean` | `true` = tobacco flag or DOB triggered a requote; re-present premium |
|
|
2078
|
+
|
|
2079
|
+
***
|
|
2080
|
+
|
|
2081
|
+
### Example
|
|
2082
|
+
|
|
2083
|
+
```typescript
|
|
2084
|
+
const appResp = await client.startFinalExpenseApplication({
|
|
2085
|
+
quoteResponseId,
|
|
2086
|
+
firstName: 'Jane',
|
|
2087
|
+
lastName: 'Doe',
|
|
2088
|
+
email: 'jane.doe@example.com',
|
|
2089
|
+
phoneNumber: '5551234567',
|
|
2090
|
+
isUsCitizen: true,
|
|
2091
|
+
isPayerAlsoOwnerAndInsured: true,
|
|
2092
|
+
address: { addressLine1: '123 Main St', city: 'Austin', state: 'TX', zipcode: '78701' },
|
|
2093
|
+
dateOfBirth: '1966-06-15',
|
|
2094
|
+
socialSecurityNumber: '123456789',
|
|
2095
|
+
hasExistingCoverage: false,
|
|
2096
|
+
beneficiaryDetails: { beneficiaryType: BeneficiaryType.InsuredEstate },
|
|
2097
|
+
height: { feet: 5, inches: 10 },
|
|
2098
|
+
weight: 170,
|
|
2099
|
+
isHoldingValidDriverLicense: true,
|
|
2100
|
+
birthJurisdiction: { country: 'US', state: 'TX' },
|
|
2101
|
+
driverLicenseState: 'TX',
|
|
2102
|
+
driverLicenseNumber: '12345678',
|
|
2103
|
+
flagTobaccoUse: false,
|
|
2104
|
+
nicotineInfo: null,
|
|
2105
|
+
currentCareConditions: {
|
|
2106
|
+
isOnOxygenOrConfinedToFacility: false,
|
|
2107
|
+
hasHospitalizationOrAdvisedAdmissionInPastSixMonths: false,
|
|
2108
|
+
hasLifeExpectancyTwentyFourMonthsOrLess: false,
|
|
2109
|
+
hasAidsArcOrHiv: false,
|
|
2110
|
+
},
|
|
2111
|
+
substanceUseAndMentalHealth: {
|
|
2112
|
+
hasReceivedDrugAlcoholAdviceInPastTwoYears: false,
|
|
2113
|
+
hasMentalDisorderHospitalizationInPastTwoYears: false,
|
|
2114
|
+
},
|
|
2115
|
+
testsAppointmentsAndLegalHistory: {
|
|
2116
|
+
hasIncompleteMedicalAppointmentInPastTwoYears: false,
|
|
2117
|
+
hasIncompleteMedicalTestInPastTwoYears: false,
|
|
2118
|
+
hasFelonyOrDuiInPastFiveYears: false,
|
|
2119
|
+
},
|
|
2120
|
+
heartStrokeOrganIssuesInPastTwoYears: {
|
|
2121
|
+
hasHeartOrVascularConditionInPastTwoYears: false,
|
|
2122
|
+
hasKidneyLiverOrganOrDiabeticComplicationsInPastTwoYears: false,
|
|
2123
|
+
hasCognitiveOrNeurologicalConditionInPastTwoYears: false,
|
|
2124
|
+
hasNonBasalCellCancerInPastTwoYears: false,
|
|
2125
|
+
},
|
|
2126
|
+
respiratoryDetails: {
|
|
2127
|
+
hasRespiratoryCondition: false,
|
|
2128
|
+
conditions: null,
|
|
2129
|
+
isCurrentlyTreatedForSleepApnea: null,
|
|
2130
|
+
sleepApneaComorbidConditions: null,
|
|
2131
|
+
},
|
|
2132
|
+
includeSecondaryAddressee: false,
|
|
2133
|
+
secondaryAddressee: null,
|
|
2134
|
+
});
|
|
2135
|
+
|
|
2136
|
+
if (appResp.isDeclined) {
|
|
2137
|
+
return; // knockout — stop
|
|
2138
|
+
}
|
|
2139
|
+
const { opportunityId } = appResp;
|
|
2140
|
+
```
|
|
2141
|
+
|
|
2142
|
+
***
|
|
2143
|
+
|
|
2144
|
+
### Field to Question Mapping
|
|
2145
|
+
|
|
2146
|
+
Every field accepted by `startFinalExpenseApplication()` mapped to the exact question text shown to the applicant. Fields marked `N/A` are internal or container objects — word them however you choose in the UI.
|
|
2147
|
+
|
|
2148
|
+
| API Field | Question Text | When Required |
|
|
2149
|
+
|---|---|---|
|
|
2150
|
+
| `quoteResponseId` | N/A | Always required. |
|
|
2151
|
+
| `firstName` | First Name | Always required. |
|
|
2152
|
+
| `lastName` | Last Name | Always required. |
|
|
2153
|
+
| `email` | Email Address | Always required. |
|
|
2154
|
+
| `phoneNumber` | Preferred Phone Number | Always required. |
|
|
2155
|
+
| `dateOfBirth` | Date of Birth | Always required. |
|
|
2156
|
+
| `isUsCitizen` | Are you a United States citizen? | Always required. |
|
|
2157
|
+
| `isLegalUsResident` | Are you a legal U.S. resident and have you resided in the U.S. for more than 2 years? | Required when `isUsCitizen` is `false`. |
|
|
2158
|
+
| `isPayerAlsoOwnerAndInsured` | This product requires that the payer, the person purchasing the policy, and the owner are the same person. Please confirm that you are both the insured individual and will also be the owner of the policy. | Always required. `false` declines. |
|
|
2159
|
+
| `socialSecurityNumber` | Social Security Number | Always required. |
|
|
2160
|
+
| `address` | N/A | Always required. |
|
|
2161
|
+
| `address.addressLine1` | Street | Always required. |
|
|
2162
|
+
| `address.city` | City | Always required. |
|
|
2163
|
+
| `address.state` | State | Always required. |
|
|
2164
|
+
| `address.zipcode` | Zip Code | Always required. |
|
|
2165
|
+
| `birthJurisdiction` | N/A | Always required. |
|
|
2166
|
+
| `birthJurisdiction.country` | Birth Country | Always required. |
|
|
2167
|
+
| `birthJurisdiction.state` | State (Birth Jurisdiction) | Required when `birthJurisdiction.country` is `US`. |
|
|
2168
|
+
| `height` | What is your height? | Always required. |
|
|
2169
|
+
| `height.feet` | N/A | Always required. |
|
|
2170
|
+
| `height.inches` | N/A | Always required. |
|
|
2171
|
+
| `weight` | What is your weight? | Always required. |
|
|
2172
|
+
| `isHoldingValidDriverLicense` | Do you have a valid driver's license? | Always required. `false` declines. |
|
|
2173
|
+
| `driverLicenseState` | N/A | Required when `isHoldingValidDriverLicense` is `true`. |
|
|
2174
|
+
| `driverLicenseNumber` | N/A | Required when `isHoldingValidDriverLicense` is `true`. |
|
|
2175
|
+
| `flagTobaccoUse` | Within the past 2 years have you used tobacco or any other product that contains nicotine? | Always required. |
|
|
2176
|
+
| `nicotineInfo` | N/A | Cond. |
|
|
2177
|
+
| `nicotineInfo.lastUseDate` | When was the last time you used tobacco or any other product that contains nicotine? | Required when `flagTobaccoUse` is `true`. |
|
|
2178
|
+
| `currentCareConditions` | N/A | Always required. |
|
|
2179
|
+
| `currentCareConditions.isOnOxygenOrConfinedToFacility` | Are you currently on oxygen for a medical condition, or confined to a nursing facility or assisted living facility? | Always required. `true` declines. |
|
|
2180
|
+
| `currentCareConditions.hasHospitalizationOrAdvisedAdmissionInPastSixMonths` | Within the past six months, have you been hospitalized two or more times, or have you been advised by a member of the medical profession to have any hospitalization or to be admitted to a nursing facility that has not yet been completed? | Always required. `true` declines. |
|
|
2181
|
+
| `currentCareConditions.hasLifeExpectancyTwentyFourMonthsOrLess` | Have you been diagnosed by a member of the medical profession as having a life expectancy of 24 months or less? | Always required. `true` declines. |
|
|
2182
|
+
| `currentCareConditions.hasAidsArcOrHiv` | Have you ever been diagnosed by a member of the medical profession as having acquired immune deficiency syndrome (AIDS) or AIDS related complex (ARC), or tested positive for human immunodeficiency virus (HIV)? | Always required. `true` declines. |
|
|
2183
|
+
| `substanceUseAndMentalHealth` | N/A | Always required. |
|
|
2184
|
+
| `substanceUseAndMentalHealth.hasReceivedDrugAlcoholAdviceInPastTwoYears` | Within the past 2 years have you been counseled, treated, or advised by a physician to discontinue or seek treatment for use of illegal drugs, alcohol or prescription drugs? | Always required. `true` declines. |
|
|
2185
|
+
| `substanceUseAndMentalHealth.hasMentalDisorderHospitalizationInPastTwoYears` | Within the past 2 years have you been hospitalized for a mental disorder? | Always required. `true` declines. |
|
|
2186
|
+
| `testsAppointmentsAndLegalHistory` | N/A | Always required. |
|
|
2187
|
+
| `testsAppointmentsAndLegalHistory.hasIncompleteMedicalAppointmentInPastTwoYears` | Within the past 2 years have you been advised by a member of the medical profession to have any medical appointment that has not yet been completed? | Always required. `true` declines. |
|
|
2188
|
+
| `testsAppointmentsAndLegalHistory.hasIncompleteMedicalTestInPastTwoYears` | Within the past 2 years, have you been advised by a member of the medical profession, to have any medical test (other than related to HIV/AIDS) that has not yet been completed? | Always required. `true` declines. |
|
|
2189
|
+
| `testsAppointmentsAndLegalHistory.hasFelonyOrDuiInPastFiveYears` | Within the past 5 years have you been convicted of any felony or driving under the influence of alcohol or drugs? | Always required. `true` declines. |
|
|
2190
|
+
| `heartStrokeOrganIssuesInPastTwoYears` | N/A | Always required. |
|
|
2191
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasHeartOrVascularConditionInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for heart attack, stroke, chest pain, coronary artery disorder, Transient Ischemic Attack (TIA), myocarditis or any other disorder of the heart, blood vessels or peripheral vascular system? | Always required. `true` declines. |
|
|
2192
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasKidneyLiverOrganOrDiabeticComplicationsInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for kidney disorder, liver disorder, any organ transplant, or diabetic complications (amputation, coma, or blindness)? | Always required. `true` declines. |
|
|
2193
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasCognitiveOrNeurologicalConditionInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for Alzheimer's disease, dementia, organic brain syndrome, cognitive impairment (of any degree), or Amyotrophic Lateral Sclerosis (ALS)? | Always required. `true` declines. |
|
|
2194
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasNonBasalCellCancerInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for cancer, other than basal cell skin cancer? | Always required. `true` declines. |
|
|
2195
|
+
| `respiratoryDetails` | N/A | Always required. |
|
|
2196
|
+
| `respiratoryDetails.hasRespiratoryCondition` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for Chronic Obstructive Pulmonary Disease (COPD), emphysema, Acute Respiratory Distress Syndrome (ARDS) or any other respiratory disorder other than asthma or required the use of a ventilator? | Always required. |
|
|
2197
|
+
| `respiratoryDetails.conditions` | Please specify | Required when `hasRespiratoryCondition` is `true`. |
|
|
2198
|
+
| `respiratoryDetails.isCurrentlyTreatedForSleepApnea` | Are you presently taking any prescribed medication or receiving treatment for this condition? | Required when `sleep apnea` is selected. |
|
|
2199
|
+
| `respiratoryDetails.sleepApneaComorbidConditions` | Do you suffer from any of the following diseases? | Required when `sleep apnea` is selected. |
|
|
2200
|
+
| `includeSecondaryAddressee` | Do you want to provide a secondary addressee? | Always required. |
|
|
2201
|
+
| `secondaryAddressee` | N/A | Cond. |
|
|
2202
|
+
| `secondaryAddressee.firstName` | First Name | Required when `includeSecondaryAddressee` is `true`. |
|
|
2203
|
+
| `secondaryAddressee.lastName` | Last Name | Required when `includeSecondaryAddressee` is `true`. |
|
|
2204
|
+
| `secondaryAddressee.street` | Street | Required when `includeSecondaryAddressee` is `true`. |
|
|
2205
|
+
| `secondaryAddressee.city` | City | Required when `includeSecondaryAddressee` is `true`. |
|
|
2206
|
+
| `secondaryAddressee.state` | State | Required when `includeSecondaryAddressee` is `true`. |
|
|
2207
|
+
| `secondaryAddressee.zipCode` | Zip Code | Required when `includeSecondaryAddressee` is `true`. |
|
|
2208
|
+
| `beneficiaryDetails` | N/A | Always required. |
|
|
2209
|
+
| `beneficiaryDetails.beneficiaryType` | The beneficiary is a... | Always required. |
|
|
2210
|
+
| `beneficiaryDetails.beneficiaryPerson` | N/A | Required when `beneficiaryType` is `Person`. |
|
|
2211
|
+
| `beneficiaryDetails.beneficiaryPerson.firstName` | First name | Required when `beneficiaryType` is `Person`. |
|
|
2212
|
+
| `beneficiaryDetails.beneficiaryPerson.lastName` | Last name | Required when `beneficiaryType` is `Person`. |
|
|
2213
|
+
| `beneficiaryDetails.beneficiaryPerson.relationship` | Relationship | Required when `beneficiaryType` is `Person`. |
|
|
2214
|
+
| `beneficiaryDetails.namedEntity` | N/A | Required when `beneficiaryType` is `Trust`. |
|
|
2215
|
+
| `beneficiaryDetails.namedEntity.name` | Name | Required when `beneficiaryType` is `Trust`. |
|
|
2216
|
+
| `beneficiaryDetails.namedEntity.taxId` | Tax ID | Required when `beneficiaryType` is `Trust`. |
|
|
2217
|
+
| `beneficiaryDetails.namedEntity.trustDate` | Trust Date (mm/yyyy) | Required when `beneficiaryType` is `Trust`. |
|
|
2218
|
+
| `hasExistingCoverage` | Do you have any existing life insurance or annuity contracts in force or is any application for life insurance, or reinstatement now pending with any insurance company? | Always required. |
|
|
2219
|
+
| `existingCoverageData` | N/A | Required when `hasExistingCoverage` is `true`. |
|
|
2220
|
+
| `existingCoverageData.isExistingPolicyBeingTerminated` | Are you considering discontinuing making premium payments, surrendering, forfeiting, assigning to the insurer, or otherwise terminating your existing policy or contract? | Required when `hasExistingCoverage` is `true`. |
|
|
2221
|
+
| `existingCoverageData.areExistingPoliciesIssuedByFidelity` | Are any of your existing policies issued by Fidelity Life Association? | Required for RI and WV. |
|
|
2222
|
+
| `existingCoverageData.existingCoverages` | Please list all such policies here. | Required when `hasExistingCoverage` is `true`. |
|
|
2223
|
+
| `existingCoverageData.existingCoverages[].nameOfTheCompany` | Name of Company | Required per coverage row. |
|
|
2224
|
+
| `existingCoverageData.existingCoverages[].insuranceAmount` | Insurance Amount | Required per coverage row. |
|
|
2225
|
+
| `existingCoverageData.existingCoverages[].dateOfIssue` | Date of Issue | Required per coverage row. |
|
|
2226
|
+
| `existingCoverageData.existingCoverages[].toBeReplaced` | To Be Replaced | Required per coverage row. |
|
|
2227
|
+
| `existingCoverageData.existingCoverages[].toBeFinanced` | To Be Financed | Required per coverage row. |
|
|
2228
|
+
| `existingCoverageData.existingCoverages[].requestsYieldIndices` | Would you like to request yield indices for cash value policies? | Required per coverage row. |
|
|
2229
|
+
| `existingCoverageData.existingCoverages[].notifyPresentInsurer` | Please notify my present insurer(s) regarding this transaction? | Required per coverage row. |
|
|
2230
|
+
| `existingCoverageData.existingCoverages[].wantsPolicySummary` | Do you want a policy summary statement from your existing insurer? | Required per coverage row. |
|
|
2231
|
+
| `existingCoverageData.existingCoverages[].wantsComparativeInformationForm` | Indicate whether or not you wish a Comparative Information Form from the proposed company and your existing insurer or insurers? | Required per coverage row. |
|
|
2232
|
+
| `willOtherCoverageBeReplacedOrFinanced` | If this policy is issued, will any other existing life insurance or annuity contract be cancelled, lapsed or not renewed or are you considering using funds from your existing policies or contracts to pay premiums on the new policy or contract? | Required when `hasExistingCoverage` is `true`. |
|
|
2233
|
+
| `willOtherCoverageBeReplacedOrFinancedData` | N/A | Required for KS/WA when replacing or financing. |
|
|
2234
|
+
| `willOtherCoverageBeReplacedOrFinancedData.areReplacedPoliciesIssuedByFidelity` | Are any of the policies you are considering replacing issued by Fidelity Life Association? | Required for KS/WA. |
|
|
2235
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData` | N/A | Required for KS/WA. |
|
|
2236
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.mayReduceBenefitsIncreasePremiums` | Can there be reduced benefits or increased premiums in later years? | Required for KS/WA. |
|
|
2237
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyReduceBenefitsIncreasePremiums` | Please explain | Cond. |
|
|
2238
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasNewPolicyCharges` | Are there penalties, set up or surrender charges for the new policy? | Required for KS/WA. |
|
|
2239
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyNewPolicyCharges` | Please explain, emphasizing any extra cost for early withdrawal. | Cond. |
|
|
2240
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasPriorPolicyCharges` | Will there be penalties or surrender charges under the existing insurance as a result of the proposed transaction? | Required for KS/WA. |
|
|
2241
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyPriorPolicyCharges` | Please explain | Cond. |
|
|
2242
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasTaxConsequences` | Are there adverse tax consequences from the replacement under current tax law? | Required for KS/WA. |
|
|
2243
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyTaxConsequences` | Please explain | Cond. |
|
|
2244
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasInterestConsiderations` | Are interest earnings a consideration in this replacement? | Required for KS/WA. |
|
|
2245
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyInterestConsiderations` | Please explain what portions of premiums or contributions will produce limited or no earnings. As pertinent, include the need for minimum deposits to enhance earnings, and the reduction of earnings that may result from set up charges, policy fees, and other factors. | Cond. |
|
|
2246
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasMinRequirementsBeforeInterest` | Are minimum amounts required to be on deposit before excess interest will be paid? | Required for KS/WA. |
|
|
2247
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyMinRequirementsBeforeInterest` | Please explain | Cond. |
|
|
2248
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasOtherAdverseEffects` | Are there other short or long term effects from the replacement that might be materially adverse? | Required for KS/WA. |
|
|
2249
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyOtherAdverseEffects` | Please explain | Cond. |
|
|
2250
|
+
|
|
2251
|
+
---
|
|
2252
|
+
|
|
2253
|
+
## Final Expense — Get Existing Quote
|
|
2254
|
+
|
|
2255
|
+
**Method:** `client.getFinalExpenseExistingQuote(opportunityId)`
|
|
2256
|
+
|
|
2257
|
+
Re-fetch a Final Expense quote by `opportunityId` without re-quoting. Returns the same shape as Get Quote. Use `selectedQuote.quoteResponseId` for start application.
|
|
2258
|
+
|
|
2259
|
+
| Validation Error | When |
|
|
2260
|
+
|---|---|
|
|
2261
|
+
| `OpportunityId is required.` | Missing `opportunityId` |
|
|
2262
|
+
| `OpportunityId does not exist.` | Unknown opportunity |
|
|
2263
|
+
| `OpportunityId does not match selected product.` | Opportunity belongs to a different product |
|
|
2264
|
+
|
|
2265
|
+
> A valid GUID format that is not found returns **403 Forbidden** (no body) — surfaced as `InstaBrainError`.
|
|
2266
|
+
|
|
2267
|
+
```typescript
|
|
2268
|
+
const existing = await client.getFinalExpenseExistingQuote(opportunityId);
|
|
2269
|
+
console.log('Premium:', existing.selectedQuote.quoteAmount);
|
|
2270
|
+
```
|
|
2271
|
+
|
|
2272
|
+
---
|
|
2273
|
+
|
|
2274
|
+
## Final Expense — Update Quote
|
|
2275
|
+
|
|
2276
|
+
**Method:** `client.updateFinalExpenseQuote(request)` · **Type:** `ThirdPartyFinalExpenseUpdateQuoteReq`
|
|
2277
|
+
|
|
2278
|
+
Change `faceAmount` and/or `paymentFreq` before payment. Only these two fields can change — nicotine, state, and age cannot. **Blocked once EFT payment is recorded.**
|
|
2279
|
+
|
|
2280
|
+
| Field | Type | Required |
|
|
2281
|
+
|---|---|---|
|
|
2282
|
+
| `opportunityId` | `string` | Yes |
|
|
2283
|
+
| `faceAmount` | `number` | Yes |
|
|
2284
|
+
| `paymentFreq` | `PaymentFrequency` | Yes |
|
|
2285
|
+
|
|
2286
|
+
| Validation Error | When |
|
|
2287
|
+
|---|---|
|
|
2288
|
+
| `OpportunityId is required.` | Missing `opportunityId` |
|
|
2289
|
+
| `OpportunityId does not exist.` | Unknown opportunity |
|
|
2290
|
+
| `OpportunityId does not match selected product.` | Opportunity belongs to a different product |
|
|
2291
|
+
| `Quote update is not allowed when payment is already made.` | EFT payment already saved |
|
|
2292
|
+
| `Coverage amount (FaceAmount) is required.` | Missing `faceAmount` |
|
|
2293
|
+
| `Payment frequency is required.` / `Invalid payment frequency.` | Missing/invalid `paymentFreq` |
|
|
2294
|
+
|
|
2295
|
+
```typescript
|
|
2296
|
+
import { PaymentFrequency } from '@instabrain-sdks/api-client';
|
|
2297
|
+
|
|
2298
|
+
const updated = await client.updateFinalExpenseQuote({
|
|
2299
|
+
opportunityId,
|
|
2300
|
+
faceAmount: 20000,
|
|
2301
|
+
paymentFreq: PaymentFrequency.Annually,
|
|
2302
|
+
});
|
|
2303
|
+
```
|
|
2304
|
+
|
|
2305
|
+
---
|
|
2306
|
+
|
|
2307
|
+
## Final Expense — Underwriting Status (async)
|
|
2308
|
+
|
|
2309
|
+
Final Expense underwrites **asynchronously**. After `finalSubmit()` returns `applicationStatus: 'InProgress'`, poll for the carrier decision. **Final Expense only** — calling these for ADB/GIGDB returns `FinalSubmitStatusNotSupported`.
|
|
2310
|
+
|
|
2311
|
+
**Methods:**
|
|
2312
|
+
- `client.pollFinalExpenseUnderwritingStatus(opportunityId, options?)` — poll until terminal (recommended)
|
|
2313
|
+
- `client.pingFinalExpenseUnderwritingStatus(opportunityId)` — single poll (manual control)
|
|
2314
|
+
|
|
2315
|
+
**Response fields** (`ThirdPartyFinalExpensePingRes`): each poll returns `applicationStatus`, `policyNumber` (populated only when `applicationStatus === 'Approved'`), and **`shouldContinuePolling`** — the authoritative stop signal. Poll while `shouldContinuePolling` is `true`; stop as soon as it is `false`, regardless of the status value. `pollFinalExpenseUnderwritingStatus()` handles this for you.
|
|
2316
|
+
|
|
2317
|
+
### `FinalExpenseApplicationStatus`
|
|
2318
|
+
|
|
2319
|
+
| Value | `shouldContinuePolling` | Meaning |
|
|
2320
|
+
|---|---|---|
|
|
2321
|
+
| `InProgress` | `true` | Decision pending — keep polling |
|
|
2322
|
+
| `Approved` | `false` | `policyNumber` is populated |
|
|
2323
|
+
| `NotEligible` | `false` | Declined by carrier |
|
|
2324
|
+
| `UnableToOffer` | `false` | Carrier cannot offer coverage |
|
|
2325
|
+
| `Closed` | `false` | Application closed, not accepted |
|
|
2326
|
+
| `Abandoned` | `false` | Application abandoned |
|
|
2327
|
+
| `TimedOut` | `false` | No carrier decision within 30 minutes of `finalSubmit()` — terminal |
|
|
2328
|
+
|
|
2329
|
+
### Polling strategy (`PollUnderwritingStatusOptions`)
|
|
2330
|
+
|
|
2331
|
+
Defaults implement the recommended two-phase cadence:
|
|
2332
|
+
|
|
2333
|
+
| Option | Default | Meaning |
|
|
2334
|
+
|---|---|---|
|
|
2335
|
+
| `fastIntervalMs` | `10_000` (10s) | Interval during the fast phase |
|
|
2336
|
+
| `fastPhaseDurationMs` | `420_000` (7 min) | Length of the fast phase |
|
|
2337
|
+
| `slowIntervalMs` | `300_000` (5 min) | Interval after the fast phase |
|
|
2338
|
+
| `maxTotalDurationMs` | `1_800_000` (30 min) | Client-side safety-net budget. The backend itself returns a terminal `'TimedOut'` at 30 min; if that isn't seen, the poll resolves with the last response at this budget |
|
|
2339
|
+
| `onPoll` | — | Callback `(result: ThirdPartyFinalExpensePingRes, attempt: number, elapsedMs: number) => void` invoked after **every** poll. Use it to surface "still underwriting…" progress instead of awaiting silently |
|
|
2340
|
+
|
|
2341
|
+
`pollUnderwritingStatus` resolves as soon as `shouldContinuePolling` is `false` (falling back to a non-`'InProgress'` status on older backends that don't yet send the flag). If the client budget is exhausted first, it resolves with the last response — inspect `applicationStatus` / `shouldContinuePolling` and resume manually with `pingFinalExpenseUnderwritingStatus()` if needed.
|
|
2342
|
+
|
|
2343
|
+
> **Rate limit:** the status endpoint allows **1 request per 2 seconds** per `opportunityId`; exceeding it returns `429 Too Many Requests` with `Retry-After: 2`. `pollFinalExpenseUnderwritingStatus()` **transparently retries a `429` after that delay** — the managed poll never aborts on rate limiting. The default 10s / 5min cadence stays well within the limit; if you override the intervals, keep them **≥ `2000`**. A single `pingFinalExpenseUnderwritingStatus()` call does not auto-retry — handle the `429` yourself.
|
|
2344
|
+
|
|
2345
|
+
```typescript
|
|
2346
|
+
const submit = await client.finalSubmit(opportunityId);
|
|
2347
|
+
|
|
2348
|
+
if (submit.applicationStatus === 'InProgress') {
|
|
2349
|
+
// Final Expense — async underwriting. Poll for the decision.
|
|
2350
|
+
const decision = await client.pollFinalExpenseUnderwritingStatus(opportunityId, {
|
|
2351
|
+
onPoll: (r, attempt, ms) => console.log(`poll #${attempt} (${Math.round(ms / 1000)}s): ${r.applicationStatus}`),
|
|
2352
|
+
});
|
|
2353
|
+
switch (decision.applicationStatus) {
|
|
2354
|
+
case 'Approved':
|
|
2355
|
+
console.log('Policy issued:', decision.policyNumber);
|
|
2356
|
+
break;
|
|
2357
|
+
case 'TimedOut':
|
|
2358
|
+
console.log('No carrier decision within 30 min — treat as terminal');
|
|
2359
|
+
break;
|
|
2360
|
+
case 'InProgress':
|
|
2361
|
+
console.log('Client budget exhausted before backend TimedOut (rare) — resume later');
|
|
2362
|
+
break;
|
|
2363
|
+
default:
|
|
2364
|
+
console.log('Not issued:', decision.applicationStatus);
|
|
2365
|
+
}
|
|
2366
|
+
} else {
|
|
2367
|
+
// ADB / GIGDB — synchronous. policyNumber is immediately available.
|
|
2368
|
+
console.log('Policy issued:', submit.policyNumber);
|
|
2369
|
+
}
|
|
2370
|
+
```
|
|
2371
|
+
|
|
2372
|
+
| Validation Error | Code / Status |
|
|
2373
|
+
|---|---|
|
|
2374
|
+
| `OpportunityId is required.` / `OpportunityId does not exist.` | `400` `InvalidRequestFormat` |
|
|
2375
|
+
| `Final submit status polling is not supported for this product.` | `400` `FinalSubmitStatusNotSupported` |
|
|
2376
|
+
| `Too many requests. Retry after 2 seconds.` | `429` (`Retry-After: 2`) — auto-retried by `pollFinalExpenseUnderwritingStatus()` |
|
|
2377
|
+
|
|
2378
|
+
---
|
|
2379
|
+
|
|
2380
|
+
## Shared methods — GIGDB, ADB & Final Expense
|
|
2381
|
+
|
|
2382
|
+
These methods apply to **GIGDB, ADB, and Final Expense**. IB Term and Pure Term use the frontend links returned by Start Application and do **not** call these.
|
|
1835
2383
|
|
|
1836
2384
|
---
|
|
1837
2385
|
|
|
@@ -2183,6 +2731,9 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2183
2731
|
|
|
2184
2732
|
1. Can only be called once. Subsequent calls for the same `opportunityId` are rejected.
|
|
2185
2733
|
2. `policyNumber` may be `null` — carrier decisions can be async/pending. A `null` on `flagStatus: true` is **not** an error.
|
|
2734
|
+
3. **Response shape differs by product:**
|
|
2735
|
+
- **ADB / GIGDB (synchronous):** `policyNumber` is a non-null string; `applicationStatus` is **absent**.
|
|
2736
|
+
- **Final Expense (asynchronous):** `policyNumber` is `null` and `applicationStatus` is `'InProgress'`. Check `applicationStatus === 'InProgress'` and then poll [`pollFinalExpenseUnderwritingStatus()`](#final-expense--underwriting-status-async).
|
|
2186
2737
|
|
|
2187
2738
|
|
|
2188
2739
|
***
|
|
@@ -2202,7 +2753,8 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2202
2753
|
|
|
2203
2754
|
| Field | Type | Description |
|
|
2204
2755
|
|---|---|---|
|
|
2205
|
-
| `policyNumber` | `string\|null` | Issued policy number.
|
|
2756
|
+
| `policyNumber` | `string\|null` | Issued policy number. `null` while pending (sync) or always on the first call (Final Expense, async). |
|
|
2757
|
+
| `applicationStatus` | `'InProgress'` (optional) | Present only for Final Expense (async underwriting). Absent for ADB/GIGDB. When `'InProgress'`, poll for the decision. |
|
|
2206
2758
|
|
|
2207
2759
|
|
|
2208
2760
|
***
|
|
@@ -2212,8 +2764,12 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2212
2764
|
```typescript
|
|
2213
2765
|
const submitResp = await client.finalSubmit(opportunityId);
|
|
2214
2766
|
|
|
2215
|
-
|
|
2216
|
-
|
|
2767
|
+
if (submitResp.applicationStatus === 'InProgress') {
|
|
2768
|
+
// Final Expense — async underwriting. Poll for the carrier decision.
|
|
2769
|
+
const decision = await client.pollFinalExpenseUnderwritingStatus(opportunityId);
|
|
2770
|
+
console.log('Final status:', decision.applicationStatus, decision.policyNumber);
|
|
2771
|
+
} else if (submitResp.policyNumber) {
|
|
2772
|
+
// ADB / GIGDB — synchronous.
|
|
2217
2773
|
console.log('Policy issued:', submitResp.policyNumber);
|
|
2218
2774
|
} else {
|
|
2219
2775
|
console.log('Submission accepted — policy number pending carrier decision');
|
|
@@ -2580,7 +3136,7 @@ Deprecated enum members (`QuoteNotFound`, `HeightNotValid`, `DocumentsNotViewed`
|
|
|
2580
3136
|
|
|
2581
3137
|
| Code | String Value | Products | When |
|
|
2582
3138
|
|---|---|---|---|
|
|
2583
|
-
| `ApplicationLimitReached` | `'ApplicationLimitReached'` | ADB, GIGDB | Same SSN/email/phone has policy within last 30 days. Not used by IB Term. |
|
|
3139
|
+
| `ApplicationLimitReached` | `'ApplicationLimitReached'` | ADB, GIGDB, Final Expense | Same SSN/email/phone has policy within last 30 days. Not used by IB Term. |
|
|
2584
3140
|
| `StateMismatchIdentified` | `'StateMismatchIdentified'` | All | Quote state ≠ application address state — re-quote |
|
|
2585
3141
|
| `AgentNotFound` | `'agentNotFound'` | All | Quote cannot be linked to agent account — verify credentials |
|
|
2586
3142
|
| `InternalServerError` | `'internalServerError'` | All | Unexpected backend failure — retry; if persistent contact support |
|
|
@@ -2619,6 +3175,7 @@ Deprecated enum members (`QuoteNotFound`, `HeightNotValid`, `DocumentsNotViewed`
|
|
|
2619
3175
|
|---|---|---|
|
|
2620
3176
|
| `PaymentNotMade` | `'paymentNotMade'` | EFT not saved — call `saveEftPayment()` before `finalSubmit()` |
|
|
2621
3177
|
| `FidelityFinalSubmitError` | `'FidelityFinalSubmitError'` | Fidelity carrier rejected or failed to process the submission — contact support with the `opportunityId` |
|
|
3178
|
+
| `FinalSubmitStatusNotSupported` | `'FinalSubmitStatusNotSupported'` | Underwriting status polling attempted for a non-Final-Expense product — `pingFinalExpenseUnderwritingStatus()` / `pollFinalExpenseUnderwritingStatus()` are Final Expense only |
|
|
2622
3179
|
|
|
2623
3180
|
|
|
2624
3181
|
***
|