@instabrain-sdks/api-client 2.3.0 → 2.3.2

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