@delegance/sdk 0.1.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.
@@ -0,0 +1,1616 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Delegance SDK Types
5
+ */
6
+
7
+ interface DeleganceClientConfig {
8
+ /** API key for authentication (format: dlg_xxx_sk_xxx) */
9
+ apiKey: string;
10
+ /** Base URL for the Delegance API (default: https://app.delegance.ai) */
11
+ baseUrl?: string;
12
+ /** Request timeout in milliseconds (default: 30000) */
13
+ timeout?: number;
14
+ /** Number of retry attempts for failed requests (default: 3) */
15
+ retries?: number;
16
+ /** Custom headers to include in all requests */
17
+ headers?: Record<string, string>;
18
+ }
19
+ interface APIResponse<T = unknown> {
20
+ success: boolean;
21
+ traceId: string;
22
+ data?: T;
23
+ error?: string;
24
+ message?: string;
25
+ }
26
+ interface PaginatedResponse<T> extends APIResponse<T[]> {
27
+ pagination: {
28
+ total: number;
29
+ limit: number;
30
+ offset: number;
31
+ hasMore: boolean;
32
+ };
33
+ }
34
+ declare const CompanySizeSchema: z.ZodEnum<["1", "2-10", "11-25", "26-50", "51-100", "100-499", "500+"]>;
35
+ type CompanySize = z.infer<typeof CompanySizeSchema>;
36
+ declare const CreateCompanySchema: z.ZodObject<{
37
+ name: z.ZodString;
38
+ legalName: z.ZodOptional<z.ZodString>;
39
+ dba: z.ZodOptional<z.ZodString>;
40
+ industry: z.ZodString;
41
+ companySize: z.ZodEnum<["1", "2-10", "11-25", "26-50", "51-100", "100-499", "500+"]>;
42
+ yearEstablished: z.ZodOptional<z.ZodString>;
43
+ website: z.ZodOptional<z.ZodString>;
44
+ fein: z.ZodOptional<z.ZodString>;
45
+ companyStructure: z.ZodOptional<z.ZodString>;
46
+ description: z.ZodOptional<z.ZodString>;
47
+ contactEmail: z.ZodString;
48
+ contactPhone: z.ZodOptional<z.ZodString>;
49
+ address: z.ZodOptional<z.ZodObject<{
50
+ street: z.ZodString;
51
+ suite: z.ZodOptional<z.ZodString>;
52
+ city: z.ZodString;
53
+ state: z.ZodString;
54
+ zip: z.ZodString;
55
+ }, "strip", z.ZodTypeAny, {
56
+ street: string;
57
+ city: string;
58
+ state: string;
59
+ zip: string;
60
+ suite?: string | undefined;
61
+ }, {
62
+ street: string;
63
+ city: string;
64
+ state: string;
65
+ zip: string;
66
+ suite?: string | undefined;
67
+ }>>;
68
+ externalId: z.ZodOptional<z.ZodString>;
69
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ name: string;
72
+ industry: string;
73
+ companySize: "1" | "2-10" | "11-25" | "26-50" | "51-100" | "100-499" | "500+";
74
+ contactEmail: string;
75
+ legalName?: string | undefined;
76
+ dba?: string | undefined;
77
+ yearEstablished?: string | undefined;
78
+ website?: string | undefined;
79
+ fein?: string | undefined;
80
+ companyStructure?: string | undefined;
81
+ description?: string | undefined;
82
+ contactPhone?: string | undefined;
83
+ address?: {
84
+ street: string;
85
+ city: string;
86
+ state: string;
87
+ zip: string;
88
+ suite?: string | undefined;
89
+ } | undefined;
90
+ externalId?: string | undefined;
91
+ metadata?: Record<string, unknown> | undefined;
92
+ }, {
93
+ name: string;
94
+ industry: string;
95
+ companySize: "1" | "2-10" | "11-25" | "26-50" | "51-100" | "100-499" | "500+";
96
+ contactEmail: string;
97
+ legalName?: string | undefined;
98
+ dba?: string | undefined;
99
+ yearEstablished?: string | undefined;
100
+ website?: string | undefined;
101
+ fein?: string | undefined;
102
+ companyStructure?: string | undefined;
103
+ description?: string | undefined;
104
+ contactPhone?: string | undefined;
105
+ address?: {
106
+ street: string;
107
+ city: string;
108
+ state: string;
109
+ zip: string;
110
+ suite?: string | undefined;
111
+ } | undefined;
112
+ externalId?: string | undefined;
113
+ metadata?: Record<string, unknown> | undefined;
114
+ }>;
115
+ type CreateCompanyInput = z.infer<typeof CreateCompanySchema>;
116
+ interface Company {
117
+ id: string;
118
+ name: string;
119
+ legalName?: string;
120
+ industry: string;
121
+ companySize: CompanySize;
122
+ contactEmail: string;
123
+ website?: string;
124
+ createdAt: string;
125
+ }
126
+ declare const DocumentTypeSchema: z.ZodEnum<["policy", "loss_run", "financial_statement", "sov", "application", "certificate", "endorsement", "bor", "other"]>;
127
+ type DocumentType = z.infer<typeof DocumentTypeSchema>;
128
+ declare const DocumentStatusSchema: z.ZodEnum<["pending", "processing", "completed", "processed", "error", "failed"]>;
129
+ type DocumentStatus = z.infer<typeof DocumentStatusSchema>;
130
+ interface UploadDocumentInput {
131
+ /** Company ID to associate the document with */
132
+ companyId: string;
133
+ /** File to upload (Buffer, Blob, or base64 string) */
134
+ file: Buffer | Blob | string;
135
+ /** File name */
136
+ fileName: string;
137
+ /** Document type for classification hint */
138
+ documentType?: DocumentType;
139
+ /** External ID for idempotency/reference */
140
+ externalId?: string;
141
+ /** Additional metadata */
142
+ metadata?: Record<string, unknown>;
143
+ }
144
+ interface Document {
145
+ id: string;
146
+ companyId?: string;
147
+ fileName: string;
148
+ documentType?: DocumentType;
149
+ status: DocumentStatus;
150
+ fileSize: number;
151
+ createdAt: string;
152
+ updatedAt?: string;
153
+ externalId?: string;
154
+ }
155
+ interface DocumentWithExtraction extends Document {
156
+ extraction?: {
157
+ hasText: boolean;
158
+ textLength: number;
159
+ policies: ExtractedPolicy[];
160
+ };
161
+ processing?: {
162
+ message: string;
163
+ estimatedTimeSeconds: number;
164
+ };
165
+ error?: {
166
+ message: string;
167
+ code?: string;
168
+ };
169
+ }
170
+ interface ExtractedPolicy {
171
+ id: string;
172
+ policyType: string;
173
+ policyNumber?: string;
174
+ carrierName?: string;
175
+ effectiveDate?: string;
176
+ expirationDate?: string;
177
+ premium?: number;
178
+ coverageLimit?: number;
179
+ }
180
+ interface APIKey {
181
+ id: string;
182
+ name: string;
183
+ prefix: string;
184
+ scopes: string[];
185
+ isActive: boolean;
186
+ createdAt: string;
187
+ expiresAt?: string;
188
+ lastUsedAt?: string;
189
+ }
190
+ interface CreateAPIKeyInput {
191
+ name: string;
192
+ scopes?: ('read' | 'write' | 'admin')[];
193
+ expiresInDays?: number;
194
+ }
195
+ interface CreatedAPIKey extends APIKey {
196
+ /** The full API key - only shown once at creation time */
197
+ key: string;
198
+ }
199
+ declare class DeleganceError extends Error {
200
+ statusCode: number;
201
+ traceId?: string | undefined;
202
+ details?: unknown | undefined;
203
+ constructor(message: string, statusCode: number, traceId?: string | undefined, details?: unknown | undefined);
204
+ }
205
+ declare class AuthenticationError extends DeleganceError {
206
+ constructor(message: string, traceId?: string);
207
+ }
208
+ declare class ValidationError extends DeleganceError {
209
+ constructor(message: string, details?: unknown, traceId?: string);
210
+ }
211
+ declare class NotFoundError extends DeleganceError {
212
+ constructor(message: string, traceId?: string);
213
+ }
214
+ declare class RateLimitError extends DeleganceError {
215
+ retryAfter?: number | undefined;
216
+ constructor(message: string, retryAfter?: number | undefined, traceId?: string);
217
+ }
218
+
219
+ /**
220
+ * HTTP Client utilities for the Delegance SDK
221
+ */
222
+
223
+ interface RequestOptions {
224
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
225
+ path: string;
226
+ body?: unknown;
227
+ headers?: Record<string, string>;
228
+ timeout?: number;
229
+ /** If true, body is FormData and shouldn't be JSON stringified */
230
+ isFormData?: boolean;
231
+ }
232
+ declare const SDK_VERSION = "0.1.0";
233
+ declare class HttpClient {
234
+ private config;
235
+ constructor(config: DeleganceClientConfig);
236
+ request<T>(options: RequestOptions): Promise<T>;
237
+ /**
238
+ * Upload a file with multipart form data.
239
+ * Retries on 5xx/network errors like request().
240
+ */
241
+ uploadFile<T>(path: string, file: Buffer | Blob, fileName: string, additionalFields?: Record<string, string>): Promise<T>;
242
+ /**
243
+ * Shared retry logic for both request() and uploadFile().
244
+ * Creates a fresh AbortController per attempt, clears timeout in finally,
245
+ * and excludes non-retryable errors (401, 400, 404, 429).
246
+ */
247
+ private executeWithRetry;
248
+ private handleErrorResponse;
249
+ private delay;
250
+ }
251
+
252
+ /**
253
+ * Companies Module
254
+ *
255
+ * Handles company creation and management operations.
256
+ */
257
+
258
+ interface ListCompaniesOptions {
259
+ /** Include companies created by this API key */
260
+ includeCreated?: boolean;
261
+ }
262
+ declare class CompaniesModule {
263
+ private http;
264
+ constructor(http: HttpClient);
265
+ /**
266
+ * Create a new company
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const company = await client.companies.create({
271
+ * name: 'ABC Construction',
272
+ * industry: 'construction',
273
+ * companySize: '11-25',
274
+ * contactEmail: 'contact@abc.com',
275
+ * fein: '12-3456789'
276
+ * });
277
+ * ```
278
+ */
279
+ create(input: CreateCompanyInput): Promise<Company>;
280
+ /**
281
+ * List companies accessible to this API key
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * const companies = await client.companies.list();
286
+ *
287
+ * // Include companies created via this API key
288
+ * const allCompanies = await client.companies.list({ includeCreated: true });
289
+ * ```
290
+ */
291
+ list(options?: ListCompaniesOptions): Promise<Company[]>;
292
+ /**
293
+ * Get a company by ID
294
+ *
295
+ * @example
296
+ * ```typescript
297
+ * const company = await client.companies.get('uuid-here');
298
+ * ```
299
+ */
300
+ get(companyId: string): Promise<Company>;
301
+ /**
302
+ * Create a company if it doesn't exist (using externalId for deduplication)
303
+ *
304
+ * @example
305
+ * ```typescript
306
+ * const company = await client.companies.upsert({
307
+ * name: 'ABC Construction',
308
+ * industry: 'construction',
309
+ * companySize: '11-25',
310
+ * contactEmail: 'contact@abc.com',
311
+ * externalId: 'ams-12345' // Will dedupe on this
312
+ * });
313
+ * ```
314
+ */
315
+ upsert(input: CreateCompanyInput & {
316
+ externalId: string;
317
+ }): Promise<{
318
+ company: Company;
319
+ isExisting: boolean;
320
+ }>;
321
+ }
322
+
323
+ /**
324
+ * Documents Module
325
+ *
326
+ * Handles document upload, listing, and status operations.
327
+ */
328
+
329
+ interface ListDocumentsResponse {
330
+ success: boolean;
331
+ documents: Document[];
332
+ pagination: {
333
+ total: number;
334
+ limit: number;
335
+ offset: number;
336
+ hasMore: boolean;
337
+ };
338
+ traceId: string;
339
+ }
340
+ interface ListDocumentsOptions {
341
+ /** Filter by company ID */
342
+ companyId?: string;
343
+ /** Filter by document type */
344
+ documentType?: DocumentType;
345
+ /** Filter by status */
346
+ status?: DocumentStatus;
347
+ /** Filter by external ID */
348
+ externalId?: string;
349
+ /** Maximum number of documents to return (default: 50, max: 100) */
350
+ limit?: number;
351
+ /** Offset for pagination */
352
+ offset?: number;
353
+ }
354
+ interface WaitForExtractionOptions {
355
+ /** Maximum time to wait in milliseconds (default: 120000 = 2 minutes) */
356
+ timeoutMs?: number;
357
+ /** Polling interval in milliseconds (default: 2000 = 2 seconds) */
358
+ pollIntervalMs?: number;
359
+ /** Callback for status updates */
360
+ onStatusChange?: (status: DocumentStatus) => void;
361
+ }
362
+ declare class DocumentsModule {
363
+ private http;
364
+ constructor(http: HttpClient);
365
+ /**
366
+ * Upload a document for processing
367
+ *
368
+ * @example
369
+ * ```typescript
370
+ * import fs from 'fs';
371
+ *
372
+ * const doc = await client.documents.upload({
373
+ * companyId: 'company-uuid',
374
+ * file: fs.readFileSync('./policy.pdf'),
375
+ * fileName: 'GL-2025.pdf',
376
+ * documentType: 'policy'
377
+ * });
378
+ *
379
+ * console.log(`Document ${doc.id} uploaded, status: ${doc.status}`);
380
+ * ```
381
+ */
382
+ upload(input: UploadDocumentInput): Promise<Document>;
383
+ /**
384
+ * Upload multiple documents in batch
385
+ *
386
+ * @example
387
+ * ```typescript
388
+ * const docs = await client.documents.uploadBatch([
389
+ * { companyId, file: buffer1, fileName: 'policy1.pdf' },
390
+ * { companyId, file: buffer2, fileName: 'policy2.pdf' }
391
+ * ]);
392
+ * ```
393
+ */
394
+ uploadBatch(inputs: UploadDocumentInput[], options?: {
395
+ concurrency?: number;
396
+ }): Promise<{
397
+ documents: Document[];
398
+ errors: Array<{
399
+ input: UploadDocumentInput;
400
+ error: Error;
401
+ }>;
402
+ }>;
403
+ /**
404
+ * Get document details and extraction status
405
+ *
406
+ * @example
407
+ * ```typescript
408
+ * const doc = await client.documents.get('doc-uuid');
409
+ * console.log(`Status: ${doc.status}`);
410
+ * if (doc.extraction) {
411
+ * console.log(`Found ${doc.extraction.policies.length} policies`);
412
+ * }
413
+ * ```
414
+ */
415
+ get(documentId: string): Promise<DocumentWithExtraction>;
416
+ /**
417
+ * List documents with optional filters
418
+ *
419
+ * @example
420
+ * ```typescript
421
+ * // List all documents
422
+ * const docs = await client.documents.list();
423
+ *
424
+ * // Filter by type and status
425
+ * const policies = await client.documents.list({
426
+ * documentType: 'policy',
427
+ * status: 'completed'
428
+ * });
429
+ *
430
+ * // Paginate
431
+ * const page2 = await client.documents.list({ offset: 50, limit: 50 });
432
+ * ```
433
+ */
434
+ list(options?: ListDocumentsOptions): Promise<{
435
+ documents: Document[];
436
+ pagination: ListDocumentsResponse['pagination'];
437
+ }>;
438
+ /**
439
+ * Wait for document extraction to complete
440
+ *
441
+ * @example
442
+ * ```typescript
443
+ * const doc = await client.documents.upload({ ... });
444
+ *
445
+ * // Wait for processing to complete
446
+ * const result = await client.documents.waitForExtraction(doc.id, {
447
+ * timeoutMs: 60000,
448
+ * onStatusChange: (status) => console.log(`Status: ${status}`)
449
+ * });
450
+ *
451
+ * if (result.extraction) {
452
+ * console.log('Extraction complete:', result.extraction.policies);
453
+ * }
454
+ * ```
455
+ */
456
+ waitForExtraction(documentId: string, options?: WaitForExtractionOptions): Promise<DocumentWithExtraction>;
457
+ /**
458
+ * Check if a document with the given external ID already exists
459
+ *
460
+ * @example
461
+ * ```typescript
462
+ * const existing = await client.documents.findByExternalId('ams-doc-123');
463
+ * if (existing) {
464
+ * console.log('Document already uploaded:', existing.id);
465
+ * }
466
+ * ```
467
+ */
468
+ findByExternalId(externalId: string, companyId?: string): Promise<Document | null>;
469
+ /**
470
+ * Archive a document (soft delete)
471
+ *
472
+ * This does NOT permanently delete the document - archived documents
473
+ * are excluded from list queries but remain for audit purposes.
474
+ *
475
+ * @example
476
+ * ```typescript
477
+ * await client.documents.archive('doc-uuid');
478
+ * console.log('Document archived');
479
+ * ```
480
+ */
481
+ archive(documentId: string): Promise<{
482
+ success: boolean;
483
+ message: string;
484
+ }>;
485
+ /**
486
+ * Unarchive a previously archived document
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * await client.documents.unarchive('doc-uuid');
491
+ * console.log('Document restored');
492
+ * ```
493
+ */
494
+ unarchive(documentId: string): Promise<{
495
+ success: boolean;
496
+ message: string;
497
+ status: string;
498
+ }>;
499
+ /**
500
+ * Trigger re-extraction of a document
501
+ *
502
+ * Useful when:
503
+ * - Document extraction failed
504
+ * - You want to try extraction with updated extractors
505
+ * - Document was partially processed
506
+ *
507
+ * Rate limited to 3 reprocesses per document per day.
508
+ *
509
+ * @example
510
+ * ```typescript
511
+ * const result = await client.documents.reprocess('doc-uuid');
512
+ * console.log(`Reprocessing initiated. ${result.reprocessesRemaining} retries remaining today.`);
513
+ *
514
+ * // Then wait for extraction
515
+ * const doc = await client.documents.waitForExtraction('doc-uuid');
516
+ * ```
517
+ */
518
+ reprocess(documentId: string): Promise<{
519
+ success: boolean;
520
+ message: string;
521
+ status: string;
522
+ reprocessesRemaining: number;
523
+ }>;
524
+ }
525
+
526
+ /**
527
+ * Chat Module
528
+ *
529
+ * Handles chat/LLM interactions with the Orin insurance assistant.
530
+ */
531
+
532
+ interface ChatMessage {
533
+ role: 'user' | 'assistant';
534
+ content: string;
535
+ }
536
+ interface ChatOptions {
537
+ /** Conversation ID for maintaining context across messages */
538
+ conversationId?: string;
539
+ /** Optional context to focus the response */
540
+ context?: {
541
+ policyId?: string;
542
+ documentId?: string;
543
+ };
544
+ }
545
+ interface ChatResponse {
546
+ success: boolean;
547
+ response: string;
548
+ conversationId: string;
549
+ intent?: string;
550
+ sources?: Array<{
551
+ fileName: string;
552
+ excerpt: string;
553
+ }>;
554
+ traceId: string;
555
+ }
556
+ declare class ChatModule {
557
+ private http;
558
+ constructor(http: HttpClient);
559
+ /**
560
+ * Send a message to the Orin insurance assistant
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * const response = await client.chat.ask('What is my GL coverage limit?');
565
+ * console.log(response.response);
566
+ *
567
+ * // Continue the conversation
568
+ * const followUp = await client.chat.ask('And when does it expire?', {
569
+ * conversationId: response.conversationId
570
+ * });
571
+ * ```
572
+ */
573
+ ask(message: string, options?: ChatOptions): Promise<ChatResponse>;
574
+ /**
575
+ * Start a new conversation and send the first message
576
+ *
577
+ * @example
578
+ * ```typescript
579
+ * const conversation = await client.chat.startConversation('Tell me about my policies');
580
+ * console.log('Conversation ID:', conversation.conversationId);
581
+ * ```
582
+ */
583
+ startConversation(message: string): Promise<ChatResponse>;
584
+ }
585
+
586
+ /**
587
+ * Quotes Module
588
+ *
589
+ * Handles quote requests and carrier interactions.
590
+ */
591
+
592
+ interface Carrier {
593
+ id: string;
594
+ name: string;
595
+ logoUrl?: string;
596
+ supportedLines?: string[];
597
+ statesAvailable?: string[];
598
+ averageQuoteTimeSeconds: number;
599
+ successRate?: number;
600
+ queueDepth: number;
601
+ }
602
+ interface QuoteRequest {
603
+ /** Carrier IDs to request quotes from */
604
+ carriers: string[];
605
+ /** Priority level */
606
+ priority?: 'low' | 'normal' | 'high';
607
+ /** Coverage types to quote (optional - uses company defaults) */
608
+ coverageTypes?: string[];
609
+ /** Schedule for later (ISO datetime) */
610
+ scheduledFor?: string;
611
+ }
612
+ interface Quote {
613
+ id: string;
614
+ carrierId: string;
615
+ carrierName: string;
616
+ status: 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
617
+ priority: string;
618
+ createdAt: string;
619
+ scheduledFor?: string;
620
+ startedAt?: string;
621
+ completedAt?: string;
622
+ estimatedWaitSeconds?: number | null;
623
+ durationSeconds?: number | null;
624
+ result?: {
625
+ premium?: number;
626
+ bindable?: boolean;
627
+ expiresAt?: string;
628
+ };
629
+ error?: string;
630
+ cancelledAt?: string;
631
+ cancelledBy?: string;
632
+ }
633
+ interface GetQuoteResponse {
634
+ success: boolean;
635
+ quote: Quote;
636
+ actions: {
637
+ canCancel: boolean;
638
+ };
639
+ traceId: string;
640
+ }
641
+ interface SubmitQuoteResponse {
642
+ success: boolean;
643
+ queueIds: string[];
644
+ carriers: Array<{
645
+ id: string;
646
+ name: string;
647
+ }>;
648
+ invalidCarriers?: string[];
649
+ errors?: string[];
650
+ message: string;
651
+ traceId: string;
652
+ }
653
+ interface ListQuotesResponse {
654
+ success: boolean;
655
+ quotes: Quote[];
656
+ count: number;
657
+ traceId: string;
658
+ }
659
+ interface ListCarriersResponse {
660
+ success: boolean;
661
+ carriers: Carrier[];
662
+ count: number;
663
+ traceId: string;
664
+ }
665
+ interface ListQuotesOptions {
666
+ /** Filter by status */
667
+ status?: 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
668
+ /** Maximum results (default: 50) */
669
+ limit?: number;
670
+ }
671
+ declare class QuotesModule {
672
+ private http;
673
+ constructor(http: HttpClient);
674
+ /**
675
+ * List available carriers for quoting
676
+ *
677
+ * @example
678
+ * ```typescript
679
+ * const { carriers } = await client.quotes.listCarriers();
680
+ * for (const carrier of carriers) {
681
+ * console.log(`${carrier.name} - avg ${carrier.averageQuoteTimeSeconds}s`);
682
+ * }
683
+ * ```
684
+ */
685
+ listCarriers(): Promise<ListCarriersResponse>;
686
+ /**
687
+ * Submit a quote request to one or more carriers
688
+ *
689
+ * @example
690
+ * ```typescript
691
+ * // Get available carriers
692
+ * const { carriers } = await client.quotes.listCarriers();
693
+ *
694
+ * // Submit to first 3 carriers
695
+ * const result = await client.quotes.submit({
696
+ * carriers: carriers.slice(0, 3).map(c => c.id),
697
+ * priority: 'high'
698
+ * });
699
+ *
700
+ * console.log(`Submitted ${result.queueIds.length} quote requests`);
701
+ * ```
702
+ */
703
+ submit(request: QuoteRequest): Promise<SubmitQuoteResponse>;
704
+ /**
705
+ * List quote requests for the company
706
+ *
707
+ * @example
708
+ * ```typescript
709
+ * // List all quotes
710
+ * const { quotes } = await client.quotes.list();
711
+ *
712
+ * // List only pending quotes
713
+ * const { quotes: pending } = await client.quotes.list({ status: 'pending' });
714
+ * ```
715
+ */
716
+ list(options?: ListQuotesOptions): Promise<ListQuotesResponse>;
717
+ /**
718
+ * Get a single quote by ID with full details
719
+ *
720
+ * @example
721
+ * ```typescript
722
+ * const { quote, actions } = await client.quotes.get('quote-uuid');
723
+ * console.log(`Status: ${quote.status}`);
724
+ * if (actions.canCancel) {
725
+ * console.log('This quote can be cancelled');
726
+ * }
727
+ * ```
728
+ */
729
+ get(quoteId: string): Promise<{
730
+ quote: Quote;
731
+ canCancel: boolean;
732
+ }>;
733
+ /**
734
+ * Cancel a pending quote
735
+ *
736
+ * Only quotes in 'pending' status can be cancelled.
737
+ * Once a quote starts processing, it cannot be stopped.
738
+ *
739
+ * @example
740
+ * ```typescript
741
+ * try {
742
+ * await client.quotes.cancel('quote-uuid');
743
+ * console.log('Quote cancelled');
744
+ * } catch (error) {
745
+ * console.log('Cannot cancel:', error.message);
746
+ * }
747
+ * ```
748
+ */
749
+ cancel(quoteId: string): Promise<{
750
+ success: boolean;
751
+ message: string;
752
+ }>;
753
+ /**
754
+ * Wait for a quote to complete
755
+ *
756
+ * @example
757
+ * ```typescript
758
+ * const result = await client.quotes.submit({ carriers: ['carrier-1'] });
759
+ * const quote = await client.quotes.waitForCompletion(result.queueIds[0]);
760
+ * console.log('Quote status:', quote.status);
761
+ * ```
762
+ */
763
+ waitForCompletion(quoteId: string, options?: {
764
+ timeoutMs?: number;
765
+ pollIntervalMs?: number;
766
+ }): Promise<Quote>;
767
+ }
768
+
769
+ /**
770
+ * Policies Module
771
+ *
772
+ * Handles insurance policy management.
773
+ */
774
+
775
+ interface Policy {
776
+ id: string;
777
+ name: string;
778
+ carrier: string;
779
+ policyNumber?: string;
780
+ policyType?: string;
781
+ premium?: number;
782
+ deductible?: number;
783
+ aggregateLimit?: number;
784
+ occurrenceLimit?: number;
785
+ effectiveDate?: string;
786
+ expiryDate?: string;
787
+ naicCode?: string;
788
+ amBestRating?: string;
789
+ sourceDocuments?: string[];
790
+ coverageDetails?: Record<string, unknown>;
791
+ exclusions?: string[];
792
+ endorsements?: string[];
793
+ additionalInsureds?: Array<{
794
+ name: string;
795
+ relationship?: string;
796
+ }>;
797
+ createdAt: string;
798
+ updatedAt?: string;
799
+ isActive: boolean;
800
+ daysUntilExpiry?: number | null;
801
+ status?: 'active' | 'expiring_soon' | 'expired';
802
+ }
803
+ interface PolicyCoverage {
804
+ id: string;
805
+ coverageType: string;
806
+ limit?: number;
807
+ deductible?: number;
808
+ description?: string;
809
+ }
810
+ interface GetPolicyResponse {
811
+ success: boolean;
812
+ policy: Policy;
813
+ coverages: PolicyCoverage[];
814
+ traceId: string;
815
+ }
816
+ interface ListPoliciesOptions {
817
+ /** Filter by status: active, expired, all */
818
+ status?: 'active' | 'expired' | 'all';
819
+ /** Filter policies expiring within N days */
820
+ expiringDays?: number;
821
+ /** Filter by policy type */
822
+ policyType?: string;
823
+ /** Maximum results (default: 100) */
824
+ limit?: number;
825
+ }
826
+ interface ListPoliciesResponse {
827
+ success: boolean;
828
+ policies: Policy[];
829
+ count: number;
830
+ traceId: string;
831
+ }
832
+ declare class PoliciesModule {
833
+ private http;
834
+ constructor(http: HttpClient);
835
+ /**
836
+ * List policies for the company
837
+ *
838
+ * @example
839
+ * ```typescript
840
+ * // List all active policies
841
+ * const { policies } = await client.policies.list({ status: 'active' });
842
+ *
843
+ * // List policies expiring in 30 days
844
+ * const { policies: expiring } = await client.policies.list({ expiringDays: 30 });
845
+ * ```
846
+ */
847
+ list(options?: ListPoliciesOptions): Promise<ListPoliciesResponse>;
848
+ /**
849
+ * Get policies expiring soon
850
+ *
851
+ * @param days - Number of days to look ahead (default: 30)
852
+ */
853
+ getExpiring(days?: number): Promise<ListPoliciesResponse>;
854
+ /**
855
+ * Get a single policy by ID with full details
856
+ *
857
+ * @example
858
+ * ```typescript
859
+ * const { policy, coverages } = await client.policies.get('policy-uuid');
860
+ * console.log(`${policy.carrier} - ${policy.policyType}`);
861
+ * console.log(`Coverages: ${coverages.length}`);
862
+ * ```
863
+ */
864
+ get(policyId: string): Promise<{
865
+ policy: Policy;
866
+ coverages: PolicyCoverage[];
867
+ } | null>;
868
+ }
869
+
870
+ /**
871
+ * COI (Certificate of Insurance) Module
872
+ *
873
+ * Handles COI generation and management.
874
+ */
875
+
876
+ interface CertificateHolder {
877
+ name: string;
878
+ address?: string;
879
+ city?: string;
880
+ state?: string;
881
+ zip?: string;
882
+ email?: string;
883
+ }
884
+ interface GenerateCOIRequest {
885
+ /** Policy IDs to include in the COI */
886
+ policyIds: string[];
887
+ /** Certificate holder information */
888
+ certificateHolder: CertificateHolder;
889
+ /** Type of certificate */
890
+ certificateType?: 'additional_insured' | 'certificate_holder';
891
+ /** Description/project name */
892
+ description?: string;
893
+ /** Special provisions or endorsements */
894
+ specialProvisions?: string[];
895
+ }
896
+ interface GenerateCOIResponse {
897
+ success: boolean;
898
+ coiId: string;
899
+ downloadUrl: string;
900
+ expiresAt: string;
901
+ policiesIncluded: Array<{
902
+ id: string;
903
+ carrier: string;
904
+ policyType: string;
905
+ }>;
906
+ traceId: string;
907
+ }
908
+ interface COI {
909
+ id: string;
910
+ certificateHolder: string;
911
+ certificateType: string;
912
+ policyIds: string[];
913
+ s3Key?: string;
914
+ createdAt: string;
915
+ }
916
+ interface ListCOIsResponse {
917
+ success: boolean;
918
+ cois: COI[];
919
+ count: number;
920
+ traceId: string;
921
+ }
922
+ declare class COIModule {
923
+ private http;
924
+ constructor(http: HttpClient);
925
+ /**
926
+ * Generate a Certificate of Insurance
927
+ *
928
+ * @example
929
+ * ```typescript
930
+ * const { policies } = await client.policies.list({ status: 'active' });
931
+ *
932
+ * const result = await client.coi.generate({
933
+ * policyIds: policies.map(p => p.id),
934
+ * certificateHolder: {
935
+ * name: 'ABC Property Management',
936
+ * address: '123 Main St',
937
+ * city: 'New York',
938
+ * state: 'NY',
939
+ * zip: '10001'
940
+ * },
941
+ * certificateType: 'additional_insured'
942
+ * });
943
+ *
944
+ * console.log('Download URL:', result.downloadUrl);
945
+ * ```
946
+ */
947
+ generate(request: GenerateCOIRequest): Promise<GenerateCOIResponse>;
948
+ /**
949
+ * List generated COIs
950
+ *
951
+ * @param limit - Maximum results (default: 50)
952
+ */
953
+ list(limit?: number): Promise<ListCOIsResponse>;
954
+ }
955
+
956
+ /**
957
+ * SOV (Schedule of Values) Module
958
+ *
959
+ * Handles SOV upload and management for commercial property insurance.
960
+ */
961
+
962
+ interface UploadSOVRequest {
963
+ /** File buffer or Blob */
964
+ file: Buffer | Blob | ArrayBuffer;
965
+ /** Original file name */
966
+ fileName: string;
967
+ /** Line of business (default: property) */
968
+ lineOfBusiness?: string;
969
+ /** Policy effective date */
970
+ effectiveDate?: string;
971
+ /** Policy expiration date */
972
+ expirationDate?: string;
973
+ }
974
+ interface UploadSOVResponse {
975
+ success: boolean;
976
+ sovId: string;
977
+ s3Key: string;
978
+ status: string;
979
+ message: string;
980
+ traceId: string;
981
+ }
982
+ interface SOV {
983
+ id: string;
984
+ fileName: string;
985
+ status: 'uploaded' | 'parsing' | 'parsed' | 'validated' | 'submitted' | 'error';
986
+ lineOfBusiness: string;
987
+ effectiveDate?: string;
988
+ expirationDate?: string;
989
+ totalLocations?: number;
990
+ totalTIV?: number;
991
+ totalBuildingValue?: number;
992
+ totalContentsValue?: number;
993
+ totalBIValue?: number;
994
+ currency: string;
995
+ validationErrors?: string[];
996
+ parsingErrors?: string[];
997
+ createdAt: string;
998
+ updatedAt?: string;
999
+ }
1000
+ interface SOVLocation {
1001
+ id: string;
1002
+ locationNumber: number;
1003
+ locationName?: string;
1004
+ address: {
1005
+ street?: string;
1006
+ city?: string;
1007
+ state?: string;
1008
+ zip?: string;
1009
+ county?: string;
1010
+ country?: string;
1011
+ };
1012
+ values: {
1013
+ building?: number;
1014
+ contents?: number;
1015
+ businessIncome?: number;
1016
+ total?: number;
1017
+ };
1018
+ construction: {
1019
+ type?: string;
1020
+ yearBuilt?: number;
1021
+ stories?: number;
1022
+ squareFeet?: number;
1023
+ roofType?: string;
1024
+ };
1025
+ occupancy?: string;
1026
+ protectionClass?: string;
1027
+ sprinklered?: boolean;
1028
+ validationIssues?: string[];
1029
+ }
1030
+ interface GetSOVResponse {
1031
+ success: boolean;
1032
+ sov: SOV;
1033
+ processing?: {
1034
+ message: string;
1035
+ status: string;
1036
+ };
1037
+ locations?: {
1038
+ items: SOVLocation[];
1039
+ pagination: {
1040
+ total: number;
1041
+ limit: number;
1042
+ offset: number;
1043
+ hasMore: boolean;
1044
+ };
1045
+ };
1046
+ traceId: string;
1047
+ }
1048
+ interface ListSOVsResponse {
1049
+ success: boolean;
1050
+ sovs: SOV[];
1051
+ count: number;
1052
+ traceId: string;
1053
+ }
1054
+ interface ListSOVsOptions {
1055
+ /** Filter by status */
1056
+ status?: 'uploaded' | 'parsing' | 'parsed' | 'validated' | 'error';
1057
+ /** Maximum results (default: 50) */
1058
+ limit?: number;
1059
+ }
1060
+ declare class SOVModule {
1061
+ private http;
1062
+ constructor(http: HttpClient);
1063
+ /**
1064
+ * Upload a Schedule of Values file
1065
+ *
1066
+ * @example
1067
+ * ```typescript
1068
+ * import fs from 'fs';
1069
+ *
1070
+ * const result = await client.sov.upload({
1071
+ * file: fs.readFileSync('./property-schedule.xlsx'),
1072
+ * fileName: 'property-schedule.xlsx',
1073
+ * lineOfBusiness: 'property',
1074
+ * effectiveDate: '2024-01-01'
1075
+ * });
1076
+ *
1077
+ * console.log('SOV ID:', result.sovId);
1078
+ * ```
1079
+ */
1080
+ upload(request: UploadSOVRequest): Promise<UploadSOVResponse>;
1081
+ /**
1082
+ * List SOVs for the company
1083
+ */
1084
+ list(options?: ListSOVsOptions): Promise<ListSOVsResponse>;
1085
+ /**
1086
+ * Get a single SOV by ID with full details and locations
1087
+ *
1088
+ * @example
1089
+ * ```typescript
1090
+ * const { sov, locations } = await client.sov.get('sov-uuid');
1091
+ * console.log(`${sov.totalLocations} locations, TIV: $${sov.totalTIV}`);
1092
+ *
1093
+ * // Access individual locations
1094
+ * for (const loc of locations.items) {
1095
+ * console.log(`${loc.address.city}, ${loc.address.state}: $${loc.values.total}`);
1096
+ * }
1097
+ * ```
1098
+ */
1099
+ get(sovId: string, options?: {
1100
+ includeLocations?: boolean;
1101
+ locationLimit?: number;
1102
+ locationOffset?: number;
1103
+ }): Promise<GetSOVResponse>;
1104
+ /**
1105
+ * Wait for SOV parsing to complete
1106
+ */
1107
+ waitForParsing(sovId: string, options?: {
1108
+ timeoutMs?: number;
1109
+ pollIntervalMs?: number;
1110
+ }): Promise<SOV>;
1111
+ }
1112
+
1113
+ /**
1114
+ * ApiKeys Module
1115
+ *
1116
+ * Handles API key lifecycle management: create, list, revoke, and rotate.
1117
+ */
1118
+
1119
+ interface ApiKey {
1120
+ id: string;
1121
+ name: string;
1122
+ prefix: string;
1123
+ scopes: string[];
1124
+ isActive: boolean;
1125
+ createdAt: string;
1126
+ expiresAt?: string;
1127
+ lastUsedAt?: string;
1128
+ }
1129
+ /** Full API key including the secret — shown once at creation time */
1130
+ interface CreatedApiKey extends ApiKey {
1131
+ key: string;
1132
+ }
1133
+ interface RotateResult {
1134
+ newKey: CreatedApiKey;
1135
+ oldKeyValidUntil: string;
1136
+ rotationId: string;
1137
+ status: 'rotating';
1138
+ }
1139
+ interface CreateApiKeyInput {
1140
+ name: string;
1141
+ scopes: ('read' | 'write' | 'admin')[];
1142
+ expiresInDays?: number;
1143
+ }
1144
+ interface ListApiKeysOptions {
1145
+ limit?: number;
1146
+ cursor?: string;
1147
+ }
1148
+ interface IdempotencyOptions {
1149
+ idempotencyKey?: string;
1150
+ }
1151
+ interface ListApiKeysResponse {
1152
+ success: boolean;
1153
+ data: ApiKey[];
1154
+ pagination: {
1155
+ cursor?: string;
1156
+ nextCursor?: string;
1157
+ hasMore: boolean;
1158
+ };
1159
+ traceId: string;
1160
+ }
1161
+ declare class ApiKeysModule {
1162
+ private http;
1163
+ constructor(http: HttpClient);
1164
+ /**
1165
+ * Create a new API key.
1166
+ *
1167
+ * The returned `key` value (the full secret) is shown **only once**.
1168
+ * Store it securely — it cannot be retrieved again.
1169
+ *
1170
+ * @example
1171
+ * ```typescript
1172
+ * const created = await client.apiKeys.create({
1173
+ * name: 'My Integration Key',
1174
+ * scopes: ['read', 'write'],
1175
+ * expiresInDays: 365,
1176
+ * });
1177
+ * console.log('Save this key now:', created.key);
1178
+ * ```
1179
+ */
1180
+ create(input: CreateApiKeyInput, options?: IdempotencyOptions): Promise<CreatedApiKey>;
1181
+ /**
1182
+ * List API keys for the current workspace.
1183
+ *
1184
+ * @example
1185
+ * ```typescript
1186
+ * const { data, pagination } = await client.apiKeys.list({ limit: 20 });
1187
+ * if (pagination.hasMore) {
1188
+ * const next = await client.apiKeys.list({ cursor: pagination.nextCursor });
1189
+ * }
1190
+ * ```
1191
+ */
1192
+ list(options?: ListApiKeysOptions): Promise<{
1193
+ data: ApiKey[];
1194
+ pagination: ListApiKeysResponse['pagination'];
1195
+ }>;
1196
+ /**
1197
+ * Revoke an API key immediately.
1198
+ *
1199
+ * @example
1200
+ * ```typescript
1201
+ * await client.apiKeys.revoke('key-id-here');
1202
+ * ```
1203
+ */
1204
+ revoke(keyId: string): Promise<void>;
1205
+ /**
1206
+ * Rotate an API key.
1207
+ *
1208
+ * Issues a new key while keeping the old key valid for `gracePeriodHours`
1209
+ * so you have time to update your integrations.
1210
+ *
1211
+ * @example
1212
+ * ```typescript
1213
+ * const { newKey, oldKeyValidUntil } = await client.apiKeys.rotate(
1214
+ * 'key-id-here',
1215
+ * { gracePeriodHours: 24 },
1216
+ * { idempotencyKey: 'my-rotation-id' }
1217
+ * );
1218
+ * console.log('New key (save now):', newKey.key);
1219
+ * console.log('Old key expires:', oldKeyValidUntil);
1220
+ * ```
1221
+ */
1222
+ rotate(keyId: string, options: {
1223
+ gracePeriodHours: number;
1224
+ }, idempotency?: IdempotencyOptions): Promise<RotateResult>;
1225
+ }
1226
+
1227
+ /**
1228
+ * Usage Module
1229
+ *
1230
+ * Provides access to API usage data: billing summaries, daily breakdowns,
1231
+ * and current rate-limit status.
1232
+ */
1233
+
1234
+ interface MeterUsage {
1235
+ used: number;
1236
+ included: number;
1237
+ overage: number;
1238
+ overageCostCents: number;
1239
+ }
1240
+ interface UsageSummary {
1241
+ /** Billing period, e.g. '2026-04' */
1242
+ period: string;
1243
+ /** Plan name, e.g. 'growth' */
1244
+ plan: string;
1245
+ /** Whether the period is still being estimated, has been invoiced, or is a shadow run */
1246
+ status: 'estimated' | 'invoiced' | 'shadow';
1247
+ /** Per-meter usage breakdown keyed by meter name */
1248
+ meters: Record<string, MeterUsage>;
1249
+ /** Total overage charges in cents across all meters */
1250
+ totalOverageCents: number;
1251
+ /** ISO-8601 timestamp of when this snapshot was computed */
1252
+ asOf: string;
1253
+ }
1254
+ interface DailyUsage {
1255
+ date: string;
1256
+ meter: string;
1257
+ quantity: number;
1258
+ }
1259
+ interface RateLimitStatus {
1260
+ requestsPerMinute: number;
1261
+ remaining: number;
1262
+ /** ISO-8601 timestamp at which the rate-limit window resets */
1263
+ resetsAt: string;
1264
+ }
1265
+ interface DailyUsageOptions {
1266
+ /** Start date (inclusive), e.g. '2026-04-01' */
1267
+ from: string;
1268
+ /** End date (inclusive), e.g. '2026-04-30' */
1269
+ to: string;
1270
+ /** Filter to a single meter name */
1271
+ meter?: string;
1272
+ /** Aggregate by 'day' (default server behaviour) or 'meter' */
1273
+ groupBy?: 'day' | 'meter';
1274
+ }
1275
+ declare class UsageModule {
1276
+ private http;
1277
+ constructor(http: HttpClient);
1278
+ /**
1279
+ * Get a billing-period summary across all meters.
1280
+ *
1281
+ * @example
1282
+ * ```typescript
1283
+ * const summary = await client.usage.summary();
1284
+ * console.log(`Plan: ${summary.plan}, overage: $${summary.totalOverageCents / 100}`);
1285
+ * ```
1286
+ */
1287
+ summary(): Promise<UsageSummary>;
1288
+ /**
1289
+ * Get daily usage data for a date range.
1290
+ *
1291
+ * @example
1292
+ * ```typescript
1293
+ * const { data } = await client.usage.daily({
1294
+ * from: '2026-04-01',
1295
+ * to: '2026-04-30',
1296
+ * meter: 'api_requests',
1297
+ * });
1298
+ * const total = data.reduce((sum, row) => sum + row.quantity, 0);
1299
+ * ```
1300
+ */
1301
+ daily(options: DailyUsageOptions): Promise<{
1302
+ data: DailyUsage[];
1303
+ }>;
1304
+ /**
1305
+ * Get the current rate-limit status for this API key.
1306
+ *
1307
+ * @example
1308
+ * ```typescript
1309
+ * const limits = await client.usage.rateLimits();
1310
+ * console.log(`${limits.remaining}/${limits.requestsPerMinute} requests remaining`);
1311
+ * ```
1312
+ */
1313
+ rateLimits(): Promise<RateLimitStatus>;
1314
+ }
1315
+
1316
+ /**
1317
+ * Knowledge Module
1318
+ *
1319
+ * Search notecards and document chunks, list notecards, and
1320
+ * retrieve structured facts extracted from documents.
1321
+ */
1322
+
1323
+ interface KnowledgeSearchResult {
1324
+ id: string;
1325
+ type: 'notecard' | 'document_chunk';
1326
+ title: string;
1327
+ summary: string;
1328
+ score: number;
1329
+ documentId?: string;
1330
+ notecardId?: string;
1331
+ chunkId?: string;
1332
+ highlights: string[];
1333
+ metadata: Record<string, unknown>;
1334
+ }
1335
+ interface Notecard {
1336
+ id: string;
1337
+ tocPath: string;
1338
+ templateType: string;
1339
+ title: string;
1340
+ summary: string;
1341
+ content: string;
1342
+ validFrom?: string;
1343
+ validTo?: string;
1344
+ createdAt: string;
1345
+ updatedAt?: string;
1346
+ }
1347
+ interface DocumentFacts {
1348
+ policies: Array<{
1349
+ id: string;
1350
+ policyType: string;
1351
+ policyNumber?: string;
1352
+ carrierName?: string;
1353
+ effectiveDate?: string;
1354
+ expirationDate?: string;
1355
+ premium?: number;
1356
+ coverageLimit?: number;
1357
+ }>;
1358
+ dates: Record<string, string>;
1359
+ carriers: string[];
1360
+ coverages: Array<{
1361
+ type: string;
1362
+ limit?: number;
1363
+ deductible?: number;
1364
+ }>;
1365
+ }
1366
+ interface SearchInput {
1367
+ query: string;
1368
+ types?: ('notecard' | 'document_chunk')[];
1369
+ limit?: number;
1370
+ }
1371
+ interface ListNotecardsOptions {
1372
+ type?: string;
1373
+ limit?: number;
1374
+ cursor?: string;
1375
+ }
1376
+ interface KnowledgePagination {
1377
+ cursor: string | null;
1378
+ nextCursor: string | null;
1379
+ hasMore: boolean;
1380
+ }
1381
+ declare class KnowledgeModule {
1382
+ private http;
1383
+ constructor(http: HttpClient);
1384
+ /**
1385
+ * Search notecards and document chunks using semantic search.
1386
+ *
1387
+ * Uses POST because the query body can be complex (filters, types, etc.).
1388
+ *
1389
+ * @example
1390
+ * ```typescript
1391
+ * const { data, pagination } = await client.knowledge.search({
1392
+ * query: 'general liability occurrence limit',
1393
+ * types: ['notecard'],
1394
+ * limit: 10,
1395
+ * });
1396
+ * console.log(data[0].title, data[0].score);
1397
+ * ```
1398
+ */
1399
+ search(input: SearchInput): Promise<{
1400
+ data: KnowledgeSearchResult[];
1401
+ pagination: KnowledgePagination;
1402
+ }>;
1403
+ /**
1404
+ * List notecards, optionally filtered by template type.
1405
+ *
1406
+ * @example
1407
+ * ```typescript
1408
+ * const { data, pagination } = await client.knowledge.notecards({
1409
+ * type: 'policy_summary',
1410
+ * limit: 50,
1411
+ * });
1412
+ * if (pagination.hasMore) {
1413
+ * const next = await client.knowledge.notecards({ cursor: pagination.nextCursor! });
1414
+ * }
1415
+ * ```
1416
+ */
1417
+ notecards(options?: ListNotecardsOptions): Promise<{
1418
+ data: Notecard[];
1419
+ pagination: KnowledgePagination;
1420
+ }>;
1421
+ /**
1422
+ * Retrieve structured facts extracted from a document.
1423
+ *
1424
+ * @throws {NotFoundError} when the document does not exist
1425
+ *
1426
+ * @example
1427
+ * ```typescript
1428
+ * const facts = await client.knowledge.documentFacts('doc-uuid');
1429
+ * console.log(facts.carriers); // ['Hartford', 'Chubb']
1430
+ * console.log(facts.policies[0].policyType); // 'GL'
1431
+ * ```
1432
+ */
1433
+ documentFacts(documentId: string): Promise<DocumentFacts>;
1434
+ }
1435
+
1436
+ /**
1437
+ * Onboarding Module
1438
+ *
1439
+ * Provides a status checklist for developer onboarding: account setup,
1440
+ * company profile completeness, billing plan, and quote readiness.
1441
+ */
1442
+
1443
+ /** The next recommended action for the developer to complete onboarding. */
1444
+ interface OnboardingNextStep {
1445
+ /** Short identifier for the action, e.g. 'complete_company_profile'. */
1446
+ action: string;
1447
+ /** Optional list of fields that are missing or incomplete. */
1448
+ fields?: string[];
1449
+ /** Optional URL the developer can visit to resolve the step. */
1450
+ url?: string;
1451
+ }
1452
+ /**
1453
+ * Onboarding status checklist returned by `onboarding.status()`.
1454
+ */
1455
+ interface OnboardingStatus {
1456
+ /**
1457
+ * Account-level setup (API key present, company exists).
1458
+ * Always 'complete' when this endpoint returns successfully.
1459
+ */
1460
+ account: 'complete';
1461
+ /**
1462
+ * Minimum company profile (name + industry present).
1463
+ * 'minimum' = name and industry filled in.
1464
+ * 'complete' = all core fields populated (contact email, address, etc.).
1465
+ */
1466
+ company: 'minimum' | 'complete';
1467
+ /**
1468
+ * Full company profile completeness (all non-critical optional fields).
1469
+ * 'incomplete' = some optional fields are missing.
1470
+ * 'complete' = every optional field is populated.
1471
+ */
1472
+ companyFull: 'incomplete' | 'complete';
1473
+ /**
1474
+ * Current billing plan status.
1475
+ * 'sandbox' = free developer sandbox.
1476
+ * 'active' = paid plan in good standing.
1477
+ * 'past_due' = payment failed, degraded access.
1478
+ * 'cancelled' = subscription cancelled.
1479
+ */
1480
+ billing: 'sandbox' | 'active' | 'past_due' | 'cancelled';
1481
+ /**
1482
+ * Whether the company has enough information to submit a quote request.
1483
+ * Requires at minimum: company name, industry, contact email.
1484
+ */
1485
+ quoteReady: boolean;
1486
+ /**
1487
+ * Whether the API key belongs to a sandbox (developer-trial) company.
1488
+ */
1489
+ sandbox: boolean;
1490
+ /**
1491
+ * The next recommended action, or null if onboarding is fully complete.
1492
+ */
1493
+ nextStep: OnboardingNextStep | null;
1494
+ }
1495
+ declare class OnboardingModule {
1496
+ private http;
1497
+ constructor(http: HttpClient);
1498
+ /**
1499
+ * Retrieve the onboarding status checklist for the authenticated company.
1500
+ *
1501
+ * Use this to determine what setup steps remain before going live.
1502
+ *
1503
+ * @example
1504
+ * ```typescript
1505
+ * const status = await client.onboarding.status();
1506
+ *
1507
+ * if (!status.quoteReady) {
1508
+ * console.log('Next step:', status.nextStep?.action);
1509
+ * }
1510
+ *
1511
+ * if (status.sandbox) {
1512
+ * console.log('Running in sandbox mode — upgrade to submit live quotes.');
1513
+ * }
1514
+ * ```
1515
+ */
1516
+ status(): Promise<OnboardingStatus>;
1517
+ }
1518
+
1519
+ /**
1520
+ * Delegance SDK Client
1521
+ *
1522
+ * Main entry point for interacting with the Delegance API.
1523
+ *
1524
+ * @example
1525
+ * ```typescript
1526
+ * import { DeleganceClient } from '@delegance/sdk';
1527
+ *
1528
+ * const client = new DeleganceClient({
1529
+ * apiKey: 'dlg_xxx_sk_xxx',
1530
+ * baseUrl: 'https://app.delegance.ai'
1531
+ * });
1532
+ *
1533
+ * // Create a company
1534
+ * const company = await client.companies.create({
1535
+ * name: 'ABC Construction',
1536
+ * industry: 'construction',
1537
+ * companySize: '11-25',
1538
+ * contactEmail: 'contact@abc.com'
1539
+ * });
1540
+ *
1541
+ * // Upload a document
1542
+ * const doc = await client.documents.upload({
1543
+ * companyId: company.id,
1544
+ * file: fs.readFileSync('./policy.pdf'),
1545
+ * fileName: 'GL-2025.pdf'
1546
+ * });
1547
+ *
1548
+ * // Wait for extraction
1549
+ * const result = await client.documents.waitForExtraction(doc.id);
1550
+ * ```
1551
+ */
1552
+
1553
+ declare class DeleganceClient {
1554
+ private http;
1555
+ /** Companies module for managing companies */
1556
+ readonly companies: CompaniesModule;
1557
+ /** Documents module for uploading and managing documents */
1558
+ readonly documents: DocumentsModule;
1559
+ /** Chat module for interacting with the Orin assistant */
1560
+ readonly chat: ChatModule;
1561
+ /** Quotes module for requesting insurance quotes */
1562
+ readonly quotes: QuotesModule;
1563
+ /** Policies module for managing insurance policies */
1564
+ readonly policies: PoliciesModule;
1565
+ /** COI module for generating certificates of insurance */
1566
+ readonly coi: COIModule;
1567
+ /** SOV module for managing schedules of values */
1568
+ readonly sov: SOVModule;
1569
+ /** API keys module for managing API keys */
1570
+ readonly apiKeys: ApiKeysModule;
1571
+ /** Usage module for billing summaries, daily data, and rate-limit status */
1572
+ readonly usage: UsageModule;
1573
+ /** Knowledge module for searching notecards and document facts */
1574
+ readonly knowledge: KnowledgeModule;
1575
+ /** Onboarding module for checking developer setup status */
1576
+ readonly onboarding: OnboardingModule;
1577
+ /**
1578
+ * Create a new Delegance client
1579
+ *
1580
+ * @param config - Client configuration
1581
+ * @throws Error if API key is missing or invalid format
1582
+ */
1583
+ constructor(config: DeleganceClientConfig);
1584
+ /**
1585
+ * Get the SDK version
1586
+ */
1587
+ static get version(): string;
1588
+ /**
1589
+ * Verify the API key is valid by making a test request
1590
+ *
1591
+ * @example
1592
+ * ```typescript
1593
+ * const isValid = await client.verifyApiKey();
1594
+ * if (!isValid) {
1595
+ * console.error('API key is invalid or expired');
1596
+ * }
1597
+ * ```
1598
+ */
1599
+ verifyApiKey(): Promise<boolean>;
1600
+ }
1601
+ /**
1602
+ * Create a Delegance client from environment variables
1603
+ *
1604
+ * Reads from:
1605
+ * - DELEGANCE_API_KEY - Required API key
1606
+ * - DELEGANCE_BASE_URL - Optional base URL (default: https://app.delegance.ai)
1607
+ *
1608
+ * @example
1609
+ * ```typescript
1610
+ * // Ensure DELEGANCE_API_KEY is set in environment
1611
+ * const client = createClientFromEnv();
1612
+ * ```
1613
+ */
1614
+ declare function createClientFromEnv(): DeleganceClient;
1615
+
1616
+ export { type APIKey, type APIResponse, type ApiKey, ApiKeysModule, AuthenticationError, type COI, COIModule, type Carrier, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreatedAPIKey, type CreatedApiKey, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type ExtractedPolicy, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, KnowledgeModule, type KnowledgeSearchResult, 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, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingStatus, type PaginatedResponse, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, type SubmitQuoteResponse, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, createClientFromEnv };