@instabrain-sdks/api-client 2.3.1 → 2.3.2

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 CHANGED
@@ -1,10 +1,20 @@
1
1
  # @instabrain-sdks/api-client
2
2
 
3
- [npm version](https://badge.fury.io/js/%40instabrain-sdks%2Fapi-client)
3
+ [![npm version](https://badge.fury.io/js/%40instabrain-sdks%2Fapi-client.svg)](https://badge.fury.io/js/%40instabrain-sdks%2Fapi-client)
4
4
 
5
- TypeScript/Node.js SDK for integrating with the InstaBrain insurance platform. Covers three products: **GIGDB** (Guaranteed Issue Guaranteed Death Benefit), **ADB** (Accidental Death Benefit), and IB Term life insurance.
5
+ TypeScript SDK for Node.js. All operations go through `InstaBrainClient` — request/response types are exported from `@instabrain-sdks/api-client`.
6
6
 
7
- **Primary products for third-party integration: GIGDB and ADB.**
7
+ **Products covered:** GIGDB, ADB, IB Term.
8
+
9
+ - **GIGDB & ADB** — full client flow: `get*Quote()` → `start*Application()` → `saveEftPayment()` → SecureSign methods → `finalSubmit()`.
10
+ - **IB Term** — client flow ends at `startIBTermApplication()`; use returned `agentLink` / `applicantLink` / `eAppAgentLink` for the InstaBrain frontend.
11
+
12
+ ```typescript
13
+ import { InstaBrainClient } from '@instabrain-sdks/api-client';
14
+
15
+ const client = InstaBrainClient.forEnvironment('sandbox');
16
+ await client.authenticate(userId, accessToken);
17
+ ```
8
18
 
9
19
  Credentials (`userId` and `accessToken`) are provisioned during onboarding.
10
20
 
@@ -15,25 +25,59 @@ Credentials (`userId` and `accessToken`) are provisioned during onboarding.
15
25
  1. [Installation](#installation)
16
26
  2. [Requirements](#requirements)
17
27
  3. [Authentication](#authentication)
18
- 4. [Product Comparison](#product-comparison)
19
- 5. [GIGDB Flow](#gigdb-flow)
20
- 6. [ADB Flow](#adb-flow)
21
- 7. [IB Term Flow](#ib-term-flow)
22
- 8. [Secure Sign Flow](#secure-sign-flow)
23
- 9. [Final Submit](#final-submit)
24
- 10. [Reporting API](#reporting-api)
25
- 11. [Request Type Reference](#request-type-reference)
26
- 12. [Response Type Reference](#response-type-reference)
27
- 13. [Enums and Constants](#enums-and-constants)
28
- 14. [Beneficiary Reference](#beneficiary-reference)
29
- 15. [Error Handling](#error-handling)
30
- 16. [APIErrorCode Reference](#apierrorcode-reference)
31
- 17. [Field-Level Error Messages](#field-level-error-messages)
32
- 18. [Environment Configuration](#environment-configuration)
33
- 19. [Token Management](#token-management)
34
- 20. [Examples Directory](#examples-directory)
35
- 21. [Changelog](#changelog)
36
- 22. [Support](#support)
28
+ 4. [GIGDB](#gigdb)
29
+ - [Integration flow](#integration-flow)
30
+ - [Get quote](#gigdb--get-quote)
31
+ - [Start application](#gigdb--start-application)
32
+ - [Get existing quote](#gigdb--get-existing-quote)
33
+ - [Update quote](#gigdb--update-quote)
34
+ 5. [ADB](#adb)
35
+ - [Integration flow](#integration-flow-1)
36
+ - [Rider lookup](#adb--rider-lookup)
37
+ - [Occupation lookup (CA)](#adb--occupation-lookup-ca-only)
38
+ - [Get quote](#adb--get-quote)
39
+ - [Start application](#adb--start-application)
40
+ - [Get existing quote](#adb--get-existing-quote)
41
+ - [Update quote](#adb--update-quote)
42
+ 6. [IB Term](#ib-term)
43
+ - [Integration flow](#integration-flow-2)
44
+ - [Rider lookup](#ib-term--rider-lookup)
45
+ - [Get quote](#ib-term--get-quote)
46
+ - [Start application](#ib-term--start-application)
47
+ - [Get existing quote](#ib-term--get-existing-quote)
48
+ 7. [Shared methods — GIGDB & ADB](#shared-methods--gigdb--adb)
49
+ - [Save EFT payment](#save-eft-payment)
50
+ - [Prepare docs & get delivery channels](#prepare-docs--get-delivery-channels)
51
+ - [Send PIN & get documents link](#send-pin--get-documents-link)
52
+ - [Resend PIN](#resend-pin)
53
+ - [Verify PIN](#verify-pin)
54
+ - [Final submit](#final-submit)
55
+ 8. [Reporting](#reporting)
56
+ - [Request fields](#request-fields-shared-shape)
57
+ - [Filters (`SQLOperator`)](#filters--sqloperator-enum)
58
+ - [Response shapes](#response-shapes)
59
+ 9. [Enums & Constants](#enums--constants)
60
+ 10. [Beneficiary Reference](#beneficiary-reference)
61
+ - [No extra fields](#variant-1--no-extra-fields)
62
+ - [Named person](#variant-2--named-person)
63
+ - [Named entity](#variant-3--named-entity)
64
+ 11. [Error Handling](#error-handling)
65
+ - [Error class hierarchy](#error-class-hierarchy)
66
+ - [Using `APIValidationError`](#using-apivalidationerror)
67
+ - [`BaseResponse<T>` envelope](#baseresponset-envelope)
68
+ - [Field-level error messages](#field-level-error-messages)
69
+ 12. [Error codes (`APIErrorCode`)](#apierrorcode-reference)
70
+ - [Quote errors](#quote-errors)
71
+ - [Start application errors](#start-application-errors)
72
+ - [Payment & quote update errors](#payment--quote-update-errors)
73
+ - [Secure Sign errors](#secure-sign-errors)
74
+ - [Final submit errors](#final-submit-errors)
75
+ - [Session](#session)
76
+ - [Deprecated codes (reference only)](#deprecated-codes-reference-only)
77
+ 13. [Environment Configuration](#environment-configuration)
78
+ 14. [Token Management](#token-management)
79
+ 15. [Examples Directory](#examples-directory)
80
+ 16. [Support](#support)
37
81
 
38
82
  ---
39
83
 
@@ -50,83 +94,143 @@ npm install @instabrain-sdks/api-client
50
94
  ## Requirements
51
95
 
52
96
  - Node.js >= 14.0.0
53
- - TypeScript >= 4.0 *(optional - the SDK ships with full type definitions)*
97
+ - TypeScript >= 4.0 *(optional — the SDK ships with full type definitions)*
98
+
99
+ In request field tables, **Type** matches the SDK TypeScript definitions. **Required** values:
100
+
101
+ | Value | Meaning |
102
+ |---|---|
103
+ | `Yes` | Must be sent with a non-null value |
104
+ | `No` | Optional; may be omitted |
105
+ | `Yes*` | Send one of the fields marked `Yes*` in that table |
106
+ | `Yes**` | Send either `dayCount` or both `startDate` and `endDate` (see table footnote) |
107
+ | `One of †` | Send exactly one rating group (see † footnote on that table) |
108
+ | `Conditional` | Required only when the condition in the description or notes applies |
54
109
 
55
110
  ---
56
111
 
57
112
  ## Authentication
58
113
 
59
- Credentials are issued during onboarding:
60
-
114
+ **Method:** `client.authenticate(userId, accessToken)`
61
115
 
62
- | Credential | Type | Description |
63
- | ------------- | --------------- | ------------------------ |
64
- | `userId` | `number` | Your account user ID |
65
- | `accessToken` | `string` (UUID) | Your secret access token |
66
116
 
117
+ **Token validity:** 30 minutes. Design your system to refresh before expiry.
67
118
 
68
119
  ```typescript
69
120
  import { InstaBrainClient } from '@instabrain-sdks/api-client';
70
121
 
71
- const client = InstaBrainClient.forEnvironment('sandbox');
72
- const jwt = await client.authenticate(userId, accessToken);
73
- // JWT is stored internally and automatically attached to all subsequent calls
74
- // No need to manually set it after authenticate()
122
+ const client = InstaBrainClient.forEnvironment('sandbox'); // or 'production'
123
+ await client.authenticate(userId, accessToken);
124
+ // JWT is stored internally — all subsequent calls include it automatically
75
125
  ```
76
126
 
77
- > Call `authenticate()` once at startup. The returned JWT is stored internally - every subsequent API call uses it automatically.
127
+ | Parameter | Type | Description |
128
+ |---------------|----------|--------------------------|
129
+ | `userId` | `number` | Account user ID |
130
+ | `accessToken` | `string` | UUID secret access token |
131
+
132
+ | Environment | Code |
133
+ |-------------|----------|
134
+ | Sandbox | sandbox |
135
+ | Production | production |
78
136
 
79
137
  ---
80
138
 
81
- ## Product Comparison
139
+ ## GIGDB
140
+
141
+ **Guaranteed Issue Guaranteed Death Benefit** — whole life product, no medical exam.
82
142
 
143
+ - **Eligible ages:** 50–85
144
+ - **Face amount:** $5,000–$25,000
145
+ - **Not available in:** NY, MT
146
+ - **Requires:** `isSmoker` on both quote and application; `birthJurisdiction` on application
83
147
 
84
- | Feature | GIGDB | ADB | IB Term |
85
- | -------------------- | ------------------------- | ------------------------------- | --------------------------------------------- |
86
- | Eligible ages | 50–85 | 20–59 | 18–60 |
87
- | Face amount | $5,000–$25,000 | $50,000-$300,000 | $50,000–$1,000,000 (age-scaled) |
88
- | Medical exam | No | No | No (build chart used) |
89
- | Smoker/tobacco field | `isSmoker` (required) | N/A | `flagTobaccoUse` (required) |
90
- | Birth jurisdiction | Yes (`birthJurisdiction`) | No | No |
91
- | App response type | `ThirdPartyStartAppResp` | `ThirdPartyAdbStartAppResp` | `ThirdPartyStartAppResp` |
92
- | `isDeclined` | Yes | Yes | No |
93
- | `isQuoteChanged` | Yes | No | No |
94
- | Response links | None | None | `agentLink`, `eAppAgentLink`, `applicantLink` |
95
- | EFT method | `saveEftPayment()` | `saveEftPayment()` | N/A |
96
- | Unavailable states | NY, MT | MA, NH, AK *(CA: next release)* | WY, NY |
97
- | Status | **Primary** | **Primary** | Secondary *(not fully live yet)* |
148
+ ---
149
+
150
+ ## Integration flow
98
151
 
152
+ ```
153
+ 1. [`getGigdbQuote()`](#gigdb--get-quote) Get quote → quoteResponseId
154
+ 2. [`startGigdbApplication()`](#gigdb--start-application) Start app → opportunityId
155
+ ├── isDeclined = true → STOP (valid knockout, not an error)
156
+ └── isQuoteChanged = true → call `getExistingGigdbQuote()` to fetch updated premium
157
+ 3. [`getExistingGigdbQuote()`](#gigdb--get-existing-quote) [When isQuoteChanged=true, or resuming a prior session]
158
+ 4. [`updateGigdbQuote()`](#gigdb--update-quote) [Optional] Change face amount / payment freq (before EFT only)
159
+ 5. [`saveEftPayment()`](#save-eft-payment) Save bank details — locks the quote
160
+ 6. [`prepareDocsAndGetDeliveryChannels()`](#prepare-docs--get-delivery-channels)
161
+ └── isSignCompleted = true → skip to step 9
162
+ 7. [`sendPinAndGetDocumentsLink()`](#send-pin--get-documents-link)
163
+ 8. [`verifyPin()`](#verify-pin)
164
+ 9. [`finalSubmit()`](#final-submit) → policyNumber
165
+ ```
166
+
167
+ > Steps 5–9 are documented under [Shared methods — GIGDB & ADB](#shared-methods--gigdb--adb).
99
168
 
100
169
  ---
101
170
 
102
- ## GIGDB Flow
171
+ ## GIGDB — Get Quote
103
172
 
104
- > **Not available in:** NY, MT
173
+ **Method:** `client.getGigdbQuote(request)` · **Type:** `ThirdPartyGigdbQuoteRequest`
105
174
 
106
- GIGDB (Guaranteed Issue Guaranteed Death Benefit) is a simplified-issue whole life product for ages 50–85 with no medical exam.
107
175
 
108
- ### Complete flow
176
+ ***
177
+
178
+ ### Request Fields
179
+
180
+ | Field | Type | Required | Description | Validation Error |
181
+ |---|---|---|---|---|
182
+ | `faceAmount` | `number` | Yes | Coverage amount in dollars ($5,000–$25,000) | `Coverage amount (FaceAmount) is required.` |
183
+ | `gender` | `Gender` | Yes | `Gender.Male`, `Gender.Female` | `Gender is required.` / `Invalid gender.` |
184
+ | `stateCode` | `string` | Yes | 2-letter US state code | `State code is required.` / `State code is not valid.` / `This product is not available for the selected state.` |
185
+ | `age` | `number` | Yes* | Applicant age — must be 50–85 | `Either age or date of birth must be provided.` / `Age must be between 50 and 85 for GIGDB.` |
186
+ | `dateOfBirth` | `string` (ISO 8601) | Yes* | Date of birth — derived age must be 50–85 | `Date of birth must be a valid date.` |
187
+ | `paymentFreq` | `PaymentFrequency` | Yes | `"Monthly"` or `"Annually"` | `Payment frequency is required.` / `Invalid payment frequency.` |
188
+ | `isSmoker` | `boolean` | Yes | Smoker status — affects premium | `Smoker status is required.` |
189
+ | `firstName` | `string` | No | Alphabetic only — lead capture | `First name is invalid. Only alphabetic characters are allowed.` |
190
+ | `lastName` | `string` | No | Alphabetic only — lead capture | `Last name is invalid. Only alphabetic characters are allowed.` |
191
+ | `email` | `string` | No | Lead capture | `Please enter a valid email address.` |
192
+ | `phoneNum` | `string` | No | 10 digits or E.164 — lead capture | `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` / `Phone number is invalid.` |
193
+
194
+ > *Provide `age` OR `dateOfBirth`. When both are sent, `dateOfBirth` takes priority.
195
+
196
+
197
+ ***
198
+
199
+ ### Business Rules
200
+
201
+ 1. `isSmoker` is required and affects premium calculation.
202
+ 2. Age is validated against 50–85 range after derivation from `dateOfBirth`.
203
+ 3. GIGDB is not available in NY and MT.
109
204
 
110
- ```
111
- getGigdbQuote()
112
- ↓
113
- startGigdbApplication()
114
- ↓
115
- [if isDeclined = true] → stop - applicant not eligible
116
- [if isQuoteChanged = true] → getExistingGigdbQuote() (conditional)
117
- ↓
118
- updateGigdbQuote() ← optional; MUST be called before saveEftPayment
119
- ↓
120
- saveEftPayment() ← quote cannot be updated after this point
121
- ↓
122
- prepareDocsAndGetDeliveryChannels()
123
- ↓
124
- sendPinAndGetDocumentsLink() → verifyPin()
125
- ↓
126
- finalSubmit()
127
- ```
128
205
 
129
- ### Step 1 - `getGigdbQuote(request: ThirdPartyGigdbQuoteRequest)`
206
+ ***
207
+
208
+ ### Error Codes
209
+
210
+ | Code | When |
211
+ |---|---|
212
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` for details |
213
+ | `StateNotFound` | State code not recognized |
214
+ | `AgeNotFound` | Neither age nor date of birth supplied, or age could not be derived |
215
+ | `NotAvailableForState` | GIGDB not available in the requested state |
216
+ | `QuoteNotEligibleForGivenConditions` | State / age / smoker combination not eligible |
217
+ | `CoverageNotAvailable` | Face amount outside allowed range for state / age / smoker |
218
+
219
+
220
+ ***
221
+
222
+ ### Response
223
+
224
+ | Field | Type | Description |
225
+ |---|---|---|
226
+ | `productName` | `string` | `"InstaGIGDB"` |
227
+ | `selectedQuote.quoteResponseId` | `string` | Pass as `quoteResponseId` in Start Application |
228
+ | `selectedQuote.quoteAmount` | `number` | Premium at requested payment frequency |
229
+
230
+
231
+ ***
232
+
233
+ ### Example
130
234
 
131
235
  ```typescript
132
236
  import { InstaBrainClient, Gender, PaymentFrequency } from '@instabrain-sdks/api-client';
@@ -136,251 +240,585 @@ const quoteResp = await client.getGigdbQuote({
136
240
  gender: Gender.Female,
137
241
  stateCode: 'TX',
138
242
  age: 65,
139
- dateOfBirth: null,
140
243
  paymentFreq: PaymentFrequency.Monthly,
141
- isSmoker: false,
142
- firstName: 'Jane',
143
- lastName: 'Doe',
144
- email: 'jane.doe@example.com',
145
- phoneNum: null
244
+ isSmoker: false
146
245
  });
147
246
 
148
247
  const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
149
248
  ```
150
249
 
151
- ### Step 2 - `startGigdbApplication(request: ThirdPartyGigdbAppReq)`
250
+ ---
251
+
252
+ ## GIGDB — Start Application
253
+
254
+ **Method:** `client.startGigdbApplication(request)` · **Type:** `ThirdPartyGigdbAppReq`
255
+
256
+
257
+ ***
258
+
259
+ ### Top-Level Request Fields
260
+
261
+ | Field | Type | Required | Applicant-Facing Question | Validation Error |
262
+ |---|---|---|---|---|
263
+ | `quoteResponseId` | `string` | Yes | — | `QuoteResponseId is required.` / `QuoteResponseId does not exist or does not belong to the requested product.` |
264
+ | `firstName` | `string` | Yes | *First Name* | `First name is required.` / `First name is invalid. Only alphabetic characters are allowed.` |
265
+ | `lastName` | `string` | Yes | *Last Name* | `Last name is required.` / `Last name is invalid. Only alphabetic characters are allowed.` |
266
+ | `email` | `string` | Yes | *Email Address* | `Email is required.` / `Please enter a valid email address.` |
267
+ | `phoneNumber` | `string` | Yes | *Preferred Phone Number* | `Phone number is required.` / `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` |
268
+ | `dateOfBirth` | `string` (ISO 8601) | Yes | *Date of Birth* | `Date of birth is required.` / `Date of birth must be a valid date in the past.` / `Age must be between 50 and 85 for GIGDB.` |
269
+ | `isUsCitizen` | `boolean` | Yes | *Are you a United States citizen?* | `US citizenship status is required.` |
270
+ | `isLegalUsResident` | `boolean` | Conditional | *Are you a legal U.S. resident and have you resided in the U.S. for more than 2 years?* | `Legal US residency status is required for non-US citizens.` |
271
+ | `isPayerAlsoOwnerAndInsured` | `boolean` | Yes | *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.* | `IsPayerAlsoOwnerAndInsured field is required.` |
272
+ | `socialSecurityNumber` | `string` | Yes | *Social Security Number* | `Social Security Number is required.` / `Social Security Number must be in valid format (e.g., XXX-XX-XXXX).` |
273
+ | `isSmoker` | `boolean` | Yes | *Within the past 2 years have you used tobacco or any other product that contains nicotine?* | `Smoker status is required.` |
274
+ | `hasExistingCoverage` | `boolean` | Yes | See state-specific wording below | `Existing coverage field is required` |
275
+ | `willOtherCoverageBeReplacedOrFinanced` | `boolean\|null` | Conditional | See state-specific wording below | `Please indicate whether any other coverage will be replaced or financed.` / `Other Coverage be replaced or financed must be either null or false as no existing coverage passed.` |
276
+
277
+ > `isLegalUsResident` required when `isUsCitizen = false`.
278
+ > `willOtherCoverageBeReplacedOrFinanced` required when `hasExistingCoverage = true`; must be `null` or `false` when `hasExistingCoverage = false`.
279
+ > `socialSecurityNumber` must be **9 consecutive digits, no dashes** (e.g. `123456789`). The `XXX-XX-XXXX` text in validation messages shows digit positions only.
280
+
281
+
282
+ ***
283
+
284
+ ### `hasExistingCoverage` — State-Specific Question Text
285
+
286
+ | States | Exact Question |
287
+ |---|---|
288
+ | AR, CO, DE, DC, IA, KY, NJ, OK, PA, VA | *Do you have any existing life or health coverage in force or is any application for life or health coverage, or reinstatement, now pending?* |
289
+ | AZ, ID, IN, MI, MS, NV | *Do you have any existing life or health coverage in force or is any application for life or annuity coverage, or reinstatement, now pending?* |
290
+ | All others | *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?* |
291
+
292
+
293
+ ***
294
+
295
+ ### `willOtherCoverageBeReplacedOrFinanced` — State-Specific Question Text
296
+
297
+ | States | Exact Question |
298
+ |---|---|
299
+ | AR, CO, DE, DC, IA, KY, NJ, OK, PA, VA | *If this policy is issued, will any other existing life or health coverage be cancelled, terminated, lapsed or not renewed?* |
300
+ | AZ, ID, IN, MI, MS, NV | *If this policy is issued, will any other existing life or annuity coverage be cancelled, terminated, lapsed or not renewed?* |
301
+ | All others | *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?* |
302
+
303
+
304
+ ***
305
+
306
+ ### Address
307
+
308
+ | Field | Type | Required | Question | Validation Error |
309
+ |---|---|---|---|---|
310
+ | `address.addressLine1` | `string` | Yes | *Street* | `Address line is required.` / `Street address is invalid. Avoid special characters.` |
311
+ | `address.city` | `string` | Yes | *City* | `Address city is required.` / `City name is invalid. Only letters and spaces are allowed.` |
312
+ | `address.state` | `string` | Yes | *State* | `Residence state is required.` / `Residence state code is invalid.` |
313
+ | `address.zipcode` | `string` | Yes | *Zip Code* | `Zip code is required.` / `Zip code is invalid. It must be in 5-digit format.` / `Zip code is not found.` |
314
+
315
+
316
+ ***
317
+
318
+ ### Birth Jurisdiction
319
+
320
+ | Field | Type | Required | Question | Validation Error |
321
+ |---|---|---|---|---|
322
+ | `birthJurisdiction.country` | `string` | Yes | *Birth Country* | `Birth jurisdiction details are required.` / `Birth country is required when applicant is not a U.S. citizen.` / `Birth country code is invalid.` |
323
+ | `birthJurisdiction.state` | `string` | Conditional | *State (Birth Jurisdiction)* | `Birth state is required when applicant is a U.S. citizen.` / `Birth state code is invalid.` |
324
+
325
+ > `birthJurisdiction.state` required when `birthJurisdiction.country = "US"`.
326
+
327
+
328
+ ***
329
+
330
+ ### Nicotine Info (required when `isSmoker = true`)
331
+
332
+ | Field | Type | Required | Question | Validation Error |
333
+ |---|---|---|---|---|
334
+ | `nicotineInfo.lastUseDate` | `string` (`YYYY-MM`) | Yes (when smoker) | *When was the last time you used tobacco or any other product that contains nicotine?* | `Nicotine details are required when applicant is a smoker.` / `Last nicotine use date is required when applicant is a smoker.` / `Nicotine last use date must be in YYYY-MM format.` |
335
+
336
+
337
+ ***
338
+
339
+ ### Existing Coverage (when `hasExistingCoverage = true`)
340
+
341
+ | Field | Type | Required | Question | Validation Error |
342
+ |---|---|---|---|---|
343
+ | `existingCoverageData.isExistingPolicyBeingTerminated` | `boolean` | No | *Are you considering discontinuing making premium payments, surrendering, forfeiting, assigning to the insurer, or otherwise terminating your existing policy or contract?* | `Please indicate whether any existing policy is being terminated.` |
344
+ | `existingCoverageData.existingCoverages[n].nameOfTheCompany` | `string` | Yes | *Name of Company (Enter unknown if company name is not available)* | `Please provide the name of the insurance company.` |
345
+ | `existingCoverageData.existingCoverages[n].insuranceAmount` | `string` | Yes | *Insurance Amount* | `Insurance amount must be provided.` |
346
+ | `existingCoverageData.existingCoverages[n].dateOfIssue` | `string` (`YYYY-MM`) | Yes | *Date of Issue* | `Please provide Date of Issue in YYYY-MM format` / `Date of issue must be in YYYY-MM format.` |
347
+ | `existingCoverageData.existingCoverages[n].toBeReplaced` | `boolean` | Yes | *To Be Replaced* | `Replacement coverage answer must be specified.` |
348
+ | `existingCoverageData.existingCoverages[n].toBeFinanced` | `boolean` | Yes | *Are you considering using funds from your existing policies or contracts to pay premiums due on the new policy or contract?* | `Financing coverage answer must be specified.` |
349
+
350
+
351
+ ***
352
+
353
+ ### State-Specific Existing Coverage Fields
354
+
355
+ | State(s) | Field on `existingCoverages[n]` | Exact Question | Validation Error |
356
+ |---|---|---|---|
357
+ | MA | `requestsYieldIndices` | *Would you like to request yield indices for cash value policies?* | `Please indicate whether yield indices for cash value policies are requested (required for Massachusetts).` |
358
+ | OK | `notifyPresentInsurer` | *Please notify my present insurer(s) regarding this transaction?* | `Please indicate whether to notify present insurer(s) (required for Oklahoma).` |
359
+ | DE, GA | `wantsPolicySummary` | *Do you want a policy summary statement from your existing insurer?* | `Please indicate whether you want a policy summary statement (required for Delaware and Georgia).` |
360
+ | FL | `wantsComparativeInformationForm` | *Indicate whether or not you wish a Comparative Information Form from the proposed company and your existing insurer or insurers?* | `Please indicate whether you want a Comparative Information Form (required for Florida).` |
361
+
362
+ | State(s) | Field on `existingCoverageData` | Exact Question | Validation Error |
363
+ |---|---|---|---|
364
+ | RI, WV | `areExistingPoliciesIssuedByFidelity` | *Are any of your existing policies issued by Fidelity Life Association?* | `Please indicate whether any existing policies are issued by Fidelity Life Association (required for RI and WV).` |
365
+
366
+
367
+ ***
368
+
369
+ ### Replacement / Financing Data (when `willOtherCoverageBeReplacedOrFinanced = true`)
370
+
371
+ For **KS**, populate `willOtherCoverageBeReplacedOrFinancedData.areReplacedPoliciesIssuedByFidelity`:
372
+
373
+ | Field | Exact Question | Validation Error |
374
+ |---|---|---|
375
+ | `areReplacedPoliciesIssuedByFidelity` | *Are any of the policies you are considering replacing issued by Fidelity Life Association?* | `Please indicate whether any policies being replaced are issued by Fidelity Life Association (required for Kansas when replacing or financing coverage).` |
376
+
377
+ For **WA**, populate `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData`. All 7 booleans are required. For each boolean set to `true`, the paired `specify*` string is required.
378
+
379
+ | Field | Exact Question |
380
+ |---|---|
381
+ | `mayReduceBenefitsIncreasePremiums` | *Can there be reduced benefits or increased premiums in later years?* |
382
+ | `specifyReduceBenefitsIncreasePremiums` | *Please explain* |
383
+ | `hasNewPolicyCharges` | *Are there penalties, set up or surrender charges for the new policy?* |
384
+ | `specifyNewPolicyCharges` | *Please explain, emphasizing any extra cost for early withdrawal.* |
385
+ | `hasPriorPolicyCharges` | *Will there be penalties or surrender charges under the existing insurance as a result of the proposed transaction?* |
386
+ | `specifyPriorPolicyCharges` | *Please explain* |
387
+ | `hasTaxConsequences` | *Are there adverse tax consequences from the replacement under current tax law?* |
388
+ | `specifyTaxConsequences` | *Please explain* |
389
+ | `hasInterestConsiderations` | *Are interest earnings a consideration in this replacement?* |
390
+ | `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.* |
391
+ | `hasMinRequirementsBeforeInterest` | *Are minimum amounts required to be on deposit before excess interest will be paid?* |
392
+ | `specifyMinRequirementsBeforeInterest` | *Please explain* |
393
+ | `hasOtherAdverseEffects` | *Are there other short or long term effects from the replacement that might be materially adverse?* |
394
+ | `specifyOtherAdverseEffects` | *Please explain* |
395
+
396
+ WA Validation Errors:
397
+
398
+ | Field | Error |
399
+ |---|---|
400
+ | `WillOtherCoverageBeReplacedOrFinancedData` | `State-specific replacement data is required when other coverage will be replaced or financed.` |
401
+ | `WillOtherCoverageBeReplacedOrFinancedData.OtherInsuranceReplacementData` | `Washington replacement disclosure answers are required when replacing or financing coverage.` |
402
+ | `WillOtherCoverageBeReplacedOrFinancedData.OtherInsuranceReplacementData[n]` | `Each Washington replacement disclosure question must be answered.` |
403
+ | `WillOtherCoverageBeReplacedOrFinancedData.OtherInsuranceReplacementData[n].Explain` | `Please explain is required when the answer is Yes.` |
404
+
405
+
406
+ ***
407
+
408
+ ### Beneficiary Details
409
+
410
+ See [Beneficiary Reference](#beneficiary-reference). GIGDB accepts all `BeneficiaryType` values.
411
+
412
+ | Field | Type | Required | Validation Error |
413
+ |---|---|---|---|
414
+ | `beneficiaryDetails.beneficiaryType` | `string` | Yes | `Beneficiary details are required.` / `Please select a valid beneficiary option.` |
415
+ | `beneficiaryDetails.beneficiaryPerson.firstName` | `string` | Yes (Person) | `Beneficiary first name is required.` / `Beneficiary's first name is invalid.` |
416
+ | `beneficiaryDetails.beneficiaryPerson.lastName` | `string` | Yes (Person) | `Beneficiary last name is required.` / `Beneficiary's last name is invalid.` |
417
+ | `beneficiaryDetails.beneficiaryPerson.relationship` | `string` | Yes (Person) | `Please specify the relationship with the beneficiary.` |
418
+ | `beneficiaryDetails.namedEntity.name` | `string` | Yes (entity types) | `Named entity details must be provided for this beneficiary type.` / `Beneficiary name is required.` |
419
+ | `beneficiaryDetails.namedEntity.trustDate` | `string` (`YYYY-MM`) | Yes (Trust) | `Trust date must be in YYYY-MM format.` |
420
+
421
+
422
+ ***
423
+
424
+ ### Business Rules
425
+
426
+ 1. Quote state and `address.state` must match — mismatch returns `StateMismatchIdentified`.
427
+ 2. `isSmoker = true` requires `nicotineInfo.lastUseDate` in `YYYY-MM` format.
428
+ 3. `hasExistingCoverage = false` requires `existingCoverageData = null` and `willOtherCoverageBeReplacedOrFinanced` null or false.
429
+ 4. State-specific existing coverage fields are only enforced when `hasExistingCoverage = true` or `willOtherCoverageBeReplacedOrFinanced = true`.
430
+ 5. `ApplicationLimitReached` fires (as a top-level error code, not `InvalidRequestFormat`) when the same SSN, email, or phone already has a GIGDB policy generated within the last 30 days.
431
+
432
+
433
+ ***
434
+
435
+ ### Knockout Rules
436
+
437
+ Returns `isDeclined: true` on a successful response — the SDK does **not** throw. Check the field explicitly; do not treat it as an exception.
438
+
439
+ - `isPayerAlsoOwnerAndInsured = false`
440
+ - `isUsCitizen = false` AND `isLegalUsResident = false`
441
+
442
+ > When declined, `opportunityId` may be the all-zero UUID (`00000000-0000-0000-0000-000000000000`).
443
+
444
+
445
+ ***
446
+
447
+ ### `isQuoteChanged`
448
+
449
+ When `isQuoteChanged = true`, the carrier adjusted the premium based on application data. Call [`getExistingGigdbQuote()`](#gigdb--get-existing-quote) with the returned `opportunityId` to retrieve the revised quote, then re-present it to the applicant before proceeding to EFT.
450
+
451
+
452
+ ***
453
+
454
+ ### Error Codes
455
+
456
+ | Code | When |
457
+ |---|---|
458
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
459
+ | `ApplicationLimitReached` | SSN, email, or phone matches a GIGDB policy generated within the last 30 days |
460
+ | `StateMismatchIdentified` | Quote state ≠ `address.state` |
461
+ | `AgentNotFound` | Quote cannot be linked to the agent account — verify credentials |
462
+ | `InternalServerError` | Unexpected backend failure — retry; contact support if persistent |
463
+
464
+ **`ApplicationLimitReached` field-level messages:**
465
+
466
+ | Field | Message |
467
+ |---|---|
468
+ | `SocialSecurityNumber` | `An application with the same SSN has a policy generated within the last 30 days.` |
469
+ | `Email` | `An application with the same email has a policy generated within the last 30 days.` |
470
+ | `PhoneNumber` | `Two applications with the same phone have policies generated within the last 30 days.` |
471
+
472
+
473
+ ***
474
+
475
+ ### Response
476
+
477
+ | Field | Type | Description |
478
+ |---|---|---|
479
+ | `opportunityId` | `string` | Pass to later `client.*` calls (EFT, SecureSign, `finalSubmit`, etc.) |
480
+ | `isDeclined` | `boolean` | `true` = knockout; stop the flow |
481
+ | `isQuoteChanged` | `boolean` | `true` = carrier adjusted premium; call `getExistingGigdbQuote()` before EFT |
482
+
483
+
484
+ ***
485
+
486
+ ### Example
152
487
 
153
488
  ```typescript
154
489
  import { BeneficiaryType, BeneficiaryRelationship } from '@instabrain-sdks/api-client';
155
490
 
156
491
  const appResp = await client.startGigdbApplication({
157
- quoteResponseId: quoteResp.selectedQuote.quoteResponseId,
158
- firstName: 'Jane',
159
- lastName: 'Doe',
160
- email: 'jane.doe@example.com',
161
- phoneNumber: '5551234567',
162
- isUsCitizen: true,
163
- isPayerAlsoOwnerAndInsured: true,
164
- isLegalUsResident: true,
165
- address: {
166
- addressLine1: '123 Main St',
167
- city: 'Austin',
168
- state: 'TX',
169
- zipcode: '73301'
170
- },
492
+ quoteResponseId,
493
+ firstName: 'Jane', lastName: 'Doe',
494
+ email: 'jane.doe@example.com', phoneNumber: '5551234567',
171
495
  dateOfBirth: '1958-06-15',
172
- socialSecurityNumber: '123-45-6789',
173
- birthJurisdiction: {
174
- state: 'TX',
175
- country: 'US'
176
- },
177
- isSmoker: false,
178
- nicotineInfo: null,
179
- hasExistingCoverage: false,
180
- willOtherCoverageBeReplacedOrFinanced: null,
181
- existingCoverageData: null,
496
+ isUsCitizen: true, isPayerAlsoOwnerAndInsured: true,
497
+ socialSecurityNumber: '123456789',
498
+ isSmoker: false, nicotineInfo: null,
499
+ hasExistingCoverage: false, willOtherCoverageBeReplacedOrFinanced: null, existingCoverageData: null,
500
+ address: { addressLine1: '123 Main St', city: 'Austin', state: 'TX', zipcode: '73301' },
501
+ birthJurisdiction: { country: 'US', state: 'TX' },
182
502
  beneficiaryDetails: {
183
503
  beneficiaryType: BeneficiaryType.Person,
184
- beneficiaryPerson: {
185
- firstName: 'John',
186
- lastName: 'Doe',
187
- relationship: BeneficiaryRelationship.Spouse
188
- }
504
+ beneficiaryPerson: { firstName: 'John', lastName: 'Doe', relationship: BeneficiaryRelationship.Spouse }
189
505
  }
190
506
  });
191
507
 
192
508
  if (appResp.isDeclined) {
193
- // Valid knockout - the applicant did not meet eligibility criteria.
194
- // This is NOT an error - do not throw.
195
- console.log('Application declined');
509
+ // Valid knockout — stop the flow, do not proceed
196
510
  return;
197
511
  }
198
-
199
- const { opportunityId, isQuoteChanged } = appResp;
512
+ if (appResp.isQuoteChanged) {
513
+ // Carrier adjusted the premium — fetch updated quote before saving EFT
514
+ const updated = await client.getExistingGigdbQuote(appResp.opportunityId);
515
+ // Re-present updated.selectedQuote.quoteAmount to the applicant
516
+ }
517
+ const { opportunityId } = appResp;
200
518
  ```
201
519
 
202
- `**isDeclined: true**` - the applicant did not meet eligibility criteria. This is a valid response, not an error. Stop the flow.
520
+ ---
521
+
522
+ ## GIGDB — Get Existing Quote
203
523
 
204
- `**isQuoteChanged: true**` - the carrier adjusted the premium based on application data. Proceed to Step 3.
524
+ **Method:** `client.getExistingGigdbQuote(opportunityId)`
205
525
 
206
- #### State-specific Other Insurance fields (Q-08)
207
526
 
208
- > Third-party integrations must display the exact regulated question text below to applicants — paraphrasing is not sufficient. Source: Confluence page 687800321 (GIGDB Start Application API).
527
+ **When to call:**
528
+ - `isQuoteChanged = true` returned by Start Application — fetch the carrier-adjusted premium before proceeding.
529
+ - Resuming a prior session — re-fetch the quote for an existing opportunity without re-quoting.
209
530
 
210
- When `hasExistingCoverage === true`, the following per-coverage flags are required for specific states:
211
531
 
212
- | State | Field on `existingCoverages[]` | Type | Exact applicant-facing question text |
213
- |-----------|------------------------------------|-----------|---------------------------------------|
214
- | MA | `requestsYieldIndices` | `boolean` | *Would you like to request yield indices for cash value policies?* |
215
- | OK | `notifyPresentInsurer` | `boolean` | *Please notify my present insurer(s) regarding this transaction?* |
216
- | DE / GA | `wantsPolicySummary` | `boolean` | *Do you want a policy summary statement from your existing insurer?* |
217
- | FL | `wantsComparativeInformationForm` | `boolean` | *Indicate whether or not you wish a Comparative Information Form from the proposed company and your existing insurer or insurers?* |
532
+ ***
218
533
 
219
- For **RI** or **WV**, set `existingCoverageData.areExistingPoliciesIssuedByFidelity: boolean`.
220
- > Question text: *"Are any of your existing policies issued by Fidelity Life Association?"*
534
+ ### Request Parameters
535
+
536
+ | Parameter | Type | Required |
537
+ |---|---|---|
538
+ | `opportunityId` | `string` | Yes |
221
539
 
222
- When `willOtherCoverageBeReplacedOrFinanced === true` and the state is **KS** or **WA**, populate the new top-level `willOtherCoverageBeReplacedOrFinancedData` object:
223
540
 
224
- - **KS** → `areReplacedPoliciesIssuedByFidelity: boolean`
225
- > Question text: *"Are any of the policies you are considering replacing issued by Fidelity Life Association?"*
226
- - **WA** → `otherInsuranceReplacementData` — all 7 booleans are required; each `specify*` string is required when its boolean is `true`. See `GigdbOtherInsuranceReplacementData` for the full field list.
541
+ ***
227
542
 
228
- ##### WA `otherInsuranceReplacementData` — exact question text per field
543
+ ### Error Codes
229
544
 
230
- | Field | Exact applicant-facing question text |
545
+ | Code | When |
231
546
  |---|---|
232
- | `mayReduceBenefitsIncreasePremiums` | *Can there be reduced benefits or increased premiums in later years?* |
233
- | `specifyReduceBenefitsIncreasePremiums` | *Please explain* |
234
- | `hasNewPolicyCharges` | *Are there penalties, set up or surrender charges for the new policy?* |
235
- | `specifyNewPolicyCharges` | *Please explain, emphasizing any extra cost for early withdrawal.* |
236
- | `hasPriorPolicyCharges` | *Will there be penalties or surrender charges under the existing insurance as a result of the proposed transaction?* |
237
- | `specifyPriorPolicyCharges` | *Please explain* |
238
- | `hasTaxConsequences` | *Are there adverse tax consequences from the replacement under current tax law?* |
239
- | `specifyTaxConsequences` | *Please explain* |
240
- | `hasInterestConsiderations` | *Are interest earnings a consideration in this replacement?* |
241
- | `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.* |
242
- | `hasMinRequirementsBeforeInterest` | *Are minimum amounts required to be on deposit before excess interest will be paid?* |
243
- | `specifyMinRequirementsBeforeInterest`| *Please explain* |
244
- | `hasOtherAdverseEffects` | *Are there other short or long term effects from the replacement that might be materially adverse?* |
245
- | `specifyOtherAdverseEffects` | *Please explain* |
246
-
247
- Example WA payload (replacement disclosure):
547
+ | `InvalidRequestFormat` | `OpportunityId is required.` / `OpportunityId does not exist.` / `OpportunityId does not match selected product.` |
548
+ > Throws `AuthenticationError` when the opportunity ID is not found or not in scope for your token. Distinct from `APIValidationError` with message `"does not exist"`.
549
+
550
+
551
+ ***
552
+
553
+ ### Response
554
+
555
+ | Field | Type | Description |
556
+ |---|---|---|
557
+ | `productName` | `string` | `"InstaGIGDB"` |
558
+ | `selectedQuote.quoteResponseId` | `string` | Updated quote response ID |
559
+ | `selectedQuote.quoteAmount` | `number` | Revised premium |
560
+
561
+
562
+ ***
563
+
564
+ ### Example
248
565
 
249
566
  ```typescript
250
- willOtherCoverageBeReplacedOrFinancedData: {
251
- otherInsuranceReplacementData: {
252
- mayReduceBenefitsIncreasePremiums: true,
253
- specifyReduceBenefitsIncreasePremiums: 'Premiums may rise after year 5',
254
- hasNewPolicyCharges: true,
255
- specifyNewPolicyCharges: 'Surrender charges in years 1-3',
256
- hasPriorPolicyCharges: false,
257
- hasTaxConsequences: false,
258
- hasInterestConsiderations: true,
259
- specifyInterestConsiderations: 'Lower guaranteed rate on new policy',
260
- hasMinRequirementsBeforeInterest: false,
261
- hasOtherAdverseEffects: false
262
- }
263
- }
567
+ const quoteResp = await client.getExistingGigdbQuote(opportunityId);
568
+ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
264
569
  ```
265
570
 
266
- ### Step 3 - Handle quote change (conditional)
571
+ ---
267
572
 
268
- ```typescript
269
- let currentQuote = quoteResp.selectedQuote;
573
+ ## GIGDB — Update Quote
270
574
 
271
- if (isQuoteChanged) {
272
- const updatedQuoteResp = await client.getExistingGigdbQuote(opportunityId);
273
- currentQuote = updatedQuoteResp.selectedQuote;
274
- // Show the updated premium to the applicant before continuing
275
- }
276
- ```
575
+ **Method:** `client.updateGigdbQuote(request)` · **Type:** `ThirdPartyGigdbUpdateQuoteReq`
576
+
577
+
578
+ Changes face amount or payment frequency after start application. Must be called **before** `save-eft-payment` — blocked once payment is saved.
579
+
580
+
581
+ ***
582
+
583
+ ### Request Fields
584
+
585
+ | Field | Type | Required | Validation Error |
586
+ |---|---|---|---|
587
+ | `opportunityId` | `string` | Yes | `OpportunityId is required.` / `OpportunityId does not exist.` / `Quote update is not allowed when payment is already made.` |
588
+ | `faceAmount` | `number` | Yes | `Coverage amount (FaceAmount) is required.` |
589
+ | `paymentFreq` | `PaymentFrequency` | Yes | `Payment frequency is required.` / `Invalid payment frequency.` |
590
+
591
+
592
+ ***
593
+
594
+ ### Business Rules
595
+
596
+ 1. GIGDB does not support riders — do not send a `riders` field.
597
+ 2. Only `faceAmount` and `paymentFreq` can be changed. Smoker status, state, and age cannot be modified.
598
+
599
+
600
+ ***
601
+
602
+ ### Error Codes
603
+
604
+ | Code | When |
605
+ |---|---|
606
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
607
+ | `PaymentAlreadyMade` | EFT already saved — quote update no longer allowed |
608
+
609
+
610
+ ***
611
+
612
+ ### Response
613
+
614
+ Same shape as Get Quote — reflects the recalculated premium.
277
615
 
278
- ### Step 4 - `updateGigdbQuote` (optional - must be called BEFORE `saveEftPayment`)
279
616
 
280
- If the applicant wants to change the face amount or payment frequency after the application has started:
617
+ ***
618
+
619
+ ### Example
281
620
 
282
621
  ```typescript
283
- const updatedQuoteResp = await client.updateGigdbQuote({
622
+ import { PaymentFrequency } from '@instabrain-sdks/api-client';
623
+
624
+ const updatedQuote = await client.updateGigdbQuote({
284
625
  opportunityId,
285
626
  faceAmount: 20000,
286
627
  paymentFreq: PaymentFrequency.Annually
287
628
  });
288
- // updatedQuoteResp.selectedQuote.quoteAmount reflects the new premium
629
+ // updatedQuote.selectedQuote.quoteAmount reflects the new premium
289
630
  ```
290
631
 
291
- > **Important:** The quote cannot be updated after EFT payment details are saved. `updateGigdbQuote()` must be called before `saveEftPayment()`.
632
+ ---
292
633
 
293
- ### Step 5 - `saveEftPayment(request: ThirdPartyEftPaymentReq)`
634
+ ## ADB
294
635
 
295
- ```typescript
296
- await client.saveEftPayment({
297
- opportunityId,
298
- accountHolderName: 'Jane Doe',
299
- routingNumber: '021000021',
300
- accountNumber: '123456789'
301
- });
302
- // After this point, the quote can no longer be updated.
303
- ```
636
+ **Accidental Death Benefit** — simplified-issue product, no medical exam.
304
637
 
305
- ### Steps 6–7 - Secure Sign → Final Submit
638
+ - **Eligible ages:** 20–59
639
+ - **Face amount:** $50,000–$300,000
640
+ - **Not available in:** MA, NH, AK
641
+ - **CA:** Supported — `occupation` field required on application
642
+ - **No** `isSmoker`, `birthJurisdiction`, or `nicotineInfo` fields
306
643
 
307
- See [Secure Sign Flow](#secure-sign-flow) and [Final Submit](#final-submit).
644
+ ---
645
+
646
+ ## Integration flow
647
+
648
+ ```
649
+ 0. [`getAdbRiderDetails()`](#adb--rider-lookup) [Optional] Confirm availability + rider codes
650
+ └── flagProductNotAvailableForState = true → STOP
651
+ 0b. [`getAdbOccupationOptions()`](#adb--occupation-lookup-ca-only) [CA only] Fetch valid occupation labels
652
+ 1. [`getAdbQuote()`](#adb--get-quote) Get quote → quoteResponseId
653
+ 2. [`startAdbApplication()`](#adb--start-application) Start app → opportunityId
654
+ └── isDeclined = true → STOP (valid knockout, not an error)
655
+ 3. [`getExistingAdbQuote()`](#adb--get-existing-quote) [Optional] Re-fetch quote for resumed session
656
+ 4. [`updateAdbQuote()`](#adb--update-quote) [Optional] Change face amount / payment freq / riders (before EFT only)
657
+ 5. [`saveEftPayment()`](#save-eft-payment) Save bank details — locks the quote
658
+ 6. [`prepareDocsAndGetDeliveryChannels()`](#prepare-docs--get-delivery-channels)
659
+ └── isSignCompleted = true → skip to step 9
660
+ 7. [`sendPinAndGetDocumentsLink()`](#send-pin--get-documents-link)
661
+ 8. [`verifyPin()`](#verify-pin)
662
+ 9. [`finalSubmit()`](#final-submit) → policyNumber
663
+ ```
664
+
665
+ > Steps 5–9 are documented under [Shared methods — GIGDB & ADB](#shared-methods--gigdb--adb).
308
666
 
309
667
  ---
310
668
 
311
- ## ADB Flow
669
+ ## ADB — Rider Lookup
312
670
 
313
- > **Not available in:** MA, NH, AK
314
- >
315
- > **CA:** Supported. The ADB application requires the `occupation` field for California residents — populate it via `getAdbOccupationOptions()`.
671
+ **Method:** `client.getAdbRiderDetails(stateCode)`
316
672
 
317
- ADB (Accidental Death Benefit) provides coverage for accidental deaths for ages 20–59.
318
673
 
319
- ### Complete flow
674
+ Optional pre-quote step. Confirms ADB availability for a state and returns valid rider codes.
320
675
 
321
- ```
322
- getAdbRiderDetails() ← check state availability & collect riderCodes
323
- ↓
324
- getAdbOccupationOptions() ← CA only — lookup occupation labels for the application
325
- ↓
326
- getAdbQuote()
327
- ↓
328
- startAdbApplication()
329
- ↓
330
- [if isDeclined = true] → stop - applicant not eligible
331
- ↓
332
- updateAdbQuote() ← optional — MUST be before saveEftPayment
333
- ↓
334
- getExistingAdbQuote() ← optional — fetch the current quote after update
335
- ↓
336
- saveEftPayment() ← shared with GIGDB; quote cannot be updated after this point
337
- ↓
338
- prepareDocsAndGetDeliveryChannels()
339
- ↓
340
- sendPinAndGetDocumentsLink() → verifyPin()
341
- ↓
342
- finalSubmit()
343
- ```
676
+ > **CA is not supported.** `stateCode = "CA"` returns a 400 validation error — not a `flagProductNotAvailableForState` flag.
344
677
 
345
- ### Step 0 - `getAdbRiderDetails(stateCode: string)` (optional pre-step)
346
678
 
347
- Call before `getAdbQuote()` to check whether ADB is available in the applicant's state and to retrieve the `riderCode` values to pass into the quote request. Skip this step only if you already know which riders (if any) are available for the state.
679
+ ***
348
680
 
349
- > **Note:** California (`CA`) is not supported — the API will return a 400 error for `stateCode = "CA"`.
681
+ ### Request Parameters
682
+
683
+ | Parameter | Type | Required | Validation Error |
684
+ |---|---|---|---|
685
+ | `stateCode` | `string` (query) | Yes | `State code is required.` / `State code is not valid.` / `This state is currently not supported.` |
686
+
687
+
688
+ ***
689
+
690
+ ### Error Codes
691
+
692
+ | Code | When |
693
+ |---|---|
694
+ | `InvalidRequestFormat` | State code missing, invalid, or unsupported |
350
695
 
351
- ```typescript
352
- import { InstaBrainClient } from '@instabrain-sdks/api-client';
353
696
 
697
+ ***
698
+
699
+ ### Response
700
+
701
+ | Field | Type | Description |
702
+ |---|---|---|
703
+ | `flagProductNotAvailableForState` | `boolean` | `true` → ADB not available in this state — do not proceed |
704
+ | `riders[n].riderCode` | `string` | Pass as a value in `riders[]` on Get Quote and Update Quote |
705
+ | `riders[n].riderTitle` | `string` | Display name |
706
+ | `riders[n].riderDescription` | `string` | Coverage description |
707
+
708
+ > `riders` may be an empty array even when `flagProductNotAvailableForState = false` — no optional riders configured for that state.
709
+
710
+
711
+ ***
712
+
713
+ ### Example
714
+
715
+ ```typescript
354
716
  const riderDetails = await client.getAdbRiderDetails('TX');
355
717
 
356
718
  if (riderDetails.flagProductNotAvailableForState) {
357
- // ADB not available in this state — do not proceed to quote
719
+ // ADB not available in this state — do not proceed
358
720
  return;
359
721
  }
360
722
 
361
- // Collect riderCodes the user wants to include (may be an empty array)
362
- const selectedRiderCodes = riderDetails.riders.map(r => r.riderCode);
363
- // Pass selectedRiderCodes into ThirdPartyAdbQuoteRequest.riders
723
+ const riderCodes = riderDetails.riders.map(r => r.riderCode);
724
+ // Pass riderCodes into the riders[] field on Get Quote
364
725
  ```
365
726
 
366
- > **Note:** `riders` may be an empty array even when `flagProductNotAvailableForState = false` — this means no optional riders are configured for that state.
367
727
 
368
- ### Step 0a - `getAdbOccupationOptions(query?: string)` (CA only)
728
+ ***
729
+
730
+ ### Available Rider Codes
731
+
732
+ | `AdbRiderType` Enum | Code Value | Description |
733
+ |---|---|---|
734
+ | `AdbRiderType.FamilyADB` | `'FamilyADB'` | Accidental death benefit for spouse and eligible dependent children |
735
+ | `AdbRiderType.ReturnOfPremium` | `'ReturnOfPremium'` | Returns all premiums paid if no claim during policy term |
736
+ | `AdbRiderType.InflationBenefit` | `'InflationBenefit'` | Face amount increases annually with inflation |
737
+
738
+ > Do **not** use `RiderType` values (`"ADB Rider"`, `"Dependent Child Rider"`) — those are IB Term display titles. Do **not** use `"CHILD_TERM"` — it does not exist for ADB.
739
+
740
+ ---
741
+
742
+ ## ADB — Occupation Lookup (CA only)
369
743
 
370
- Search occupation labels for the ADB product. Required only when `address.state === "CA"` on the application — the `occupation` field on `ThirdPartyAdbAppReq` must be populated with one or more labels returned by this endpoint.
744
+ **Method:** `client.getAdbOccupationOptions(query?)`
745
+
746
+
747
+ Returns valid occupation label strings for CA residents. Pass returned values directly as the `occupation` array in Start Application. `query` is optional — omit to retrieve all options.
371
748
 
372
749
  ```typescript
373
- // Filter to a short list
374
750
  const matches = await client.getAdbOccupationOptions('nurse');
375
- // ['Registered Nurse', 'Nurse Practitioner', 'Licensed Practical Nurse', ...]
376
-
377
- // Or fetch the full list (omit the query)
378
- const allOccupations = await client.getAdbOccupationOptions();
751
+ const all = await client.getAdbOccupationOptions();
379
752
  ```
380
753
 
381
- > Skip this call entirely for non-CA states — `occupation` should be omitted from the application request when the state is not CA.
754
+ No field-validation errors are returned for this method.
755
+
756
+ ---
757
+
758
+ ## ADB — Get Quote
759
+
760
+ **Method:** `client.getAdbQuote(request)` · **Type:** `ThirdPartyAdbQuoteRequest`
761
+
762
+
763
+ ***
764
+
765
+ ### Request Fields
766
+
767
+ | Field | Type | Required | Description | Validation Error |
768
+ |---|---|---|---|---|
769
+ | `faceAmount` | `number` | Yes | Coverage amount ($50,000–$300,000) | `Coverage amount (FaceAmount) is required.` |
770
+ | `gender` | `Gender` | Yes | `Gender.Male`, `Gender.Female` | `Gender is required.` / `Invalid gender.` |
771
+ | `stateCode` | `string` | Yes | 2-letter US state — not MA, NH, AK, CA | `State code is required.` / `State code is not valid.` / `This state is currently not supported.` / `This product is not available for the selected state.` |
772
+ | `age` | `number` | Yes* | Must be 20–59 | `Either age or date of birth must be provided.` / `Age must be between 20 and 59 for ADB.` |
773
+ | `dateOfBirth` | `string` (ISO 8601) | Yes* | Derived age must be 20–59 | `Date of birth must be a valid date.` |
774
+ | `paymentFreq` | `PaymentFrequency` | Yes | `"Monthly"` or `"Annually"` | `Payment frequency is required.` / `Invalid payment frequency.` |
775
+ | `riders` | `AdbRiderType[]` | No | `riderCode` values from Rider Lookup | `Riders are invalid.` |
776
+ | `firstName` | `string` | No | Alphabetic only | `First name is invalid. Only alphabetic characters are allowed.` |
777
+ | `lastName` | `string` | No | Alphabetic only | `Last name is invalid. Only alphabetic characters are allowed.` |
778
+ | `email` | `string` | No | Lead capture | `Please enter a valid email address.` |
779
+ | `phoneNum` | `string` | No | 10 digits or E.164 | `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` / `Phone number is invalid.` |
780
+
781
+ > *Provide `age` OR `dateOfBirth`.
782
+
783
+
784
+ ***
785
+
786
+ ### Business Rules
787
+
788
+ 1. Rider codes are validated against ADB for the given state — unrecognised codes are rejected.
789
+ 2. CA is not supported at quote time — returns `This state is currently not supported.`
790
+
791
+
792
+ ***
793
+
794
+ ### Error Codes
795
+
796
+ | Code | When |
797
+ |---|---|
798
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
799
+ | `StateNotFound` | State code not recognized |
800
+ | `AgeNotFound` | Neither age nor date of birth supplied, or age could not be derived |
801
+ | `NotAvailableForState` | ADB not available in the requested state |
802
+ | `QuoteNotEligibleForGivenConditions` | State / age combination not eligible |
803
+ | `CoverageNotAvailable` | Face amount outside allowed range |
804
+ | `RiderNotAvailable` | Rider not available for this product or state |
805
+ | `RiderFaceAmountNotValid` | Rider benefit amount outside allowed range |
806
+
807
+
808
+ ***
809
+
810
+ ### Response
382
811
 
383
- ### Step 1 - `getAdbQuote(request: ThirdPartyAdbQuoteRequest)`
812
+ | Field | Type | Description |
813
+ |---|---|---|
814
+ | `productName` | `string` | `"InstaADB"` |
815
+ | `selectedQuote.quoteResponseId` | `string` | Pass as `quoteResponseId` in Start Application |
816
+ | `selectedQuote.quoteAmount` | `number` | Premium at requested payment frequency |
817
+
818
+
819
+ ***
820
+
821
+ ### Example
384
822
 
385
823
  ```typescript
386
824
  import { InstaBrainClient, Gender, PaymentFrequency, AdbRiderType } from '@instabrain-sdks/api-client';
@@ -391,1507 +829,1412 @@ const quoteResp = await client.getAdbQuote({
391
829
  stateCode: 'TX',
392
830
  age: 35,
393
831
  paymentFreq: PaymentFrequency.Monthly,
394
- riders: [AdbRiderType.FamilyADB],
395
- firstName: 'John',
396
- lastName: 'Smith',
397
- email: 'john.smith@example.com'
832
+ riders: [AdbRiderType.FamilyADB]
398
833
  });
399
834
 
400
- const { quoteResponseId } = quoteResp.selectedQuote;
835
+ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
401
836
  ```
402
837
 
403
- **Rider notes:**
838
+ ---
839
+
840
+ ## ADB — Start Application
841
+
842
+ **Method:** `client.startAdbApplication(request)` · **Type:** `ThirdPartyAdbAppReq`
843
+
844
+
845
+ ***
846
+
847
+ ### Top-Level Request Fields
848
+
849
+ | Field | Type | Required | Applicant-Facing Question | Validation Error |
850
+ |---|---|---|---|---|
851
+ | `quoteResponseId` | `string` | Yes | — | `QuoteResponseId is required.` / `QuoteResponseId does not exist or does not belong to the requested product.` |
852
+ | `firstName` | `string` | Yes | *First Name* | `First name is required.` / `First name is invalid. Only alphabetic characters are allowed.` |
853
+ | `lastName` | `string` | Yes | *Last Name* | `Last name is required.` / `Last name is invalid. Only alphabetic characters are allowed.` |
854
+ | `email` | `string` | Yes | *Email Address* | `Email is required.` / `Please enter a valid email address.` |
855
+ | `phoneNumber` | `string` | Yes | *Preferred Phone Number* | `Phone number is required.` / `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` |
856
+ | `dateOfBirth` | `string` (ISO 8601) | Yes | *Date of Birth* | `Date of birth is required.` / `Date of birth must be a valid date in the past.` / `Age must be between 20 and 59 for ADB.` |
857
+ | `isUsCitizen` | `boolean` | Yes | *Are you a United States citizen?* | `US citizenship status is required.` |
858
+ | `isLegalUsResident` | `boolean` | Conditional | *Are you a legal U.S. resident and have you resided in the U.S. for more than 2 years?* | `Legal US residency status is required for non-US citizens.` |
859
+ | `isPayerAlsoOwnerAndInsured` | `boolean` | Yes | *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.* | `IsPayerAlsoOwnerAndInsured field is required.` |
860
+ | `socialSecurityNumber` | `string` | Yes | *Social Security Number* | `Social Security Number is required.` / `Social Security Number must be in valid format (e.g., XXX-XX-XXXX).` |
861
+ | `hasExistingCoverage` | `boolean` | Yes | See state-specific wording in GIGDB section above | `Existing coverage field is required` |
862
+ | `willOtherCoverageBeReplacedOrFinanced` | `boolean\|null` | Conditional | See state-specific wording in GIGDB section above | `Please indicate whether any other coverage will be replaced or financed.` / `Other Coverage be replaced or financed must be either null or false as no existing coverage passed.` |
863
+ | `occupation` | `string[]` | CA only | *Please enter your occupation* | `At least one occupation is required when residence state is CA.` / `One or more selected occupations are invalid.` |
864
+ | `hasMedicalCoverage` | `boolean` | DC only | *Do you have comprehensive medical coverage including the minimum essential coverage required by the Affordable Care Act (ACA) or are you treated as having minimum essential coverage due to your status as a bona fide resident of any possession of the United States?* | `Medical coverage acknowledgement is required when residence state is DC.` |
865
+ | `understandsBenefits` | `boolean` | DC only | *Do you understand most supplemental only policies may not pay full benefits if your ACA compliant minimum essential coverage plan is not in force?* | `Supplemental policy benefits acknowledgement is required when residence state is DC.` |
866
+ | `understandsLimitedBenefits` | `boolean` | DC only | *Do you understand that the benefits provided under this policy may be limited?* | `Limited benefits acknowledgement is required when residence state is DC.` |
867
+
868
+ > `socialSecurityNumber` must be **9 consecutive digits, no dashes** (e.g. `123456789`).
869
+ > `isLegalUsResident` required when `isUsCitizen = false`.
870
+ > `occupation` values must come from [`getAdbOccupationOptions()`](#adb--occupation-lookup-ca-only).
871
+
872
+
873
+ ***
874
+
875
+ ### Address
876
+
877
+ | Field | Type | Required | Question | Validation Error |
878
+ |---|---|---|---|---|
879
+ | `address.addressLine1` | `string` | Yes | *Street* | `Address line is required.` / `Street address is invalid. Avoid special characters.` |
880
+ | `address.city` | `string` | Yes | *City* | `Address city is required.` / `City name is invalid. Only letters and spaces are allowed.` |
881
+ | `address.state` | `string` | Yes | *State* | `Residence state is required.` / `Residence state code is invalid.` |
882
+ | `address.zipcode` | `string` | Yes | *Zip Code* | `Zip code is required.` / `Zip code is invalid. It must be in 5-digit format.` / `Zip code is not found.` |
883
+
884
+
885
+ ***
886
+
887
+ ### Existing Coverage (when `hasExistingCoverage = true`)
888
+
889
+ Base fields are the same as GIGDB: `nameOfTheCompany`, `insuranceAmount`, `dateOfIssue`, `toBeReplaced`, `toBeFinanced`.
890
+
891
+ ADB state-specific per-coverage fields (ADB does not use MA `requestsYieldIndices` or GA `wantsPolicySummary`):
892
+
893
+ | State | Field on `existingCoverages[n]` | Exact Question | Validation Error |
894
+ |---|---|---|---|
895
+ | OK | `notifyPresentInsurer` | *Please notify my present insurer(s) regarding this transaction?* | `Notify present insurer response is required for Oklahoma when existing coverage is provided.` |
896
+ | FL | `wantsComparativeInformationForm` | *Indicate whether or not you wish a Comparative Information Form from the proposed company and your existing insurer or insurers?* | `Comparative information form preference is required for Florida when existing coverage is provided.` |
897
+ | DE | `wantsPolicySummary` | *Do you want a policy summary statement from your existing insurer?* | `Policy summary preference is required for Delaware when existing coverage is provided.` |
898
+
899
+
900
+ ***
901
+
902
+ ### Beneficiary Details
404
903
 
405
- - `riders` is `AdbRiderType[]` - use the ADB-specific enum: `AdbRiderType.FamilyADB`, `AdbRiderType.ReturnOfPremium`, `AdbRiderType.InflationBenefit`
406
- - Do **not** reuse the Term product's `RiderType` enum — those values (`'ADB Rider'`, `'Dependent Child Rider'`) are display titles, not ADB rider codes
407
- - Rider availability varies by state - see [ADB Rider Availability](#adb-rider-availability)
904
+ Same shape as GIGDB. ADB accepts all `BeneficiaryType` values.
408
905
 
409
- ### Step 2 - `startAdbApplication(request: ThirdPartyAdbAppReq)`
906
+
907
+ ***
908
+
909
+ ### Business Rules
910
+
911
+ 1. ADB does **not** accept `isSmoker`, `birthJurisdiction`, or `nicotineInfo`.
912
+ 2. Quote state and `address.state` must match — mismatch returns `StateMismatchIdentified`.
913
+ 3. Age at application (from `dateOfBirth`) must be 20–59.
914
+ 4. For CA: `occupation` must contain at least one valid label from `getAdbOccupationOptions()`.
915
+ 5. For DC: all three ACA acknowledgement booleans are required.
916
+ 6. ADB does **not** return `isQuoteChanged`.
917
+ 7. `ApplicationLimitReached` applies — same SSN/email/phone within 30 days for ADB.
918
+
919
+
920
+ ***
921
+
922
+ ### Knockout Rules
923
+
924
+ Returns `isDeclined: true` on a successful response — the SDK does **not** throw.
925
+
926
+ - `isPayerAlsoOwnerAndInsured = false`
927
+ - `isUsCitizen = false` AND `isLegalUsResident = false`
928
+
929
+
930
+ ***
931
+
932
+ ### Error Codes
933
+
934
+ | Code | When |
935
+ |---|---|
936
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
937
+ | `ApplicationLimitReached` | SSN, email, or phone matches an ADB policy generated within the last 30 days |
938
+ | `StateMismatchIdentified` | Quote state ≠ `address.state` |
939
+ | `AgentNotFound` | Quote cannot be linked to the agent account — verify credentials |
940
+ | `InternalServerError` | Unexpected backend failure — retry; contact support if persistent |
941
+
942
+
943
+ ***
944
+
945
+ ### Response
946
+
947
+ | Field | Type | Description |
948
+ |---|---|---|
949
+ | `opportunityId` | `string` | All-zero UUID when `isDeclined = true` |
950
+ | `isDeclined` | `boolean` | `true` = knockout; stop the flow |
951
+
952
+ > ADB does **not** return `isQuoteChanged`, `agentLink`, `eAppAgentLink`, or `applicantLink`.
953
+
954
+
955
+ ***
956
+
957
+ ### Example
410
958
 
411
959
  ```typescript
412
960
  import { BeneficiaryType, BeneficiaryRelationship } from '@instabrain-sdks/api-client';
413
961
 
414
962
  const appResp = await client.startAdbApplication({
415
- quoteResponseId: quoteResp.selectedQuote.quoteResponseId,
416
- firstName: 'John',
417
- lastName: 'Smith',
418
- email: 'john.smith@example.com',
419
- phoneNumber: '5559876543',
420
- isUsCitizen: true,
421
- isPayerAlsoOwnerAndInsured: true, // must be true - knockout if false
422
- address: {
423
- addressLine1: '456 Oak Ave',
424
- city: 'Dallas',
425
- state: 'TX',
426
- zipcode: '75201'
427
- },
963
+ quoteResponseId,
964
+ firstName: 'John', lastName: 'Smith',
965
+ email: 'john.smith@example.com', phoneNumber: '5559876543',
428
966
  dateOfBirth: '1988-03-20',
429
- socialSecurityNumber: '987-65-4321',
430
- hasExistingCoverage: false,
967
+ isUsCitizen: true, isPayerAlsoOwnerAndInsured: true,
968
+ socialSecurityNumber: '987654321',
969
+ hasExistingCoverage: false, willOtherCoverageBeReplacedOrFinanced: null, existingCoverageData: null,
970
+ address: { addressLine1: '456 Oak Ave', city: 'Dallas', state: 'TX', zipcode: '75201' },
431
971
  beneficiaryDetails: {
432
972
  beneficiaryType: BeneficiaryType.Person,
433
- beneficiaryPerson: {
434
- firstName: 'Mary',
435
- lastName: 'Smith',
436
- relationship: BeneficiaryRelationship.Spouse
437
- }
973
+ beneficiaryPerson: { firstName: 'Mary', lastName: 'Smith', relationship: BeneficiaryRelationship.Spouse }
438
974
  }
439
975
  });
440
976
 
441
977
  if (appResp.isDeclined) {
442
- // Valid knockout - stop the flow
443
978
  return;
444
979
  }
445
-
446
980
  const { opportunityId } = appResp;
447
981
  ```
448
982
 
449
- **Knockout rules - returns `isDeclined: true` (not an error, not thrown):**
983
+ ---
450
984
 
451
- - `isPayerAlsoOwnerAndInsured === false` → declined
452
- - `isUsCitizen === false` AND `isLegalUsResident === false` → declined
985
+ ## ADB — Get Existing Quote
453
986
 
454
- **California residents — `occupation` field required:**
987
+ **Method:** `client.getExistingAdbQuote(opportunityId)`
455
988
 
456
- ```typescript
457
- const appResp = await client.startAdbApplication({
458
- // ...same fields as above, with CA address...
459
- address: { addressLine1: '...', city: 'Los Angeles', state: 'CA', zipcode: '90001' },
460
- occupation: ['Registered Nurse'], // populate from getAdbOccupationOptions()
461
- // ...
462
- });
463
- ```
464
989
 
465
- - `occupation` is an optional `string[]` on `ThirdPartyAdbAppReq`
466
- - Required only when `address.state === "CA"` — omit for all other states
467
- - Values must come from `getAdbOccupationOptions()`
990
+ **When to call:** Session resumption — re-fetch the quote for an existing opportunity. ADB does not return `isQuoteChanged` so this is not needed immediately after Start Application.
991
+
992
+
993
+ ***
994
+
995
+ ### Request Parameters
996
+
997
+ | Parameter | Type | Required |
998
+ |---|---|---|
999
+ | `opportunityId` | `string` | Yes |
468
1000
 
469
- **District of Columbia residents — three top-level ACA acknowledgement booleans required:**
470
1001
 
471
- > Third-party integrations must display the exact regulated question text below to applicants — paraphrasing is not sufficient. Source: Confluence page 699924481 (ADB Start Application API).
1002
+ ***
472
1003
 
473
- | Field | Exact applicant-facing question text |
1004
+ ### Error Codes
1005
+
1006
+ | Code | When |
474
1007
  |---|---|
475
- | `hasMedicalCoverage` | *Do you have comprehensive medical coverage including the minimum essential coverage required by the Affordable Care Act (ACA) or are you treated as having minimum essential coverage due to your status as a bona fide resident of any possession of the United States?* |
476
- | `understandsBenefits` | *Do you understand most supplemental only policies may not pay full benefits if your ACA compliant minimum essential coverage plan is not in force?* |
477
- | `understandsLimitedBenefits`| *Do you understand that the benefits provided under this policy may be limited?* |
1008
+ | `InvalidRequestFormat` | `OpportunityId is required.` / `OpportunityId does not exist.` / `OpportunityId does not match selected product.` |
1009
+
1010
+ > Throws `AuthenticationError` when the opportunity ID is not found or not in scope for your token.
1011
+
1012
+
1013
+ ***
1014
+
1015
+ ### Response
1016
+
1017
+ | Field | Type | Description |
1018
+ |---|---|---|
1019
+ | `productName` | `string` | `"InstaADB"` |
1020
+ | `selectedQuote.quoteResponseId` | `string` | Quote response ID |
1021
+ | `selectedQuote.quoteAmount` | `number` | Premium |
1022
+
1023
+
1024
+ ***
1025
+
1026
+ ### Example
478
1027
 
479
1028
  ```typescript
480
- await client.startAdbApplication({
481
- // ...same fields as above...
482
- address: { addressLine1: '100 7th St NW', city: 'Washington', state: 'DC', zipcode: '20001' },
483
- hasMedicalCoverage: true, // ACA minimum essential coverage
484
- understandsBenefits: true, // supplemental policy benefits acknowledgement
485
- understandsLimitedBenefits: true // limited benefits acknowledgement
486
- });
1029
+ const quoteResp = await client.getExistingAdbQuote(opportunityId);
1030
+ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
487
1031
  ```
488
1032
 
489
- **OK / FL / DE residents with existing coverage — per-coverage acknowledgement:**
1033
+ ---
1034
+
1035
+ ## ADB — Update Quote
1036
+
1037
+ **Method:** `client.updateAdbQuote(request)` · **Type:** `ThirdPartyAdbUpdateQuoteReq`
1038
+
1039
+
1040
+ Changes face amount, payment frequency, or riders after start application. Must be called **before** `save-eft-payment`.
490
1041
 
491
- When `hasExistingCoverage === true`, set the corresponding flag on each `existingCoverages[]` item. Display the exact regulated question text:
492
1042
 
493
- | State | Field on `existingCoverages[]` | Exact applicant-facing question text |
494
- |-------|------------------------------------|---------------------------------------|
495
- | OK | `notifyPresentInsurer` | *Please notify my present insurer(s) regarding this transaction?* |
496
- | FL | `wantsComparativeInformationForm` | *Indicate whether or not you wish a Comparative Information Form from the proposed company and your existing insurer or insurers?* |
497
- | DE | `wantsPolicySummary` | *Do you want a policy summary statement from your existing insurer?* |
1043
+ ***
498
1044
 
499
- **ADB response differences from GIGDB/IB Term:**
1045
+ ### Request Fields
500
1046
 
501
- - Response type is `ThirdPartyAdbStartAppResp` - contains only `opportunityId` and `isDeclined`
502
- - No `agentLink`, `eAppAgentLink`, `applicantLink`
503
- - No `isQuoteChanged`
504
- - No `birthJurisdiction` field in the application request (unlike GIGDB)
1047
+ | Field | Type | Required | Description | Validation Error |
1048
+ |---|---|---|---|---|
1049
+ | `opportunityId` | `string` | Yes | From Start Application | `OpportunityId is required.` / `OpportunityId does not exist.` / `Quote update is not allowed when payment is already made.` |
1050
+ | `faceAmount` | `number` | Yes | New coverage amount | `Coverage amount (FaceAmount) is required.` |
1051
+ | `paymentFreq` | `PaymentFrequency` | Yes | `"Monthly"` or `"Annually"` | `Payment frequency is required.` / `Invalid payment frequency.` |
1052
+ | `riders` | `AdbRiderType[]` | Yes | Rider codes — pass `[]` to clear all riders | `Riders are required.` / `Riders are invalid.` |
505
1053
 
506
- ### Step 3 - `updateAdbQuote(request: ThirdPartyAdbUpdateQuoteReq)` (optional - must be called BEFORE `saveEftPayment`)
1054
+ > `riders` is **required** on Update Quote (unlike Get Quote where it is optional). Send `[]` to remove all riders.
507
1055
 
508
- Re-quote an in-flight ADB opportunity with a new `faceAmount`, `paymentFreq`, or `riders` list. The quote cannot be updated after EFT payment details are saved — the API returns `"Quote update is not allowed when payment is already made"`.
1056
+
1057
+ ***
1058
+
1059
+ ### Error Codes
1060
+
1061
+ | Code | When |
1062
+ |---|---|
1063
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
1064
+ | `PaymentAlreadyMade` | EFT already saved — quote update no longer allowed |
1065
+
1066
+
1067
+ ***
1068
+
1069
+ ### Response
1070
+
1071
+ Same shape as Get Quote — reflects the recalculated premium.
1072
+
1073
+
1074
+ ***
1075
+
1076
+ ### Example
509
1077
 
510
1078
  ```typescript
511
- import { PaymentFrequency } from '@instabrain-sdks/api-client';
1079
+ import { PaymentFrequency, AdbRiderType } from '@instabrain-sdks/api-client';
512
1080
 
513
1081
  const updatedQuote = await client.updateAdbQuote({
514
1082
  opportunityId,
515
1083
  faceAmount: 150000,
516
1084
  paymentFreq: PaymentFrequency.Monthly,
517
- riders: [] // pass [] to clear all riders
1085
+ riders: [AdbRiderType.FamilyADB] // pass [] to clear all riders
518
1086
  });
519
-
520
- const { quoteResponseId, quoteAmount } = updatedQuote.selectedQuote;
521
1087
  ```
522
1088
 
523
- ### Step 3a - `getExistingAdbQuote(opportunityId: string)` (optional)
1089
+ ---
524
1090
 
525
- Retrieve the current quote for an in-flight ADB opportunity. Useful any time you need to display or re-read the current premium after `updateAdbQuote()` or in the agent portal.
1091
+ ## IB Term
526
1092
 
527
- ```typescript
528
- const currentQuote = await client.getExistingAdbQuote(opportunityId);
529
- console.log(currentQuote.selectedQuote.quoteAmount);
530
- ```
1093
+ **InstaBrain Term** — term life product, no medical exam.
531
1094
 
532
- ### Step 4 - `saveEftPayment(request: ThirdPartyEftPaymentReq)`
1095
+ This is a **pre-fill flow**: use `getQuote()` and `startIBTermApplication()`, then hand off via `agentLink`, `applicantLink`, and `eAppAgentLink`. Do **not** call `saveEftPayment()`, SecureSign methods, or `finalSubmit()` for IB Term.
533
1096
 
534
- Same shared method as GIGDB — both products use the same `POST /api/ThirdPartyPayment/save-eft-payment` endpoint.
1097
+ - **Eligible ages:** 18–60
1098
+ - **Not available in:** WY, NY
1099
+ - **Term lengths:** 10, 20, or 30 years (`benefitPeriod`)
1100
+ - **Rating:** `rateClass`, `healthClass`, or `height` + `weightInLbs`
535
1101
 
536
- ```typescript
537
- await client.saveEftPayment({
538
- opportunityId,
539
- accountHolderName: 'John Smith',
540
- routingNumber: '021000021',
541
- accountNumber: '987654321'
542
- });
543
- // After this point, the quote can no longer be updated.
544
- ```
1102
+ ---
545
1103
 
546
- ### Steps 5–6 - Secure Sign → Final Submit
1104
+ ## Integration flow
547
1105
 
548
- See [Secure Sign Flow](#secure-sign-flow) and [Final Submit](#final-submit).
1106
+ ```
1107
+ 0. [`getIBTermRiderDetails()`](#ib-term--rider-lookup) [Optional] Confirm availability + rider codes
1108
+ └── flagProductNotAvailableForState = true → STOP
1109
+ 1. [`getQuote()`](#ib-term--get-quote) Get quote → quoteResponseId
1110
+ 2. [`startIBTermApplication()`](#ib-term--start-application) Start app → agentLink / applicantLink
1111
+ ├── isDeclined = true → STOP
1112
+ └── isQuoteChanged = true → re-present updated premium, then hand off via links
1113
+ 3. [`getExistingIBTermQuote()`](#ib-term--get-existing-quote) [Optional] Re-fetch prior quote for resumed session
1114
+
1115
+ → Direct agent or applicant to agentLink / applicantLink / eAppAgentLink
1116
+ All remaining steps (underwriting, payment, signing) complete inside the InstaBrain frontend.
1117
+ No further `InstaBrainClient` methods for IB Term.
1118
+ ```
549
1119
 
550
1120
  ---
551
1121
 
552
- ## IB Term Flow
1122
+ ## IB Term — Rider Lookup
553
1123
 
554
- > **Eligibility:** Ages 18–60. **Not available in:** WY, NY.
1124
+ **Method:** `client.getIBTermRiderDetails(stateCode, age, flagNicotineUse)`
555
1125
 
556
- ### Complete flow
557
1126
 
558
- ```
559
- getIBTermRiderDetails() ← optional pre-quote — check state availability & filter riders by age + nicotine
560
- ↓
561
- getQuote() ← IB Term quote (current SDK uses the generic getQuote method)
562
- ↓
563
- startIBTermApplication() ← NEW — typed IB Term Start Application wrapper
564
- ↓
565
- saveEftPayment() ← shared with GIGDB / ADB
566
- ↓
567
- prepareDocsAndGetDeliveryChannels() → sendPinAndGetDocumentsLink() → verifyPin()
568
- ↓
569
- finalSubmit()
570
- ```
1127
+ ***
571
1128
 
572
- ### Step 0 - `getIBTermRiderDetails(stateCode, age, flagNicotineUse)` (optional pre-step)
1129
+ ### Request Parameters
573
1130
 
574
- Call this before `getQuote()` to check whether IB Term is available for the applicant's state, age, and nicotine-use status, and to collect the rider codes available for that combination.
1131
+ | Parameter | Type | Required | Validation Error |
1132
+ |---|---|---|---|
1133
+ | `stateCode` | `string` | Yes | `State code is required.` / `State code is not valid.` |
1134
+ | `age` | `number` | Yes | `Age is required.` / `Age must be between 18 and 60.` |
1135
+ | `flagNicotineUse` | `boolean` | Yes | `Nicotine use status is required.` |
1136
+
1137
+ > Send the same `stateCode`, `age`, and `flagNicotineUse` you intend to use on Get Quote.
1138
+
1139
+
1140
+ ***
1141
+
1142
+ ### Error Codes
1143
+
1144
+ | Code | When |
1145
+ |---|---|
1146
+ | `InvalidRequestFormat` | Any parameter missing or invalid |
1147
+
1148
+
1149
+ ***
1150
+
1151
+ ### Response
1152
+
1153
+ | Field | Type | Description |
1154
+ |---|---|---|
1155
+ | `flagProductNotAvailableForState` | `boolean` | `true` → not available for this state/age/nicotine combination — do not proceed |
1156
+ | `riders[n].riderCode` | `string` | Pass as `riders[n].rider` on the Get Quote request |
1157
+ | `riders[n].riderTitle` | `string` | Display name |
1158
+ | `riders[n].riderDescription` | `string` | Coverage description |
1159
+
1160
+
1161
+ ***
1162
+
1163
+ ### Example
575
1164
 
576
1165
  ```typescript
577
1166
  const riderDetails = await client.getIBTermRiderDetails('TX', 35, false);
578
1167
 
579
1168
  if (riderDetails.flagProductNotAvailableForState) {
580
- // IB Term is not available for this state/age/nicotine combo — do not proceed
581
1169
  return;
582
1170
  }
583
-
584
- // riderDetails.riders[].riderCode → pass into ThirdPartyQuoteReq.riders[n].rider on the quote
1171
+ // Pass riderDetails.riders[n].riderCode as riders[n].rider on Get Quote
585
1172
  ```
586
1173
 
587
- > `flagProductNotAvailableForState: true` is a valid business state (not an error). The SDK returns it as-is; do not throw.
1174
+ ---
588
1175
 
589
- ### Step 1 - `getQuote(request: ThirdPartyQuoteReq)`
590
1176
 
591
- Provide exactly one of three mutually exclusive rating inputs:
1177
+ ---
592
1178
 
593
- - `rateClass` - use `RateClass` enum
594
- - `healthClass` - use `HealthClass` enum *(note: `HealthClass.Preferred` does not exist; valid values: Excellent, Great, Good, Average)*
595
- - `height` + `weightInLbs` - build chart rating
1179
+ ## IB Term — Get Quote
596
1180
 
597
- ```typescript
598
- import { Gender, PaymentFrequency, HealthClass } from '@instabrain-sdks/api-client';
1181
+ **Method:** `client.getQuote(request)` · **Type:** `ThirdPartyQuoteReq`
599
1182
 
600
- const quoteResp = await client.getQuote({
601
- faceAmount: 500000,
602
- benefitPeriod: 20,
603
- flagTobaccoUse: false,
604
- gender: Gender.Male,
605
- stateCode: 'TX',
606
- zipCode: null,
607
- healthClass: HealthClass.Great,
608
- rateClass: null,
609
- height: { feet: 5, inches: 10 },
610
- weightInLbs: null,
611
- age: 40,
612
- dateOfBirth: null,
613
- riders: null,
614
- paymentFreq: PaymentFrequency.Monthly,
615
- firstName: 'John',
616
- lastName: null,
617
- email: null,
618
- phoneNum: null
619
- });
620
1183
 
621
- const { quoteResponseId } = quoteResp.selectedQuote;
622
- ```
1184
+ ***
623
1185
 
624
- **Field priority rules:**
1186
+ ### Request Fields
625
1187
 
626
- - `zipCode` takes priority over `stateCode` if both are provided *(ADB / GIGDB only)*
627
- - `dateOfBirth` takes priority over `age` if both are provided
1188
+ Provide exactly one rating group (†) and exactly one age input (‡).
628
1189
 
629
- > **IB Term — do not send `zipCode`**. Per the updated `ThirdPartyIbTermQuoteDocs.md`, the IB Term quote endpoint only accepts `stateCode`; the `zipCode` field on `ThirdPartyQuoteReq` (used here for cross-product convenience) is ignored by IB Term. Pass `null`.
1190
+ | Field | Type | Required | Description | Validation Error |
1191
+ |---|---|---|---|---|
1192
+ | `faceAmount` | `number` | Yes | Coverage amount — age-based limits apply | `Coverage amount (FaceAmount) is required.` |
1193
+ | `benefitPeriod` | `number` | Yes | Term: 10, 20, or 30 years (state/age/nicotine dependent) | `Benefit period is required.` |
1194
+ | `flagTobaccoUse` | `boolean` | No | Defaults to `false` when omitted | — |
1195
+ | `gender` | `Gender` | Yes | `Gender.Male`, `Gender.Female` | `Gender is required.` / `Invalid gender.` |
1196
+ | `stateCode` | `string` | Yes | 2-letter US state — do **not** send `zipCode` for IB Term | `State code is required.` / `State code is not valid.` / `This product is not available for the selected state.` |
1197
+ | `rateClass` | `RateClass` | One of † | `"Preferred Plus"`, `"Preferred"`, `"Standard"`, `"Standard Extra"` | `Either RateClass, HealthClass, or Height and WeightInLbs must be provided.` / `Rate class is invalid. Allowed values: Preferred Plus, Preferred, Standard, Standard Extra.` |
1198
+ | `healthClass` | `HealthClass` | One of † | `"excellent"`, `"great"`, `"good"`, `"average"` (case-insensitive) | `Health class is invalid. Allowed values: excellent, great, good, average.` |
1199
+ | `height` | `ThirdPartyQuoteReqHeight \| null` | One of † | `feet` (1–8), `inches` (0–11) — required with `weightInLbs` | `Height or weight is invalid.` |
1200
+ | `weightInLbs` | `number \| null` | One of † | Paired with `height` | — |
1201
+ | `age` | `number` | Yes‡ | 18–60 | `Either age or date of birth must be provided.` / `Age must be between 18 and 60.` |
1202
+ | `dateOfBirth` | `string` (ISO 8601) | Yes‡ | Wins over `age` when both provided | `Date of birth must be a valid date.` |
1203
+ | `riders` | `object[]` | No | `[{ rider: riderCode, riderFaceAmount: number }]` — use `riderCode` from `getIBTermRiderDetails()` | `Riders are invalid.` |
1204
+ | `paymentFreq` | `PaymentFrequency` | Yes | `"Monthly"` or `"Annually"` | `Payment frequency is required.` / `Invalid payment frequency.` |
1205
+ | `firstName` | `string` | No | Alphabetic only | `First name is invalid. Only alphabetic characters are allowed.` |
1206
+ | `lastName` | `string` | No | Alphabetic only | `Last name is invalid. Only alphabetic characters are allowed.` |
1207
+ | `email` | `string` | No | Lead capture | `Please enter a valid email address.` |
1208
+ | `phoneNum` | `string` | No | 10 digits or E.164 | `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` |
630
1209
 
631
- **Required-field rules (enforced server-side):**
1210
+ > **†** Supply exactly **one** rating group: `rateClass`, OR `healthClass`, OR both `height` and `weightInLbs`. Do not send all three.
1211
+ > `HealthClass.Preferred` does **not** exist — using it throws `APIValidationError`.
1212
+ > Rider face amounts: ADB Rider $25,000–$250,000 · Dependent Child Rider $5,000–$25,000. Must not exceed `faceAmount`.
632
1213
 
633
- - `benefitPeriod` is **required**.
634
- - **Rating input** — supply exactly ONE group: `rateClass`, OR `healthClass`, OR `height` + `weightInLbs` together. `height` is optional in the type (omit it when rating via `rateClass`/`healthClass`).
635
- - **Age** — supply `age` OR `dateOfBirth`; resolved age must be **18–60**.
636
- - **Location** — supply `stateCode` (for IB Term) or `stateCode` / `zipCode` (other products).
637
- - **`flagTobaccoUse`** defaults to `false` when omitted on the IB Term quote — explicit `true` indicates nicotine use.
638
1214
 
639
- > The IB Term Quote endpoint returns failures in **two shapes**:
640
- >
641
- > 1. **Request validation** (HTTP 400, `value.fields`) — top-level `error` is usually `InvalidRequestFormat`. The two cross-field eligibility checks below can also be returned as top-level codes in this same shape:
642
- > - `BenefitPeriodNotAvailable` — `BenefitPeriod` is not allowed for the selected state, age, and smoker status (carrier params).
643
- > - `CoverageNotAvailable` — `FaceAmount` is outside the min/max/step for the selected state, age, and smoker status (carrier params).
644
- > 2. **Business rules** (HTTP 400, `value: null`) — top-level `error` is `BenefitPeriodNotAvailable`, `CoverageNotAvailable`, `outsideBuildChart`, `QuoteNotEligibleForGivenConditions`, `NotAvailableForState`, `RiderNotAvailable`, or `RiderFaceAmountNotValid`.
645
- >
646
- > Detect specific failures with `err.isErrorType(APIErrorCode.X)`. See [APIErrorCode Reference → IB Term Quote Business Errors](#ib-term-quote-business-errors).
1215
+ ***
647
1216
 
648
- ### Step 1a - `getExistingIBTermQuote(opportunityId)` (resume / review an existing quote)
1217
+ ### Face Amount Limits (age-based)
649
1218
 
650
- Retrieve a previously created IB Term quote by its opportunity ID — useful for resuming or reviewing a quote without re-quoting.
1219
+ | Age | Min | Max |
1220
+ |---|---|---|
1221
+ | Up to 55 | $50,000 | $1,000,000 |
1222
+ | 56 | $50,000 | $900,000 |
1223
+ | 57 | $50,000 | $800,000 |
1224
+ | 58 | $50,000 | $700,000 |
1225
+ | 59 | $50,000 | $600,000 |
1226
+ | 60 | $50,000 | $500,000 |
651
1227
 
652
- ```typescript
653
- const quoteResp = await client.getExistingIBTermQuote(opportunityId);
654
- const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
655
- ```
656
1228
 
657
- > A not-found result is an **error** (surfaced via the SDK error model), not a valid business state. Invalid/missing `opportunityId` → `APIValidationError` (`InvalidRequestFormat`); a non-IB-Term opportunity → field-level `Opportunity does not match the IB Term product`; an opportunity with no stored quote → `QuoteNotFound`.
1229
+ ***
1230
+
1231
+ ### Benefit Period Availability
1232
+
1233
+ | Age | Tobacco use | Available periods |
1234
+ |---|---|---|
1235
+ | Up to 45 | Any | 10, 20, 30 |
1236
+ | 45–50 | Non-tobacco | 10, 20, 30 |
1237
+ | 45–50 | Tobacco | 10, 20 |
1238
+ | 51–60 | Any | 10, 20 |
1239
+
658
1240
 
659
- ### Step 2 - `startIBTermApplication(request: IBTermStartApplicationReq)`
1241
+ ***
660
1242
 
661
- The IB Term Start Application takes a fully typed request with applicant info, address, birth jurisdiction, height/weight, driver license, primary care physician, structured tobacco/nicotine usage, beneficiary details, and (when the Dependent Child Rider was selected on the quote) child rider info.
1243
+ ### Error Codes
662
1244
 
663
- > **Progressive disclosure:** the following top-level fields are **optional** — `address`, `socialSecurityNumber`, `dateOfBirth`, `birthJurisdiction`, `hasPrimaryCarePhysician`, `hasExistingCoverage`, `beneficiaryDetails`, `tobaccoNicotineUsage`. Within `childRiderInfo`, `hasExistingCoverageForChildren` and `childrenToBeInsuredDetails` are also optional. The full example below shows them populated for illustration; omit any of them if your flow collects them at a later step. Backend validation fires only when each parent is present.
1245
+ `getQuote()` throws `APIValidationError` when the server returns `flagStatus: false`. Common codes:
1246
+
1247
+ | Code | `err.response.value` | When |
1248
+ |---|---|---|
1249
+ | `InvalidRequestFormat` | `fields` object present | Any field validation failure |
1250
+ | `StateNotFound` | `null` | State code not recognized |
1251
+ | `AgeNotFound` | `null` | Neither age nor date of birth supplied, or age could not be derived |
1252
+ | `BenefitPeriodNotAvailable` | `fields` object present | `benefitPeriod` not allowed for state/age/nicotine |
1253
+ | `CoverageNotAvailable` | `fields` object present | `faceAmount` out of range for state/age/nicotine |
1254
+ | `NotAvailableForState` | `null` | Product not available in this state |
1255
+ | `QuoteNotEligibleForGivenConditions` | `null` | State/age/nicotine combination not eligible |
1256
+ | `OutsideBuildChart` | `null` | Height/weight outside carrier build chart |
1257
+ | `RiderNotAvailable` | `null` | Rider not available for this product/state |
1258
+ | `RiderFaceAmountNotValid` | `null` | Rider face amount outside allowed range |
1259
+
1260
+
1261
+ ***
1262
+
1263
+ ### Response
1264
+
1265
+ | Field | Type | Description |
1266
+ |---|---|---|
1267
+ | `productName` | `string` | `"InstaTerm"` |
1268
+ | `selectedQuote.quoteResponseId` | `string` | Pass as `quoteResponseId` in Start Application |
1269
+ | `selectedQuote.quoteAmount` | `number` | Total premium at requested payment frequency |
1270
+ | `selectedQuote.premiumSaveWhenSelectingAnnual` | `number \| null` | Annual billing savings vs monthly; `null` when already annual |
1271
+ | `selectedQuote.maxQuoteAmount` | `number \| null` | Upper premium bound for the quoted profile |
1272
+ | `selectedQuote.minQuoteAmount` | `number \| null` | Lower premium bound for the quoted profile |
1273
+ | `selectedQuote.faceAmount` | `number` | Coverage amount |
1274
+ | `selectedQuote.benefitPeriod` | `number \| null` | Term length in years |
1275
+ | `selectedQuote.paymentFrequency` | `string\|null` | `"Monthly"` or `"Annually"` |
1276
+ | `selectedQuote.selectedRiders[n].rider` | `string` | Rider code |
1277
+ | `selectedQuote.selectedRiders[n].riderFaceAmount` | `number` | Rider face amount |
1278
+ | `selectedQuote.selectedRiders[n].riderQuoteAmount` | `number` | Rider-only premium contribution |
1279
+
1280
+
1281
+ ***
1282
+
1283
+ ### Example
664
1284
 
665
1285
  ```typescript
666
- import {
667
- BeneficiaryType,
668
- BeneficiaryRelationship,
669
- Gender,
670
- TobaccoNicotineLastUsedPeriod,
671
- TobaccoNicotineProductType,
672
- } from '@instabrain-sdks/api-client';
1286
+ import { Gender, PaymentFrequency, HealthClass } from '@instabrain-sdks/api-client';
673
1287
 
674
- const appResp = await client.startIBTermApplication({
675
- quoteResponseId: quoteResp.selectedQuote.quoteResponseId,
676
- firstName: 'John',
677
- lastName: 'Smith',
678
- email: 'john.smith@example.com',
679
- phoneNumber: '5559876543', // 10-digit local OR E.164 ('+15559876543')
680
- isUsCitizenOrIsPermanentResident: true,
681
- isPayerAlsoOwnerAndInsured: true, // must be true; knockout otherwise
682
- dateOfBirth: '1988-03-20',
683
- socialSecurityNumber: '123456789',
684
- address: {
685
- addressLine1: '456 Oak Ave',
686
- city: 'Dallas',
687
- state: 'TX',
688
- zipcode: '75201',
689
- },
690
- birthJurisdiction: { country: 'US', state: 'TX' },
691
- height: { feet: 5, inches: 10 },
692
- weight: 175,
693
- isHoldingValidDriverLicense: true,
694
- driverLicenseState: 'TX', // flat field, NOT nested
695
- driverLicenseNumber: 'D12345678', // flat field, NOT nested
696
- hasPrimaryCarePhysician: false,
697
- physicianDetails: null,
698
- tobaccoNicotineUsage: {
699
- lastUsedPeriod: TobaccoNicotineLastUsedPeriod.Never,
700
- lastTimeUsed: null, // null when lastUsedPeriod === Never
701
- productTypesUsed: null, // null when lastUsedPeriod === Never
702
- },
703
- areListedConditionsNotApplicable: true, // false → declined (knockout)
704
- hasExistingCoverage: false,
705
- beneficiaryDetails: {
706
- beneficiaryType: BeneficiaryType.Person,
707
- beneficiaryPerson: {
708
- firstName: 'Mary',
709
- lastName: 'Smith',
710
- relationship: BeneficiaryRelationship.Spouse,
711
- },
712
- },
1288
+ const quoteResp = await client.getQuote({
1289
+ faceAmount: 500000,
1290
+ benefitPeriod: 20,
1291
+ flagTobaccoUse: false,
1292
+ gender: Gender.Male,
1293
+ stateCode: 'TX',
1294
+ healthClass: HealthClass.Great,
1295
+ age: 35,
1296
+ paymentFreq: PaymentFrequency.Monthly
713
1297
  });
714
1298
 
715
- if (appResp.isDeclined) {
716
- // Valid knockout — stop the flow
717
- return;
718
- }
719
-
720
- const { opportunityId } = appResp;
1299
+ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
721
1300
  ```
722
1301
 
723
- **Knockout rules — returns `isDeclined: true` (not an error, not thrown):**
724
-
725
- - `isPayerAlsoOwnerAndInsured === false` → declined
726
- - `isUsCitizenOrIsPermanentResident === false` → declined
727
- - `isHoldingValidDriverLicense === false` → declined (driver license attestation)
728
- - `areListedConditionsNotApplicable === false` → declined (one or more of the listed health conditions applies to the applicant)
729
- - Any child knockout (`isAnyChildTakingMedication`, `isAnyChildDiagnosedWithDisability`, `isAnyChildDiagnosedWithSevereCondition`, `isAnyChildAdvisedForSurgery`) set to `true` → declined when Dependent Child Rider is selected
730
- - Applicant height / weight outside the build chart → declined
1302
+ ---
731
1303
 
732
- > The physician-age-55 knockout was **removed** — applicants aged 55+ without primary care physician details are no longer declined.
1304
+ ## IB Term — Start Application
733
1305
 
734
- > IB Term does **NOT** use `ApplicationLimitReached` (that applies to ADB / GIGDB only).
1306
+ **Method:** `client.startIBTermApplication(request)` · **Type:** `IBTermStartApplicationReq`
735
1307
 
736
- **Beneficiary type restriction:** IB Term accepts only `Person`, `Trust`, `Insured Estate`, `All Children Of The Insured Equally`, and `All Children Of The Marriage Equally`. The Business / Corporation / Charitable Organization / Employer / Other named-entity types are **not accepted** by IB Term — the SDK uses the shared `BeneficiaryDetails` union but the restriction is enforced server-side.
737
1308
 
738
- #### Applicant Disclosure (`areListedConditionsNotApplicable`)
1309
+ ***
739
1310
 
740
- This field corresponds to *"By checking the box I confirm the conditions listed are not applicable and able to proceed with the application."*
1311
+ ### Progressive Disclosure
741
1312
 
742
- IB Term is designed for applicants who have **not** been diagnosed with the serious medical conditions below and have **not** had recent legal, driving, or insurance history issues that affect coverage availability.
1313
+ Many fields are **optional** — validated only when sent. Backend validation fires only when the parent block is present.
743
1314
 
744
- | Value | Meaning | API behavior |
745
- |---|---|---|
746
- | `true` | None of the listed conditions apply to the applicant | Application may proceed (`isDeclined=false`). |
747
- | `false` | One or more listed conditions apply | Immediate decline (`isDeclined=true`). |
1315
+ **Always required:** `quoteResponseId`, `firstName`, `lastName`, `email`, `phoneNumber`, `isUsCitizenOrIsPermanentResident`, `isPayerAlsoOwnerAndInsured`, `height`, `weight`, `isHoldingValidDriverLicense`, `areListedConditionsNotApplicable`.
748
1316
 
749
- Third-party integrations send a single boolean for the entire disclosure. Individual conditions are **not** separate request fields — your applicant-facing UI should present the full list and only set `areListedConditionsNotApplicable: true` when the applicant confirms none of the items below apply.
1317
+ **Optional — validated when sent:** `address`, `dateOfBirth`, `socialSecurityNumber`, `birthJurisdiction`, `driverLicenseState`, `driverLicenseNumber`, `hasPrimaryCarePhysician` / `physicianDetails`, `tobaccoNicotineUsage`, `hasExistingCoverage` / `existingCoverageData`, `beneficiaryDetails`.
750
1318
 
751
- ##### Listed conditions (by category)
1319
+ **Conditional:** `childRiderInfo` — required when Dependent Child Rider is on the quote; must not be sent otherwise.
752
1320
 
753
- **Cardiovascular & Heart Conditions**
754
1321
 
755
- - Angina, Heart Attack or Stroke
756
- - Aortic or Brain Aneurysm
757
- - Atrial Fibrillation and/or Arrhythmia (Irregular Heartbeat)
758
- - Cardiomyopathy, Congestive Heart Failure
759
- - Cerebral Vascular Accident (Stroke) or multiple Transient Ischemic Attacks (TIAs)
760
- - Coronary Artery Blockage, Bypass, Stent Placement
761
- - Myocardial Infarction (Heart Attack)
762
- - Myocarditis
1322
+ ***
763
1323
 
764
- **Neurological Conditions**
1324
+ ### Always-Required Fields
765
1325
 
766
- - ALS (Lou Gehrig's Disease)
767
- - Alzheimer's, Dementia or Cognitive Impairment
768
- - Cerebral Palsy
769
- - Multiple Sclerosis
770
- - Parkinson's Disease
771
- - Seizures including Grand Mal, Partial or Focal with moderate control
1326
+ | Field | Type | Required | Applicant-Facing Question | Validation Error |
1327
+ |---|---|---|---|---|
1328
+ | `quoteResponseId` | `string` | Yes | — | `QuoteResponseId is required.` / `QuoteResponseId does not exist or does not belong to the requested product.` |
1329
+ | `firstName` | `string` | Yes | *First Name* | `First name is required.` / `First name is invalid. Only alphabetic characters are allowed.` |
1330
+ | `lastName` | `string` | Yes | *Last Name* | `Last name is required.` / `Last name is invalid. Only alphabetic characters are allowed.` |
1331
+ | `email` | `string` | Yes | *Email Address* | `Email is required.` / `Please enter a valid email address.` |
1332
+ | `phoneNumber` | `string` | Yes | *Preferred Phone Number* | `Phone number is required.` / `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` |
1333
+ | `isUsCitizenOrIsPermanentResident` | `boolean` | Yes | *Are you a US citizen or lawful permanent resident who has resided in the US for more than 2 years?* | `US citizenship or permanent residency status is required.` |
1334
+ | `isPayerAlsoOwnerAndInsured` | `boolean` | Yes | *Are you the insured, owner, and payor of this policy?* | `IsPayerAlsoOwnerAndInsured field is required.` |
1335
+ | `height.feet` | `number` | Yes | — | `Height is required.` / `Height feet is required.` / `Height feet must be between 1 and 8.` |
1336
+ | `height.inches` | `number` | Yes | — | `Height inches is required.` / `Height inches must be between 0 and 11.` |
1337
+ | `weight` | `number` | Yes | — | `Weight is required.` / `Weight must be greater than 0.` |
1338
+ | `isHoldingValidDriverLicense` | `boolean` | Yes | *Do you hold a valid driver's license?* | `IsHoldingValidDriverLicense is required.` |
1339
+ | `areListedConditionsNotApplicable` | `boolean` | Yes | *By checking the box I confirm the conditions listed are not applicable and able to proceed with the application.* | `AreListedConditionsNotApplicable is required.` |
772
1340
 
773
- **Metabolic & Endocrine Conditions**
774
1341
 
775
- - Diagnosed with Diabetes Type I
776
- - Diagnosed with Diabetes Type II below age 40
777
- - Liver Disease including Cirrhosis, elevated Liver Function tests and/or Hemochromatosis
1342
+ ***
778
1343
 
779
- **Mental Health & Developmental Conditions**
1344
+ ### `areListedConditionsNotApplicable` — Listed Conditions
780
1345
 
781
- - Autism
782
- - Mental Illness (Schizophrenia or Psychosis)
783
- - Mentally Challenged (Down's Syndrome, Autism, etc)
1346
+ `true` = none apply → application proceeds. `false` = one or more apply → immediate decline.
784
1347
 
785
- **Other Serious Medical Conditions**
1348
+ Display the full list to the applicant. Only set `true` when they confirm none apply.
786
1349
 
787
- - Any pending medical test or exams
788
- - Lupus (SLE)
789
- - Muscular Dystrophy
790
- - Organ Transplant
791
- - Sleep Apnea (non-compliant or within 6 months of diagnosis)
792
- - Treatment for Alcohol and/or Drug Use within the past 5 years
793
- - Ventilator use
1350
+ **Cardiovascular:** Angina / Heart Attack / Stroke · Aortic or Brain Aneurysm · Atrial Fibrillation / Arrhythmia · Cardiomyopathy / Congestive Heart Failure · Cerebrovascular Accident / TIAs · Coronary Artery Blockage / Bypass / Stent · Myocardial Infarction · Myocarditis
794
1351
 
795
- **Legal & Insurance History**
1352
+ **Neurological:** ALS · Alzheimer's / Dementia / Cognitive Impairment · Cerebral Palsy · Multiple Sclerosis · Parkinson's Disease · Seizures (Grand Mal, Partial, or Focal with moderate control)
796
1353
 
797
- - Adverse action by another Insurance carrier
798
- - Convicted of a misdemeanor within the past 8 years
799
- - Convicted of a felony
800
- - Currently disabled
801
- - Declined by or submitted more than 3 applications to life insurance carrier in the past year
802
- - Do not currently have a valid drivers license
803
- - DUI, License Suspension/Revoked, Reckless/Negligent Driving within last 2 years
804
- - Pending criminal charges or current probation
1354
+ **Metabolic / Endocrine:** Diabetes Type I · Diabetes Type II under age 40 · Liver Disease / Cirrhosis / Hemochromatosis
805
1355
 
806
- #### Driver license
1356
+ **Mental Health / Developmental:** Autism · Schizophrenia or Psychosis · Mentally Challenged (Down's Syndrome, etc.)
807
1357
 
808
- Driver license is two **flat fields** on the request (not a nested object): `driverLicenseState` and `driverLicenseNumber`. They are **independent** of `isHoldingValidDriverLicense` — validated only when sent. Pass `null` (or omit) when you don't have them; the backend will only validate state-code / number-against-state format when present. Note that `isHoldingValidDriverLicense === false` is still a knockout decline (driver-license attestation), but that decline is independent of whether you supply the actual license values.
1358
+ **Other Medical:** Pending medical tests or exams · Lupus (SLE) · Muscular Dystrophy · Organ Transplant · Sleep Apnea (non-compliant or within 6 months of diagnosis) · Drug/Alcohol treatment within past 5 years · Ventilator use
809
1359
 
810
- #### Primary care physician
1360
+ **Legal / Insurance History:** Adverse action by another insurer · Misdemeanor within past 8 years · Convicted of a felony · Currently disabled · Declined by or submitted more than 3 life insurance applications in past year · No valid driver's license · DUI / License Suspension / Reckless Driving within last 2 years · Pending criminal charges or probation
811
1361
 
812
- The whole `hasPrimaryCarePhysician` / `physicianDetails` pair is **optional**. When `hasPrimaryCarePhysician === true`, supply `physicianDetails.{physicianName, city, stateCode, lastSeen}`. `lastSeen` is `YYYY-MM` and must not be after the current month — the current month is allowed; only future months are rejected. When `false`, `physicianDetails` must be `null`. Physician's `stateCode` cannot be "Outside Of The USA". No decline is issued for applicants ≥ 55 without physician details (the physician knockout was removed).
813
1362
 
814
- #### Tobacco / nicotine usage
1363
+ ***
815
1364
 
816
- IB Term uses a structured `tobaccoNicotineUsage` object — **not** a boolean `isSmoker` flag like ADB / GIGDB.
1365
+ ### Optional Fields (validated when sent)
817
1366
 
818
- - When `lastUsedPeriod === TobaccoNicotineLastUsedPeriod.Never` (`'never used'`), both `lastTimeUsed` and `productTypesUsed` **must be `null`**.
819
- - Otherwise: supply `lastTimeUsed` (`YYYY-MM`) AND at least one `productTypesUsed` value. If `productTypesUsed` includes `Cigars`, `cigarUsagePerYear` (1–999) is required.
1367
+ | Field | Type | Notes | Validation Error |
1368
+ |---|---|---|---|
1369
+ | `dateOfBirth` | `string\|null` | ISO date; age 18–60 when sent | `Date of birth must be a valid date in the past.` / `Age must be between 18 and 60 for IB Term.` |
1370
+ | `socialSecurityNumber` | `string\|null` | 9 consecutive digits, no dashes (e.g. `123456789`) | `Social Security Number must be in valid format (e.g., XXX-XX-XXXX).` |
1371
+ | `address.addressLine1` | `string` | When `address` sent | `Address line is required.` / `Street address is invalid. Avoid special characters.` |
1372
+ | `address.city` | `string` | When `address` sent | `Address city is required.` / `City name is invalid. Only letters and spaces are allowed.` |
1373
+ | `address.state` | `string` | When `address` sent — must match quote state | `Residence state is required.` / `Residence state code is invalid.` |
1374
+ | `address.zipcode` | `string` | When `address` sent | `Zip code is required.` / `Zip code is invalid. It must be in 5-digit format.` / `Zip code is not found.` |
1375
+ | `birthJurisdiction.country` | `string` | When `birthJurisdiction` sent | `Birth jurisdiction country is required.` |
1376
+ | `birthJurisdiction.state` | `string` | When `country = "US"` | `Birth jurisdiction state is required when birth country is US.` / `Birth state code is invalid.` |
1377
+ | `driverLicenseState` | `string\|null` | Flat field — independent of `isHoldingValidDriverLicense` | `Residence state code is invalid.` *(when sent)* |
1378
+ | `driverLicenseNumber` | `string\|null` | Flat field — validated against `driverLicenseState` when both sent | `Driver license number format is invalid for the selected driver license state.` |
820
1379
 
821
- #### Child rider (when Dependent Child Rider was selected on the quote)
1380
+ > `driverLicenseState` and `driverLicenseNumber` are **flat top-level fields**, not nested. `isHoldingValidDriverLicense = false` is still a knockout regardless of whether these fields are provided.
822
1381
 
823
- > Backend field-name quirks: child `dateOfBirth` serializes as **`dob`**, child `relationship` serializes as **`relation`**. The SDK field names match the wire format (`dob`, `relation`) — don't use `dateOfBirth` / `relationship`, they will be silently dropped.
824
1382
 
825
- ```typescript
826
- childRiderInfo: {
827
- hasExistingCoverageForChildren: true,
828
- isAnyChildTakingMedication: false,
829
- isAnyChildDiagnosedWithDisability: false,
830
- isAnyChildDiagnosedWithSevereCondition: false,
831
- isAnyChildAdvisedForSurgery: false,
832
- childrenToBeInsuredDetails: [{
833
- firstName: 'Alice',
834
- lastName: 'Smith',
835
- gender: Gender.Female,
836
- dob: '2020-05-10', // 15 days – under 18 years (BE field: DOB → dob)
837
- height: { feet: 3, inches: 6 },
838
- weight: 40,
839
- relation: 'Daughter', // BE field: Relation → relation
840
- }],
841
- existingCoverageInfoForChildren: [{
842
- nameOfTheCompany: 'KidsCo',
843
- insuranceAmount: '25000', // string, NOT number (matches adult coverage shape)
844
- policyNumber: 'POL-1',
845
- dateOfIssue: '2022-01',
846
- toBeReplaced: false, // required
847
- toBeFinanced: false, // required
848
- }],
849
- }
850
- ```
1383
+ ***
851
1384
 
852
- Max 10 children. Max 10 child existing-coverage entries. Total "not-being-replaced" coverage amounts must not exceed $100,000.
1385
+ ### Primary Care Physician (optional)
853
1386
 
854
- #### State-specific existing-coverage fields (Q-08)
1387
+ | Field | Type | Required | Question | Validation Error |
1388
+ |---|---|---|---|---|
1389
+ | `hasPrimaryCarePhysician` | `boolean\|null` | No | *Do you have a primary care physician?* | — |
1390
+ | `physicianDetails.physicianName` | `string` | When `hasPrimaryCarePhysician = true` | *What is the name of your primary care physician?* | `Physician name is required when HasPrimaryCarePhysician is true.` |
1391
+ | `physicianDetails.city` | `string` | When `hasPrimaryCarePhysician = true` | *In which city does your physician practice?* | `Physician city/address is required when HasPrimaryCarePhysician is true.` |
1392
+ | `physicianDetails.stateCode` | `string` | When `hasPrimaryCarePhysician = true` | *In which state does your physician practice?* | `Physician state is required when HasPrimaryCarePhysician is true.` / `Outside Of The USA is not allowed for physician state.` / `Physician state code is invalid.` |
1393
+ | `physicianDetails.lastSeen` | `string` (`YYYY-MM`) | When `hasPrimaryCarePhysician = true` | *When did you last see your physician?* | `Physician last-seen date is required when HasPrimaryCarePhysician is true.` / `Physician last-seen date must be in YYYY-MM format and must not be after the current month.` |
855
1394
 
856
- IB Term enforces the **same state-specific matrix as GIGDB** — see the [GIGDB state-specific Other Insurance fields](#state-specific-other-insurance-fields-q-08) section. When `hasExistingCoverage === true`:
1395
+ > When `hasPrimaryCarePhysician = false`, `physicianDetails` must be `null`. Error: `Physician details must be null when HasPrimaryCarePhysician is false.`
1396
+ > The physician-age-55 knockout has been **removed** — applicants 55+ without a physician are not declined.
857
1397
 
858
- | State | Field on `existingCoverages[]` | Type |
859
- |-----------|------------------------------------|-----------|
860
- | MA | `requestsYieldIndices` | `boolean` |
861
- | OK | `notifyPresentInsurer` | `boolean` |
862
- | DE / GA | `wantsPolicySummary` | `boolean` |
863
- | FL | `wantsComparativeInformationForm` | `boolean` |
864
1398
 
865
- For **RI** / **WV**, set `existingCoverageData.areExistingPoliciesIssuedByFidelity`. For **KS** / **WA** with `willOtherCoverageBeReplacedOrFinanced=true`, populate the top-level `willOtherCoverageBeReplacedOrFinancedData` block — same shape as GIGDB (see the GIGDB section for the full WA `otherInsuranceReplacementData` field table).
1399
+ ***
866
1400
 
867
- ### Legacy `startApplication(request: ThirdPartyStartApplicationReq)`
1401
+ ### Tobacco / Nicotine Usage (optional — validated when sent)
868
1402
 
869
- The original 5-field `startApplication()` method remains available for backward compatibility but **`startIBTermApplication()` is the recommended path**. The legacy method only returns iframe links (`agentLink`, `eAppAgentLink`, `applicantLink`) — it does not give you a typed `opportunityId` you can hand off to EFT / Secure Sign / Final Submit.
1403
+ | Field | Type | Required | Question | Validation Error |
1404
+ |---|---|---|---|---|
1405
+ | `tobaccoNicotineUsage.lastUsedPeriod` | `TobaccoNicotineLastUsedPeriod` | Yes (in block) | *When did you last use tobacco or nicotine products?* | `Last used period is required.` / `Last used period must be one of: within the last 12 months, 12 to 23 months, 24 to 35 months, 36 months or greater, never used.` |
1406
+ | `tobaccoNicotineUsage.productTypesUsed` | `TobaccoNicotineProductType[] \| null` | When `lastUsedPeriod !== TobaccoNicotineLastUsedPeriod.Never` | *Which tobacco or nicotine products have you used?* | `At least one tobacco or nicotine product type must be selected.` |
1407
+ | `tobaccoNicotineUsage.lastTimeUsed` | `string \| null` (`YYYY-MM`) | When `lastUsedPeriod !== TobaccoNicotineLastUsedPeriod.Never` | *When was the most recent time you used tobacco or nicotine?* | `Last time used tobacco/nicotine date is required.` / `Last time used tobacco/nicotine date must be in YYYY-MM format.` |
1408
+ | `tobaccoNicotineUsage.cigarUsagePerYear` | `number \| null` | When `productTypesUsed` is `[TobaccoNicotineProductType.Cigars]` only | *How many cigars do you smoke per year?* (1–999) | `Number of times cigars are smoked per year is required when Cigars is selected.` / `Cigar usage per year must be greater than 0.` / `Cigar usage per year must be less than or equal to 999.` |
870
1409
 
871
- ```typescript
872
- // Legacy iframe-driven flow:
873
- const appResp = await client.startApplication({
874
- quoteResponseId, firstName: 'John', lastName: 'Smith',
875
- email: 'john.smith@example.com', phoneNumber: '5559876543',
876
- });
877
- const { agentLink, applicantLink } = appResp;
878
- ```
1410
+ > When `lastUsedPeriod === TobaccoNicotineLastUsedPeriod.Never`, `lastTimeUsed`, `productTypesUsed`, and `cigarUsagePerYear` must all be `null`.
1411
+ > `cigarUsagePerYear` is required **only when `productTypesUsed` is exclusively `[TobaccoNicotineProductType.Cigars]`**. When cigars appear alongside other products it is not required.
879
1412
 
880
- ### Steps 3–4 - Secure Sign → Final Submit
881
1413
 
882
- See [Secure Sign Flow](#secure-sign-flow) and [Final Submit](#final-submit).
1414
+ ***
883
1415
 
884
- ---
1416
+ ### Existing Coverage (when `hasExistingCoverage` is sent as `true` or `false`)
885
1417
 
886
- ## Secure Sign Flow
1418
+ Same base fields and state-specific existing coverage fields as GIGDB (MA / OK / DE / GA / FL / RI / WV / KS / WA). See GIGDB Start Application section above for full field tables and exact question text.
887
1419
 
888
- Shared across all products. Used to electronically sign application documents after EFT payment.
1420
+ > State-specific existing coverage fields are only enforced when `address` is included in the request. If `address` is omitted, these per-state fields are not validated.
889
1421
 
890
- ### Complete flow
891
1422
 
892
- ```
893
- prepareDocsAndGetDeliveryChannels(opportunityId)
894
- ↓
895
- [if isSignCompleted = true] → skip directly to finalSubmit()
896
- ↓
897
- sendPinAndGetDocumentsLink()
898
- ↓
899
- [agent reads script aloud; applicant reviews and signs documents via link]
900
- ↓
901
- verifyPin() [or resendPin() if PIN was not received]
902
- ↓
903
- finalSubmit()
904
- ```
1423
+ ***
905
1424
 
906
- ### Step 1 - `prepareDocsAndGetDeliveryChannels(opportunityId: string)`
1425
+ ### Beneficiary Details (optional — validated when sent)
907
1426
 
908
- Always call this first in the signing flow. If `isSignCompleted` is `true`, skip directly to `finalSubmit()`.
1427
+ IB Term accepts only: `Person`, `Trust`, `Insured Estate`, `All Children Of The Insured Equally`, `All Children Of The Marriage Equally`. Business, Corporation, Charitable Organization, Employer, and Other types are **rejected** by IB Term.
909
1428
 
910
- ```typescript
911
- const prepResp = await client.prepareDocsAndGetDeliveryChannels(opportunityId);
1429
+ | Field | Type | Question | Validation Error |
1430
+ |---|---|---|---|
1431
+ | `beneficiaryDetails.beneficiaryType` | `string` | *Who is your primary beneficiary?* | `Please select a valid beneficiary option.` |
1432
+ | `beneficiaryDetails.beneficiaryPerson.firstName` | `string` | *What is your beneficiary's first name?* | `Beneficiary first name is required.` |
1433
+ | `beneficiaryDetails.beneficiaryPerson.lastName` | `string` | *What is your beneficiary's last name?* | `Beneficiary last name is required.` |
1434
+ | `beneficiaryDetails.beneficiaryPerson.relationship` | `string` | *What is your relationship to the beneficiary?* | `Please specify the relationship with the beneficiary.` |
1435
+ | `beneficiaryDetails.namedEntity.name` | `string` | *What is the name of the trust or estate?* | `Beneficiary name is required.` |
1436
+ | `beneficiaryDetails.namedEntity.trustDate` | `string` (`YYYY-MM`) | *When was the trust established?* | `Trust date must be in YYYY-MM format.` |
912
1437
 
913
- if (prepResp.isSignCompleted) {
914
- // Documents already signed - go to finalSubmit()
915
- } else {
916
- console.log('SMS available:', prepResp.isSmsAvailable);
917
- console.log('Email available:', prepResp.isEmailAvailable);
918
- }
919
- ```
920
1438
 
921
- ### Step 2 - `sendPinAndGetDocumentsLink(request: ThirdPartySendPinReq)`
1439
+ ***
922
1440
 
923
- At least one of `flagSendSms` or `flagSendEmail` must be `true`.
1441
+ ### Child Rider (when Dependent Child Rider is on the quote)
924
1442
 
925
- ```typescript
926
- const pinResp = await client.sendPinAndGetDocumentsLink({
927
- opportunityId,
928
- flagSendSms: true,
929
- flagSendEmail: false
930
- });
1443
+ `childRiderInfo` is **required** when Dependent Child Rider was selected on the quote. Omit it otherwise — `startIBTermApplication()` returns validation errors if sent without the rider.
931
1444
 
932
- // pinResp.link - URL for the applicant to review and sign documents
933
- // pinResp.scriptHeader - header for the disclosure section
934
- // pinResp.script - array of disclosure statements to read aloud
935
- // pinResp.consentMessage - consent statement with the applicant's name
936
- ```
1445
+ **Knockout booleans (all required — `true` = immediate decline):**
937
1446
 
938
- ### Step 3 - Agent reads script; applicant signs
1447
+ | Field | Exact Question | Validation Error |
1448
+ |---|---|---|
1449
+ | `childRiderInfo.isAnyChildTakingMedication` | *Is any Proposed Child (Children) to be Insured now taking medication, by prescription or over the counter (OTC), or undergoing treatment or therapy of any kind by a member of the medical profession?* | `Child medication knockout question is required.` |
1450
+ | `childRiderInfo.isAnyChildDiagnosedWithDisability` | *Has any Proposed Child (Children) to be Insured been diagnosed with or treated by a Physician for any physical or mental disability?* | `Child disability knockout question is required.` |
1451
+ | `childRiderInfo.isAnyChildDiagnosedWithSevereCondition` | *Has any Proposed Child (Children) to be Insured ever been diagnosed with or treated by a physician for any disorder of the heart, lung or for cancer?* | `Child severe condition knockout question is required.` |
1452
+ | `childRiderInfo.isAnyChildAdvisedForSurgery` | *Within the last 5 years, has any Proposed Child (Children) to be Insured been advised by a member of the medical profession to have any surgery or hospitalization which has not yet been completed?* | `Child surgery knockout question is required.` |
939
1453
 
940
- 1. The agent reads each item in `pinResp.script` aloud to the proposed insured
941
- 2. The applicant opens `pinResp.link` in their browser to review and sign documents
942
- 3. *(Non-code step - the SDK does not manage the applicant's browser session)*
1454
+ **`childrenToBeInsuredDetails[]`** (optional, max 10):
943
1455
 
944
- ### Step 4 - `verifyPin(request: ThirdPartyVerifyPinReq)`
1456
+ > **TypeScript / JSON property names:** use `dob` (not `dateOfBirth`) and `relation` (not `relationship`). Wrong keys are ignored by the serializer.
945
1457
 
946
- `isScriptReadConfirmed: true` is required - confirms the agent has read the disclosure aloud.
1458
+ | Field | Type | Constraints | Validation Error |
1459
+ |---|---|---|---|
1460
+ | `firstName` | `string` | Alphabetic only | `Child first name is required.` / `Invalid child first name.` |
1461
+ | `lastName` | `string` | Alphabetic only | `Child last name is required.` / `Invalid child last name.` |
1462
+ | `gender` | `Gender` | Male or Female | `Child gender is required.` / `Gender must be Male or Female.` |
1463
+ | `dob` | `string` | 15 days – under 18 years | `Child date of birth is required.` / `Child must be between 15 days and under 18 years old.` |
1464
+ | `height.feet` | `number` | 0–8 | `Child height feet must be between 0 and 8.` |
1465
+ | `height.inches` | `number` | 0–11 | `Child height inches must be between 0 and 11.` |
1466
+ | `weight` | `number` | > 0 | `Child weight must be greater than 0.` |
1467
+ | `relation` | `string` | **Restricted:** `"biological child"` \| `"legally adopted child"` \| `"stepchild"` | `Child relationship is required.` / `Relationship must be one of: biological child, legally adopted child, stepchild.` |
1468
+
1469
+ **`existingCoverageInfoForChildren[]`** (required when `hasExistingCoverageForChildren = true`, max 10):
1470
+
1471
+ | Field | Type | Validation Error |
1472
+ |---|---|---|
1473
+ | `nameOfTheCompany` | `string` | `Name of the company is required for child existing coverage.` |
1474
+ | `insuranceAmount` | `string` | `Insurance amount is required for child existing coverage.` / `Insurance amount must be a positive number.` |
1475
+ | `policyNumber` | `string` | `Policy number is required for child existing coverage.` |
1476
+ | `dateOfIssue` | `string` (`YYYY-MM`) | `Date of issue is required for child existing coverage.` |
1477
+ | `toBeReplaced` | `boolean` | `Replacement coverage answer must be specified.` |
1478
+ | `toBeFinanced` | `boolean` | `Financing coverage answer must be specified.` |
947
1479
 
948
- ```typescript
949
- const verifyResp = await client.verifyPin({
950
- opportunityId,
951
- pin: '123456',
952
- isScriptReadConfirmed: true
953
- });
1480
+ > Total `insuranceAmount` for entries where `toBeReplaced = false` must not exceed $100,000.
954
1481
 
955
- if (verifyResp.isVerified) {
956
- // Signing complete - proceed to finalSubmit()
957
- }
958
- ```
959
1482
 
960
- **Optional - `resendPin` (if PIN was not received):**
1483
+ ***
961
1484
 
962
- ```typescript
963
- await client.resendPin({
964
- opportunityId,
965
- flagSendSms: true,
966
- flagSendEmail: false
967
- });
968
- ```
1485
+ ### Business Rules
969
1486
 
970
- ---
1487
+ 1. `quoteResponseId` must belong to an IB Term quote.
1488
+ 2. `address.state` (when sent) must match the quote state — mismatch returns `StateMismatchIdentified`.
1489
+ 3. IB Term does **not** return `ApplicationLimitReached` (30-day duplicate limit applies to ADB/GIGDB only).
1490
+ 4. State-specific existing coverage fields are only enforced when `address` is included in the request.
1491
+ 5. When Dependent Child Rider is on the quote, `childRiderInfo` is required. If not on the quote, sending it returns `Child rider was not included in the quote. Cannot add child rider details.`
1492
+ 6. No physician knockout for applicants ≥ 55 — that rule was removed.
971
1493
 
972
- ## Final Submit
973
1494
 
974
- Shared across all products. Submits the completed application to the carrier for underwriting.
1495
+ ***
975
1496
 
976
- ```typescript
977
- const submitResp = await client.finalSubmit(opportunityId);
978
- console.log('Policy number:', submitResp.policyNumber);
979
- ```
1497
+ ### Knockout Rules
980
1498
 
981
- > `**policyNumber: null**` is normal - the carrier may not issue a policy number immediately (pending underwriting decision). This is **not** an error.
1499
+ Returns `isDeclined: true` on a successful response — the SDK does **not** throw.
982
1500
 
983
- > **Throws `PaymentNotMade`** if `saveEftPayment()` was not called before this step.
1501
+ - `isPayerAlsoOwnerAndInsured = false`
1502
+ - `isUsCitizenOrIsPermanentResident = false`
1503
+ - `isHoldingValidDriverLicense = false`
1504
+ - `areListedConditionsNotApplicable = false`
1505
+ - Any child knockout boolean = `true`
1506
+ - Height / weight outside the IB Term build chart
984
1507
 
985
- ---
986
1508
 
987
- ## Reporting API
1509
+ ***
988
1510
 
989
- Three methods for retrieving data from the agent portal. `pageSize` and `pageIndex` are required.
1511
+ ### `isQuoteChanged`
990
1512
 
991
- ```typescript
992
- import { AgentPortalReq } from '@instabrain-sdks/api-client';
1513
+ When `isQuoteChanged = true`, the carrier adjusted the premium. Re-present the updated premium to the applicant before directing them to the link.
993
1514
 
994
- const request: AgentPortalReq = {
995
- pageSize: 20, // required
996
- pageIndex: 0 // required, 0-based
997
- };
998
- ```
999
1515
 
1000
- ### Methods
1516
+ ***
1001
1517
 
1002
- ```typescript
1003
- // Quotes not yet converted to applications
1004
- const prospects = await client.getProspects(request);
1005
- // Returns: { prospectCount: number, prospects: ThirdPartyProspectsDetails[] }
1518
+ ### Error Codes
1006
1519
 
1007
- // Completed / sold policies
1008
- const sales = await client.getSales(request);
1009
- // Returns: { applicationCount: number, salesReport: ThirdPartySalesReport[], totalPremiumAmount: number }
1520
+ | Code | When |
1521
+ |---|---|
1522
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
1523
+ | `StateMismatchIdentified` | Quote state ≠ `address.state` |
1524
+ | `AgentNotFound` | Quote cannot be linked to the agent account — verify credentials |
1525
+ | `InternalServerError` | Unexpected backend failure — retry; contact support if persistent |
1010
1526
 
1011
- // Applications in progress
1012
- const applications = await client.getApplications(request);
1013
- // Returns: { applicationCount: number, applications: ThirdPartyApplicationsReport[] }
1014
- ```
1015
1527
 
1016
- ### Full `AgentPortalReq` field reference
1528
+ ***
1017
1529
 
1530
+ ### Response
1018
1531
 
1019
- | Field | Type | Required | Description |
1020
- | -------------- | ------------------------- | -------- | --------------------------------------------- |
1021
- | `pageSize` | `number` | **Yes** | Items per page |
1022
- | `pageIndex` | `number` | **Yes** | Page index, 0-based |
1023
- | `startDate` | `string` (ISO) | No | Start of date range |
1024
- | `endDate` | `string` (ISO) | No | End of date range |
1025
- | `dayCount` | `number` | No | Alternative to date range - fetch last N days |
1026
- | `userTimeZone` | `string` | No | IANA timezone (e.g., `'America/Chicago'`) |
1027
- | `sort` | `AgentPortalReqSorting` | No | Sort configuration |
1028
- | `filters` | `AgentPortalReqFilters[]` | No | Array of filters |
1029
- | `searchParam` | `string` | No | Text search |
1532
+ | Field | Type | Description |
1533
+ |---|---|---|
1534
+ | `opportunityId` | `string` | All-zero UUID when declined before opportunity creation |
1535
+ | `isDeclined` | `boolean` | `true` = knockout; stop the flow |
1536
+ | `isQuoteChanged` | `boolean` | `true` = carrier adjusted premium; re-present before handoff |
1537
+ | `agentLink` | `string\|null` | Agent Conversational UI |
1538
+ | `applicantLink` | `string\|null` | Applicant Conversational UI |
1539
+ | `eAppAgentLink` | `string\|null` | Agent E-App |
1030
1540
 
1541
+ > After a non-declined response, direct the agent or applicant to the appropriate link. All remaining steps (underwriting, payment, signing) complete inside the InstaBrain frontend.
1031
1542
 
1032
- ### Sorting (`AgentPortalReqSorting`)
1033
1543
 
1034
- ```typescript
1035
- sort: {
1036
- value: 'createdOn',
1037
- sortDescending: true
1038
- }
1039
- ```
1544
+ ***
1040
1545
 
1041
- ### Filtering (`AgentPortalReqFilters[]`)
1546
+ ### Example
1042
1547
 
1043
1548
  ```typescript
1044
- import { SQLOperator } from '@instabrain-sdks/api-client';
1549
+ import {
1550
+ BeneficiaryType, BeneficiaryRelationship,
1551
+ TobaccoNicotineLastUsedPeriod, TobaccoNicotineProductType
1552
+ } from '@instabrain-sdks/api-client';
1045
1553
 
1046
- filters: [
1047
- {
1048
- field: 'stateCode',
1049
- operator: SQLOperator.Equal,
1050
- value: 'TX'
1554
+ const appResp = await client.startIBTermApplication({
1555
+ quoteResponseId,
1556
+ firstName: 'John', lastName: 'Smith',
1557
+ email: 'john.smith@example.com', phoneNumber: '5559876543',
1558
+ isUsCitizenOrIsPermanentResident: true,
1559
+ isPayerAlsoOwnerAndInsured: true,
1560
+ height: { feet: 5, inches: 10 },
1561
+ weight: 175,
1562
+ isHoldingValidDriverLicense: true,
1563
+ areListedConditionsNotApplicable: true,
1564
+ tobaccoNicotineUsage: {
1565
+ lastUsedPeriod: TobaccoNicotineLastUsedPeriod.Never,
1566
+ lastTimeUsed: null,
1567
+ productTypesUsed: null
1568
+ },
1569
+ beneficiaryDetails: {
1570
+ beneficiaryType: BeneficiaryType.Person,
1571
+ beneficiaryPerson: { firstName: 'Mary', lastName: 'Smith', relationship: BeneficiaryRelationship.Spouse }
1051
1572
  }
1052
- ]
1053
- ```
1054
-
1055
- `**SQLOperator` enum values:**
1573
+ });
1056
1574
 
1575
+ if (appResp.isDeclined) {
1576
+ return;
1577
+ }
1578
+ if (appResp.isQuoteChanged) {
1579
+ // Re-present updated premium before directing to link
1580
+ }
1581
+ // Hand off to InstaBrain frontend
1582
+ console.log('Applicant link:', appResp.applicantLink);
1583
+ ```
1057
1584
 
1058
- | Enum Member | Numeric Value | Description |
1059
- | -------------------- | ------------- | --------------------- |
1060
- | `Equal` | `0` | Exact match |
1061
- | `NotEqual` | `1` | Not equal |
1062
- | `GreaterThan` | `2` | Greater than |
1063
- | `GreaterThanOrEqual` | `3` | Greater than or equal |
1064
- | `LessThan` | `4` | Less than |
1065
- | `LessThanOrEqual` | `5` | Less than or equal |
1066
- | `Contains` | `6` | Contains substring |
1067
- | `StartsWith` | `7` | Starts with |
1068
- | `EndsWith` | `8` | Ends with |
1069
- | `In` | `9` | In list |
1070
- | `NotIn` | `10` | Not in list |
1585
+ ---
1071
1586
 
1587
+ ## IB Term — Get Existing Quote
1072
1588
 
1073
- ---
1589
+ **Method:** `client.getExistingIBTermQuote(opportunityId)`
1074
1590
 
1075
- ## Request Type Reference
1076
1591
 
1077
- ### `ThirdPartyGigdbQuoteRequest`
1592
+ **When to call:** Resuming a prior session — re-fetch a previously generated IB Term quote.
1078
1593
 
1079
1594
 
1080
- | Field | Type | Required | Constraints |
1081
- | ------------- | ------------------ | -------- | ----------- |
1082
- | `faceAmount` | `number | null` | Yes |
1083
- | `gender` | `Gender` | Yes | |
1084
- | `stateCode` | `string | null` | Yes |
1085
- | `age` | `number | null` | Yes* |
1086
- | `dateOfBirth` | `string | null` | Yes* |
1087
- | `paymentFreq` | `PaymentFrequency` | Yes | |
1088
- | `isSmoker` | `boolean | null` | Yes |
1089
- | `firstName` | `string | null` | No |
1090
- | `lastName` | `string | null` | No |
1091
- | `email` | `string | null` | No |
1092
- | `phoneNum` | `string | null` | No |
1595
+ ***
1093
1596
 
1597
+ ### Request Parameters
1094
1598
 
1095
- ### `ThirdPartyGigdbAppReq`
1599
+ | Parameter | Type | Required |
1600
+ |---|---|---|
1601
+ | `opportunityId` | `string` | Yes |
1096
1602
 
1097
1603
 
1098
- | Field | Type | Required | Constraints |
1099
- | --------------------------------------- | -------------------------- | -------- | --------------------------------------------------- |
1100
- | `quoteResponseId` | `string` | Yes | UUID from quote response |
1101
- | `firstName` | `string | null` | No |
1102
- | `lastName` | `string | null` | No |
1103
- | `email` | `string | null` | No |
1104
- | `phoneNumber` | `string | null` | No |
1105
- | `isUsCitizen` | `boolean | null` | Yes |
1106
- | `isPayerAlsoOwnerAndInsured` | `boolean | null` | Yes |
1107
- | `isLegalUsResident` | `boolean | null` | No |
1108
- | `address` | `GigdbAddress` | Yes | See sub-fields below |
1109
- | `dateOfBirth` | `string | null` | Yes |
1110
- | `socialSecurityNumber` | `string | null` | Yes |
1111
- | `birthJurisdiction` | `GigdbBirthJurisdiction` | Yes | See sub-fields below |
1112
- | `isSmoker` | `boolean | null` | Yes |
1113
- | `nicotineInfo` | `GigdbNicotineInfo | null` | No |
1114
- | `hasExistingCoverage` | `boolean | null` | Yes |
1115
- | `willOtherCoverageBeReplacedOrFinanced` | `boolean | null` | No |
1116
- | `existingCoverageData` | `GigdbExistingCoverageData | null` | No |
1117
- | `willOtherCoverageBeReplacedOrFinancedData` | `GigdbWillOtherCoverageBeReplacedOrFinancedData | null` | No | Required when `address.state` is `"KS"` or `"WA"` AND `willOtherCoverageBeReplacedOrFinanced === true` |
1118
- | `beneficiaryDetails` | `BeneficiaryDetails` | Yes | See [Beneficiary Reference](#beneficiary-reference) |
1604
+ ***
1119
1605
 
1606
+ ### Error Codes
1120
1607
 
1121
- `**GigdbAddress`:**
1608
+ | Code | When |
1609
+ |---|---|
1610
+ | `InvalidRequestFormat` | `OpportunityId is required.` / `OpportunityId does not exist.` / `OpportunityId does not match selected product.` |
1122
1611
 
1612
+ > Throws `AuthenticationError` when the opportunity ID is not found or not in scope for your token.
1123
1613
 
1124
- | Field | Type |
1125
- | -------------- | ------- |
1126
- | `addressLine1` | `string |
1127
- | `city` | `string |
1128
- | `state` | `string |
1129
- | `zipcode` | `string |
1130
1614
 
1615
+ ***
1131
1616
 
1132
- `**GigdbBirthJurisdiction`:**
1617
+ ### Response
1133
1618
 
1619
+ Same shape as Get Quote response, including `premiumSaveWhenSelectingAnnual`, `maxQuoteAmount`, `minQuoteAmount`, and `selectedRiders[n].riderQuoteAmount`.
1134
1620
 
1135
- | Field | Type | Description |
1136
- | --------- | ------- | ----------- |
1137
- | `state` | `string | null` |
1138
- | `country` | `string | null` |
1139
1621
 
1622
+ ***
1140
1623
 
1141
- `**GigdbExistingCoverageData`:**
1624
+ ### Example
1142
1625
 
1626
+ ```typescript
1627
+ const quoteResp = await client.getExistingIBTermQuote(opportunityId);
1628
+ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
1629
+ ```
1143
1630
 
1144
- | Field | Type | Required | Notes |
1145
- | --------------------------------------- | ---------------------------- | -------- | ----- |
1146
- | `isExistingPolicyBeingTerminated` | `boolean | null` | No |
1147
- | `existingCoverages` | `GigdbExistingCoverageInfo[] | null` | Yes (when `hasExistingCoverage === true`) |
1148
- | `areExistingPoliciesIssuedByFidelity` | `boolean | null` | No | Required when `address.state` is `"RI"` or `"WV"` |
1631
+ ---
1149
1632
 
1633
+ ## Shared methods — GIGDB & ADB
1150
1634
 
1151
- `**GigdbExistingCoverageInfo`:**
1635
+ These methods apply to **GIGDB and ADB only**. IB Term uses the frontend links returned by Start Application.
1152
1636
 
1637
+ ---
1153
1638
 
1154
- | Field | Type | Required | Notes |
1155
- | --------------------------------- | ---------------- | -------- | ----- |
1156
- | `nameOfTheCompany` | `string | null` | Yes | |
1157
- | `insuranceAmount` | `string | null` | Yes | |
1158
- | `dateOfIssue` | `string | null` | Yes | `YYYY-MM` |
1159
- | `toBeReplaced` | `boolean | null` | Yes | |
1160
- | `toBeFinanced` | `boolean | null` | Yes | |
1161
- | `requestsYieldIndices` | `boolean | null` | No | Required when `address.state === "MA"` (per-coverage Q-08) |
1162
- | `notifyPresentInsurer` | `boolean | null` | No | Required when `address.state === "OK"` (per-coverage Q-08) |
1163
- | `wantsPolicySummary` | `boolean | null` | No | Required when `address.state` is `"DE"` or `"GA"` (per-coverage Q-08) |
1164
- | `wantsComparativeInformationForm` | `boolean | null` | No | Required when `address.state === "FL"` (per-coverage Q-08) |
1639
+ ## Save EFT Payment
1165
1640
 
1641
+ **Method:** `client.saveEftPayment(request)` · **Type:** `ThirdPartyEftPaymentReq`
1166
1642
 
1167
- `**GigdbWillOtherCoverageBeReplacedOrFinancedData`:**
1168
1643
 
1644
+ Saves bank account details for premium payment. Call after Start Application, before Prepare Docs. Once saved, quote updates are blocked.
1169
1645
 
1170
- | Field | Type | Required | Notes |
1171
- | -------------------------------------- | ------------------------------------- | -------- | ----- |
1172
- | `areReplacedPoliciesIssuedByFidelity` | `boolean | null` | No | Required when `address.state === "KS"` AND `willOtherCoverageBeReplacedOrFinanced === true` |
1173
- | `otherInsuranceReplacementData` | `GigdbOtherInsuranceReplacementData | null` | No | Required when `address.state === "WA"` AND `willOtherCoverageBeReplacedOrFinanced === true` |
1174
1646
 
1647
+ ***
1175
1648
 
1176
- `**GigdbOtherInsuranceReplacementData`:** *(WA-only)*
1649
+ ### Request Fields
1177
1650
 
1178
- > All 7 booleans are server-required (must be non-null). For each boolean set to `true`, the paired `specify*` string must be a non-empty explanation. When the boolean is `false`, the paired `specify*` may be omitted or `null`.
1651
+ | Field | Type | Required | Validation Error |
1652
+ |---|---|---|---|
1653
+ | `opportunityId` | `string` | Yes | `OpportunityId is required.` |
1654
+ | `accountHolderName` | `string` | Yes | `Account holder name is required.` / `Account holder name must be 100 characters or fewer.` |
1655
+ | `routingNumber` | `string` | Yes | `Routing number is required.` / `Routing number must be 9 digits.` |
1656
+ | `accountNumber` | `string` | Yes | `Account number is required.` / `Account number must be 4 to 17 digits.` |
1179
1657
 
1180
- | Field | Type | Required when | Exact applicant-facing question text |
1181
- | ------------------------------------------- | ---------------- | ------------------------------------------------- | --- |
1182
- | `mayReduceBenefitsIncreasePremiums` | `boolean` | Always (WA) | *Can there be reduced benefits or increased premiums in later years?* |
1183
- | `specifyReduceBenefitsIncreasePremiums` | `string | null` | When `mayReduceBenefitsIncreasePremiums === true` | *Please explain* |
1184
- | `hasNewPolicyCharges` | `boolean` | Always (WA) | *Are there penalties, set up or surrender charges for the new policy?* |
1185
- | `specifyNewPolicyCharges` | `string | null` | When `hasNewPolicyCharges === true` | *Please explain, emphasizing any extra cost for early withdrawal.* |
1186
- | `hasPriorPolicyCharges` | `boolean` | Always (WA) | *Will there be penalties or surrender charges under the existing insurance as a result of the proposed transaction?* |
1187
- | `specifyPriorPolicyCharges` | `string | null` | When `hasPriorPolicyCharges === true` | *Please explain* |
1188
- | `hasTaxConsequences` | `boolean` | Always (WA) | *Are there adverse tax consequences from the replacement under current tax law?* |
1189
- | `specifyTaxConsequences` | `string | null` | When `hasTaxConsequences === true` | *Please explain* |
1190
- | `hasInterestConsiderations` | `boolean` | Always (WA) | *Are interest earnings a consideration in this replacement?* |
1191
- | `specifyInterestConsiderations` | `string | null` | When `hasInterestConsiderations === true` | *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.* |
1192
- | `hasMinRequirementsBeforeInterest` | `boolean` | Always (WA) | *Are minimum amounts required to be on deposit before excess interest will be paid?* |
1193
- | `specifyMinRequirementsBeforeInterest` | `string | null` | When `hasMinRequirementsBeforeInterest === true` | *Please explain* |
1194
- | `hasOtherAdverseEffects` | `boolean` | Always (WA) | *Are there other short or long term effects from the replacement that might be materially adverse?* |
1195
- | `specifyOtherAdverseEffects` | `string | null` | When `hasOtherAdverseEffects === true` | *Please explain* |
1196
1658
 
1659
+ ***
1197
1660
 
1198
- ### `ThirdPartyGigdbUpdateQuoteReq`
1661
+ ### Business Rules
1199
1662
 
1663
+ 1. Once EFT payment is saved, quote update calls for the same `opportunityId` are blocked.
1200
1664
 
1201
- | Field | Type | Required | Constraints |
1202
- | --------------- | ------------------ | -------- | ------------------------------------ |
1203
- | `opportunityId` | `string` | Yes | UUID from start application response |
1204
- | `faceAmount` | `number` | Yes | $5,000–$25,000 |
1205
- | `paymentFreq` | `PaymentFrequency` | Yes | |
1206
1665
 
1666
+ ***
1207
1667
 
1208
- > Must be called before `saveEftPayment()`. Cannot update after EFT payment is saved.
1668
+ ### Error Codes
1209
1669
 
1210
- ### `ThirdPartyAdbQuoteRequest`
1670
+ | Code | When |
1671
+ |---|---|
1672
+ | `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
1673
+ | `PaymentAlreadyMade` | EFT already saved for this opportunity |
1211
1674
 
1212
1675
 
1213
- | Field | Type | Required | Constraints |
1214
- | ------------- | ------------------ | -------- | --------------------------------------------------------- |
1215
- | `faceAmount` | `number` | Yes | |
1216
- | `gender` | `Gender` | Yes | |
1217
- | `stateCode` | `string` | Yes | 2-char US state; not MA, NH, AK; CA not yet supported |
1218
- | `age` | `number` | Yes* | 20–59; required if `dateOfBirth` not provided |
1219
- | `dateOfBirth` | `string` | Yes* | ISO 8601; required if `age` not provided |
1220
- | `paymentFreq` | `PaymentFrequency` | Yes | |
1221
- | `riders` | `AdbRiderType[]` | No | Use `AdbRiderType` enum values; availability varies by state |
1222
- | `firstName` | `string` | No | Max 35 chars |
1223
- | `lastName` | `string` | No | Max 35 chars |
1224
- | `email` | `string` | No | Valid email format |
1225
- | `phoneNum` | `string` | No | 10-digit local or E.164 (e.g. `+11234567890`) |
1676
+ ***
1226
1677
 
1678
+ ### Response
1227
1679
 
1228
- ### `ThirdPartyAdbAppReq`
1680
+ `flagStatus: true` with `value: null` on success.
1229
1681
 
1230
1682
 
1231
- | Field | Type | Required | Constraints |
1232
- | --------------------------------------- | ------------------------- | -------- | --------------------------------------------------- |
1233
- | `quoteResponseId` | `string` | Yes | UUID from ADB quote response |
1234
- | `firstName` | `string` | Yes | Max 35 chars |
1235
- | `lastName` | `string` | Yes | Max 35 chars |
1236
- | `email` | `string` | Yes | Valid email format |
1237
- | `phoneNumber` | `string` | Yes | 10-digit local or E.164 (e.g. `+11234567890`) |
1238
- | `isUsCitizen` | `boolean` | Yes | |
1239
- | `isLegalUsResident` | `boolean` | No | Required when `isUsCitizen = false` |
1240
- | `isPayerAlsoOwnerAndInsured` | `boolean` | Yes | Must be `true`; knockout if `false` |
1241
- | `address` | `AdbAddress` | Yes | See sub-fields below |
1242
- | `dateOfBirth` | `string` | Yes | ISO 8601; age must be 20–59 |
1243
- | `socialSecurityNumber` | `string` | Yes | Format: `XXXXXXXXX` (9 digits, no dashes) |
1244
- | `hasExistingCoverage` | `boolean` | Yes | |
1245
- | `willOtherCoverageBeReplacedOrFinanced` | `boolean` | No | Required if `hasExistingCoverage = true` |
1246
- | `existingCoverageData` | `AdbExistingCoverageData` | No | Required if `hasExistingCoverage = true` |
1247
- | `occupation` | `string[]` | No | Required when `address.state === "CA"`; values from `getAdbOccupationOptions()` |
1248
- | `hasMedicalCoverage` | `boolean` | No | Required when `address.state === "DC"` (ACA acknowledgement) |
1249
- | `understandsBenefits` | `boolean` | No | Required when `address.state === "DC"` (ACA acknowledgement) |
1250
- | `understandsLimitedBenefits` | `boolean` | No | Required when `address.state === "DC"` (ACA acknowledgement) |
1251
- | `beneficiaryDetails` | `BeneficiaryDetails` | Yes | See [Beneficiary Reference](#beneficiary-reference) |
1683
+ ***
1252
1684
 
1685
+ ### Example
1253
1686
 
1254
- `**AdbAddress`:**
1687
+ ```typescript
1688
+ await client.saveEftPayment({
1689
+ opportunityId,
1690
+ accountHolderName: 'Jane Doe',
1691
+ routingNumber: '021000021',
1692
+ accountNumber: '123456789012'
1693
+ });
1694
+ // After this point, quote updates are blocked
1695
+ ```
1255
1696
 
1697
+ ---
1256
1698
 
1257
- | Field | Type | Constraints |
1258
- | -------------- | -------- | ------------------------------------------- |
1259
- | `addressLine1` | `string` | |
1260
- | `city` | `string` | |
1261
- | `state` | `string` | 2-char; must match state used at quote time |
1262
- | `zipcode` | `string` | 5-digit numeric |
1699
+ ## Prepare Docs & Get Delivery Channels
1263
1700
 
1701
+ **Method:** `client.prepareDocsAndGetDeliveryChannels(opportunityId)`
1264
1702
 
1265
- `**AdbExistingCoverageData`:**
1266
1703
 
1704
+ Always call this first in the signing flow. Prepares e-signature documents server-side and returns available delivery channels.
1267
1705
 
1268
- | Field | Type | Required | Notes |
1269
- | --------------------------------- | -------------------------- | -------- | ----- |
1270
- | `isExistingPolicyBeingTerminated` | `boolean` | Yes | |
1271
- | `existingCoverages` | `AdbExistingCoverageInfo[]`| Yes | At least one entry required when present |
1272
1706
 
1707
+ ***
1273
1708
 
1274
- `**AdbExistingCoverageInfo`:**
1709
+ ### Request Parameters
1275
1710
 
1711
+ | Parameter | Type | Required |
1712
+ |---|---|---|
1713
+ | `opportunityId` | `string` | Yes |
1276
1714
 
1277
- | Field | Type | Required | Notes |
1278
- | --------------------------------- | --------- | -------- | ----- |
1279
- | `nameOfTheCompany` | `string` | Yes | |
1280
- | `insuranceAmount` | `string` | Yes | |
1281
- | `dateOfIssue` | `string` | Yes | `YYYY-MM` |
1282
- | `toBeReplaced` | `boolean` | Yes | |
1283
- | `toBeFinanced` | `boolean` | Yes | |
1284
- | `notifyPresentInsurer` | `boolean` | No | Required when `address.state === "OK"` AND `hasExistingCoverage === true` |
1285
- | `wantsComparativeInformationForm` | `boolean` | No | Required when `address.state === "FL"` AND `hasExistingCoverage === true` |
1286
- | `wantsPolicySummary` | `boolean` | No | Required when `address.state === "DE"` AND `hasExistingCoverage === true` |
1287
1715
 
1716
+ ***
1288
1717
 
1289
- ### `ThirdPartyEftPaymentReq` (shared - GIGDB and ADB)
1718
+ ### Business Rules
1290
1719
 
1720
+ 1. If `isSignCompleted = true`, documents are already signed — skip Send PIN, Resend PIN, and Verify PIN. Call Final Submit directly.
1291
1721
 
1292
- | Field | Type | Required | Description |
1293
- | ------------------- | -------- | -------- | ------------------------------------ |
1294
- | `opportunityId` | `string` | Yes | UUID from start application response |
1295
- | `accountHolderName` | `string | null` | Yes |
1296
- | `routingNumber` | `string | null` | Yes |
1297
- | `accountNumber` | `string | null` | Yes |
1298
1722
 
1723
+ ***
1299
1724
 
1300
- > Use `saveEftPayment()` for both GIGDB and ADB — both products share the same `POST /api/ThirdPartyPayment/save-eft-payment` endpoint.
1725
+ ### Error Codes
1301
1726
 
1302
- ### `IBTermStartApplicationReq`
1727
+ | Code | When |
1728
+ |---|---|
1729
+ | `InvalidRequestFormat` | `OpportunityId is required.` / `OpportunityId does not exist.` / `Documents are already signed.` (field-level) |
1730
+ | `DocumentsAlreadySigned` | Documents already completed for this opportunity |
1731
+ | `SecureSignRelatedError` | Generic SecureSign failure during document preparation — retry; if persistent, contact support |
1303
1732
 
1733
+ > When signing is already complete, you may see `DocumentsAlreadySigned` or the `InvalidRequestFormat` field message `"Documents are already signed."` — both are terminal; do not retry Prepare Docs / Send PIN.
1304
1734
 
1305
- | Field | Type | Required | Constraints |
1306
- | --- | --- | --- | --- |
1307
- | `quoteResponseId` | `string` | Yes | UUID from IB Term quote response |
1308
- | `firstName` | `string` | Yes | Alphabetic only |
1309
- | `lastName` | `string` | Yes | Alphabetic only |
1310
- | `email` | `string` | Yes | Valid email format |
1311
- | `phoneNumber` | `string` | Yes | 10-digit local or E.164 (e.g. `+11234567890`) |
1312
- | `isUsCitizenOrIsPermanentResident` | `boolean` | Yes | Single combined field (IB Term variant) |
1313
- | `isPayerAlsoOwnerAndInsured` | `boolean` | Yes | Must be `true`; knockout otherwise |
1314
- | `dateOfBirth` | `string \| null` | No | ISO date; when sent, age 18–60. Optional — captured on the originating quote |
1315
- | `socialSecurityNumber` | `string \| null` | No | 9 consecutive digits (`XXXXXXXXX`); dashed values rejected |
1316
- | `address` | `IBTermAddress \| null` | No | See sub-fields below. Optional — state code is captured on the quote |
1317
- | `birthJurisdiction` | `IBTermBirthJurisdiction \| null` | No | See sub-fields below |
1318
- | `height` | `IBTermHeight` | Yes | See sub-fields below |
1319
- | `weight` | `number` | Yes | Must be > 0 |
1320
- | `isHoldingValidDriverLicense` | `boolean` | Yes | `false` → knockout (declined) |
1321
- | `driverLicenseState` | `string \| null` | No (optional) | 2-letter US state. **Optional and independent of `isHoldingValidDriverLicense`** — validated only when sent. BE field: `DriverLicenseState` (top-level flat). |
1322
- | `driverLicenseNumber` | `string \| null` | No (optional) | **Optional and independent of `isHoldingValidDriverLicense`** — validated against `driverLicenseState` when both are present. BE field: `DriverLicenseNumber` (top-level flat). |
1323
- | `hasPrimaryCarePhysician` | `boolean \| null` | No | The whole physician pair is optional. Physician-age-55 knockout removed. |
1324
- | `physicianDetails` | `IBTermPhysicianDetails \| null` | No | Required when `hasPrimaryCarePhysician === true`; must be `null` when `false` |
1325
- | `tobaccoNicotineUsage` | `IBTermTobaccoNicotineUsage \| null` | No | Structured object — see sub-fields. Optional under progressive disclosure |
1326
- | `areListedConditionsNotApplicable` | `boolean` | Yes | Required acknowledgement. `false` → knockout (declined) |
1327
- | `hasExistingCoverage` | `boolean \| null` | No | When `true`, supply `existingCoverageData` and `willOtherCoverageBeReplacedOrFinanced` |
1328
- | `willOtherCoverageBeReplacedOrFinanced` | `boolean` | No | Required when `hasExistingCoverage = true` |
1329
- | `existingCoverageData` | `IBTermExistingCoverageData` | No | Required when `hasExistingCoverage = true` |
1330
- | `willOtherCoverageBeReplacedOrFinancedData` | `IBTermWillOtherCoverageBeReplacedOrFinancedData` | No | Required when `address.state` is `"KS"` or `"WA"` AND `willOtherCoverageBeReplacedOrFinanced === true` |
1331
- | `beneficiaryDetails` | `BeneficiaryDetails \| null` | No | Restricted to Person / Trust / Insured Estate / All-children-of-insured-equally / All-children-of-marriage-equally |
1332
- | `childRiderInfo` | `IBTermChildRiderInfo` | No | Required when Dependent Child Rider was selected on the quote |
1333
1735
 
1736
+ ***
1334
1737
 
1335
- `**IBTermAddress`:**
1738
+ ### Response
1336
1739
 
1740
+ | Field | Type | Description |
1741
+ |---|---|---|
1742
+ | `isSignCompleted` | `boolean` | `true` → skip PIN flow; go to Final Submit |
1743
+ | `isSmsAvailable` | `boolean` | SMS delivery available for this applicant |
1744
+ | `isEmailAvailable` | `boolean` | Email delivery available for this applicant |
1337
1745
 
1338
- | Field | Type | Constraints |
1339
- | -------------- | -------- | ------------------------------------------- |
1340
- | `addressLine1` | `string` | Avoid special characters |
1341
- | `city` | `string` | Letters and spaces only |
1342
- | `state` | `string` | 2-char; must match state used at quote time |
1343
- | `zipcode` | `string` | 5-digit numeric |
1344
1746
 
1747
+ ***
1345
1748
 
1346
- `**IBTermBirthJurisdiction`:**
1749
+ ### Example
1347
1750
 
1751
+ ```typescript
1752
+ const prepResp = await client.prepareDocsAndGetDeliveryChannels(opportunityId);
1348
1753
 
1349
- | Field | Type | Required | Notes |
1350
- | --------- | -------- | -------- | --------------------------------------------- |
1351
- | `country` | `string` | Yes | ISO country code (e.g. `"US"`) |
1352
- | `state` | `string` | No | 2-letter US state; required when `country === "US"` |
1754
+ if (prepResp.isSignCompleted) {
1755
+ // Documents already signed — skip directly to final submit
1756
+ } else {
1757
+ // Proceed to send PIN using an available channel
1758
+ const useSms = prepResp.isSmsAvailable;
1759
+ }
1760
+ ```
1353
1761
 
1762
+ ---
1354
1763
 
1355
- `**IBTermHeight`:**
1764
+ ## Send PIN & Get Documents Link
1356
1765
 
1766
+ **Method:** `client.sendPinAndGetDocumentsLink(request)` · **Type:** `ThirdPartySendPinReq`
1357
1767
 
1358
- | Field | Type | Constraints |
1359
- | -------- | -------- | ---------------- |
1360
- | `feet` | `number` | 1–8 inclusive |
1361
- | `inches` | `number` | 0–11 inclusive |
1362
1768
 
1769
+ Sends a signing PIN to the applicant and returns the document URL plus the consent script to read aloud.
1363
1770
 
1364
- `**IBTermPhysicianDetails`:**
1365
1771
 
1772
+ ***
1366
1773
 
1367
- | Field | Type | Constraints |
1368
- | --------------- | -------- | ------------------------------------------------------ |
1369
- | `physicianName` | `string` | Required when `hasPrimaryCarePhysician === true`. BE field: `PhysicianDetails.PhysicianName` |
1370
- | `city` | `string` | Physician's city. BE field: `PhysicianDetails.City` |
1371
- | `stateCode` | `string` | 2-letter US; "Outside Of The USA" not accepted. BE field: `PhysicianDetails.StateCode` |
1372
- | `lastSeen` | `string` | `YYYY-MM`. Must **not be after the current month** (current month is allowed; only future months are rejected). |
1774
+ ### Request Fields
1373
1775
 
1776
+ | Field | Type | Required | Description | Validation Error |
1777
+ |---|---|---|---|---|
1778
+ | `opportunityId` | `string` | Yes | | `OpportunityId is required.` / `OpportunityId does not exist.` / `Documents are already signed.` |
1779
+ | `flagSendSms` | `boolean` | Yes | `true` to send via SMS | `FlagSendSms is required.` |
1780
+ | `flagSendEmail` | `boolean` | Yes | `true` to send via email | `FlagSendEmail is required.` |
1374
1781
 
1375
- `**IBTermTobaccoNicotineUsage`:**
1782
+ > **Exactly one** of `flagSendSms` / `flagSendEmail` must be `true`.
1783
+ > Both `null` → `"At least one delivery channel (SMS or Email) must be selected."` (on both fields).
1784
+ > Both `true` → `"Only one delivery channel can be selected at a time."` (on both fields).
1376
1785
 
1377
1786
 
1378
- | Field | Type | Required | Constraints |
1379
- | -------------------- | ------------------------------------------ | --------------- | ------------------------------------------------------ |
1380
- | `lastUsedPeriod` | `TobaccoNicotineLastUsedPeriod` | Yes | Use enum values |
1381
- | `lastTimeUsed` | `string | null` | Yes (nullable) | `YYYY-MM`. **Must be `null`** when `lastUsedPeriod === Never` (`'never used'`); non-null otherwise. |
1382
- | `productTypesUsed` | `TobaccoNicotineProductType[] | null` | Yes (nullable) | **Must be `null`** when `lastUsedPeriod === Never`; non-null with ≥1 entry otherwise. BE field: `TobaccoNicotineUsage.ProductTypesUsed` |
1383
- | `cigarUsagePerYear` | `number` | No | 1–999; required when `productTypesUsed` includes `Cigars` |
1787
+ ***
1384
1788
 
1789
+ ### Business Rules
1385
1790
 
1386
- `**IBTermExistingCoverageData`:**
1791
+ 1. Read each item in the `script` array aloud to the applicant before they sign.
1792
+ 2. Give the applicant the `link` URL to review and sign documents.
1387
1793
 
1388
1794
 
1389
- | Field | Type | Required | Notes |
1390
- | ------------------------------------- | --------------------------------- | -------- | ----- |
1391
- | `isExistingPolicyBeingTerminated` | `boolean` | Yes | |
1392
- | `existingCoverages` | `IBTermExistingCoverageInfo[]` | Yes | At least one entry when present |
1393
- | `areExistingPoliciesIssuedByFidelity` | `boolean` | No | Required when `address.state` is `"RI"` or `"WV"` |
1795
+ ***
1394
1796
 
1797
+ ### Error Codes
1395
1798
 
1396
- `**IBTermExistingCoverageInfo`:**
1799
+ | Code | When |
1800
+ |---|---|
1801
+ | `InvalidRequestFormat` | Any field validation failure including channel rules |
1802
+ | `SigningPackageNotCreated` | Signing package not yet created — call Prepare Docs first |
1803
+ | `SecureSignRelatedError` | Generic SecureSign failure — retry; if persistent, contact support |
1804
+ | `PinExpired` | PIN validity window exceeded — call Resend PIN |
1805
+ | `DocumentsAlreadySigned` | Documents already completed |
1806
+ | `InvalidPhoneNumber` | Phone number on application is invalid for SMS delivery — check applicant phone number |
1807
+ | `EmailDeliveryFailed` | Email delivery failed — retry with Resend PIN or switch to SMS |
1808
+ | `MessageNotDelivered` | SMS delivery failed — retry with Resend PIN or switch to email |
1397
1809
 
1398
1810
 
1399
- | Field | Type | Required | Notes |
1400
- | --------------------------------- | --------- | -------- | ----- |
1401
- | `nameOfTheCompany` | `string` | Yes | |
1402
- | `insuranceAmount` | `string` | Yes | |
1403
- | `dateOfIssue` | `string` | Yes | `YYYY-MM` |
1404
- | `toBeReplaced` | `boolean` | Yes | |
1405
- | `toBeFinanced` | `boolean` | Yes | |
1406
- | `requestsYieldIndices` | `boolean` | No | Required when `address.state === "MA"` |
1407
- | `notifyPresentInsurer` | `boolean` | No | Required when `address.state === "OK"` |
1408
- | `wantsPolicySummary` | `boolean` | No | Required when `address.state` is `"DE"` or `"GA"` |
1409
- | `wantsComparativeInformationForm` | `boolean` | No | Required when `address.state === "FL"` |
1811
+ ***
1410
1812
 
1813
+ ### Response
1411
1814
 
1412
- `**IBTermWillOtherCoverageBeReplacedOrFinancedData`:**
1815
+ | Field | Type | Description |
1816
+ |---|---|---|
1817
+ | `link` | `string\|null` | URL for applicant to review and sign documents |
1818
+ | `scriptHeader` | `string\|null` | Header for the consent script |
1819
+ | `script` | `string[]\|null` | Lines to read aloud to the applicant |
1820
+ | `consentMessage` | `string\|null` | Consent confirmation message |
1413
1821
 
1414
1822
 
1415
- | Field | Type | Required | Notes |
1416
- | -------------------------------------- | ------------------------------------- | -------- | ----- |
1417
- | `areReplacedPoliciesIssuedByFidelity` | `boolean` | No | Required when `address.state === "KS"` AND `willOtherCoverageBeReplacedOrFinanced === true` |
1418
- | `otherInsuranceReplacementData` | `IBTermOtherInsuranceReplacementData` | No | Required when `address.state === "WA"` AND `willOtherCoverageBeReplacedOrFinanced === true` |
1823
+ ***
1419
1824
 
1825
+ ### Example
1420
1826
 
1421
- `**IBTermOtherInsuranceReplacementData`:** *(WA only; mirrors `GigdbOtherInsuranceReplacementData`)*
1827
+ ```typescript
1828
+ const pinResp = await client.sendPinAndGetDocumentsLink({
1829
+ opportunityId,
1830
+ flagSendSms: true,
1831
+ flagSendEmail: false
1832
+ });
1422
1833
 
1423
- > All 7 booleans are server-required. Each `specify*` string is required when its paired boolean is `true`; may be omitted or `null` otherwise.
1834
+ // Read each line of pinResp.script aloud to the applicant
1835
+ for (const line of pinResp.script ?? []) {
1836
+ console.log(line);
1837
+ }
1838
+ // Share pinResp.link with the applicant to review and sign
1839
+ ```
1424
1840
 
1425
- | Field | Type | Notes |
1426
- | -------------------------------------- | -------- | ----- |
1427
- | `mayReduceBenefitsIncreasePremiums` | `boolean` | Always required |
1428
- | `specifyReduceBenefitsIncreasePremiums`| `string` | Required when `mayReduceBenefitsIncreasePremiums === true` |
1429
- | `hasNewPolicyCharges` | `boolean` | Always required |
1430
- | `specifyNewPolicyCharges` | `string` | Required when `hasNewPolicyCharges === true` |
1431
- | `hasPriorPolicyCharges` | `boolean` | Always required |
1432
- | `specifyPriorPolicyCharges` | `string` | Required when `hasPriorPolicyCharges === true` |
1433
- | `hasTaxConsequences` | `boolean` | Always required |
1434
- | `specifyTaxConsequences` | `string` | Required when `hasTaxConsequences === true` |
1435
- | `hasInterestConsiderations` | `boolean` | Always required |
1436
- | `specifyInterestConsiderations` | `string` | Required when `hasInterestConsiderations === true` |
1437
- | `hasMinRequirementsBeforeInterest` | `boolean` | Always required |
1438
- | `specifyMinRequirementsBeforeInterest` | `string` | Required when `hasMinRequirementsBeforeInterest === true` |
1439
- | `hasOtherAdverseEffects` | `boolean` | Always required |
1440
- | `specifyOtherAdverseEffects` | `string` | Required when `hasOtherAdverseEffects === true` |
1841
+ ---
1441
1842
 
1843
+ ## Resend PIN
1442
1844
 
1443
- `**IBTermChildRiderInfo`:**
1845
+ **Method:** `client.resendPin(request)` · **Type:** `ThirdPartyResendPinReq`
1444
1846
 
1445
1847
 
1446
- | Field | Type | Required | Notes |
1447
- | ------------------------------------------- | --------------------------------- | -------- | ----- |
1448
- | `hasExistingCoverageForChildren` | `boolean \| null` | No | When `true`, supply `existingCoverageInfoForChildren` (max 10 entries) |
1449
- | `isAnyChildTakingMedication` | `boolean` | Yes | Knockout when `true` |
1450
- | `isAnyChildDiagnosedWithDisability` | `boolean` | Yes | Knockout when `true` |
1451
- | `isAnyChildDiagnosedWithSevereCondition` | `boolean` | Yes | Knockout when `true` |
1452
- | `isAnyChildAdvisedForSurgery` | `boolean` | Yes | Knockout when `true` |
1453
- | `childrenToBeInsuredDetails` | `IBTermChildToBeInsured[] \| null` | No | When provided, each entry is validated (max 10). The previous "at least 1 required" constraint has been removed. |
1454
- | `existingCoverageInfoForChildren` | `IBTermChildExistingCoverage[]` | No | Required when `hasExistingCoverageForChildren === true`; max 10 entries; total non-replaced coverage ≤ $100,000 |
1848
+ Resends the signing PIN. Use when the applicant did not receive the PIN. Same channel rules as Send PIN.
1455
1849
 
1456
1850
 
1457
- `**IBTermChildToBeInsured`:**
1851
+ ***
1458
1852
 
1853
+ ### Request Fields
1459
1854
 
1460
- | Field | Type | Constraints |
1461
- | ------------- | --------------- | --------------------------------------------------- |
1462
- | `firstName` | `string` | Alphabetic only |
1463
- | `lastName` | `string` | Alphabetic only |
1464
- | `gender` | `Gender` | Use enum |
1465
- | `dob` | `string` | ISO date; 15 days – under 18 years old. BE field name: `DOB` (serializes as `dob`) |
1466
- | `height` | `IBTermHeight` | Child: feet 0–8, inches 0–11 |
1467
- | `weight` | `number` | > 0 |
1468
- | `relation` | `string` | Free-form (e.g. "Daughter", "Son", "Stepchild"). BE field name: `Relation` (serializes as `relation`) |
1855
+ Same as Send PIN: `opportunityId`, `flagSendSms`, `flagSendEmail`.
1469
1856
 
1470
1857
 
1471
- `**IBTermChildExistingCoverage`:**
1858
+ ***
1472
1859
 
1860
+ ### Error Codes
1473
1861
 
1474
- | Field | Type | Constraints |
1475
- | ------------------ | --------- | --------------------------------------------- |
1476
- | `nameOfTheCompany` | `string` | |
1477
- | `insuranceAmount` | `string` | Matches adult `IBTermExistingCoverageInfo.insuranceAmount`. Non-replaced totals must not exceed $100,000 |
1478
- | `policyNumber` | `string` | |
1479
- | `dateOfIssue` | `string` | `YYYY-MM` |
1480
- | `toBeReplaced` | `boolean` | Whether this child policy is being replaced |
1481
- | `toBeFinanced` | `boolean` | Whether premiums on the new policy will be financed from this existing child policy |
1862
+ Same error codes as Send PIN.
1482
1863
 
1483
1864
 
1484
- ### `IBTermRiderDetailsResp` *(returned by `getIBTermRiderDetails`)*
1865
+ ***
1485
1866
 
1867
+ ### Response
1486
1868
 
1487
- | Field | Type | Notes |
1488
- | ---------------------------------- | ---------------- | ----- |
1489
- | `flagProductNotAvailableForState` | `boolean` | `true` → IB Term not available for this state/age/nicotine combo |
1490
- | `riders` | `IBTermRider[]` | Empty when product is not available |
1869
+ | Field | Type | Description |
1870
+ |---|---|---|
1871
+ | `flagPinSent` | `boolean` | `true` when PIN successfully resent |
1491
1872
 
1492
1873
 
1493
- `**IBTermRider`:**
1874
+ ***
1494
1875
 
1876
+ ### Example
1495
1877
 
1496
- | Field | Type | Notes |
1497
- | ----------------- | -------- | ----- |
1498
- | `riderCode` | `string` | Pass into `ThirdPartyQuoteReq.riders[n].rider` on the quote |
1499
- | `riderTitle` | `string` | Display title |
1500
- | `riderDescription`| `string` | Display description |
1878
+ ```typescript
1879
+ const resendResp = await client.resendPin({
1880
+ opportunityId,
1881
+ flagSendSms: false,
1882
+ flagSendEmail: true // switch channel if SMS wasn't received
1883
+ });
1884
+ ```
1501
1885
 
1886
+ ---
1502
1887
 
1503
- ### `ThirdPartyQuoteReq` (IB Term - Secondary)
1888
+ ## Verify PIN
1504
1889
 
1890
+ **Method:** `client.verifyPin(request)` · **Type:** `ThirdPartyVerifyPinReq`
1505
1891
 
1506
- | Field | Type | Required | Constraints |
1507
- | ---------------- | ---------------------------------- | -------- | ----------------------------------------------- |
1508
- | `faceAmount` | `number` | Yes | See age-based limits below. `CoverageNotAvailable` if not offered for state+age |
1509
- | `benefitPeriod` | `number` | Yes | 10, 20, or 30 (age-dependent - see table below). `BenefitPeriodNotAvailable` if not offered for state+age |
1510
- | `flagTobaccoUse` | `boolean` | Yes | |
1511
- | `gender` | `Gender` | Yes | |
1512
- | `stateCode` | `string | null` | Yes* (one of stateCode / zipCode) |
1513
- | `zipCode` | `string | null` | Yes* (zipCode wins if both) |
1514
- | `rateClass` | `RateClass | null` | Yes† (one of rateClass / healthClass / height+weight) |
1515
- | `healthClass` | `HealthClass | null` | Yes† (rating OR-group) |
1516
- | `height` | `{ feet, inches } | null` | Yes† — optional; required only with `weightInLbs` (height+weight rating path) |
1517
- | `weightInLbs` | `number | null` | Yes† (paired with `height`) |
1518
- | `age` | `number | null` | Yes‡ (one of age / dateOfBirth; resolved 18–60) |
1519
- | `dateOfBirth` | `string | null` | Yes‡ (dateOfBirth wins if both) |
1520
- | `riders` | `ThirdPartyQuoteReqRider[] | null` | No |
1521
- | `paymentFreq` | `PaymentFrequency` | Yes | |
1522
- | `firstName` | `string | null` | No |
1523
- | `lastName` | `string | null` | No |
1524
- | `email` | `string | null` | No |
1525
- | `phoneNum` | `string | null` | No |
1526
1892
 
1527
- > `*` one of `stateCode` / `zipCode` required · `†` one rating group required (`rateClass` OR `healthClass` OR `height`+`weightInLbs`) · `‡` one of `age` / `dateOfBirth` required
1893
+ Verifies the PIN and confirms the consent script was read aloud.
1528
1894
 
1529
1895
 
1530
- **Face amount limits (age-based):**
1896
+ ***
1531
1897
 
1898
+ ### Request Fields
1532
1899
 
1533
- | Age | Min | Max |
1534
- | -------- | ------- | ---------- |
1535
- | Up to 55 | $50,000 | $1,000,000 |
1536
- | 56 | $50,000 | $900,000 |
1537
- | 57 | $50,000 | $800,000 |
1538
- | 58 | $50,000 | $700,000 |
1539
- | 59 | $50,000 | $600,000 |
1540
- | 60 | $50,000 | $500,000 |
1900
+ | Field | Type | Required | Description | Validation Error |
1901
+ |---|---|---|---|---|
1902
+ | `opportunityId` | `string` | Yes | | `OpportunityId is required.` / `OpportunityId does not exist.` / `Documents are already signed.` |
1903
+ | `pin` | `string` | Yes | PIN entered by the applicant | `Pin is required.` |
1904
+ | `isScriptReadConfirmed` | `boolean` | Yes | Must be `true` — confirms consent script was read aloud | `IsScriptReadConfirmed is required.` / `IsScriptReadConfirmed must be true.` |
1541
1905
 
1542
1906
 
1543
- **Benefit period availability:**
1907
+ ***
1544
1908
 
1909
+ ### Business Rules
1545
1910
 
1546
- | Age | Tobacco use | Available periods |
1547
- | -------- | ----------- | ----------------- |
1548
- | Up to 45 | Any | 10, 20, 30 |
1549
- | 45–50 | Non-tobacco | 10, 20, 30 |
1550
- | 45–50 | Tobacco | 10, 20 |
1551
- | 51–60 | Any | 10, 20 |
1911
+ 1. `isScriptReadConfirmed = false` is rejected — the caller must confirm the script was read before submitting.
1912
+ 2. Wrong PIN returns `isVerified: false` on a successful response — the SDK does **not** throw.
1913
+ 3. After successful verification, calling Prepare Docs again returns `isSignCompleted: true`.
1552
1914
 
1553
1915
 
1554
- ### `ThirdPartySendPinReq`
1916
+ ***
1555
1917
 
1918
+ ### Error Codes
1556
1919
 
1557
- | Field | Type | Required | Constraints |
1558
- | --------------- | --------- | -------- | --------------------------------------------------------------- |
1559
- | `opportunityId` | `string` | Yes | |
1560
- | `flagSendSms` | `boolean` | Yes | At least one of `flagSendSms` or `flagSendEmail` must be `true` |
1561
- | `flagSendEmail` | `boolean` | Yes | At least one of `flagSendSms` or `flagSendEmail` must be `true` |
1920
+ | Code | When |
1921
+ |---|---|
1922
+ | `InvalidRequestFormat` | Any field validation failure |
1923
+ | `SigningPackageNotCreated` | Signing package missing — call Prepare Docs first |
1924
+ | `SecureSignPinMismatch` | Wrong PIN entered — applicant should re-enter |
1925
+ | `PinExpired` | PIN validity window exceeded — call Resend PIN |
1926
+ | `DocumentsNotViewed` | Applicant has not viewed all documents before PIN verification |
1927
+ | `DocumentsAlreadySigned` | Documents already completed |
1928
+ | `SecureSignRelatedError` | Generic SecureSign failure — retry; if persistent, contact support |
1562
1929
 
1563
1930
 
1564
- ### `ThirdPartyResendPinReq`
1931
+ ***
1565
1932
 
1933
+ ### Response
1566
1934
 
1567
- | Field | Type | Required | Constraints |
1568
- | --------------- | --------- | -------- | ----------------------------------------- |
1569
- | `opportunityId` | `string` | Yes | |
1570
- | `flagSendSms` | `boolean` | Yes | At least one delivery flag must be `true` |
1571
- | `flagSendEmail` | `boolean` | Yes | At least one delivery flag must be `true` |
1935
+ | Field | Type | Description |
1936
+ |---|---|---|
1937
+ | `isVerified` | `boolean` | `true` = PIN matched, signing complete · `false` = wrong PIN (successful response, not thrown) |
1572
1938
 
1573
1939
 
1574
- ### `ThirdPartyVerifyPinReq`
1940
+ ***
1575
1941
 
1942
+ ### Example
1576
1943
 
1577
- | Field | Type | Required | Constraints |
1578
- | ----------------------- | --------- | -------- | -------------------------------------------------- |
1579
- | `opportunityId` | `string` | Yes | |
1580
- | `pin` | `string` | Yes | PIN entered by the signer |
1581
- | `isScriptReadConfirmed` | `boolean` | Yes | Must be `true`; confirms disclosure was read aloud |
1944
+ ```typescript
1945
+ const verifyResp = await client.verifyPin({
1946
+ opportunityId,
1947
+ pin: '482910',
1948
+ isScriptReadConfirmed: true // confirms script was read aloud
1949
+ });
1582
1950
 
1951
+ if (verifyResp.isVerified) {
1952
+ // Signing complete — proceed to final submit
1953
+ } else {
1954
+ // Wrong PIN — ask applicant to try again or call resendPin()
1955
+ }
1956
+ ```
1583
1957
 
1584
1958
  ---
1585
1959
 
1586
- ## Response Type Reference
1960
+ ## Final Submit
1587
1961
 
1588
- ### `BaseResponse<T>`
1962
+ **Method:** `client.finalSubmit(opportunityId)`
1589
1963
 
1590
- All InstaBrain API responses are wrapped in this envelope:
1591
1964
 
1592
- ```typescript
1593
- interface BaseResponse<T> {
1594
- flagStatus: boolean; // true = success, false = API-level error
1595
- value: T; // the actual response data
1596
- error: string | null; // error message when flagStatus = false
1597
- errorCode?: string; // error code when flagStatus = false
1598
- }
1599
- ```
1965
+ Submits the signed application to the carrier. Can only be called once per opportunity.
1600
1966
 
1601
- The SDK unwraps this envelope automatically - integrators receive `value` directly. When `flagStatus = false`, the SDK throws `APIValidationError`. You never check `flagStatus` manually.
1602
1967
 
1603
- ### `ThirdPartyQuoteResp`
1968
+ ***
1604
1969
 
1605
- Returned by `getGigdbQuote()`, `getAdbQuote()`, `getQuote()`, `updateGigdbQuote()`, `getExistingGigdbQuote()`.
1970
+ ### Request Fields
1606
1971
 
1607
- ```typescript
1608
- interface ThirdPartyQuoteResp {
1609
- productName: string | null;
1610
- selectedQuote: Quote;
1611
- }
1612
- ```
1972
+ | Field | Type | Required | Validation Error |
1973
+ |---|---|---|---|
1974
+ | `opportunityId` | `string` | Yes | `OpportunityId is required.` / `OpportunityId does not exist.` / `Application has already been final submitted.` |
1613
1975
 
1614
- **Key `Quote` fields:**
1976
+ > `"Application has already been final submitted."` is a terminal state — do not retry.
1615
1977
 
1978
+ > Throws `AuthenticationError` when `opportunityId` is not authorized for the current JWT.
1616
1979
 
1617
- | Field | Type | Description |
1618
- | ------------------- | ------------- | -------------------------------------- |
1619
- | `quoteResponseId` | `string` | UUID - pass to `startXxxApplication()` |
1620
- | `quoteAmount` | `number | null` |
1621
- | `faceAmount` | `number` | Coverage amount |
1622
- | `benefitPeriod` | `number | null` |
1623
- | `paymentFrequency` | `string | null` |
1624
- | `isMedicalRequired` | `boolean` | Whether a medical exam is required |
1625
- | `selectedRiders` | `RidersList[] | null` |
1626
1980
 
1981
+ ***
1627
1982
 
1628
- ### `ThirdPartyStartAppResp` (GIGDB, IB Term)
1983
+ ### Business Rules
1629
1984
 
1630
- Returned by `startGigdbApplication()` and `startApplication()`.
1985
+ 1. Can only be called once. Subsequent calls for the same `opportunityId` are rejected.
1986
+ 2. `policyNumber` may be `null` — carrier decisions can be async/pending. A `null` on `flagStatus: true` is **not** an error.
1631
1987
 
1632
1988
 
1633
- | Field | Type | Description |
1634
- | ---------------- | --------- | --------------------------------------------- |
1635
- | `opportunityId` | `string` | UUID - used for all subsequent calls |
1636
- | `agentLink` | `string | null` |
1637
- | `eAppAgentLink` | `string | null` |
1638
- | `applicantLink` | `string | null` |
1639
- | `isDeclined` | `boolean` | `true` = valid knockout (GIGDB); not an error |
1640
- | `isQuoteChanged` | `boolean` | `true` = premium was adjusted (GIGDB) |
1989
+ ***
1641
1990
 
1991
+ ### Error Codes
1642
1992
 
1643
- ### `AdbRiderDetailsResp` (ADB only)
1993
+ | Code | When |
1994
+ |---|---|
1995
+ | `InvalidRequestFormat` | `opportunityId` missing, not found, or already submitted |
1996
+ | `PaymentNotMade` | EFT not saved — call `saveEftPayment()` first |
1997
+ | `FidelityFinalSubmitError` | Fidelity carrier rejected or failed to process the final submission — contact support with the `opportunityId` |
1644
1998
 
1645
- Returned by `getAdbRiderDetails()`.
1646
1999
 
1647
- | Field | Type | Description |
1648
- |---|---|---|
1649
- | `riders` | `AdbRiderResp[]` | Available riders for the state. May be empty even when product is available. |
1650
- | `flagProductNotAvailableForState` | `boolean` | `true` = ADB not available in this state; stop. `false` = available; proceed to quote. |
2000
+ ***
1651
2001
 
1652
- ### `AdbRiderResp`
2002
+ ### Response
1653
2003
 
1654
2004
  | Field | Type | Description |
1655
2005
  |---|---|---|
1656
- | `riderCode` | `AdbRiderType` | Pass into `ThirdPartyAdbQuoteRequest.riders` to include this rider in the quote. Values: `FamilyADB`, `ReturnOfPremium`, `InflationBenefit`. |
1657
- | `riderTitle` | `string` | Display title for UI rendering. |
1658
- | `riderDescription` | `string` | Display description for UI rendering. |
2006
+ | `policyNumber` | `string\|null` | Issued policy number. May be `null` — carrier decision may be pending. |
1659
2007
 
1660
- ### `ThirdPartyAdbStartAppResp` (ADB only)
1661
2008
 
1662
- Returned by `startAdbApplication()`. Contains only two fields - no links, no `isQuoteChanged`:
2009
+ ***
1663
2010
 
2011
+ ### Example
1664
2012
 
1665
- | Field | Type | Description |
1666
- | --------------- | --------- | ------------------------------------------ |
1667
- | `opportunityId` | `string` | UUID - empty GUID when `isDeclined = true` |
1668
- | `isDeclined` | `boolean` | `true` = knockout; stop the flow |
1669
-
2013
+ ```typescript
2014
+ const submitResp = await client.finalSubmit(opportunityId);
1670
2015
 
1671
- ### `ThirdPartyPrepareDocsResp`
2016
+ // policyNumber may be null — carrier decision may still be pending
2017
+ if (submitResp.policyNumber) {
2018
+ console.log('Policy issued:', submitResp.policyNumber);
2019
+ } else {
2020
+ console.log('Submission accepted — policy number pending carrier decision');
2021
+ }
2022
+ ```
1672
2023
 
2024
+ ---
1673
2025
 
1674
- | Field | Type | Description |
1675
- | ------------------ | --------- | ---------------------------------- |
1676
- | `isSignCompleted` | `boolean` | If `true`, skip to `finalSubmit()` |
1677
- | `isSmsAvailable` | `boolean` | SMS delivery channel available |
1678
- | `isEmailAvailable` | `boolean` | Email delivery channel available |
1679
- | `productName` | `string | null` |
2026
+ ## Reporting
1680
2027
 
2028
+ | SDK method | Returns |
2029
+ |---|---|
2030
+ | `getProspects()` | Quotes not yet converted to applications |
2031
+ | `getSales()` | Completed / sold policies |
2032
+ | `getApplications()` | Applications in progress |
1681
2033
 
1682
- ### `ThirdPartySendPinResp`
2034
+ All three methods accept `AgentPortalReq`.
1683
2035
 
1684
2036
 
1685
- | Field | Type | Description |
1686
- | ---------------- | --------- | ----------- |
1687
- | `link` | `string | null` |
1688
- | `scriptHeader` | `string | null` |
1689
- | `script` | `string[] | null` |
1690
- | `consentMessage` | `string | null` |
2037
+ ***
1691
2038
 
2039
+ ### Request fields (shared shape)
1692
2040
 
1693
- ### `ThirdPartyResendPinResp`
2041
+ | Field | Type | Required | Description |
2042
+ |---|---|---|---|
2043
+ | `pageSize` | `number` | Yes | Items per page — do not pass `0` or `null` |
2044
+ | `pageIndex` | `number` | Yes | Page index, 0-based — do not pass `0` or `null` |
2045
+ | `startDate` | `string` (ISO) | Conditional | Start of date range — required if `dayCount` not provided |
2046
+ | `endDate` | `string` (ISO) | Conditional | End of date range — required with `startDate` |
2047
+ | `dayCount` | `number` | Conditional | Last N days — required if `startDate`/`endDate` not provided |
2048
+ | `userTimeZone` | `string` | No | IANA timezone e.g. `"America/Chicago"` |
2049
+ | `sort.value` | `string` | No | Column name to sort by |
2050
+ | `sort.sortDescending` | `boolean` | No | `true` = descending order |
2051
+ | `filters[]` | `object[]` | No | `{ field, operator, value }` — see `SQLOperator` below |
2052
+ | `searchParam` | `string` | No | Text search across all response fields except `riders` |
1694
2053
 
1695
2054
 
1696
- | Field | Type | Description |
1697
- | ------------- | --------- | ----------------------------------- |
1698
- | `flagPinSent` | `boolean` | `true` when PIN resent successfully |
2055
+ ***
1699
2056
 
2057
+ ### Filters — `SQLOperator` Enum
1700
2058
 
1701
- ### `ThirdPartyVerifyPinResp`
2059
+ | Member | Value | Description |
2060
+ |---|---|---|
2061
+ | `Equal` | `0` | Exact match |
2062
+ | `NotEqual` | `1` | Not equal |
2063
+ | `GreaterThan` | `2` | Greater than |
2064
+ | `GreaterThanOrEqual` | `3` | Greater than or equal |
2065
+ | `LessThan` | `4` | Less than |
2066
+ | `LessThanOrEqual` | `5` | Less than or equal |
2067
+ | `Contains` | `6` | Substring match |
2068
+ | `StartsWith` | `7` | Starts with |
2069
+ | `EndsWith` | `8` | Ends with |
2070
+ | `In` | `9` | In list |
2071
+ | `NotIn` | `10` | Not in list |
1702
2072
 
1703
2073
 
1704
- | Field | Type | Description |
1705
- | ------------ | --------- | ------------------------------------------------ |
1706
- | `isVerified` | `boolean` | `true` when PIN matched and documents are signed |
2074
+ ***
1707
2075
 
2076
+ ### Response shapes
1708
2077
 
1709
- ### `ThirdPartyFinalSubmitResp`
2078
+ | Method | Response |
2079
+ |---|---|
2080
+ | `getProspects()` | `{ prospectCount: number, prospects: ThirdPartyProspectsDetails[] }` |
2081
+ | `getSales()` | `{ applicationCount: number, salesReport: ThirdPartySalesReport[], totalPremiumAmount: number }` |
2082
+ | `getApplications()` | `{ applicationCount: number, applications: ThirdPartyApplicationsReport[] }` |
1710
2083
 
2084
+ > `applicationStatus` format: `"{Status} {RateClass}: {Assessment Factor}"` e.g. `"InProgress Preferred: Drug Use"`
1711
2085
 
1712
- | Field | Type | Description |
1713
- | -------------- | ------- | ----------- |
1714
- | `policyNumber` | `string | null` |
2086
+ ---
1715
2087
 
2088
+ ## Enums & Constants
1716
2089
 
1717
- ---
1718
2090
 
1719
- ## Enums and Constants
2091
+ ***
1720
2092
 
1721
2093
  ### `Gender`
1722
2094
 
2095
+ | Enum | Value | Products |
2096
+ |---|---|---|
2097
+ | `Gender.Male` | `'Male'` | All products |
2098
+ | `Gender.Female` | `'Female'` | All products |
1723
2099
 
1724
- | Enum Member | Value |
1725
- | --------------- | ---------- |
1726
- | `Gender.Male` | `'Male'` |
1727
- | `Gender.Female` | `'Female'` |
1728
2100
 
2101
+ ***
1729
2102
 
1730
2103
  ### `PaymentFrequency`
1731
2104
 
2105
+ `PaymentFrequency.Monthly` = `'Monthly'` · `PaymentFrequency.Annually` = `'Annually'`
1732
2106
 
1733
- | Enum Member | Value |
1734
- | --------------------------- | ------------ |
1735
- | `PaymentFrequency.Monthly` | `'Monthly'` |
1736
- | `PaymentFrequency.Annually` | `'Annually'` |
1737
2107
 
2108
+ ***
1738
2109
 
1739
- ### `HealthClass`
2110
+ ### `HealthClass` (IB Term Quote)
1740
2111
 
2112
+ `Excellent` · `Great` · `Good` · `Average` — accepted case-insensitively in `getQuote()` / `startIBTermApplication()` requests.
1741
2113
 
1742
- | Enum Member | Value |
1743
- | ----------------------- | ------------- |
1744
- | `HealthClass.Excellent` | `'Excellent'` |
1745
- | `HealthClass.Great` | `'Great'` |
1746
- | `HealthClass.Good` | `'Good'` |
1747
- | `HealthClass.Average` | `'Average'` |
2114
+ > `HealthClass.Preferred` does **not** exist — using it throws `APIValidationError`.
1748
2115
 
1749
2116
 
1750
- > **Note:** `HealthClass.Preferred` does **not** exist and will cause an API error if used.
2117
+ ***
1751
2118
 
1752
- ### `RateClass`
2119
+ ### `RateClass` (IB Term Quote)
1753
2120
 
1754
-
1755
- | Enum Member | Value |
1756
- | ------------------------- | ------------------ |
2121
+ | Enum | Value |
2122
+ |---|---|
1757
2123
  | `RateClass.PreferredPlus` | `'Preferred Plus'` |
1758
- | `RateClass.Preferred` | `'Preferred'` |
1759
- | `RateClass.Standard` | `'Standard'` |
2124
+ | `RateClass.Preferred` | `'Preferred'` |
2125
+ | `RateClass.Standard` | `'Standard'` |
1760
2126
  | `RateClass.StandardExtra` | `'Standard Extra'` |
1761
2127
 
2128
+ > Values contain spaces — always use enum members, not raw strings.
1762
2129
 
1763
- > **Note:** Values contain spaces - always use enum members, not raw strings.
1764
2130
 
1765
- ### `RiderType`
2131
+ ***
1766
2132
 
2133
+ ### `RiderType` (IB Term Quote — rider codes)
1767
2134
 
1768
- | Enum Member | Value | Coverage Range |
1769
- | ------------------------------- | ------------------------- | ---------------- |
1770
- | `RiderType.ADBRider` | `'ADB Rider'` | $25,000–$250,000 |
1771
- | `RiderType.DependentChildRider` | `'Dependent Child Rider'` | $5,000–$25,000 |
2135
+ | Enum | Value | Face Amount Range |
2136
+ |---|---|---|
2137
+ | `RiderType.ADBRider` | `'ADB Rider'` | $25,000–$250,000 |
2138
+ | `RiderType.DependentChildRider` | `'Dependent Child Rider'` | $5,000–$25,000 |
1772
2139
 
1773
2140
 
1774
- > **Note:** Values contain spaces - always use enum members.
2141
+ ***
1775
2142
 
1776
2143
  ### `AdbRiderType` (ADB product only)
1777
2144
 
1778
- Rider codes accepted by `ThirdPartyAdbQuoteRequest.riders` and `ThirdPartyAdbUpdateQuoteReq.riders`, and returned by `getAdbRiderDetails()` as `AdbRiderResp.riderCode`.
1779
-
1780
- | Enum Member | Value |
1781
- | ------------------------------ | -------------------- |
1782
- | `AdbRiderType.FamilyADB` | `'FamilyADB'` |
1783
- | `AdbRiderType.ReturnOfPremium` | `'ReturnOfPremium'` |
2145
+ | Enum | Value |
2146
+ |---|---|
2147
+ | `AdbRiderType.FamilyADB` | `'FamilyADB'` |
2148
+ | `AdbRiderType.ReturnOfPremium` | `'ReturnOfPremium'` |
1784
2149
  | `AdbRiderType.InflationBenefit` | `'InflationBenefit'` |
1785
2150
 
1786
- > **Note:** ADB has its own rider enum. Do NOT reuse the Term product's `RiderType` — those values (`'ADB Rider'`, `'Dependent Child Rider'`) are display titles, not the codes the ADB API expects.
1787
-
1788
- ### `TobaccoNicotineLastUsedPeriod` (IB Term Start Application)
1789
-
1790
- Bucket describing how recently the applicant last used tobacco/nicotine. Used on `IBTermTobaccoNicotineUsage.lastUsedPeriod`. Values match the backend `TobaccoNicotineLastUsedPeriodOptions` list — **case-sensitive, lowercase**.
1791
-
1792
- | Enum Member | Value |
1793
- | -------------------------------------------------------- | ------------------------------ |
1794
- | `TobaccoNicotineLastUsedPeriod.WithinLastTwelveMonths` | `'within the last 12 months'` |
1795
- | `TobaccoNicotineLastUsedPeriod.TwelveToTwentyThreeMonths`| `'12 to 23 months'` |
1796
- | `TobaccoNicotineLastUsedPeriod.TwentyFourToThirtyFiveMonths` | `'24 to 35 months'` |
1797
- | `TobaccoNicotineLastUsedPeriod.ThirtySixMonthsOrGreater` | `'36 months or greater'` |
1798
- | `TobaccoNicotineLastUsedPeriod.Never` | `'never used'` |
1799
-
1800
- ### `TobaccoNicotineProductType` (IB Term Start Application)
1801
-
1802
- Tobacco / nicotine product types the applicant has used. Used as a non-empty array on `IBTermTobaccoNicotineUsage.productTypesUsed`. Values match the backend `TobaccoNicotineProductTypeOptions` list — **case-sensitive, lowercase**.
2151
+ > Do **not** mix `RiderType` (IB Term) and `AdbRiderType` (ADB) — they are for different products.
1803
2152
 
1804
- | Enum Member | Value |
1805
- | -------------------------------------------- | ---------------------- |
1806
- | `TobaccoNicotineProductType.ChewingTobacco` | `'chewing tobacco'` |
1807
- | `TobaccoNicotineProductType.Cigarettes` | `'cigarettes'` |
1808
- | `TobaccoNicotineProductType.Cigars` | `'cigars'` |
1809
- | `TobaccoNicotineProductType.ECigarettes` | `'e-cigarettes'` |
1810
- | `TobaccoNicotineProductType.Hookah` | `'hookah'` |
1811
- | `TobaccoNicotineProductType.NicotineGum` | `'nicotine gum'` |
1812
- | `TobaccoNicotineProductType.NicotinePatches` | `'nicotine patches'` |
1813
- | `TobaccoNicotineProductType.None` | `'none'` |
1814
- | `TobaccoNicotineProductType.Other` | `'other'` |
1815
- | `TobaccoNicotineProductType.Pipes` | `'pipes'` |
1816
- | `TobaccoNicotineProductType.SmokelessTobacco`| `'smokeless tobacco'` |
1817
- | `TobaccoNicotineProductType.Snuff` | `'snuff'` |
1818
- | `TobaccoNicotineProductType.Vaping` | `'vaping'` |
1819
2153
 
1820
- > When `productTypesUsed` includes `Cigars`, `cigarUsagePerYear` (1–999) becomes required on the `tobaccoNicotineUsage` object.
2154
+ ***
1821
2155
 
1822
- ### `State`
2156
+ ### `TobaccoNicotineLastUsedPeriod` (IB Term Start Application)
1823
2157
 
1824
- All 50 US states + DC and 12 Canadian provinces/territories:
2158
+ | Enum | Value |
2159
+ |---|---|
2160
+ | `WithinLastTwelveMonths` | `'within the last 12 months'` |
2161
+ | `TwelveToTwentyThreeMonths` | `'12 to 23 months'` |
2162
+ | `TwentyFourToThirtyFiveMonths` | `'24 to 35 months'` |
2163
+ | `ThirtySixMonthsOrGreater` | `'36 months or greater'` |
2164
+ | `Never` | `'never used'` |
1825
2165
 
1826
- **US:** `AK`, `AL`, `AR`, `AZ`, `CA`, `CO`, `CT`, `DC`, `DE`, `FL`, `GA`, `HI`, `IA`, `ID`, `IL`, `IN`, `KS`, `KY`, `LA`, `MA`, `MD`, `ME`, `MI`, `MN`, `MO`, `MS`, `MT`, `NC`, `ND`, `NE`, `NH`, `NJ`, `NM`, `NV`, `NY`, `OH`, `OK`, `OR`, `PA`, `RI`, `SC`, `SD`, `TN`, `TX`, `UT`, `VA`, `VT`, `WA`, `WI`, `WV`, `WY`
1827
2166
 
1828
- **Canadian provinces/territories:** `AB`, `BC`, `MB`, `NB`, `NS`, `NT`, `NUNAVUT`, `ON`, `PE`, `PQ`, `SK`, `YT`
2167
+ ***
1829
2168
 
1830
- ### `Country`
2169
+ ### `TobaccoNicotineProductType` (IB Term Start Application)
1831
2170
 
1832
- Full ISO country code enum. Common values: `Country.UnitedStates` (`'US'`), `Country.Canada` (`'CA'`). Used in GIGDB's `birthJurisdiction.country`.
2171
+ | Enum | Value |
2172
+ |---|---|
2173
+ | `ChewingTobacco` | `'chewing tobacco'` |
2174
+ | `Cigarettes` | `'cigarettes'` |
2175
+ | `Cigars` | `'cigars'` |
2176
+ | `ECigarettes` | `'e-cigarettes'` |
2177
+ | `Hookah` | `'hookah'` |
2178
+ | `NicotineGum` | `'nicotine gum'` |
2179
+ | `NicotinePatches` | `'nicotine patches'` |
2180
+ | `None` | `'none'` |
2181
+ | `Other` | `'other'` |
2182
+ | `Pipes` | `'pipes'` |
2183
+ | `SmokelessTobacco` | `'smokeless tobacco'` |
2184
+ | `Snuff` | `'snuff'` |
2185
+ | `Vaping` | `'vaping'` |
2186
+
2187
+
2188
+ ***
1833
2189
 
1834
2190
  ### `BeneficiaryType`
1835
2191
 
2192
+ `Person` · `AllChildrenOfTheInsuredEqually` · `AllChildrenOfTheMarriageEqually` · `InsuredEstate` · `Business` · `Corporation` · `CharitableOrganization` · `Employer` · `Other` · `Trust`
1836
2193
 
1837
- | Enum Member | Value |
1838
- | --------------------------------- | ---------------------------------------- |
1839
- | `Person` | `'Person'` |
1840
- | `AllChildrenOfTheInsuredEqually` | `'All Children Of The Insured Equally'` |
1841
- | `AllChildrenOfTheMarriageEqually` | `'All Children Of The Marriage Equally'` |
1842
- | `InsuredEstate` | `'Insured Estate'` |
1843
- | `Business` | `'Business'` |
1844
- | `Corporation` | `'Corporation'` |
1845
- | `CharitableOrganization` | `'Charitable Organization'` |
1846
- | `Employer` | `'Employer'` |
1847
- | `Other` | `'Other'` |
1848
- | `Trust` | `'Trust'` |
2194
+ > IB Term restricts to: `Person`, `Trust`, `InsuredEstate`, `AllChildrenOfTheInsuredEqually`, `AllChildrenOfTheMarriageEqually`.
1849
2195
 
1850
2196
 
1851
- ### `BeneficiaryRelationship`
1852
-
1853
- 36 values: `Aunt`, `Boyfriend`, `Brother`, `BrotherInLaw`, `CommonLawHusband`, `CommonLawWife`, `Cousin`, `Daughter`, `DaughterInLaw`, `DomesticPartner`, `Father`, `FatherInLaw`, `FatherOfChild`, `Fiance`, `Fiancee`, `FormerSpouse`, `Friend`, `Girlfriend`, `Granddaughter`, `Grandfather`, `Grandmother`, `Grandson`, `Husband`, `LifePartner`, `Mother`, `MotherInLaw`, `MotherOfChild`, `Nephew`, `Niece`, `Sister`, `SisterInLaw`, `Son`, `SonInLaw`, `Spouse`, `Uncle`, `Wife`
2197
+ ***
1854
2198
 
1855
- ### ADB Rider Availability
1856
-
1857
- #### `ADB_RIDER_AVAILABLE_STATES`
2199
+ ### `BeneficiaryRelationship`
1858
2200
 
1859
- ADB Rider available in: `AL`, `AZ`, `AR`, `CA`*, `CO`, `CT`, `DC`, `DE`, `FL`, `GA`, `HI`, `ID`, `IL`, `IN`, `IA`, `KS`, `KY`, `LA`, `ME`, `MD`, `MI`, `MN`, `MS`, `MO`, `MT`, `NE`, `NV`, `NJ`, `NM`, `NC`, `ND`, `OH`, `OK`, `OR`, `PA`, `RI`, `SC`, `SD`, `TN`, `TX`, `UT`, `VT`, `VA`, `WV`, `WI`
2201
+ `Aunt` · `Boyfriend` · `Brother` · `BrotherInLaw` · `CommonLawHusband` · `CommonLawWife` · `Cousin` · `Daughter` · `DaughterInLaw` · `DomesticPartner` · `Father` · `FatherInLaw` · `FatherOfChild` · `Fiance` · `Fiancee` · `FormerSpouse` · `Friend` · `Girlfriend` · `Granddaughter` · `Grandfather` · `Grandmother` · `Grandson` · `Husband` · `LifePartner` · `Mother` · `MotherInLaw` · `MotherOfChild` · `Nephew` · `Niece` · `Sister` · `SisterInLaw` · `Son` · `SonInLaw` · `Spouse` · `Uncle` · `Wife`
1860
2202
 
1861
- > CA: ADB product support is coming in the next SDK release and is not yet available.
1862
2203
 
1863
- #### `CHILD_RIDER_AVAILABLE_STATES`
2204
+ ***
1864
2205
 
1865
- Dependent Child Rider available in: `AL`, `AK`, `AZ`, `AR`, `CO`, `CT`, `DC`, `DE`, `GA`, `HI`, `ID`, `IL`, `IN`, `IA`, `KS`, `KY`, `LA`, `MD`, `MA`, `MI`, `MN`, `MS`, `MO`, `MT`, `NE`, `NV`, `NH`, `NJ`, `NM`, `NC`, `OH`, `OK`, `OR`, `PA`, `RI`, `SC`, `TN`, `TX`, `UT`, `VA`, `WV`, `WI`
2206
+ ### ADB Rider State Availability
1866
2207
 
1867
- #### `NO_RIDERS_AVAILABLE_STATES`
2208
+ **ADB Rider available in:** AL, AZ, AR, CA*, CO, CT, DC, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MI, MN, MS, MO, MT, NE, NV, NJ, NM, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WV, WI
1868
2209
 
1869
- No riders available in: `WA`
2210
+ **Dependent Child Rider available in:** AL, AK, AZ, AR, CO, CT, DC, DE, GA, HI, ID, IL, IN, IA, KS, KY, LA, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NC, OH, OK, OR, PA, RI, SC, TN, TX, UT, VA, WV, WI
1870
2211
 
1871
- > **Coming in a future release:** `getAvailableRidersForState(stateCode)` - programmatically query rider availability for a given state.
2212
+ **No riders available:** WA
1872
2213
 
1873
2214
  ---
1874
2215
 
1875
2216
  ## Beneficiary Reference
1876
2217
 
1877
- The `beneficiaryDetails` field uses a TypeScript discriminated union. Required fields differ by `beneficiaryType`. TypeScript enforces the correct shape at compile time.
2218
+ `beneficiaryDetails` uses a TypeScript discriminated union keyed on `beneficiaryType`.
1878
2219
 
1879
- ### Variant 1 - No extra fields
1880
2220
 
1881
- Used for `InsuredEstate`, `AllChildrenOfTheInsuredEqually`, `AllChildrenOfTheMarriageEqually`:
2221
+ ***
2222
+
2223
+ ### Variant 1 — No extra fields
1882
2224
 
1883
2225
  ```typescript
1884
- beneficiaryDetails: {
1885
- beneficiaryType: BeneficiaryType.InsuredEstate
1886
- }
2226
+ { beneficiaryType: BeneficiaryType.InsuredEstate }
1887
2227
  ```
1888
2228
 
1889
- ### Variant 2 - Named person
2229
+ Types: `InsuredEstate` · `AllChildrenOfTheInsuredEqually` · `AllChildrenOfTheMarriageEqually`
2230
+
2231
+
2232
+ ***
1890
2233
 
1891
- Used when `beneficiaryType = Person`:
2234
+ ### Variant 2 — Named person
1892
2235
 
1893
2236
  ```typescript
1894
- beneficiaryDetails: {
2237
+ {
1895
2238
  beneficiaryType: BeneficiaryType.Person,
1896
2239
  beneficiaryPerson: {
1897
2240
  firstName: 'Jane',
@@ -1901,586 +2244,248 @@ beneficiaryDetails: {
1901
2244
  }
1902
2245
  ```
1903
2246
 
1904
- ### Variant 3 - Named entity (organization)
1905
2247
 
1906
- Used for `Business`, `Corporation`, `CharitableOrganization`, `Employer`, `Other`, `Trust`:
2248
+ ***
2249
+
2250
+ ### Variant 3 — Named entity
1907
2251
 
1908
2252
  ```typescript
1909
- // Business / Corporation / etc.
1910
- beneficiaryDetails: {
2253
+ // Business, Corporation, Employer, etc.
2254
+ {
1911
2255
  beneficiaryType: BeneficiaryType.Business,
1912
- namedEntity: {
1913
- name: 'Acme Corp',
1914
- taxId: '12-3456789' // optional
1915
- }
2256
+ namedEntity: { name: 'Acme Corp', taxId: '12-3456789' } // taxId optional
1916
2257
  }
1917
2258
 
1918
- // Trust - trustDate is required (format: YYYY-MM)
1919
- beneficiaryDetails: {
2259
+ // Trust — trustDate required (YYYY-MM)
2260
+ {
1920
2261
  beneficiaryType: BeneficiaryType.Trust,
1921
- namedEntity: {
1922
- name: 'Smith Family Trust',
1923
- trustDate: '2020-01' // required for Trust only; format: YYYY-MM
1924
- }
2262
+ namedEntity: { name: 'Smith Family Trust', trustDate: '2020-01' }
1925
2263
  }
1926
2264
  ```
1927
2265
 
2266
+ Named entity types: `Business` · `Corporation` · `CharitableOrganization` · `Employer` · `Other` · `Trust`
2267
+
1928
2268
  ---
1929
2269
 
1930
2270
  ## Error Handling
1931
2271
 
1932
- ### Error class hierarchy
2272
+
2273
+ ***
2274
+
2275
+ ### Error Class Hierarchy
1933
2276
 
1934
2277
  ```
1935
2278
  InstaBrainError
1936
- ├── AuthenticationError (statusCode: 401 - credentials invalid or session expired)
1937
- ├── ValidationError (statusCode: 400 - request-level validation failure)
1938
- └── APIValidationError (statusCode: 400 - API returned flagStatus: false)
2279
+ ├── AuthenticationError — invalid credentials, expired JWT, or unauthorized opportunityId
2280
+ ├── ValidationError — client-side / transport validation before a successful response
2281
+ └── APIValidationError — server returned flagStatus: false (check APIErrorCode)
1939
2282
  ```
1940
2283
 
1941
- ### Field reference
1942
-
1943
-
1944
- | Class | `message` | `statusCode` | `errorCode` | `response` |
1945
- | --------------------- | --------- | ------------ | ----------- | ---------- |
1946
- | `InstaBrainError` | Yes | Yes | Yes | Yes |
1947
- | `AuthenticationError` | Yes | `401` | - | - |
1948
- | `ValidationError` | Yes | `400` | Yes | - |
1949
- | `APIValidationError` | Yes | `400` | Yes | Yes |
1950
2284
 
2285
+ ***
1951
2286
 
1952
2287
  ### Using `APIValidationError`
1953
2288
 
1954
- Thrown when the API returns `flagStatus: false`. Always use `isErrorType(APIErrorCode.X)` for comparison - do **not** compare `errorCode` as a raw string, as the API uses inconsistent casing across error codes.
2289
+ Always use `isErrorType(APIErrorCode.X)` — do **not** compare `errorCode` as a raw string. InstaBrain uses inconsistent casing across codes (see string values below).
1955
2290
 
1956
2291
  ```typescript
1957
- import {
1958
- APIValidationError,
1959
- AuthenticationError,
1960
- InstaBrainError,
1961
- APIErrorCode
1962
- } from '@instabrain-sdks/api-client';
2292
+ import { APIValidationError, AuthenticationError, APIErrorCode } from '@instabrain-sdks/api-client';
1963
2293
 
1964
2294
  try {
1965
- const quoteResp = await client.getGigdbQuote(request);
2295
+ await client.startGigdbApplication(req);
1966
2296
  } catch (err) {
1967
2297
  if (err instanceof APIValidationError) {
1968
- if (err.isErrorType(APIErrorCode.NotAvailableForState)) {
1969
- console.error('Product not available in this state');
1970
- } else if (err.isErrorType(APIErrorCode.AgeNotFound)) {
1971
- console.error('Age is outside the eligible range for this product');
2298
+ if (err.isErrorType(APIErrorCode.ApplicationLimitReached)) {
2299
+ // same SSN/email/phone has a policy within 30 days — do not retry same identifiers
2300
+ } else if (err.isErrorType(APIErrorCode.StateMismatchIdentified)) {
2301
+ // re-quote with the correct state
2302
+ } else if (err.isErrorType(APIErrorCode.AgentNotFound)) {
2303
+ // verify agent credentials / token
1972
2304
  } else {
1973
- // getUserFriendlyMessage() returns a human-readable description
1974
2305
  console.error(err.getUserFriendlyMessage());
2306
+ // inspect err.response.value.fields for per-field messages
1975
2307
  }
1976
2308
  } else if (err instanceof AuthenticationError) {
1977
- console.error('Authentication failed - re-authenticate');
1978
- } else if (err instanceof InstaBrainError) {
1979
- console.error(`SDK error: ${err.message} (status: ${err.statusCode})`);
2309
+ // re-authenticate
1980
2310
  }
1981
2311
  }
1982
2312
  ```
1983
2313
 
1984
- > `**isDeclined: true` is not an error.** It is a response field on `ThirdPartyStartAppResp` and `ThirdPartyAdbStartAppResp`, indicating the application was declined due to knockout criteria. Always check this field in the response - it is never thrown as an exception.
1985
-
1986
- ---
1987
2314
 
1988
- ## APIErrorCode Reference
2315
+ ***
1989
2316
 
1990
- Always use `APIErrorCode` enum members with `err.isErrorType()`. Do not compare `errorCode` as a raw string - the API uses inconsistent casing.
2317
+ ### `BaseResponse<T>` Envelope
1991
2318
 
1992
- > **How error responses work**
1993
- >
1994
- > - **Validation failures** (the common case across all products) return HTTP 400 with `error: "InvalidRequestFormat"` and a `value.fields: { <FieldPath>: ["<message>"] }` map. Detect specific failures by inspecting field-level messages — see the [Field-Level Error Messages](#field-level-error-messages) section below.
1995
- > - **IB Term Quote business errors** return HTTP 400 with one of the codes in the *IB Term Quote Business Errors* table below; `value` is `null` and there is no `fields` map.
1996
- > - **Get-Existing-Quote business error**: `QuoteNotFound` is returned when the opportunity exists but no quote is stored.
1997
- > - **`ApplicationLimitReached`**: ADB / GIGDB Start Application only — same SSN, email, or phone matched a policy generated in the last 30 days. IB Term does NOT use this code.
1998
- > - Codes marked **`@deprecated`** below were returned by older versions of the API. The current API surfaces those failures as field-level messages under `InvalidRequestFormat`. Use the equivalent field-level checks instead. Deprecated codes will remain in the enum until the next major release for backward compatibility.
2319
+ ```typescript
2320
+ interface BaseResponse<T> {
2321
+ flagStatus: boolean; // true = success — unwrapped automatically by the SDK
2322
+ value: T;
2323
+ error: string | null; // top-level error code
2324
+ }
2325
+ ```
1999
2326
 
2000
- ### Universal validation envelope
2327
+ > **`isDeclined: true` is never thrown.** It is returned on the resolved object from `startGigdbApplication()`, `startAdbApplication()`, and `startIBTermApplication()`. Always check it before continuing.
2001
2328
 
2002
- | Enum Member | String Value | Description |
2003
- | ---------------------- | ------------------------ | ---------------------------------------------------------------------------- |
2004
- | `InvalidRequestFormat` | `'InvalidRequestFormat'` | Top-level code for every FluentValidation failure. Inspect `value.fields`. |
2005
2329
 
2006
- ### Quote Business Errors (ADB / GIGDB / IB Term)
2330
+ ***
2007
2331
 
2008
- Returned by the quote endpoints with `value: null` and `flagStatus: false`. IB Term Quote additionally returns `BenefitPeriodNotAvailable` and `CoverageNotAvailable` in the request-validation envelope (`value.fields`). Personal-info validation failures (first name, last name, email, phone format) and rating-input validation failures (rateClass / healthClass / zip) are surfaced as **field-level messages under `InvalidRequestFormat`** — see [Field-Level Error Messages](#field-level-error-messages).
2332
+ ### Field-Level Error Messages
2009
2333
 
2010
- | Enum Member | String Value | Applies to | Description |
2011
- | ------------------------------------ | -------------------------------------- | ---------- | -------------------------------------------------------------------------------------------- |
2012
- | `StateNotFound` | `'stateNotFound'` | All quotes | State code missing, invalid, or not found |
2013
- | `NotAvailableForState` | `'NotAvailableForState'` | All quotes | Product not offered for the selected state |
2014
- | `QuoteNotEligibleForGivenConditions` | `'QuoteNotEligibleForGivenConditions'` | All quotes | Combination of state / age / smoker status not eligible |
2015
- | `CoverageNotAvailable` | `'CoverageNotAvailable'` | All quotes | Face amount not available for the selected state, age, and smoker status |
2016
- | `RiderNotAvailable` | `'RiderNotAvailable'` | ADB | Rider not available for the product or state |
2017
- | `RiderFaceAmountNotValid` | `'RiderFaceAmountNotValid'` | ADB | Rider benefit amount outside the allowed range |
2018
- | `AgeNotFound` | `'AgeNotFound'` | IB Term | Neither `Age` nor `DateOfBirth` supplied |
2019
- | `BenefitPeriodNotAvailable` | `'BenefitPeriodNotAvailable'` | IB Term | Benefit period not allowed for the state + age + smoker combination. Returned as either top-level or via `value.fields`. |
2020
- | `OutsideBuildChart` | `'outsideBuildChart'` | IB Term | Height / weight outside the carrier's build chart |
2021
- | `HeightNotValid` | `'HeightNotValid'` | IB Term | Height / weight value or combination is invalid |
2334
+ Most validation failures return top-level `InvalidRequestFormat`. Per-field details are in `err.response.value.fields` — keys are backend property paths (e.g. `Address.State`, `OpportunityId`, `ChildrenToBeInsuredDetails[0].DOB`).
2022
2335
 
2023
- ### Get Existing Quote
2336
+ This README does **not** duplicate the backend’s full master catalog. Instead, each method documents the messages you are likely to see:
2024
2337
 
2025
- | Enum Member | String Value | Description |
2026
- | --------------- | ----------------- | -------------------------------------------------------------------------- |
2027
- | `QuoteNotFound` | `'QuoteNotFound'` | Returned by ADB / GIGDB / IB Term `get-existing-quote` when no saved quote exists for the opportunity. |
2338
+ | Where to look | What you get |
2339
+ |---|---|
2340
+ | **Request Fields** tables | **Validation Error** column — messages tied to each request field |
2341
+ | **Error Codes** tables (per method + [central `APIErrorCode` reference](#apierrorcode-reference)) | Top-level `APIErrorCode` values when `value` is `null` |
2342
+ | **`ApplicationLimitReached` field-level messages** (GIGDB Start Application) | Example of an explicit field-path → message list for one top-level code |
2028
2343
 
2029
- ### Start Application — duplicate-detection limit
2344
+ ```typescript
2345
+ if (err instanceof APIValidationError && err.isErrorType(APIErrorCode.InvalidRequestFormat)) {
2346
+ const fields = err.response?.value?.fields as Record<string, string[]> | undefined;
2347
+ // e.g. fields?.['OpportunityId'], fields?.['Address.State']
2348
+ }
2349
+ ```
2030
2350
 
2031
- Fires on ADB / GIGDB Start Application when SSN, email, or phone matches a policy generated within the last 30 days. **IB Term does not use this code.**
2351
+ ---
2032
2352
 
2033
- | Enum Member | String Value | Description |
2034
- | ------------------------- | --------------------------- | ------------------------------------------------------------------------------ |
2035
- | `ApplicationLimitReached` | `'ApplicationLimitReached'` | An application with the same SSN, email, or phone has a policy generated within the last 30 days. |
2353
+ ## Error codes (`APIErrorCode`)
2036
2354
 
2037
- ### Start Application — business errors (ADB / GIGDB / IB Term)
2355
+ Active `APIErrorCode` enum members match the tables below. Compare failures with `err.isErrorType(APIErrorCode.X)` — do not rely on raw string casing; use the **String Value** column when logging or debugging.
2038
2356
 
2039
- Returned as top-level codes (HTTP 400, `value: null`) when the request body is well-formed but the application cannot be started. Apply to **all three** Start Application endpoints.
2357
+ Deprecated enum members (`QuoteNotFound`, `HeightNotValid`, `DocumentsNotViewed`, and others) remain in the package for backward compatibility but are **not** listed here; the API surfaces those cases via `InvalidRequestFormat` and `value.fields` instead.
2040
2358
 
2041
- | Enum Member | String Value | Description |
2042
- | ------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------- |
2043
- | `StateMismatchIdentified` | `'StateMismatchIdentified'` | Quote state and `Address.State` on Start App refer to different US states (case-insensitive). Re-quote with the correct residence state. |
2044
- | `AgentNotFound` | `'agentNotFound'` | The quote cannot be linked to an agent account. Verify the agent token. |
2045
- | `InternalServerError` | `'internalServerError'`| Unexpected backend failure. Retry; if it persists, contact InstaBrain support. |
2046
2359
 
2047
- > Knockout and underwriting **decline** are returned as HTTP 200 with `isDeclined: true` in the response body — **not** as top-level error codes.
2360
+ ***
2048
2361
 
2049
- ### Session
2362
+ ### Quote Errors
2050
2363
 
2051
- | Enum Member | String Value | Description |
2052
- | -------------- | ---------------- | ------------------------------------------------------ |
2053
- | `AgentLogout` | `'AgentLogout'` | Agent session expired; re-authenticate |
2054
-
2055
- ### Deprecated codes
2056
-
2057
- The following codes were returned by older API versions and are kept in the enum for backward compatibility. **They are no longer returned by the current API.** Detect the equivalent failures via field-level messages under `InvalidRequestFormat` — see the [Field-Level Error Messages](#field-level-error-messages) section.
2058
-
2059
- | Enum Member (deprecated) | Use this field-level message instead |
2060
- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------- |
2061
- | ~~`InvalidBirthCountry`~~ | `BirthJurisdiction.Country` → "Birth country code is invalid." |
2062
- | ~~`InvalidBirthState`~~ | `BirthJurisdiction.State` → "Birth state code is invalid." |
2063
- | ~~`InvalidResidenceState`~~ | `Address.State` → "Residence state code is invalid." |
2064
- | ~~`OneOfTheExistingCoveragesQuestionsNotFound`~~ | (no longer returned) |
2065
- | ~~`PaymentAlreadyMade`~~ | `OpportunityId` → "Quote update is not allowed when payment is already made." |
2066
- | ~~`ErrorInSaveEftPaymentDetails`~~ | Field-level on EFT request (account holder name / routing / account number) |
2067
- | ~~`InvalidPaymentScheduledDate`~~ | (no longer returned) |
2068
- | ~~`ThirdPartyQuoteError`~~ | (generic legacy code; no longer returned) |
2069
- | ~~`InvalidQuoteParameters`~~ | (generic legacy code; no longer returned) |
2070
- | ~~`InvalidStateCode`~~ | `Address.State` → "Residence state code is invalid." or quote-specific state messages |
2071
- | ~~`InvalidAdbAgeRange`~~ | `DateOfBirth` → "Age must be between 20 and 59 for ADB." |
2072
- | ~~`PaymentNotMade`~~ | `opportunityId` (Final Submit) → "Application has already been final submitted." |
2073
- | ~~`SecureSignRelatedError`~~ | Field-level on Secure Sign endpoint |
2074
- | ~~`SigningPackageNotCreated`~~ | Field-level on Secure Sign endpoint |
2075
- | ~~`SecureSignPinMismatch`~~ | `Pin` → "Pin is required." (Verify PIN endpoint) |
2076
- | ~~`PinExpired`~~ | Field-level on Verify PIN endpoint |
2077
- | ~~`DocumentsNotViewed`~~ | Field-level on Verify PIN endpoint |
2078
- | ~~`DocumentsAlreadySigned`~~ | `OpportunityId` → "Documents are already signed." (Secure Sign endpoints) |
2364
+ | Code | String Value | Products | When |
2365
+ |---|---|---|---|
2366
+ | `InvalidRequestFormat` | `'InvalidRequestFormat'` | All | Any validation failure — inspect `value.fields` |
2367
+ | `StateNotFound` | `'stateNotFound'` | All quotes | State code not recognized |
2368
+ | `AgeNotFound` | `'AgeNotFound'` | All quotes | Neither age nor date of birth supplied, or age could not be derived |
2369
+ | `NotAvailableForState` | `'NotAvailableForState'` | All quotes | Product not available in state |
2370
+ | `QuoteNotEligibleForGivenConditions` | `'QuoteNotEligibleForGivenConditions'` | All quotes | State/age/nicotine combo not eligible |
2371
+ | `CoverageNotAvailable` | `'CoverageNotAvailable'` | All quotes | Face amount out of range |
2372
+ | `RiderNotAvailable` | `'RiderNotAvailable'` | ADB, IB Term | Rider unavailable for product/state |
2373
+ | `RiderFaceAmountNotValid` | `'RiderFaceAmountNotValid'` | ADB, IB Term | Rider face amount out of range |
2374
+ | `BenefitPeriodNotAvailable` | `'BenefitPeriodNotAvailable'` | IB Term | Benefit period not allowed for state/age/nicotine |
2375
+ | `OutsideBuildChart` | `'outsideBuildChart'` | IB Term | Height & weight provided and outside carrier build chart |
2079
2376
 
2080
2377
 
2081
- ---
2378
+ ***
2082
2379
 
2083
- ## Field-Level Error Messages
2380
+ ### Start Application Errors
2084
2381
 
2085
- When the API returns `error: "InvalidRequestFormat"`, inspect `value.fields` (a `Record<string, string[]>`) for per-field messages. The catalog below lists every field path and its exact message text returned by the backend, organized by endpoint family.
2382
+ | Code | String Value | Products | When |
2383
+ |---|---|---|---|
2384
+ | `ApplicationLimitReached` | `'ApplicationLimitReached'` | ADB, GIGDB | Same SSN/email/phone has policy within last 30 days. Not used by IB Term. |
2385
+ | `StateMismatchIdentified` | `'StateMismatchIdentified'` | All | Quote state ≠ application address state — re-quote |
2386
+ | `AgentNotFound` | `'agentNotFound'` | All | Quote cannot be linked to agent account — verify credentials |
2387
+ | `InternalServerError` | `'internalServerError'` | All | Unexpected backend failure — retry; if persistent contact support |
2086
2388
 
2087
- > Use the field paths as map keys. **Case matters** — keys are PascalCase / dotted paths matching the backend DTO property names, not the SDK's camelCase TypeScript field names.
2088
2389
 
2089
- ### Common patterns (used across ADB / GIGDB / IB Term Start Application)
2390
+ ***
2090
2391
 
2091
- | Field path | Message |
2092
- |---|---|
2093
- | `QuoteResponseId` | QuoteResponseId is required. |
2094
- | `QuoteResponseId` | QuoteResponseId does not exist or does not belong to the requested product. |
2095
- | `FirstName` | First name is required. |
2096
- | `FirstName` | First name is invalid. Only alphabetic characters are allowed. |
2097
- | `LastName` | Last name is required. |
2098
- | `LastName` | Last name is invalid. Only alphabetic characters are allowed. |
2099
- | `Email` | Email is required. |
2100
- | `Email` | Please enter a valid email address. |
2101
- | `PhoneNumber` | Phone number is required. |
2102
- | `PhoneNumber` | Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX. |
2103
- | `PhoneNumber` | Phone number is invalid. |
2104
- | `IsPayerAlsoOwnerAndInsured` | IsPayerAlsoOwnerAndInsured field is required. |
2105
- | `DateOfBirth` | Date of birth is required. |
2106
- | `DateOfBirth` | Date of birth must be a valid date in the past. |
2107
- | `SocialSecurityNumber` | Social Security Number is required. |
2108
- | `SocialSecurityNumber` | Social Security Number must be in valid format (e.g., XXX-XX-XXXX). |
2109
- | `Address` | Address is required. |
2110
- | `Address.AddressLine1` | Address line is required. |
2111
- | `Address.AddressLine1` | Street address is invalid. Avoid special characters. |
2112
- | `Address.City` | Address city is required. |
2113
- | `Address.City` | City name is invalid. Only letters and spaces are allowed. |
2114
- | `Address.State` | Residence state is required. |
2115
- | `Address.State` | Residence state code is invalid. |
2116
- | `Address.Zipcode` | Zip code is required. |
2117
- | `Address.Zipcode` | Zip code is invalid. It must be in 5-digit format. |
2118
- | `Address.Zipcode` | Zip code is not found. |
2119
- | `HasExistingCoverage` | Existing coverage field is required |
2120
- | `ExistingCoverageData` | Existing coverage details must be provided when HasExistingCoverage is true. |
2121
- | `ExistingCoverageData` | Existing coverage details must be null when HasExistingCoverage is false. |
2122
- | `ExistingCoverageData.ExistingCoverages` | At least one existing coverage entry is required. |
2123
- | `ExistingCoverageData.IsExistingPolicyBeingTerminated` | Please indicate whether any existing policy is being terminated. |
2124
- | `ExistingCoverageData.ExistingCoverages[n].NameOfTheCompany` | Please provide the name of the insurance company. |
2125
- | `ExistingCoverageData.ExistingCoverages[n].InsuranceAmount` | Insurance amount must be provided. |
2126
- | `ExistingCoverageData.ExistingCoverages[n].DateOfIssue` | Please provide Date of Issue in YYYY-MM format |
2127
- | `ExistingCoverageData.ExistingCoverages[n].DateOfIssue` | Date of issue must be in YYYY-MM format. |
2128
- | `ExistingCoverageData.ExistingCoverages[n].ToBeReplaced` | Replacement coverage answer must be specified. |
2129
- | `ExistingCoverageData.ExistingCoverages[n].ToBeFinanced` | Financing coverage answer must be specified. |
2130
- | `WillOtherCoverageBeReplacedOrFinanced` | Please indicate whether any other coverage will be replaced or financed. |
2131
- | `WillOtherCoverageBeReplacedOrFinanced` | Other Coverage be replaced or financed must be either null or false as no existing coverage passed. |
2132
- | `BeneficiaryDetails` | Beneficiary details are required. |
2133
- | `BeneficiaryDetails.BeneficiaryType` | Please select a valid beneficiary option. |
2134
- | `BeneficiaryDetails.BeneficiaryPerson` | Beneficiary person details must be provided. |
2135
- | `BeneficiaryDetails.BeneficiaryPerson.FirstName` | Beneficiary first name is required. |
2136
- | `BeneficiaryDetails.BeneficiaryPerson.FirstName` | Beneficiary's first name is invalid. |
2137
- | `BeneficiaryDetails.BeneficiaryPerson.LastName` | Beneficiary last name is required. |
2138
- | `BeneficiaryDetails.BeneficiaryPerson.LastName` | Beneficiary's last name is invalid. |
2139
- | `BeneficiaryDetails.BeneficiaryPerson.Relationship` | Please specify the relationship with the beneficiary. |
2140
- | `BeneficiaryDetails.NamedEntity` | Named entity details must be provided for this beneficiary type. |
2141
- | `BeneficiaryDetails.NamedEntity.Name` | Beneficiary name is required. |
2142
- | `BeneficiaryDetails.NamedEntity.TrustDate` | Trust date must be in YYYY-MM format. |
2143
- | `IsUsCitizen` | US citizenship status is required. |
2144
- | `IsLegalUsResident` | Legal US residency status is required for non-US citizens. |
2145
- | `Email` *(top-level on Start App; ADB / GIGDB only)* | `error: "ApplicationLimitReached"` → "An application with the same email has a policy generated within the last 30 days." |
2146
- | `PhoneNumber` *(top-level on Start App; ADB / GIGDB only)* | `error: "ApplicationLimitReached"` → "Two applications with the same phone have policies generated within the last 30 days." |
2147
- | `SocialSecurityNumber` *(top-level on Start App; ADB / GIGDB only)* | `error: "ApplicationLimitReached"` → "An application with the same SSN has a policy generated within the last 30 days." |
2148
-
2149
- ### ADB — additional messages
2150
-
2151
- | Field path | Message |
2152
- |---|---|
2153
- | `DateOfBirth` | Age must be between 20 and 59 for ADB. |
2154
- | `Address.State` | This state is currently not supported. |
2155
- | `Address.State` | This product is not available for the selected state. |
2156
- | `Occupation` | At least one occupation is required when residence state is CA. |
2157
- | `Occupation` | One or more selected occupations are invalid. |
2158
- | `HasMedicalCoverage` | Medical coverage acknowledgement is required when residence state is DC. |
2159
- | `UnderstandsBenefits` | Supplemental policy benefits acknowledgement is required when residence state is DC. |
2160
- | `UnderstandsLimitedBenefits` | Limited benefits acknowledgement is required when residence state is DC. |
2161
- | `ExistingCoverageData.ExistingCoverages[n].NotifyPresentInsurer` | Notify present insurer response is required for Oklahoma when existing coverage is provided. |
2162
- | `ExistingCoverageData.ExistingCoverages[n].WantsComparativeInformationForm` | Comparative information form preference is required for Florida when existing coverage is provided. |
2163
- | `ExistingCoverageData.ExistingCoverages[n].WantsPolicySummary` | Policy summary preference is required for Delaware when existing coverage is provided. |
2164
-
2165
- ### ADB — Update Quote / Get Existing Quote
2166
-
2167
- | Field path | Message |
2168
- |---|---|
2169
- | `OpportunityId` | OpportunityId is required. |
2170
- | `OpportunityId` | OpportunityId does not exist. |
2171
- | `OpportunityId` | OpportunityId does not match selected product. |
2172
- | `OpportunityId` | Quote update is not allowed when payment is already made. |
2173
- | `FaceAmount` | Coverage amount (FaceAmount) is required. |
2174
- | `PaymentFreq` | Payment frequency is required. |
2175
- | `PaymentFreq` | Invalid payment frequency. |
2176
- | `Riders` | Riders are required. *(Update Quote only)* |
2177
- | `Riders` | Riders are invalid. |
2178
-
2179
- ### GIGDB — additional messages
2180
-
2181
- | Field path | Message |
2182
- |---|---|
2183
- | `DateOfBirth` | Age must be between 50 and 85 for GIGDB. |
2184
- | `Address.State` | This state is currently not supported. |
2185
- | `Address.State` | This product is not available for the selected state. |
2186
- | `IsSmoker` | Smoker status is required. |
2187
- | `NicotineInfo` | Nicotine details are required when applicant is a smoker. |
2188
- | `NicotineInfo.LastUseDate` | Last nicotine use date is required when applicant is a smoker. |
2189
- | `NicotineInfo.LastUseDate` | Nicotine last use date must be in YYYY-MM format. |
2190
- | `BirthJurisdiction` | Birth jurisdiction details are required. |
2191
- | `BirthJurisdiction.Country` | Birth country is required when applicant is not a U.S. citizen. |
2192
- | `BirthJurisdiction.Country` | Birth country code is invalid. |
2193
- | `BirthJurisdiction.State` | Birth state is required when applicant is a U.S. citizen. |
2194
- | `BirthJurisdiction.State` | Birth state code is invalid. |
2195
- | `ExistingCoverageData.AreExistingPoliciesIssuedByFidelity` | Please indicate whether any existing policies are issued by Fidelity Life Association (required for RI and WV). |
2196
- | `ExistingCoverageData.ExistingCoverages[n].RequestsYieldIndices` | Please indicate whether yield indices for cash value policies are requested (required for Massachusetts). |
2197
- | `ExistingCoverageData.ExistingCoverages[n].NotifyPresentInsurer` | Please indicate whether to notify present insurer(s) (required for Oklahoma). |
2198
- | `ExistingCoverageData.ExistingCoverages[n].WantsPolicySummary` | Please indicate whether you want a policy summary statement (required for Delaware and Georgia). |
2199
- | `ExistingCoverageData.ExistingCoverages[n].WantsComparativeInformationForm` | Please indicate whether you want a Comparative Information Form (required for Florida). |
2200
- | `WillOtherCoverageBeReplacedOrFinancedData` | State-specific replacement data is required when other coverage will be replaced or financed. |
2201
- | `WillOtherCoverageBeReplacedOrFinancedData.AreReplacedPoliciesIssuedByFidelity` | Please indicate whether any policies being replaced are issued by Fidelity Life Association (required for Kansas when replacing or financing coverage). |
2202
- | `WillOtherCoverageBeReplacedOrFinancedData.OtherInsuranceReplacementData` | Washington replacement disclosure answers are required when replacing or financing coverage. |
2203
- | `WillOtherCoverageBeReplacedOrFinancedData.OtherInsuranceReplacementData[n]` | Each Washington replacement disclosure question must be answered. |
2204
- | `WillOtherCoverageBeReplacedOrFinancedData.OtherInsuranceReplacementData[n].Explain` | Please explain is required when the answer is Yes. |
2205
-
2206
- ### GIGDB — Update Quote / Get Existing Quote
2207
-
2208
- | Field path | Message |
2209
- |---|---|
2210
- | `OpportunityId` | OpportunityId is required. |
2211
- | `OpportunityId` | OpportunityId does not exist. |
2212
- | `OpportunityId` | OpportunityId does not match selected product. |
2213
- | `OpportunityId` | Quote update is not allowed when payment is already made. |
2214
- | `FaceAmount` | Coverage amount (FaceAmount) is required. |
2215
- | `PaymentFreq` | Payment frequency is required. |
2216
- | `PaymentFreq` | Invalid payment frequency. |
2392
+ ### Payment & quote update errors
2217
2393
 
2218
- ### IB Term — Start Application additional messages
2394
+ | Code | String Value | Products | When |
2395
+ |---|---|---|---|
2396
+ | `PaymentAlreadyMade` | `'PaymentAlreadyMade'` | ADB, GIGDB | `update*Quote()` or `saveEftPayment()` after EFT is already saved for the opportunity |
2219
2397
 
2220
- > **Progressive disclosure note:** for IB Term, the following common-pattern "is required" messages above no longer fire (the parent field is optional under progressive disclosure): `DateOfBirth`, `SocialSecurityNumber`, `Address`, `Address.*`, `BirthJurisdiction.*`, `HasExistingCoverage`, `BeneficiaryDetails`, `TobaccoNicotineUsage`. The format / sub-field validators below still apply when the parent block is sent.
2221
2398
 
2222
- | Field path | Message |
2223
- |---|---|
2224
- | `DateOfBirth` | Age must be between 18 and 60 for IB Term. |
2225
- | `QuoteResponseId` | Child rider was not included in the quote. Cannot add child rider details. |
2226
- | `ChildRiderInfo` | Child rider details are required because Dependent Child Rider is selected in the quote. |
2227
- | `AreListedConditionsNotApplicable` | AreListedConditionsNotApplicable is required. |
2228
- | `IsUsCitizenOrIsPermanentResident` | US citizenship or permanent residency status is required. |
2229
- | `Height` | Height is required. |
2230
- | `Height.Feet` | Height feet is required. |
2231
- | `Height.Feet` | Height feet must be between 1 and 8. |
2232
- | `Height.Inches` | Height inches is required. |
2233
- | `Height.Inches` | Height inches must be between 0 and 11. |
2234
- | `Weight` | Weight is required. |
2235
- | `Weight` | Weight must be greater than 0. |
2236
- | `IsHoldingValidDriverLicense` | IsHoldingValidDriverLicense is required. |
2237
- | `DriverLicenseState` | Driver license state code is invalid. *(Returned only when sent — driver license fields are independent of `IsHoldingValidDriverLicense`.)* |
2238
- | `DriverLicenseNumber` | Driver license number format is invalid for the selected driver license state. *(Returned only when both fields are sent — driver license fields are independent of `IsHoldingValidDriverLicense`.)* |
2239
- | `BirthJurisdiction.Country` | Birth jurisdiction country is required (when `BirthJurisdiction` is sent). |
2240
- | `BirthJurisdiction.State` | Birth jurisdiction state is required when birth country is US. |
2241
- | `BirthJurisdiction.State` | Birth state code is invalid. |
2242
- | `PhysicianDetails` | Physician details are required when HasPrimaryCarePhysician is true. |
2243
- | `PhysicianDetails` | Physician details must be null when HasPrimaryCarePhysician is false. |
2244
- | `PhysicianDetails.PhysicianName` | Physician name is required when HasPrimaryCarePhysician is true. |
2245
- | `PhysicianDetails.City` | Physician city/address is required when HasPrimaryCarePhysician is true. |
2246
- | `PhysicianDetails.StateCode` | Physician state is required when HasPrimaryCarePhysician is true. |
2247
- | `PhysicianDetails.StateCode` | Outside Of The USA is not allowed for physician state. |
2248
- | `PhysicianDetails.StateCode` | Physician state code is invalid. |
2249
- | `PhysicianDetails.LastSeen` | Physician last-seen date is required when HasPrimaryCarePhysician is true. |
2250
- | `PhysicianDetails.LastSeen` | Physician last-seen date must be in YYYY-MM format (year-month only, e.g. 2025-04; not 2025/04) and must not be after the current month. *(Current month is allowed; only future months are rejected — relaxed.)* |
2251
- | `TobaccoNicotineUsage.LastUsedPeriod` | Last used period is required *(when `TobaccoNicotineUsage` is sent)*. |
2252
- | `TobaccoNicotineUsage.LastUsedPeriod` | Last used period must be one of: *(allowed values)*. |
2253
- | `TobaccoNicotineUsage.LastTimeUsed` | Last time used tobacco/nicotine date is required. |
2254
- | `TobaccoNicotineUsage.LastTimeUsed` | Last time used tobacco/nicotine date must be in YYYY-MM format. |
2255
- | `TobaccoNicotineUsage.ProductTypesUsed` | At least one tobacco or nicotine product type must be selected. |
2256
- | `TobaccoNicotineUsage.ProductTypesUsed` | Each product type must be one of: *(allowed values)*. |
2257
- | `TobaccoNicotineUsage.CigarUsagePerYear` | Number of times cigars are smoked per year is required when Cigars is selected (i.e. when `ProductTypesUsed` includes `Cigars`). |
2258
- | `TobaccoNicotineUsage.CigarUsagePerYear` | Cigar usage per year must be greater than 0. |
2259
- | `TobaccoNicotineUsage.CigarUsagePerYear` | Cigar usage per year must be less than or equal to 999. |
2260
-
2261
- IB Term shares the state-specific Q-08 messages (MA / OK / DE / GA / FL / RI / WV / KS / WA) with GIGDB — see the GIGDB table above; the field paths are identical.
2262
-
2263
- ### IB Term — Child Rider
2264
-
2265
- | Field path | Message |
2266
- |---|---|
2267
- | `ChildRiderInfo.IsAnyChildTakingMedication` | Child medication knockout question is required. |
2268
- | `ChildRiderInfo.IsAnyChildDiagnosedWithDisability` | Child disability knockout question is required. |
2269
- | `ChildRiderInfo.IsAnyChildDiagnosedWithSevereCondition` | Child severe condition knockout question is required. |
2270
- | `ChildRiderInfo.IsAnyChildAdvisedForSurgery` | Child surgery knockout question is required. |
2271
- | `ChildRiderInfo.ChildrenToBeInsuredDetails` | Maximum 10 children to be insured details allowed. |
2272
- | `ChildRiderInfo.ExistingCoverageInfoForChildren` | Existing coverage details required when HasExistingCoverageForChildren is true. |
2273
- | `ChildRiderInfo.ExistingCoverageInfoForChildren` | Maximum 10 child existing coverage entries allowed. |
2274
- | `ChildRiderInfo.ExistingCoverageInfoForChildren` | Total insurance amount for child coverages marked as not replacing existing policies must not exceed 100000. |
2275
- | `ChildRiderInfo.ExistingCoverageInfoForChildren` | Existing coverage details must be empty when HasExistingCoverageForChildren is false. |
2276
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].FirstName` | Child first name is required. |
2277
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].FirstName` | Invalid child first name. |
2278
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].LastName` | Child last name is required. |
2279
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].LastName` | Invalid child last name. |
2280
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Gender` | Child gender is required. |
2281
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Gender` | Gender must be Male or Female. |
2282
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Height` | Child height is required. |
2283
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Height.Feet` | Child height feet is required. |
2284
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Height.Feet` | Child height feet must be between 0 and 8. |
2285
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Height.Inches` | Child height inches is required. |
2286
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Height.Inches` | Child height inches must be between 0 and 11. |
2287
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Weight` | Child weight is required. |
2288
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Weight` | Child weight must be greater than 0. |
2289
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].DOB` | Child date of birth is required. |
2290
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].DOB` | Child date of birth must be in the past. |
2291
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].DOB` | Child must be between 15 days and under 18 years old. |
2292
- | `ChildRiderInfo.ChildrenToBeInsuredDetails[n].Relation` | Child relationship is required. |
2293
- | `ChildRiderInfo.ExistingCoverageInfoForChildren[n].NameOfTheCompany` | Name of the company is required for child existing coverage. |
2294
- | `ChildRiderInfo.ExistingCoverageInfoForChildren[n].InsuranceAmount` | Insurance amount is required for child existing coverage. |
2295
- | `ChildRiderInfo.ExistingCoverageInfoForChildren[n].InsuranceAmount` | Insurance amount must be a positive number. |
2296
- | `ChildRiderInfo.ExistingCoverageInfoForChildren[n].PolicyNumber` | Policy number is required for child existing coverage. |
2297
- | `ChildRiderInfo.ExistingCoverageInfoForChildren[n].DateOfIssue` | Date of issue is required for child existing coverage. |
2298
-
2299
- ## IB Term Start Application — Field-to-Question Mapping
2300
-
2301
- The table below maps every request field on `startIBTermApplication()` to the underwriting question or disclosure it answers, and to the API-level purpose / data shape of the field. The **Question** column is the regulated wording the applicant must see — integrators should display this exact text (or a close adaptation that preserves meaning) in their applicant-facing UI to satisfy state insurance disclosure rules. The **Purpose** column describes what the field represents on the API contract (data type, allowed values, role in the request). Fields with no applicant-facing question (data captures like name / address / IDs) show `—` in the Question column. Source: `IBTermStartApplicationDocs.md` § "Field to Question Mapping".
2302
-
2303
- > See the `IBTermStartApplicationReq` reference table above for the always-required vs optional split; this table additionally maps the *meaning* of each field.
2304
-
2305
- | API Field | Question | Purpose | When Required |
2306
- |---|---|---|---|
2307
- | `quoteResponseId` | — | Links the application to a previously generated quote. | Always required. |
2308
- | `firstName` | — | First name of the proposed insured. | Always required. |
2309
- | `lastName` | — | Last name of the proposed insured. | Always required. |
2310
- | `email` | — | Email address of the proposed insured. | Always required. |
2311
- | `phoneNumber` | — | Phone number of the proposed insured. | Always required. |
2312
- | `isUsCitizenOrIsPermanentResident` | Are you a US citizen or lawful permanent resident who has resided in the US for more than 2 years? | Citizenship / residency knockout flag. | Always required. `false` results in a decline. |
2313
- | `isPayerAlsoOwnerAndInsured` | Are you the insured, owner, and payor of this policy? | Confirms applicant role — the payer must also be the owner and the insured. | Always required. `false` results in a decline. |
2314
- | `height.feet` | — | Height — feet component (1–8). | Always required. |
2315
- | `height.inches` | — | Height — inches component (0–11). | Always required. |
2316
- | `weight` | — | Weight in pounds (must be > 0). | Always required. |
2317
- | `areListedConditionsNotApplicable` | By checking the box I confirm the conditions listed are not applicable and able to proceed with the application. | Single-boolean health / legal-history knockout disclosure covering the full conditions list (see "Applicant Disclosure" section above). | Always required. `false` results in a decline. |
2318
- | `isHoldingValidDriverLicense` | Do you hold a valid driver's license? | Driver license attestation knockout flag. | Always required. `false` results in a decline. |
2319
- | `driverLicenseState` | — | State that issued the driver's license (2-letter US state). | Optional. Validated when sent. |
2320
- | `driverLicenseNumber` | — | Driver's license number; format validated against `driverLicenseState`. | Optional. Validated when sent with `driverLicenseState`. |
2321
- | `dateOfBirth` | — | Date of birth of the proposed insured. | Optional. When sent, age must be 18–60. |
2322
- | `socialSecurityNumber` | — | Social security number of the proposed insured (9 digits, no dashes). | Optional. |
2323
- | `address.addressLine1` | — | Street address line 1. | When `address` is sent. |
2324
- | `address.city` | — | City. | When `address` is sent. |
2325
- | `address.state` | — | State of residence (must match the quote state). | When `address` is sent. |
2326
- | `address.zipcode` | — | 5-digit US zip code. | When `address` is sent. |
2327
- | `birthJurisdiction.country` | — | Country of birth (ISO country code). | When `birthJurisdiction` is sent. |
2328
- | `birthJurisdiction.state` | — | State of birth (US state selection). | When `birthJurisdiction.country` is `"US"`. |
2329
- | `tobaccoNicotineUsage.lastUsedPeriod` | When did you last use tobacco or nicotine products? | Usage-period bucket: `"never used"`, `"within the last 12 months"`, `"12 to 23 months"`, `"24 to 35 months"`, `"36 months or greater"`. | When `tobaccoNicotineUsage` is sent. |
2330
- | `tobaccoNicotineUsage.productTypesUsed` | Which tobacco or nicotine products have you used? | Array of product-type strings. | When `tobaccoNicotineUsage` is sent and `lastUsedPeriod` is not `"never used"`. |
2331
- | `tobaccoNicotineUsage.lastTimeUsed` | When was the most recent time you used tobacco or nicotine? | Year-month (`YYYY-MM`) of last use. | When `tobaccoNicotineUsage` is sent and `lastUsedPeriod` is not `"never used"`. |
2332
- | `tobaccoNicotineUsage.cigarUsagePerYear` | How many cigars do you smoke per year? | Integer 1–999. | When `productTypesUsed` contains cigars only. |
2333
- | `hasPrimaryCarePhysician` | Do you have a primary care physician? | Yes/no flag; when `true`, supply `physicianDetails`. | Optional. |
2334
- | `physicianDetails.physicianName` | What is the name of your primary care physician? | Physician name string. | When `hasPrimaryCarePhysician` is `true`. |
2335
- | `physicianDetails.city` | In which city does your physician practice? | Physician city string. | When `hasPrimaryCarePhysician` is `true`. |
2336
- | `physicianDetails.stateCode` | In which state does your physician practice? | 2-letter US state (`"Outside Of The USA"` is rejected). | When `hasPrimaryCarePhysician` is `true`. |
2337
- | `physicianDetails.lastSeen` | When did you last see your physician? | Year-month (`YYYY-MM`); current month or earlier. | When `hasPrimaryCarePhysician` is `true`. |
2338
- | `beneficiaryDetails.beneficiaryType` | Who is your primary beneficiary? | Type of primary beneficiary. Must be one of the IB Term-specific values: `"Person"`, `"Trust"`, `"Insured Estate"`, `"All Children Of The Insured Equally"`, `"All Children Of The Marriage Equally"`. | When `beneficiaryDetails` is sent. |
2339
- | `beneficiaryDetails.beneficiaryPerson.firstName` | What is your beneficiary's first name? | Beneficiary's first name. | Required when `beneficiaryType` is `"Person"`. |
2340
- | `beneficiaryDetails.beneficiaryPerson.lastName` | What is your beneficiary's last name? | Beneficiary's last name. | Required when `beneficiaryType` is `"Person"`. |
2341
- | `beneficiaryDetails.beneficiaryPerson.relationship` | What is your relationship to the beneficiary? | Beneficiary's relationship to the insured. | Required when `beneficiaryType` is `"Person"`. |
2342
- | `beneficiaryDetails.namedEntity.name` | What is the name of the trust or estate? | Name of the trust or estate. | Required when `beneficiaryType` is `"Trust"`. |
2343
- | `beneficiaryDetails.namedEntity.trustDate` | When was the trust established? | Year-month (`YYYY-MM`) of trust formation. | Optional. |
2344
- | `beneficiaryDetails.namedEntity.taxId` | What is the trust's tax ID? | Tax identifier for the trust. | Optional. |
2345
- | `hasExistingCoverage` | Do you have any existing life insurance or annuity contracts in force? | Triggers the existing-coverage replacement-disclosure block. | When sent as `true` or `false`. |
2346
- | `existingCoverageData.isExistingPolicyBeingTerminated` | Are you considering terminating an existing policy? | Yes/no flag per state replacement-disclosure rules. | Required when `hasExistingCoverage` is `true`. |
2347
- | `existingCoverageData.areExistingPoliciesIssuedByFidelity` | Are any of your existing policies issued by Fidelity Life Association? | RI / WV-specific disclosure flag. | Required for RI and WV. |
2348
- | `existingCoverageData.existingCoverages[].nameOfTheCompany` | What is the name of the insurance company for this existing coverage? | Per-policy insurer name. | Required per existing coverage entry. |
2349
- | `existingCoverageData.existingCoverages[].insuranceAmount` | What is the coverage amount of this existing policy? | Per-policy face amount (string). | Required per existing coverage entry. |
2350
- | `existingCoverageData.existingCoverages[].dateOfIssue` | When was this existing policy issued? | Year-month (`YYYY-MM`) of policy issuance. | Required per existing coverage entry. |
2351
- | `existingCoverageData.existingCoverages[].toBeReplaced` | Will this existing policy be replaced? | Per-policy replacement flag. | Required per existing coverage entry. |
2352
- | `existingCoverageData.existingCoverages[].toBeFinanced` | Will funds from this policy be used to pay premiums on the new policy? | Per-policy financing flag. | Required per existing coverage entry. |
2353
- | `existingCoverageData.existingCoverages[].requestsYieldIndices` | Would you like to request yield indices for cash value policies? | MA-only per-policy disclosure flag. | Required for MA only. |
2354
- | `existingCoverageData.existingCoverages[].notifyPresentInsurer` | Should we notify your present insurer(s) regarding this transaction? | OK-only per-policy disclosure flag. | Required for OK only. |
2355
- | `existingCoverageData.existingCoverages[].wantsPolicySummary` | Do you want a policy summary statement from your existing insurer? | DE / GA-only per-policy disclosure flag. | Required for DE and GA only. |
2356
- | `existingCoverageData.existingCoverages[].wantsComparativeInformationForm` | Do you wish to receive a Comparative Information Form? | FL-only per-policy disclosure flag. | Required for FL only. |
2357
- | `willOtherCoverageBeReplacedOrFinanced` | Will any existing coverage be cancelled, lapsed, or financed as part of this application? | Top-level replacement question; when `true`, supply the `willOtherCoverageBeReplacedOrFinancedData` block. | Required when `hasExistingCoverage` is `true`. |
2358
- | `willOtherCoverageBeReplacedOrFinancedData.areReplacedPoliciesIssuedByFidelity` | Are any of the policies being replaced issued by Fidelity Life Association? | KS-specific disclosure flag. | Required for KS when replacing or financing. |
2359
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.mayReduceBenefitsIncreasePremiums` | Can there be reduced benefits or increased premiums in later years? | WA adverse-effect disclosure flag. | Required for WA when replacing or financing. |
2360
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyReduceBenefitsIncreasePremiums` | If yes, please explain. | Free-text explanation when the preceding boolean is `true`. | Required when the corresponding boolean is `true`. |
2361
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasNewPolicyCharges` | Are there penalties or surrender charges for the new policy? | WA adverse-effect disclosure flag. | Required for WA when replacing or financing. |
2362
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyNewPolicyCharges` | If yes, please explain (emphasising early-withdrawal costs). | Free-text explanation when the preceding boolean is `true`. | Required when the corresponding boolean is `true`. |
2363
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasPriorPolicyCharges` | Will there be penalties or surrender charges under the existing insurance? | WA adverse-effect disclosure flag. | Required for WA when replacing or financing. |
2364
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyPriorPolicyCharges` | If yes, please explain. | Free-text explanation when the preceding boolean is `true`. | Required when the corresponding boolean is `true`. |
2365
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasTaxConsequences` | Are there adverse tax consequences from the replacement? | WA adverse-effect disclosure flag. | Required for WA when replacing or financing. |
2366
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyTaxConsequences` | If yes, please explain. | Free-text explanation when the preceding boolean is `true`. | Required when the corresponding boolean is `true`. |
2367
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasInterestConsiderations` | Are interest earnings a consideration in this replacement? | WA adverse-effect disclosure flag. | Required for WA when replacing or financing. |
2368
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyInterestConsiderations` | If yes, please explain which portions of premiums will produce limited or no earnings. | Free-text explanation when the preceding boolean is `true`. | Required when the corresponding boolean is `true`. |
2369
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasMinRequirementsBeforeInterest` | Are minimum amounts required before excess interest will be paid? | WA adverse-effect disclosure flag. | Required for WA when replacing or financing. |
2370
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyMinRequirementsBeforeInterest` | If yes, please explain. | Free-text explanation when the preceding boolean is `true`. | Required when the corresponding boolean is `true`. |
2371
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasOtherAdverseEffects` | Are there other short or long-term effects that might be materially adverse? | WA adverse-effect disclosure flag. | Required for WA when replacing or financing. |
2372
- | `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyOtherAdverseEffects` | If yes, please explain. | Free-text explanation when the preceding boolean is `true`. | Required when the corresponding boolean is `true`. |
2373
- | `childRiderInfo.isAnyChildDiagnosedWithDisability` | Has any Proposed Child (Children) to be Insured been diagnosed with or treated by a Physician for any physical or mental disability? | Child rider health knockout. | Required when child rider is on the quote. `true` declines. |
2374
- | `childRiderInfo.isAnyChildDiagnosedWithSevereCondition` | Has any Proposed Child (Children) to be Insured ever been diagnosed with or treated by a physician for any disorder of the heart, lung or for cancer? | Child rider health knockout. | Required when child rider is on the quote. `true` declines. |
2375
- | `childRiderInfo.isAnyChildTakingMedication` | Is any Proposed Child (Children) to be Insured now taking medication, by prescription or over the counter (OTC), or undergoing treatment or therapy of any kind by a member of the medical profession? | Child rider health knockout. | Required when child rider is on the quote. `true` declines. |
2376
- | `childRiderInfo.isAnyChildAdvisedForSurgery` | Within the last 5 years, has any Proposed Child (Children) to be Insured been advised by a member of the medical profession to have any surgery or hospitalization which has not yet been completed? | Child rider health knockout. | Required when child rider is on the quote. `true` declines. |
2377
- | `childRiderInfo.childrenToBeInsuredDetails[].firstName` | — | Child's first name. | Required per child when that child entry is sent. |
2378
- | `childRiderInfo.childrenToBeInsuredDetails[].lastName` | — | Child's last name. | Required per child when that child entry is sent. |
2379
- | `childRiderInfo.childrenToBeInsuredDetails[].gender` | — | Child's gender (`Male` / `Female` or integer 1 / 2). | Required per child when that child entry is sent. |
2380
- | `childRiderInfo.childrenToBeInsuredDetails[].height.feet` | — | Child's height — feet component. | Required per child when that child entry is sent. |
2381
- | `childRiderInfo.childrenToBeInsuredDetails[].height.inches` | — | Child's height — inches component. | Required per child when that child entry is sent. |
2382
- | `childRiderInfo.childrenToBeInsuredDetails[].weight` | — | Child's weight in pounds. | Required per child when that child entry is sent. |
2383
- | `childRiderInfo.childrenToBeInsuredDetails[].dob` | — | Child's date of birth (15 days – under 18 years). | Required per child when that child entry is sent. |
2384
- | `childRiderInfo.childrenToBeInsuredDetails[].relation` | — | Child's relationship to the proposed insured. | Required per child when that child entry is sent. |
2385
- | `childRiderInfo.existingCoverageInfoForChildren[].nameOfTheCompany` | — | Name of the company holding the child's existing coverage. | Required per child existing coverage entry when `hasExistingCoverageForChildren` is `true`. |
2386
- | `childRiderInfo.existingCoverageInfoForChildren[].policyNumber` | — | Policy number of the child's existing coverage. | Required per child existing coverage entry. |
2387
- | `childRiderInfo.existingCoverageInfoForChildren[].insuranceAmount` | — | Insurance amount of the child's existing coverage (string). | Required per child existing coverage entry. |
2388
- | `childRiderInfo.existingCoverageInfoForChildren[].dateOfIssue` | — | Year-month (`YYYY-MM`) of policy issuance. | Required per child existing coverage entry. |
2389
- | `childRiderInfo.existingCoverageInfoForChildren[].toBeReplaced` | Will the child's existing policy be replaced? | Per-policy replacement flag. | Required per child existing coverage entry. |
2390
- | `childRiderInfo.existingCoverageInfoForChildren[].toBeFinanced` | Will funds from the child's existing policy be used to pay premiums? | Per-policy financing flag. | Required per child existing coverage entry. |
2391
-
2392
- ### Shared APIs — EFT Payment
2393
-
2394
- `POST /api/ThirdPartyPayment/save-eft-payment`
2395
-
2396
- | Field path | Message |
2397
- |---|---|
2398
- | `OpportunityId` | OpportunityId is required. |
2399
- | `AccountHolderName` | Account holder name is required. |
2400
- | `AccountHolderName` | Account holder name must be 100 characters or fewer. |
2401
- | `RoutingNumber` | Routing number is required. |
2402
- | `RoutingNumber` | Routing number must be 9 digits. |
2403
- | `AccountNumber` | Account number is required. |
2404
- | `AccountNumber` | Account number must be 4 to 17 digits. |
2399
+ ***
2405
2400
 
2406
- ### Shared APIs — Secure Sign (Prepare / Send PIN / Resend PIN / Verify PIN)
2401
+ ### Secure Sign Errors
2407
2402
 
2408
- | Field path | Message | Endpoints |
2409
- |---|---|---|
2410
- | `OpportunityId` | OpportunityId is required. | All four |
2411
- | `OpportunityId` | OpportunityId does not exist. | All four |
2412
- | `OpportunityId` | Documents are already signed. | All four (terminal state — do not retry) |
2413
- | `FlagSendSms` | FlagSendSms is required. | Send PIN, Resend PIN |
2414
- | `FlagSendEmail` | FlagSendEmail is required. | Send PIN, Resend PIN |
2415
- | `FlagSendSms` / `FlagSendEmail` | At least one delivery channel (SMS or Email) must be selected. | Send PIN, Resend PIN |
2416
- | `FlagSendSms` / `FlagSendEmail` | Only one delivery channel can be selected at a time. | Send PIN, Resend PIN |
2417
- | `Pin` | Pin is required. | Verify PIN |
2418
- | `IsScriptReadConfirmed` | IsScriptReadConfirmed is required. | Verify PIN |
2419
- | `IsScriptReadConfirmed` | IsScriptReadConfirmed must be true. | Verify PIN |
2420
-
2421
- ### Shared APIs — Final Submit
2422
-
2423
- `POST /api/ThirdPartyApplication/final-submit`
2424
-
2425
- | Field path | Message |
2426
- |---|---|
2427
- | `opportunityId` | OpportunityId is required. |
2428
- | `opportunityId` | OpportunityId does not exist. |
2429
- | `opportunityId` | Application has already been final submitted. *(terminal state — do not retry)* |
2403
+ | Code | String Value | Client methods | When |
2404
+ |---|---|---|---|
2405
+ | `SecureSignRelatedError` | `'SecureSignRelatedError'` | `prepareDocsAndGetDeliveryChannels`, `sendPinAndGetDocumentsLink`, `resendPin`, `verifyPin` | Generic SecureSign failure — retry; if persistent, contact support |
2406
+ | `SigningPackageNotCreated` | `'SigningPackageNotCreated'` | `sendPinAndGetDocumentsLink`, `resendPin`, `verifyPin` | Signing package missing — call `prepareDocsAndGetDeliveryChannels()` first |
2407
+ | `SecureSignPinMismatch` | `'SecureSignPinMismatch'` | `verifyPin` | Wrong PIN entered by applicant |
2408
+ | `PinExpired` | `'PinExpired'` | `verifyPin`, `sendPinAndGetDocumentsLink` | PIN validity window exceeded — call `resendPin()` |
2409
+ | `DocumentsAlreadySigned` | `'DocumentsAlreadySigned'` | `verifyPin`, `sendPinAndGetDocumentsLink`, `resendPin` | Documents already completed |
2410
+ | `InvalidPhoneNumber` | `'InvalidPhoneNumber'` | `sendPinAndGetDocumentsLink`, `resendPin` | Phone number invalid for SMS delivery |
2411
+ | `EmailDeliveryFailed` | `'EmailDeliveryFailed'` | `sendPinAndGetDocumentsLink`, `resendPin` | Email delivery failed — retry or switch to SMS |
2412
+ | `MessageNotDelivered` | `'MessageNotDelivered'` | `sendPinAndGetDocumentsLink`, `resendPin` | SMS delivery failed — retry or switch to email |
2430
2413
 
2431
- > **Authorization** (Secure Sign + Final Submit): HTTP `403` when the `opportunityId` is not authorized for the agent token. This is enforced by middleware and not captured in the `error` / `value.fields` envelope.
2432
2414
 
2415
+ ***
2433
2416
 
2434
- ---
2417
+ ### Final Submit Errors
2435
2418
 
2436
- ## Environment Configuration
2419
+ | Code | String Value | When |
2420
+ |---|---|---|
2421
+ | `PaymentNotMade` | `'paymentNotMade'` | EFT not saved — call `saveEftPayment()` before `finalSubmit()` |
2422
+ | `FidelityFinalSubmitError` | `'FidelityFinalSubmitError'` | Fidelity carrier rejected or failed to process the submission — contact support with the `opportunityId` |
2437
2423
 
2438
- Pass `'sandbox'` or `'production'` to `InstaBrainClient.forEnvironment()`. The SDK handles all routing internally.
2439
2424
 
2440
- ```typescript
2441
- // Sandbox - for development and testing
2442
- const client = InstaBrainClient.forEnvironment('sandbox');
2425
+ ***
2443
2426
 
2444
- // Production
2445
- const client = InstaBrainClient.forEnvironment('production');
2446
- ```
2427
+ ### Session
2447
2428
 
2448
- > Sandbox credentials are separate from production credentials. Both are provisioned independently during onboarding.
2429
+ | Code | String Value | When |
2430
+ |---|---|---|
2431
+ | `AgentLogout` | `'AgentLogout'` | JWT expired — re-authenticate |
2449
2432
 
2450
- ---
2451
2433
 
2452
- ## Token Management
2434
+ ***
2453
2435
 
2436
+ ### Deprecated codes (reference only)
2454
2437
 
2455
- | Method | Signature | Description |
2456
- | ------------------- | ------------------------- | ----------------------------------------------------------- |
2457
- | `isAuthenticated()` | `() => boolean` | Returns `true` if a JWT is currently stored |
2458
- | `getCurrentToken()` | `() => string | null` |
2459
- | `setToken(token)` | `(token: string) => void` | Manually set a JWT (e.g., restored from persistent storage) |
2460
- | `logout()` | `() => void` | Clears the stored JWT |
2461
- | `getBaseUrl()` | `() => string` | Returns the configured base URL (for debugging only) |
2438
+ Not documented as active responses. Kept on `APIErrorCode` for older integrations; prefer `InvalidRequestFormat` / `value.fields` (or `QuoteNotFound` → get-existing-quote field messages).
2462
2439
 
2440
+ | Code | String value |
2441
+ |---|---|
2442
+ | `QuoteNotFound` | `'QuoteNotFound'` |
2443
+ | `HeightNotValid` | `'HeightNotValid'` |
2444
+ | `DocumentsNotViewed` | `'DocumentsNotViewed'` |
2445
+ | `ThirdPartyQuoteError` | `'ThirdPartyQuoteError'` |
2446
+ | `ErrorInSaveEftPaymentDetails` | `'ErrorInSaveEftPaymentDetails'` |
2447
+ | `InvalidBirthCountry` | `'InvalidBirthCountry'` |
2448
+ | `InvalidBirthState` | `'InvalidBirthState'` |
2449
+ | `InvalidResidenceState` | `'InvalidResidenceState'` |
2450
+ | `OneOfTheExistingCoveragesQuestionsNotFound` | `'OneOfTheExistingCoveragesQuestionsNotFound'` |
2451
+ | `InvalidPaymentScheduledDate` | `'InvalidPaymentScheduledDate'` |
2452
+ | `InvalidQuoteParameters` | `'InvalidQuoteParameters'` |
2453
+ | `InvalidStateCode` | `'InvalidStateCode'` |
2454
+ | `InvalidAdbAgeRange` | `'InvalidAdbAgeRange'` |
2463
2455
 
2464
2456
  ---
2465
2457
 
2466
- ## Examples Directory
2458
+ ## Environment Configuration
2459
+
2460
+ ```typescript
2461
+ const client = InstaBrainClient.forEnvironment('sandbox'); // development
2462
+ const client = InstaBrainClient.forEnvironment('production'); // production
2463
+ ```
2467
2464
 
2468
- Working examples are in the `./examples/` directory:
2465
+ Sandbox and production credentials are provisioned independently.
2469
2466
 
2467
+ ---
2470
2468
 
2471
- | File | Description |
2472
- | ---------------------------- | ---------------------------------------------------- |
2473
- | `basic-usage.ts` | Authentication and basic quote/application flows |
2474
- | `error-handling.ts` | Error catching and handling patterns |
2475
- | `api-constraints-example.ts` | State restrictions, age limits, and validation rules |
2476
- | `reports-example.ts` | Prospects, sales, and applications reporting |
2469
+ ## Token Management
2477
2470
 
2471
+ | Method | Signature | Description |
2472
+ |---|---|---|
2473
+ | `isAuthenticated()` | `() => boolean` | `true` if a JWT is currently stored |
2474
+ | `getCurrentToken()` | `() => string \| null` | Returns the current JWT |
2475
+ | `setToken(token)` | `(token: string) => void` | Manually set a JWT (e.g. restored from persistent storage) |
2476
+ | `logout()` | `() => void` | Clears the stored JWT |
2477
+ | `getBaseUrl()` | `() => string` | Returns the configured base URL |
2478
2478
 
2479
2479
  ---
2480
2480
 
2481
- ## Changelog
2481
+ ## Examples Directory
2482
2482
 
2483
- See [CHANGELOG.md](./CHANGELOG.md).
2483
+ | File | Description |
2484
+ |---|---|
2485
+ | `basic-usage.ts` | Authentication and basic quote/application flows |
2486
+ | `error-handling.ts` | Error catching and handling patterns |
2487
+ | `api-constraints-example.ts` | State restrictions, age limits, and SDK validation patterns |
2488
+ | `reports-example.ts` | Prospects, sales, and applications reporting |
2484
2489
 
2485
2490
  ---
2486
2491
 
@@ -2488,4 +2493,3 @@ See [CHANGELOG.md](./CHANGELOG.md).
2488
2493
 
2489
2494
  - **Email:** [helpdesk@instabrain.io](mailto:helpdesk@instabrain.io)
2490
2495
  - **Website:** [https://www.instabrain.io](https://www.instabrain.io)
2491
-