@instabrain-sdks/api-client 2.2.1 → 2.3.0

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