@instabrain-sdks/api-client 2.3.1 → 2.3.3

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