@delegance/sdk 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -107,8 +107,11 @@ declare const DocumentStatusSchema: z.ZodEnum<{
107
107
  }>;
108
108
  type DocumentStatus = z.infer<typeof DocumentStatusSchema>;
109
109
  interface UploadDocumentInput {
110
- /** Company ID to associate the document with */
111
- companyId: string;
110
+ /**
111
+ * Optional. An API key belongs to one company, and the document goes there.
112
+ * Naming any other company answers 403 with `code: 'company_mismatch'`.
113
+ */
114
+ companyId?: string;
112
115
  /** File to upload (Buffer, Blob, or base64 string) */
113
116
  file: Buffer | Blob | string;
114
117
  /** File name */
@@ -168,8 +171,9 @@ interface APIKey {
168
171
  }
169
172
  interface CreateAPIKeyInput {
170
173
  name: string;
171
- scopes?: ('read' | 'write' | 'admin')[];
172
- expiresInDays?: number;
174
+ scopes?: ('read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write')[];
175
+ /** 1 to 365, or 'never' for a read-only key. Omitted: 90 days. */
176
+ expiresInDays?: number | 'never';
173
177
  }
174
178
  interface CreatedAPIKey extends APIKey {
175
179
  /** The full API key - only shown once at creation time */
@@ -181,6 +185,11 @@ declare class DeleganceError extends Error {
181
185
  details?: unknown | undefined;
182
186
  /** Machine-readable `reason` from the error body, when the server sent one. */
183
187
  reason?: string;
188
+ /**
189
+ * Machine-readable `code` from the error body, when the server sent one
190
+ * (e.g. `company_mismatch` on a 403 for a company the key does not own).
191
+ */
192
+ code?: string;
184
193
  /** The parsed error body, for fields a caller needs (portalUrl, hint). */
185
194
  body?: Record<string, unknown>;
186
195
  constructor(message: string, statusCode: number, traceId?: string | undefined, details?: unknown | undefined);
@@ -223,7 +232,7 @@ interface RequestOptions {
223
232
  isFormData?: boolean;
224
233
  }
225
234
  /** Kept equal to package.json "version"; a unit test fails on drift. */
226
- declare const SDK_VERSION = "0.2.0";
235
+ declare const SDK_VERSION = "0.3.0";
227
236
  /**
228
237
  * Canonical default API origin (WS0/WS1 shared constant, the SDK-package
229
238
  * source of truth; the CLI mirror lives in cli/src/utils/config.ts).
@@ -260,14 +269,21 @@ declare class HttpClient {
260
269
  */
261
270
 
262
271
  interface ListCompaniesOptions {
263
- /** Include companies created by this API key */
272
+ /**
273
+ * @deprecated A customer API key belongs to one company and cannot create
274
+ * others, so this adds nothing for it.
275
+ */
264
276
  includeCreated?: boolean;
265
277
  }
266
278
  declare class CompaniesModule {
267
279
  private http;
268
280
  constructor(http: HttpClient);
269
281
  /**
270
- * Create a new company
282
+ * Create a new company.
283
+ *
284
+ * @deprecated A customer API key cannot create companies (403
285
+ * `tenant_key_cannot_create`). To open a new account, use
286
+ * `createSignup().createAccount()`.
271
287
  *
272
288
  * @example
273
289
  * ```typescript
@@ -282,19 +298,19 @@ declare class CompaniesModule {
282
298
  */
283
299
  create(input: CreateCompanyInput): Promise<Company>;
284
300
  /**
285
- * List companies accessible to this API key
301
+ * List the company this API key belongs to. A key belongs to one company.
286
302
  *
287
303
  * @example
288
304
  * ```typescript
289
- * const companies = await client.companies.list();
290
- *
291
- * // Include companies created via this API key
292
- * const allCompanies = await client.companies.list({ includeCreated: true });
305
+ * const [company] = await client.companies.list();
293
306
  * ```
294
307
  */
295
308
  list(options?: ListCompaniesOptions): Promise<Company[]>;
296
309
  /**
297
- * Get a company by ID
310
+ * Get a company by ID.
311
+ *
312
+ * @deprecated The server has no `GET /api/v1/companies/{id}` route, so this
313
+ * returns 404. Use `list()`, which returns the key's own company.
298
314
  *
299
315
  * @example
300
316
  * ```typescript
@@ -303,7 +319,10 @@ declare class CompaniesModule {
303
319
  */
304
320
  get(companyId: string): Promise<Company>;
305
321
  /**
306
- * Create a company if it doesn't exist (using externalId for deduplication)
322
+ * Create a company if it doesn't exist (using externalId for deduplication).
323
+ *
324
+ * @deprecated A customer API key cannot create companies. Use
325
+ * `createSignup().createAccount()` for a new account.
307
326
  *
308
327
  * @example
309
328
  * ```typescript
@@ -374,7 +393,6 @@ declare class DocumentsModule {
374
393
  * import fs from 'fs';
375
394
  *
376
395
  * const doc = await client.documents.upload({
377
- * companyId: 'company-uuid',
378
396
  * file: fs.readFileSync('./policy.pdf'),
379
397
  * fileName: 'GL-2025.pdf',
380
398
  * documentType: 'policy'
@@ -390,8 +408,8 @@ declare class DocumentsModule {
390
408
  * @example
391
409
  * ```typescript
392
410
  * const docs = await client.documents.uploadBatch([
393
- * { companyId, file: buffer1, fileName: 'policy1.pdf' },
394
- * { companyId, file: buffer2, fileName: 'policy2.pdf' }
411
+ * { file: buffer1, fileName: 'policy1.pdf' },
412
+ * { file: buffer2, fileName: 'policy2.pdf' }
395
413
  * ]);
396
414
  * ```
397
415
  */
@@ -1205,13 +1223,23 @@ interface RotateResult {
1205
1223
  rotationId: string;
1206
1224
  status: 'rotating';
1207
1225
  }
1208
- /** Scopes the server accepts. `appetite:read` and `mcp:*` are opt-in and never implied. */
1209
- type ApiKeyScope = 'read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin';
1226
+ /**
1227
+ * Scopes the server accepts. `appetite:read`, `mcp:*` and `claims:write` are
1228
+ * opt-in and never implied. `claims:write` can be created only while signed
1229
+ * in to the portal; an API-key call that asks for it gets a 403.
1230
+ */
1231
+ type ApiKeyScope = 'read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write';
1210
1232
  declare const API_KEY_SCOPES: readonly ApiKeyScope[];
1211
1233
  interface CreateApiKeyInput {
1212
1234
  name: string;
1213
1235
  scopes: ApiKeyScope[];
1214
- expiresInDays?: number;
1236
+ /**
1237
+ * Days until the key expires, 1 to 365. Omitted: 90 days. `'never'`: no
1238
+ * expiry, allowed only for a read-only key. A key with `write`, `admin` or
1239
+ * `claims:write` must expire, or the server answers 400
1240
+ * `write_key_requires_expiry`.
1241
+ */
1242
+ expiresInDays?: number | 'never';
1215
1243
  }
1216
1244
  interface ListApiKeysOptions {
1217
1245
  limit?: number;
@@ -1903,6 +1931,29 @@ interface CarrierQuote {
1903
1931
  premium: number | null;
1904
1932
  quoteNumber: string | null;
1905
1933
  bindable: boolean | null;
1934
+ /**
1935
+ * Human-readable limits, e.g. "$1M per occurrence / $2M aggregate" or
1936
+ * "Statutory / $1M employers liability". Null when the carrier sent none.
1937
+ * Absent on older servers.
1938
+ */
1939
+ limits?: string | null;
1940
+ /**
1941
+ * Deductible in dollars; 0 means none. Today only cyber quotes carry one
1942
+ * (the retention); every other line returns null. Absent on older servers.
1943
+ */
1944
+ deductible?: number | null;
1945
+ /**
1946
+ * The carrier result status (`needs_info`, `declined`, `failed`, ...). A
1947
+ * REFERRED quote with `needs_info` is closed: the carrier needs answers.
1948
+ * Absent on older servers.
1949
+ */
1950
+ resultStatus?: string | null;
1951
+ /**
1952
+ * Why the carrier did not price, in the carrier's own words (a decline) or
1953
+ * a plain sentence (needs info, referral). Null otherwise. Absent on older
1954
+ * servers.
1955
+ */
1956
+ message?: string | null;
1906
1957
  }
1907
1958
  interface InstantQuoteStatus {
1908
1959
  submissionId: string;
@@ -1913,6 +1964,8 @@ interface InstantQuoteStatus {
1913
1964
  carrierQuotes: CarrierQuote[];
1914
1965
  allCarriersResolved: boolean;
1915
1966
  awaitingBrokerReviewCount: number;
1967
+ /** When coverage would start, as an ISO date (YYYY-MM-DD). Absent on older servers. */
1968
+ effectiveDate?: string | null;
1916
1969
  /** The newest broker task on this submission; null when none. Absent when the server could not read it. */
1917
1970
  brokerReview?: {
1918
1971
  taskId: string;
@@ -1938,6 +1991,35 @@ interface BrokerHandoffResult {
1938
1991
  unansweredRequired: number;
1939
1992
  alreadyHandedOff: boolean;
1940
1993
  }
1994
+ /**
1995
+ * Premium financing at the point of sale. Present only when Delegance has the
1996
+ * lane switched on. Terms are the LENDER's, reported once the insured starts
1997
+ * financing; they are null before that.
1998
+ */
1999
+ interface FinancingOffer {
2000
+ available: boolean;
2001
+ availability: 'provider_confirmed' | 'precheck_passed' | 'unavailable';
2002
+ provider: string;
2003
+ lender: string;
2004
+ reason: string | null;
2005
+ /** The portal finance checkout (sign in to the portal to use it). */
2006
+ checkoutUrl: string | null;
2007
+ premiumFinal: boolean;
2008
+ terms: {
2009
+ aprBps: number | null;
2010
+ downPaymentCents: number | null;
2011
+ amountFinancedCents: number | null;
2012
+ financeChargeCents: number | null;
2013
+ installmentCents: number | null;
2014
+ numberOfInstallments: number | null;
2015
+ totalOfPaymentsCents: number | null;
2016
+ agreementUrl: string | null;
2017
+ providerQuoteRef: string | null;
2018
+ providerQuoteStatus: string | null;
2019
+ } | null;
2020
+ applicationStatus: string | null;
2021
+ disclosure: string;
2022
+ }
1941
2023
  interface BindRequestResult {
1942
2024
  bindRequestId: string;
1943
2025
  status: string;
@@ -1952,6 +2034,8 @@ interface BindRequestResult {
1952
2034
  reasons?: string[];
1953
2035
  /** Tier A: the carrier's checkout page. The policy is bound only when the carrier confirms. */
1954
2036
  checkoutUrl?: string;
2037
+ /** Point-of-sale premium financing, when offered. */
2038
+ financing?: FinancingOffer;
1955
2039
  }
1956
2040
  /** The first fast-bind call emails a code; send it back with `stepUpId`. */
1957
2041
  interface BindStepUpRequired {
@@ -2221,6 +2305,19 @@ interface CreateAccountResult {
2221
2305
  /** e.g. 'address_not_saved': the account exists but the server could not store part of it. */
2222
2306
  warnings?: string[];
2223
2307
  }
2308
+ /** GET /api/v1/legal/terms: what the user is asked to accept. */
2309
+ interface TermsInfo {
2310
+ version: string;
2311
+ termsUrl: string;
2312
+ privacyUrl: string;
2313
+ slaUrl: string;
2314
+ /** One-line summaries to show beside the links (the self-directed placement disclosure first). */
2315
+ summaries: string[];
2316
+ brokerReview: {
2317
+ email: string;
2318
+ command: string;
2319
+ };
2320
+ }
2224
2321
  interface EnrollResult {
2225
2322
  enrollmentId: string;
2226
2323
  expiresAt: string;
@@ -2245,10 +2342,18 @@ declare class SignupModule {
2245
2342
  createAccount(input: CreateAccountInput, opts?: {
2246
2343
  idempotencyKey?: string;
2247
2344
  }): Promise<CreateAccountResult>;
2345
+ /** The current Terms of Service version and links. Public: no key. */
2346
+ getTerms(): Promise<TermsInfo>;
2347
+ /**
2348
+ * Register this terminal. The server refuses without `termsAccepted: true`
2349
+ * and the CURRENT `termsVersion` (from `getTerms`).
2350
+ */
2248
2351
  enroll(bootstrapKey: string, input: {
2249
2352
  deviceSecretHash: string;
2250
2353
  firstName: string;
2251
2354
  lastName: string;
2355
+ termsAccepted: true;
2356
+ termsVersion: string;
2252
2357
  }): Promise<EnrollResult>;
2253
2358
  requestVerification(bootstrapKey: string): Promise<{
2254
2359
  sentTo?: string;
@@ -2269,6 +2374,27 @@ declare class SignupModule {
2269
2374
  }): Promise<ExchangeResult>;
2270
2375
  }
2271
2376
 
2377
+ /**
2378
+ * Terms Module: read and accept the Delegance Terms of Service with a key.
2379
+ *
2380
+ * A v1 bind can require acceptance of the CURRENT version on file for the
2381
+ * key's user. After the Terms change, `accept` records the new version on
2382
+ * that user's profile (the server stamps the time).
2383
+ */
2384
+
2385
+ interface TermsAcceptance {
2386
+ version: string;
2387
+ acceptedAt: string;
2388
+ }
2389
+ declare class TermsModule {
2390
+ private http;
2391
+ constructor(http: HttpClient);
2392
+ /** The current version, the Terms / Privacy / SLA links, and the summaries to show. */
2393
+ get(): Promise<TermsInfo>;
2394
+ /** Accept `version` (it must be the current one; read it with `get`). */
2395
+ accept(version: string): Promise<TermsAcceptance>;
2396
+ }
2397
+
2272
2398
  interface PollOptions {
2273
2399
  timeoutMs?: number;
2274
2400
  intervalMs?: number;
@@ -2420,6 +2546,7 @@ declare class DeleganceClient {
2420
2546
  readonly claims: ClaimsModule;
2421
2547
  /** Report a bug, an idea, or a question to Delegance */
2422
2548
  readonly feedback: FeedbackModule;
2549
+ readonly terms: TermsModule;
2423
2550
  /** The calling key: info and refresh */
2424
2551
  readonly auth: AuthModule;
2425
2552
  /**
@@ -2492,4 +2619,4 @@ declare function createDeviceLogin(config?: {
2492
2619
  retries?: number;
2493
2620
  }): DeviceLoginModule;
2494
2621
 
2495
- export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };
2622
+ export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, type FinancingOffer, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type TermsAcceptance, type TermsInfo, TermsModule, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };
package/dist/index.d.ts CHANGED
@@ -107,8 +107,11 @@ declare const DocumentStatusSchema: z.ZodEnum<{
107
107
  }>;
108
108
  type DocumentStatus = z.infer<typeof DocumentStatusSchema>;
109
109
  interface UploadDocumentInput {
110
- /** Company ID to associate the document with */
111
- companyId: string;
110
+ /**
111
+ * Optional. An API key belongs to one company, and the document goes there.
112
+ * Naming any other company answers 403 with `code: 'company_mismatch'`.
113
+ */
114
+ companyId?: string;
112
115
  /** File to upload (Buffer, Blob, or base64 string) */
113
116
  file: Buffer | Blob | string;
114
117
  /** File name */
@@ -168,8 +171,9 @@ interface APIKey {
168
171
  }
169
172
  interface CreateAPIKeyInput {
170
173
  name: string;
171
- scopes?: ('read' | 'write' | 'admin')[];
172
- expiresInDays?: number;
174
+ scopes?: ('read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write')[];
175
+ /** 1 to 365, or 'never' for a read-only key. Omitted: 90 days. */
176
+ expiresInDays?: number | 'never';
173
177
  }
174
178
  interface CreatedAPIKey extends APIKey {
175
179
  /** The full API key - only shown once at creation time */
@@ -181,6 +185,11 @@ declare class DeleganceError extends Error {
181
185
  details?: unknown | undefined;
182
186
  /** Machine-readable `reason` from the error body, when the server sent one. */
183
187
  reason?: string;
188
+ /**
189
+ * Machine-readable `code` from the error body, when the server sent one
190
+ * (e.g. `company_mismatch` on a 403 for a company the key does not own).
191
+ */
192
+ code?: string;
184
193
  /** The parsed error body, for fields a caller needs (portalUrl, hint). */
185
194
  body?: Record<string, unknown>;
186
195
  constructor(message: string, statusCode: number, traceId?: string | undefined, details?: unknown | undefined);
@@ -223,7 +232,7 @@ interface RequestOptions {
223
232
  isFormData?: boolean;
224
233
  }
225
234
  /** Kept equal to package.json "version"; a unit test fails on drift. */
226
- declare const SDK_VERSION = "0.2.0";
235
+ declare const SDK_VERSION = "0.3.0";
227
236
  /**
228
237
  * Canonical default API origin (WS0/WS1 shared constant, the SDK-package
229
238
  * source of truth; the CLI mirror lives in cli/src/utils/config.ts).
@@ -260,14 +269,21 @@ declare class HttpClient {
260
269
  */
261
270
 
262
271
  interface ListCompaniesOptions {
263
- /** Include companies created by this API key */
272
+ /**
273
+ * @deprecated A customer API key belongs to one company and cannot create
274
+ * others, so this adds nothing for it.
275
+ */
264
276
  includeCreated?: boolean;
265
277
  }
266
278
  declare class CompaniesModule {
267
279
  private http;
268
280
  constructor(http: HttpClient);
269
281
  /**
270
- * Create a new company
282
+ * Create a new company.
283
+ *
284
+ * @deprecated A customer API key cannot create companies (403
285
+ * `tenant_key_cannot_create`). To open a new account, use
286
+ * `createSignup().createAccount()`.
271
287
  *
272
288
  * @example
273
289
  * ```typescript
@@ -282,19 +298,19 @@ declare class CompaniesModule {
282
298
  */
283
299
  create(input: CreateCompanyInput): Promise<Company>;
284
300
  /**
285
- * List companies accessible to this API key
301
+ * List the company this API key belongs to. A key belongs to one company.
286
302
  *
287
303
  * @example
288
304
  * ```typescript
289
- * const companies = await client.companies.list();
290
- *
291
- * // Include companies created via this API key
292
- * const allCompanies = await client.companies.list({ includeCreated: true });
305
+ * const [company] = await client.companies.list();
293
306
  * ```
294
307
  */
295
308
  list(options?: ListCompaniesOptions): Promise<Company[]>;
296
309
  /**
297
- * Get a company by ID
310
+ * Get a company by ID.
311
+ *
312
+ * @deprecated The server has no `GET /api/v1/companies/{id}` route, so this
313
+ * returns 404. Use `list()`, which returns the key's own company.
298
314
  *
299
315
  * @example
300
316
  * ```typescript
@@ -303,7 +319,10 @@ declare class CompaniesModule {
303
319
  */
304
320
  get(companyId: string): Promise<Company>;
305
321
  /**
306
- * Create a company if it doesn't exist (using externalId for deduplication)
322
+ * Create a company if it doesn't exist (using externalId for deduplication).
323
+ *
324
+ * @deprecated A customer API key cannot create companies. Use
325
+ * `createSignup().createAccount()` for a new account.
307
326
  *
308
327
  * @example
309
328
  * ```typescript
@@ -374,7 +393,6 @@ declare class DocumentsModule {
374
393
  * import fs from 'fs';
375
394
  *
376
395
  * const doc = await client.documents.upload({
377
- * companyId: 'company-uuid',
378
396
  * file: fs.readFileSync('./policy.pdf'),
379
397
  * fileName: 'GL-2025.pdf',
380
398
  * documentType: 'policy'
@@ -390,8 +408,8 @@ declare class DocumentsModule {
390
408
  * @example
391
409
  * ```typescript
392
410
  * const docs = await client.documents.uploadBatch([
393
- * { companyId, file: buffer1, fileName: 'policy1.pdf' },
394
- * { companyId, file: buffer2, fileName: 'policy2.pdf' }
411
+ * { file: buffer1, fileName: 'policy1.pdf' },
412
+ * { file: buffer2, fileName: 'policy2.pdf' }
395
413
  * ]);
396
414
  * ```
397
415
  */
@@ -1205,13 +1223,23 @@ interface RotateResult {
1205
1223
  rotationId: string;
1206
1224
  status: 'rotating';
1207
1225
  }
1208
- /** Scopes the server accepts. `appetite:read` and `mcp:*` are opt-in and never implied. */
1209
- type ApiKeyScope = 'read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin';
1226
+ /**
1227
+ * Scopes the server accepts. `appetite:read`, `mcp:*` and `claims:write` are
1228
+ * opt-in and never implied. `claims:write` can be created only while signed
1229
+ * in to the portal; an API-key call that asks for it gets a 403.
1230
+ */
1231
+ type ApiKeyScope = 'read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write';
1210
1232
  declare const API_KEY_SCOPES: readonly ApiKeyScope[];
1211
1233
  interface CreateApiKeyInput {
1212
1234
  name: string;
1213
1235
  scopes: ApiKeyScope[];
1214
- expiresInDays?: number;
1236
+ /**
1237
+ * Days until the key expires, 1 to 365. Omitted: 90 days. `'never'`: no
1238
+ * expiry, allowed only for a read-only key. A key with `write`, `admin` or
1239
+ * `claims:write` must expire, or the server answers 400
1240
+ * `write_key_requires_expiry`.
1241
+ */
1242
+ expiresInDays?: number | 'never';
1215
1243
  }
1216
1244
  interface ListApiKeysOptions {
1217
1245
  limit?: number;
@@ -1903,6 +1931,29 @@ interface CarrierQuote {
1903
1931
  premium: number | null;
1904
1932
  quoteNumber: string | null;
1905
1933
  bindable: boolean | null;
1934
+ /**
1935
+ * Human-readable limits, e.g. "$1M per occurrence / $2M aggregate" or
1936
+ * "Statutory / $1M employers liability". Null when the carrier sent none.
1937
+ * Absent on older servers.
1938
+ */
1939
+ limits?: string | null;
1940
+ /**
1941
+ * Deductible in dollars; 0 means none. Today only cyber quotes carry one
1942
+ * (the retention); every other line returns null. Absent on older servers.
1943
+ */
1944
+ deductible?: number | null;
1945
+ /**
1946
+ * The carrier result status (`needs_info`, `declined`, `failed`, ...). A
1947
+ * REFERRED quote with `needs_info` is closed: the carrier needs answers.
1948
+ * Absent on older servers.
1949
+ */
1950
+ resultStatus?: string | null;
1951
+ /**
1952
+ * Why the carrier did not price, in the carrier's own words (a decline) or
1953
+ * a plain sentence (needs info, referral). Null otherwise. Absent on older
1954
+ * servers.
1955
+ */
1956
+ message?: string | null;
1906
1957
  }
1907
1958
  interface InstantQuoteStatus {
1908
1959
  submissionId: string;
@@ -1913,6 +1964,8 @@ interface InstantQuoteStatus {
1913
1964
  carrierQuotes: CarrierQuote[];
1914
1965
  allCarriersResolved: boolean;
1915
1966
  awaitingBrokerReviewCount: number;
1967
+ /** When coverage would start, as an ISO date (YYYY-MM-DD). Absent on older servers. */
1968
+ effectiveDate?: string | null;
1916
1969
  /** The newest broker task on this submission; null when none. Absent when the server could not read it. */
1917
1970
  brokerReview?: {
1918
1971
  taskId: string;
@@ -1938,6 +1991,35 @@ interface BrokerHandoffResult {
1938
1991
  unansweredRequired: number;
1939
1992
  alreadyHandedOff: boolean;
1940
1993
  }
1994
+ /**
1995
+ * Premium financing at the point of sale. Present only when Delegance has the
1996
+ * lane switched on. Terms are the LENDER's, reported once the insured starts
1997
+ * financing; they are null before that.
1998
+ */
1999
+ interface FinancingOffer {
2000
+ available: boolean;
2001
+ availability: 'provider_confirmed' | 'precheck_passed' | 'unavailable';
2002
+ provider: string;
2003
+ lender: string;
2004
+ reason: string | null;
2005
+ /** The portal finance checkout (sign in to the portal to use it). */
2006
+ checkoutUrl: string | null;
2007
+ premiumFinal: boolean;
2008
+ terms: {
2009
+ aprBps: number | null;
2010
+ downPaymentCents: number | null;
2011
+ amountFinancedCents: number | null;
2012
+ financeChargeCents: number | null;
2013
+ installmentCents: number | null;
2014
+ numberOfInstallments: number | null;
2015
+ totalOfPaymentsCents: number | null;
2016
+ agreementUrl: string | null;
2017
+ providerQuoteRef: string | null;
2018
+ providerQuoteStatus: string | null;
2019
+ } | null;
2020
+ applicationStatus: string | null;
2021
+ disclosure: string;
2022
+ }
1941
2023
  interface BindRequestResult {
1942
2024
  bindRequestId: string;
1943
2025
  status: string;
@@ -1952,6 +2034,8 @@ interface BindRequestResult {
1952
2034
  reasons?: string[];
1953
2035
  /** Tier A: the carrier's checkout page. The policy is bound only when the carrier confirms. */
1954
2036
  checkoutUrl?: string;
2037
+ /** Point-of-sale premium financing, when offered. */
2038
+ financing?: FinancingOffer;
1955
2039
  }
1956
2040
  /** The first fast-bind call emails a code; send it back with `stepUpId`. */
1957
2041
  interface BindStepUpRequired {
@@ -2221,6 +2305,19 @@ interface CreateAccountResult {
2221
2305
  /** e.g. 'address_not_saved': the account exists but the server could not store part of it. */
2222
2306
  warnings?: string[];
2223
2307
  }
2308
+ /** GET /api/v1/legal/terms: what the user is asked to accept. */
2309
+ interface TermsInfo {
2310
+ version: string;
2311
+ termsUrl: string;
2312
+ privacyUrl: string;
2313
+ slaUrl: string;
2314
+ /** One-line summaries to show beside the links (the self-directed placement disclosure first). */
2315
+ summaries: string[];
2316
+ brokerReview: {
2317
+ email: string;
2318
+ command: string;
2319
+ };
2320
+ }
2224
2321
  interface EnrollResult {
2225
2322
  enrollmentId: string;
2226
2323
  expiresAt: string;
@@ -2245,10 +2342,18 @@ declare class SignupModule {
2245
2342
  createAccount(input: CreateAccountInput, opts?: {
2246
2343
  idempotencyKey?: string;
2247
2344
  }): Promise<CreateAccountResult>;
2345
+ /** The current Terms of Service version and links. Public: no key. */
2346
+ getTerms(): Promise<TermsInfo>;
2347
+ /**
2348
+ * Register this terminal. The server refuses without `termsAccepted: true`
2349
+ * and the CURRENT `termsVersion` (from `getTerms`).
2350
+ */
2248
2351
  enroll(bootstrapKey: string, input: {
2249
2352
  deviceSecretHash: string;
2250
2353
  firstName: string;
2251
2354
  lastName: string;
2355
+ termsAccepted: true;
2356
+ termsVersion: string;
2252
2357
  }): Promise<EnrollResult>;
2253
2358
  requestVerification(bootstrapKey: string): Promise<{
2254
2359
  sentTo?: string;
@@ -2269,6 +2374,27 @@ declare class SignupModule {
2269
2374
  }): Promise<ExchangeResult>;
2270
2375
  }
2271
2376
 
2377
+ /**
2378
+ * Terms Module: read and accept the Delegance Terms of Service with a key.
2379
+ *
2380
+ * A v1 bind can require acceptance of the CURRENT version on file for the
2381
+ * key's user. After the Terms change, `accept` records the new version on
2382
+ * that user's profile (the server stamps the time).
2383
+ */
2384
+
2385
+ interface TermsAcceptance {
2386
+ version: string;
2387
+ acceptedAt: string;
2388
+ }
2389
+ declare class TermsModule {
2390
+ private http;
2391
+ constructor(http: HttpClient);
2392
+ /** The current version, the Terms / Privacy / SLA links, and the summaries to show. */
2393
+ get(): Promise<TermsInfo>;
2394
+ /** Accept `version` (it must be the current one; read it with `get`). */
2395
+ accept(version: string): Promise<TermsAcceptance>;
2396
+ }
2397
+
2272
2398
  interface PollOptions {
2273
2399
  timeoutMs?: number;
2274
2400
  intervalMs?: number;
@@ -2420,6 +2546,7 @@ declare class DeleganceClient {
2420
2546
  readonly claims: ClaimsModule;
2421
2547
  /** Report a bug, an idea, or a question to Delegance */
2422
2548
  readonly feedback: FeedbackModule;
2549
+ readonly terms: TermsModule;
2423
2550
  /** The calling key: info and refresh */
2424
2551
  readonly auth: AuthModule;
2425
2552
  /**
@@ -2492,4 +2619,4 @@ declare function createDeviceLogin(config?: {
2492
2619
  retries?: number;
2493
2620
  }): DeviceLoginModule;
2494
2621
 
2495
- export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };
2622
+ export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, type FinancingOffer, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type TermsAcceptance, type TermsInfo, TermsModule, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };