@dialgem/sdk 0.1.0-beta.0 → 0.1.0-beta.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/dist/index.d.cts CHANGED
@@ -110,7 +110,12 @@ type Fetch = (url: string, init: FetchInit) => Promise<FetchResponse>;
110
110
  interface FetchInit {
111
111
  method: string;
112
112
  headers: Record<string, string>;
113
- body?: string;
113
+ /**
114
+ * A JSON string, or a `FormData` for a file upload — in which case
115
+ * `Content-Type` is deliberately absent, since only `fetch` knows the
116
+ * multipart boundary it is about to generate.
117
+ */
118
+ body?: string | FormData;
114
119
  signal: AbortSignal;
115
120
  /**
116
121
  * Always `"manual"`. A followed redirect re-sends the API key to wherever the
@@ -133,7 +138,7 @@ interface RequestOptions {
133
138
  /**
134
139
  * Retries on 408/429/5xx and connection failures.
135
140
  *
136
- * GET, PATCH and DELETE use the client's `maxRetries` unless overridden here.
141
+ * GET, PUT, PATCH and DELETE use the client's `maxRetries` unless overridden here.
137
142
  * **POST is never retried unless you set this explicitly**: most POSTs create
138
143
  * things, and an outbound call retried after an ambiguous 502 dials the person twice.
139
144
  */
@@ -143,7 +148,9 @@ interface RequestOptions {
143
148
  /** Extra headers for this request only. */
144
149
  headers?: Record<string, string> | undefined;
145
150
  }
146
- type QueryValue = string | number | boolean | null | undefined;
151
+ type QueryScalar = string | number | boolean;
152
+ /** Arrays are sent as repeated parameters: `{ status: ["a", "b"] }` → `?status=a&status=b`. */
153
+ type QueryValue = QueryScalar | QueryScalar[] | null | undefined;
147
154
  type Query = Record<string, QueryValue>;
148
155
  interface HttpClientOptions {
149
156
  apiKey: string;
@@ -153,13 +160,22 @@ interface HttpClientOptions {
153
160
  fetch: Fetch;
154
161
  defaultHeaders: Record<string, string>;
155
162
  }
156
- type Method = "GET" | "POST" | "PATCH" | "DELETE";
163
+ type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
157
164
  declare class HttpClient {
158
165
  #private;
159
166
  readonly baseURL: string;
160
167
  constructor(options: HttpClientOptions);
161
168
  get<T>(path: string, query?: Query, options?: RequestOptions): Promise<T>;
162
169
  post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
170
+ /**
171
+ * POST a `FormData` body — file uploads.
172
+ *
173
+ * The body is sent as-is and `Content-Type` is left unset, because only
174
+ * `fetch` knows the multipart boundary it is about to generate. Setting the
175
+ * header ourselves produces a request no server can parse.
176
+ */
177
+ postForm<T>(path: string, form: FormData, options?: RequestOptions): Promise<T>;
178
+ put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
163
179
  patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
164
180
  delete<T>(path: string, options?: RequestOptions): Promise<T>;
165
181
  request<T>(method: Method, path: string, { query, body, options }: {
@@ -175,12 +191,22 @@ interface components {
175
191
  schemas: {
176
192
  /** AgentCreate */
177
193
  AgentCreate: {
194
+ /**
195
+ * Adaptive Response Wait
196
+ * @default false
197
+ */
198
+ adaptive_response_wait?: boolean;
178
199
  /**
179
200
  * Agent Type
180
201
  * @default llm
181
202
  * @enum {string}
182
203
  */
183
204
  agent_type?: "llm" | "multi_prompt" | "flow";
205
+ /**
206
+ * Allow User Dtmf
207
+ * @default false
208
+ */
209
+ allow_user_dtmf?: boolean;
184
210
  /**
185
211
  * Ambient Sound
186
212
  * @default none
@@ -204,8 +230,24 @@ interface components {
204
230
  begin_message_delay_ms?: number;
205
231
  /** Boosted Keywords */
206
232
  boosted_keywords?: string[];
233
+ /**
234
+ * Call Screen Handling Enabled
235
+ * @default false
236
+ */
237
+ call_screen_handling_enabled?: boolean;
238
+ /**
239
+ * Call Screen Message
240
+ * @default
241
+ */
242
+ call_screen_message?: string;
207
243
  /** Data Retention Days */
208
244
  data_retention_days?: number | null;
245
+ /**
246
+ * Data Storage Setting
247
+ * @default everything
248
+ * @enum {string}
249
+ */
250
+ data_storage_setting?: "everything" | "everything_except_pii" | "basic_attributes_only";
209
251
  /** Default Dynamic Variables */
210
252
  default_dynamic_variables?: {
211
253
  [key: string]: string;
@@ -215,7 +257,17 @@ interface components {
215
257
  * @default off
216
258
  * @enum {string}
217
259
  */
218
- denoising_mode?: "off" | "noise-cancellation";
260
+ denoising_mode?: "off" | "noise-cancellation" | "noise-and-background-speech-cancellation";
261
+ /**
262
+ * Denoising Strength
263
+ * @default 0.5
264
+ */
265
+ denoising_strength?: number;
266
+ /**
267
+ * Dnc Detection Enabled
268
+ * @default false
269
+ */
270
+ dnc_detection_enabled?: boolean;
219
271
  /**
220
272
  * Enable Backchannel
221
273
  * @default false
@@ -240,16 +292,30 @@ interface components {
240
292
  /** First Message */
241
293
  first_message?: string | null;
242
294
  flow_config?: components["schemas"]["FlowConfig"] | null;
295
+ /** Flow Id */
296
+ flow_id?: string | null;
243
297
  /**
244
298
  * Interruption Sensitivity
245
299
  * @default 1
246
300
  */
247
301
  interruption_sensitivity?: number;
302
+ /**
303
+ * Ivr Hangup Enabled
304
+ * @default false
305
+ */
306
+ ivr_hangup_enabled?: boolean;
307
+ /**
308
+ * Ivr Prompt
309
+ * @default
310
+ */
311
+ ivr_prompt?: string;
248
312
  /**
249
313
  * Language
250
314
  * @default en
251
315
  */
252
316
  language?: string;
317
+ /** Llm Id */
318
+ llm_id?: string | null;
253
319
  /** Llm Model */
254
320
  llm_model?: string;
255
321
  /**
@@ -279,6 +345,8 @@ interface components {
279
345
  * @default false
280
346
  */
281
347
  opt_out_transcript_storage?: boolean;
348
+ /** Pii Categories */
349
+ pii_categories?: ("email" | "credit_card" | "ssn" | "phone_number")[];
282
350
  /**
283
351
  * Pii Redaction Enabled
284
352
  * @default false
@@ -291,6 +359,11 @@ interface components {
291
359
  * @default claude-sonnet-4-6
292
360
  */
293
361
  post_call_analysis_model?: string;
362
+ post_call_builtin_fields?: components["schemas"]["BuiltinAnalysisFields"];
363
+ /** Pronunciation Dictionary */
364
+ pronunciation_dictionary?: components["schemas"]["PronunciationEntry"][];
365
+ /** Reminder Max Count */
366
+ reminder_max_count?: number | null;
294
367
  /**
295
368
  * Reminder Message
296
369
  * @default
@@ -315,6 +388,12 @@ interface components {
315
388
  starting_state?: string | null;
316
389
  /** States */
317
390
  states?: components["schemas"]["PromptState"][];
391
+ /**
392
+ * Stt Mode
393
+ * @default fast
394
+ * @enum {string}
395
+ */
396
+ stt_mode?: "fast" | "accurate";
318
397
  /**
319
398
  * Stt Model
320
399
  * @enum {string}
@@ -335,6 +414,13 @@ interface components {
335
414
  * @default cartesia
336
415
  */
337
416
  tts_engine?: string;
417
+ user_dtmf_options?: components["schemas"]["UserDtmfOptions"];
418
+ /**
419
+ * Vocab Specialization
420
+ * @default general
421
+ * @enum {string}
422
+ */
423
+ vocab_specialization?: "general" | "medical";
338
424
  /**
339
425
  * Voice Id
340
426
  * @default
@@ -366,10 +452,20 @@ interface components {
366
452
  * @default
367
453
  */
368
454
  voicemail_message?: string;
455
+ /**
456
+ * Voicemail Prompt
457
+ * @default
458
+ */
459
+ voicemail_prompt?: string;
369
460
  /** Webhook Events */
370
- webhook_events?: ("call_started" | "call_ended" | "call_analyzed")[];
461
+ webhook_events?: ("call_started" | "call_ended" | "call_analyzed" | "transcript_updated" | "transfer_started" | "transfer_bridged" | "transfer_cancelled" | "transfer_ended" | "chat_started" | "chat_ended" | "chat_analyzed")[];
371
462
  /** Webhook Signing Secret */
372
463
  webhook_signing_secret?: string | null;
464
+ /**
465
+ * Webhook Timeout Ms
466
+ * @default 10000
467
+ */
468
+ webhook_timeout_ms?: number;
373
469
  /** Webhook Url */
374
470
  webhook_url?: string | null;
375
471
  };
@@ -417,8 +513,12 @@ interface components {
417
513
  };
418
514
  /** AgentUpdate */
419
515
  AgentUpdate: {
516
+ /** Adaptive Response Wait */
517
+ adaptive_response_wait?: boolean | null;
420
518
  /** Agent Type */
421
519
  agent_type?: ("llm" | "multi_prompt" | "flow") | null;
520
+ /** Allow User Dtmf */
521
+ allow_user_dtmf?: boolean | null;
422
522
  /** Ambient Sound */
423
523
  ambient_sound?: ("none" | "coffee-shop" | "call-center" | "convention-hall" | "summer-outdoor" | "mountain-outdoor" | "static-noise") | null;
424
524
  /** Ambient Sound Volume */
@@ -429,14 +529,24 @@ interface components {
429
529
  begin_message_delay_ms?: number | null;
430
530
  /** Boosted Keywords */
431
531
  boosted_keywords?: string[] | null;
532
+ /** Call Screen Handling Enabled */
533
+ call_screen_handling_enabled?: boolean | null;
534
+ /** Call Screen Message */
535
+ call_screen_message?: string | null;
432
536
  /** Data Retention Days */
433
537
  data_retention_days?: number | null;
538
+ /** Data Storage Setting */
539
+ data_storage_setting?: ("everything" | "everything_except_pii" | "basic_attributes_only") | null;
434
540
  /** Default Dynamic Variables */
435
541
  default_dynamic_variables?: {
436
542
  [key: string]: string;
437
543
  } | null;
438
544
  /** Denoising Mode */
439
- denoising_mode?: ("off" | "noise-cancellation") | null;
545
+ denoising_mode?: ("off" | "noise-cancellation" | "noise-and-background-speech-cancellation") | null;
546
+ /** Denoising Strength */
547
+ denoising_strength?: number | null;
548
+ /** Dnc Detection Enabled */
549
+ dnc_detection_enabled?: boolean | null;
440
550
  /** Enable Backchannel */
441
551
  enable_backchannel?: boolean | null;
442
552
  /** Enable Transcription Formatting */
@@ -452,10 +562,20 @@ interface components {
452
562
  /** First Message */
453
563
  first_message?: string | null;
454
564
  flow_config?: components["schemas"]["FlowConfig"] | null;
565
+ /** Flow Id */
566
+ flow_id?: string | null;
567
+ /** Folder Id */
568
+ folder_id?: string | null;
455
569
  /** Interruption Sensitivity */
456
570
  interruption_sensitivity?: number | null;
571
+ /** Ivr Hangup Enabled */
572
+ ivr_hangup_enabled?: boolean | null;
573
+ /** Ivr Prompt */
574
+ ivr_prompt?: string | null;
457
575
  /** Language */
458
576
  language?: string | null;
577
+ /** Llm Id */
578
+ llm_id?: string | null;
459
579
  /** Llm Model */
460
580
  llm_model?: string | null;
461
581
  /** Llm Provider */
@@ -470,12 +590,19 @@ interface components {
470
590
  opt_out_call_recording?: boolean | null;
471
591
  /** Opt Out Transcript Storage */
472
592
  opt_out_transcript_storage?: boolean | null;
593
+ /** Pii Categories */
594
+ pii_categories?: ("email" | "credit_card" | "ssn" | "phone_number")[] | null;
473
595
  /** Pii Redaction Enabled */
474
596
  pii_redaction_enabled?: boolean | null;
475
597
  /** Post Call Analysis Data */
476
598
  post_call_analysis_data?: components["schemas"]["PostCallAnalysisVariable"][] | null;
477
599
  /** Post Call Analysis Model */
478
600
  post_call_analysis_model?: string | null;
601
+ post_call_builtin_fields?: components["schemas"]["BuiltinAnalysisFields"] | null;
602
+ /** Pronunciation Dictionary */
603
+ pronunciation_dictionary?: components["schemas"]["PronunciationEntry"][] | null;
604
+ /** Reminder Max Count */
605
+ reminder_max_count?: number | null;
479
606
  /** Reminder Message */
480
607
  reminder_message?: string | null;
481
608
  /** Reminder Trigger Ms */
@@ -488,6 +615,8 @@ interface components {
488
615
  starting_state?: string | null;
489
616
  /** States */
490
617
  states?: components["schemas"]["PromptState"][] | null;
618
+ /** Stt Mode */
619
+ stt_mode?: ("fast" | "accurate") | null;
491
620
  /** Stt Model */
492
621
  stt_model?: ("whisper" | "conformer" | "deepgram") | null;
493
622
  /** System Prompt */
@@ -496,6 +625,9 @@ interface components {
496
625
  temperature?: number | null;
497
626
  /** Tts Engine */
498
627
  tts_engine?: string | null;
628
+ user_dtmf_options?: components["schemas"]["UserDtmfOptions"] | null;
629
+ /** Vocab Specialization */
630
+ vocab_specialization?: ("general" | "medical") | null;
499
631
  /** Voice Id */
500
632
  voice_id?: string | null;
501
633
  /** Voice Speed */
@@ -508,13 +640,24 @@ interface components {
508
640
  voicemail_detection_enabled?: boolean | null;
509
641
  /** Voicemail Message */
510
642
  voicemail_message?: string | null;
643
+ /** Voicemail Prompt */
644
+ voicemail_prompt?: string | null;
511
645
  /** Webhook Events */
512
- webhook_events?: ("call_started" | "call_ended" | "call_analyzed")[] | null;
646
+ webhook_events?: ("call_started" | "call_ended" | "call_analyzed" | "transcript_updated" | "transfer_started" | "transfer_bridged" | "transfer_cancelled" | "transfer_ended" | "chat_started" | "chat_ended" | "chat_analyzed")[] | null;
513
647
  /** Webhook Signing Secret */
514
648
  webhook_signing_secret?: string | null;
649
+ /** Webhook Timeout Ms */
650
+ webhook_timeout_ms?: number | null;
515
651
  /** Webhook Url */
516
652
  webhook_url?: string | null;
517
653
  };
654
+ /** AgentVersionCreate */
655
+ AgentVersionCreate: {
656
+ /** Description */
657
+ description?: string | null;
658
+ /** Title */
659
+ title?: string | null;
660
+ };
518
661
  /** AgentWeightIn */
519
662
  AgentWeightIn: {
520
663
  /** Agent Id */
@@ -523,13 +666,34 @@ interface components {
523
666
  * Agent Version
524
667
  * @default 0
525
668
  */
526
- agent_version?: number;
669
+ agent_version?: number | "latest_published";
527
670
  /**
528
671
  * Weight
529
672
  * @default 1
530
673
  */
531
674
  weight?: number;
532
675
  };
676
+ /** Body_clone_voice_v1_voices_clone_post */
677
+ Body_clone_voice_v1_voices_clone_post: {
678
+ /** Consent Confirmed */
679
+ consent_confirmed: boolean;
680
+ /** Description */
681
+ description?: string | null;
682
+ /**
683
+ * Engine
684
+ * @default elevenlabs
685
+ */
686
+ engine?: string;
687
+ /** Files */
688
+ files: string[];
689
+ /**
690
+ * Language
691
+ * @default en
692
+ */
693
+ language?: string;
694
+ /** Name */
695
+ name: string;
696
+ };
533
697
  /** BranchNode */
534
698
  BranchNode: {
535
699
  display_position?: components["schemas"]["DisplayPosition"] | null;
@@ -551,6 +715,255 @@ interface components {
551
715
  } & {
552
716
  [key: string]: unknown;
553
717
  };
718
+ /** BuiltinAnalysisField */
719
+ BuiltinAnalysisField: {
720
+ /** Choices */
721
+ choices?: string[] | null;
722
+ /** Description */
723
+ description?: string | null;
724
+ /**
725
+ * Enabled
726
+ * @default true
727
+ */
728
+ enabled?: boolean;
729
+ };
730
+ /** BuiltinAnalysisFields */
731
+ BuiltinAnalysisFields: {
732
+ call_successful?: components["schemas"]["BuiltinAnalysisField"] | null;
733
+ call_summary?: components["schemas"]["BuiltinAnalysisField"] | null;
734
+ user_sentiment?: components["schemas"]["BuiltinAnalysisField"] | null;
735
+ };
736
+ /** CallPatch */
737
+ CallPatch: {
738
+ /** Amd Result */
739
+ amd_result?: {
740
+ [key: string]: unknown;
741
+ } | null;
742
+ /** Call Sid */
743
+ call_sid?: string | null;
744
+ /** Disconnection Reason */
745
+ disconnection_reason?: string | null;
746
+ /** Duration S */
747
+ duration_s?: number | null;
748
+ /** Ended At */
749
+ ended_at?: string | null;
750
+ /** Events */
751
+ events?: unknown[] | null;
752
+ /** Meta */
753
+ meta?: {
754
+ [key: string]: unknown;
755
+ } | null;
756
+ /** Metadata */
757
+ metadata?: {
758
+ [key: string]: unknown;
759
+ } | null;
760
+ /** Origination State */
761
+ origination_state?: string | null;
762
+ /** Recording Key */
763
+ recording_key?: string | null;
764
+ /** Status */
765
+ status?: string | null;
766
+ /** Transcript */
767
+ transcript?: unknown[] | null;
768
+ };
769
+ /** CaseBody */
770
+ CaseBody: {
771
+ /** Caller */
772
+ caller: {
773
+ [key: string]: unknown;
774
+ };
775
+ /** Checks */
776
+ checks: {
777
+ [key: string]: unknown;
778
+ }[];
779
+ /** Dynamic Variables */
780
+ dynamic_variables?: {
781
+ [key: string]: unknown;
782
+ };
783
+ /** Name */
784
+ name: string;
785
+ /** Tool Mocks */
786
+ tool_mocks?: {
787
+ [key: string]: unknown;
788
+ };
789
+ };
790
+ /** CaseUpdate */
791
+ CaseUpdate: {
792
+ /** Caller */
793
+ caller?: {
794
+ [key: string]: unknown;
795
+ } | null;
796
+ /** Checks */
797
+ checks?: {
798
+ [key: string]: unknown;
799
+ }[] | null;
800
+ /** Dynamic Variables */
801
+ dynamic_variables?: {
802
+ [key: string]: unknown;
803
+ } | null;
804
+ /** Name */
805
+ name?: string | null;
806
+ /** Tool Mocks */
807
+ tool_mocks?: {
808
+ [key: string]: unknown;
809
+ } | null;
810
+ };
811
+ /** ChatCreate */
812
+ ChatCreate: {
813
+ /** Agent Id */
814
+ agent_id: string;
815
+ /** Agent Version */
816
+ agent_version?: number | null;
817
+ /** Dynamic Variables */
818
+ dynamic_variables?: {
819
+ [key: string]: unknown;
820
+ } | null;
821
+ /** Metadata */
822
+ metadata?: {
823
+ [key: string]: unknown;
824
+ } | null;
825
+ };
826
+ /** ChatMessageCreate */
827
+ ChatMessageCreate: {
828
+ /** Content */
829
+ content: string;
830
+ };
831
+ /** ChatUpdate */
832
+ ChatUpdate: {
833
+ /** Metadata */
834
+ metadata?: {
835
+ [key: string]: unknown;
836
+ } | null;
837
+ };
838
+ /** CodeNode */
839
+ CodeNode: {
840
+ /** Code */
841
+ code?: string | null;
842
+ display_position?: components["schemas"]["DisplayPosition"] | null;
843
+ /** Edges */
844
+ edges?: components["schemas"]["Edge"][];
845
+ else_edge?: components["schemas"]["Edge"] | null;
846
+ /** Enable Typing Sound */
847
+ enable_typing_sound?: boolean | null;
848
+ /** Execution Status Variable */
849
+ execution_status_variable?: string | null;
850
+ /** Finetune Transition Examples */
851
+ finetune_transition_examples?: unknown[] | null;
852
+ global_node_setting?: components["schemas"]["GlobalNodeSetting"] | null;
853
+ /** Id */
854
+ id: string;
855
+ instruction?: components["schemas"]["Instruction"] | null;
856
+ /** Name */
857
+ name?: string | null;
858
+ /** Response Variables */
859
+ response_variables?: {
860
+ [key: string]: string;
861
+ } | null;
862
+ /** Speak During Execution */
863
+ speak_during_execution?: boolean | null;
864
+ /** Timeout Ms */
865
+ timeout_ms?: number | null;
866
+ /**
867
+ * Type
868
+ * @constant
869
+ */
870
+ type: "code";
871
+ /** Wait For Result */
872
+ wait_for_result?: boolean | null;
873
+ } & {
874
+ [key: string]: unknown;
875
+ };
876
+ /** ContactCreate */
877
+ ContactCreate: {
878
+ /** Attributes */
879
+ attributes?: {
880
+ [key: string]: unknown;
881
+ };
882
+ /** Default Country */
883
+ default_country?: string | null;
884
+ /** Email */
885
+ email?: string | null;
886
+ /** First Name */
887
+ first_name?: string | null;
888
+ /** Last Name */
889
+ last_name?: string | null;
890
+ /** List Ids */
891
+ list_ids?: string[];
892
+ /** Phone */
893
+ phone: string;
894
+ /** Timezone */
895
+ timezone?: string | null;
896
+ };
897
+ /** ContactCsvInspectRequest */
898
+ ContactCsvInspectRequest: {
899
+ /** Csv */
900
+ csv: string;
901
+ };
902
+ /** ContactImportCreate */
903
+ ContactImportCreate: {
904
+ /** Attribute Columns */
905
+ attribute_columns?: string[] | null;
906
+ /** Csv */
907
+ csv: string;
908
+ /** Default Country */
909
+ default_country?: string | null;
910
+ /**
911
+ * Dry Run
912
+ * @default false
913
+ */
914
+ dry_run?: boolean;
915
+ /** Filename */
916
+ filename?: string | null;
917
+ /** List Id */
918
+ list_id?: string | null;
919
+ /** Mapping */
920
+ mapping?: {
921
+ [key: string]: string;
922
+ } | null;
923
+ /**
924
+ * On Duplicate
925
+ * @default update
926
+ */
927
+ on_duplicate?: string;
928
+ };
929
+ /** ContactListCreate */
930
+ ContactListCreate: {
931
+ /** Description */
932
+ description?: string | null;
933
+ /** Name */
934
+ name: string;
935
+ };
936
+ /** ContactListMembersAdd */
937
+ ContactListMembersAdd: {
938
+ /** Contact Ids */
939
+ contact_ids: string[];
940
+ };
941
+ /** ContactListUpdate */
942
+ ContactListUpdate: {
943
+ /** Description */
944
+ description?: string | null;
945
+ /** Name */
946
+ name?: string | null;
947
+ };
948
+ /** ContactUpdate */
949
+ ContactUpdate: {
950
+ /** Attributes */
951
+ attributes?: {
952
+ [key: string]: unknown;
953
+ } | null;
954
+ /** Default Country */
955
+ default_country?: string | null;
956
+ /** Email */
957
+ email?: string | null;
958
+ /** First Name */
959
+ first_name?: string | null;
960
+ /** Last Name */
961
+ last_name?: string | null;
962
+ /** Phone */
963
+ phone?: string | null;
964
+ /** Timezone */
965
+ timezone?: string | null;
966
+ };
554
967
  /** ConversationNode */
555
968
  ConversationNode: {
556
969
  /** Allow Dtmf Interruption */
@@ -745,7 +1158,7 @@ interface components {
745
1158
  /** Model Temperature */
746
1159
  model_temperature?: number | null;
747
1160
  /** Nodes */
748
- nodes?: (components["schemas"]["ConversationNode"] | components["schemas"]["SubagentNode"] | components["schemas"]["FunctionNode"] | components["schemas"]["McpNode"] | components["schemas"]["BranchNode"] | components["schemas"]["ExtractDynamicVariablesNode"] | components["schemas"]["TransferCallNode"] | components["schemas"]["PressDigitNode"] | components["schemas"]["AgentSwapNode"] | components["schemas"]["SmsNode"] | components["schemas"]["EndNode"] | components["schemas"]["OpaqueNode"])[];
1161
+ nodes?: (components["schemas"]["ConversationNode"] | components["schemas"]["SubagentNode"] | components["schemas"]["FunctionNode"] | components["schemas"]["McpNode"] | components["schemas"]["CodeNode"] | components["schemas"]["BranchNode"] | components["schemas"]["ExtractDynamicVariablesNode"] | components["schemas"]["TransferCallNode"] | components["schemas"]["PressDigitNode"] | components["schemas"]["AgentSwapNode"] | components["schemas"]["SmsNode"] | components["schemas"]["EndNode"] | components["schemas"]["OpaqueNode"])[];
749
1162
  /** Notes */
750
1163
  notes?: unknown[] | null;
751
1164
  /** Start Node Id */
@@ -761,6 +1174,17 @@ interface components {
761
1174
  } & {
762
1175
  [key: string]: unknown;
763
1176
  };
1177
+ /** FlowCreate */
1178
+ FlowCreate: {
1179
+ flow_config: components["schemas"]["FlowConfig"];
1180
+ /**
1181
+ * Language
1182
+ * @default en
1183
+ */
1184
+ language?: string;
1185
+ /** Name */
1186
+ name: string;
1187
+ };
764
1188
  /** FlowTool */
765
1189
  FlowTool: {
766
1190
  /** Description */
@@ -792,8 +1216,21 @@ interface components {
792
1216
  } & {
793
1217
  [key: string]: unknown;
794
1218
  };
1219
+ /** FlowUpdate */
1220
+ FlowUpdate: {
1221
+ flow_config?: components["schemas"]["FlowConfig"] | null;
1222
+ /** Language */
1223
+ language?: string | null;
1224
+ /** Name */
1225
+ name?: string | null;
1226
+ };
795
1227
  /** FunctionCreate */
796
1228
  FunctionCreate: {
1229
+ /**
1230
+ * Args At Root
1231
+ * @default false
1232
+ */
1233
+ args_at_root?: boolean;
797
1234
  /** Config */
798
1235
  config?: {
799
1236
  [key: string]: unknown;
@@ -810,7 +1247,7 @@ interface components {
810
1247
  * @default custom
811
1248
  * @enum {string}
812
1249
  */
813
- kind?: "custom" | "end_call" | "transfer_call" | "press_digit" | "agent_swap" | "check_availability_cal" | "book_appointment_cal";
1250
+ kind?: "custom" | "end_call" | "transfer_call" | "press_digit" | "agent_swap" | "check_availability_cal" | "book_appointment_cal" | "cancel_appointment_cal" | "reschedule_appointment_cal" | "check_availability_gcal" | "book_appointment_gcal";
814
1251
  /**
815
1252
  * Method
816
1253
  * @default POST
@@ -848,6 +1285,11 @@ interface components {
848
1285
  };
849
1286
  /** FunctionDef */
850
1287
  FunctionDef: {
1288
+ /**
1289
+ * Args At Root
1290
+ * @default false
1291
+ */
1292
+ args_at_root?: boolean;
851
1293
  /** Config */
852
1294
  config?: {
853
1295
  [key: string]: unknown;
@@ -866,7 +1308,7 @@ interface components {
866
1308
  * @default custom
867
1309
  * @enum {string}
868
1310
  */
869
- kind?: "custom" | "check_availability_cal" | "book_appointment_cal" | "end_call" | "transfer_call" | "press_digit" | "agent_swap";
1311
+ kind?: "custom" | "check_availability_cal" | "book_appointment_cal" | "cancel_appointment_cal" | "reschedule_appointment_cal" | "check_availability_gcal" | "book_appointment_gcal" | "end_call" | "transfer_call" | "press_digit" | "agent_swap";
870
1312
  /**
871
1313
  * Method
872
1314
  * @default POST
@@ -935,6 +1377,8 @@ interface components {
935
1377
  };
936
1378
  /** FunctionUpdate */
937
1379
  FunctionUpdate: {
1380
+ /** Args At Root */
1381
+ args_at_root?: boolean | null;
938
1382
  /** Config */
939
1383
  config?: {
940
1384
  [key: string]: unknown;
@@ -1041,6 +1485,56 @@ interface components {
1041
1485
  /** Value */
1042
1486
  value: string;
1043
1487
  };
1488
+ /** LLMCreate */
1489
+ LLMCreate: {
1490
+ /** Default Dynamic Variables */
1491
+ default_dynamic_variables?: {
1492
+ [key: string]: string;
1493
+ } | null;
1494
+ /** Fallback Llm Model */
1495
+ fallback_llm_model?: string | null;
1496
+ /** Fallback Llm Provider */
1497
+ fallback_llm_provider?: ("anthropic" | "openai") | null;
1498
+ /** First Message */
1499
+ first_message?: string | null;
1500
+ /** Llm Model */
1501
+ llm_model?: string | null;
1502
+ /** Llm Provider */
1503
+ llm_provider?: ("anthropic" | "openai") | null;
1504
+ /** Max Tokens */
1505
+ max_tokens?: number | null;
1506
+ /** Name */
1507
+ name: string;
1508
+ /** System Prompt */
1509
+ system_prompt?: string | null;
1510
+ /** Temperature */
1511
+ temperature?: number | null;
1512
+ };
1513
+ /** LLMUpdate */
1514
+ LLMUpdate: {
1515
+ /** Default Dynamic Variables */
1516
+ default_dynamic_variables?: {
1517
+ [key: string]: string;
1518
+ } | null;
1519
+ /** Fallback Llm Model */
1520
+ fallback_llm_model?: string | null;
1521
+ /** Fallback Llm Provider */
1522
+ fallback_llm_provider?: ("anthropic" | "openai") | null;
1523
+ /** First Message */
1524
+ first_message?: string | null;
1525
+ /** Llm Model */
1526
+ llm_model?: string | null;
1527
+ /** Llm Provider */
1528
+ llm_provider?: ("anthropic" | "openai") | null;
1529
+ /** Max Tokens */
1530
+ max_tokens?: number | null;
1531
+ /** Name */
1532
+ name?: string | null;
1533
+ /** System Prompt */
1534
+ system_prompt?: string | null;
1535
+ /** Temperature */
1536
+ temperature?: number | null;
1537
+ };
1044
1538
  /** McpNode */
1045
1539
  McpNode: {
1046
1540
  display_position?: components["schemas"]["DisplayPosition"] | null;
@@ -1155,12 +1649,21 @@ interface components {
1155
1649
  OutboundCallRequest: {
1156
1650
  /** Agent Id */
1157
1651
  agent_id?: string | null;
1652
+ /**
1653
+ * Agent Version
1654
+ * @default 0
1655
+ */
1656
+ agent_version?: number | "latest_published";
1158
1657
  /** Dialgem Llm Dynamic Variables */
1159
1658
  dialgem_llm_dynamic_variables?: {
1160
1659
  [key: string]: unknown;
1161
1660
  } | null;
1162
1661
  /** From */
1163
1662
  from_: string;
1663
+ /** Metadata */
1664
+ metadata?: {
1665
+ [key: string]: unknown;
1666
+ } | null;
1164
1667
  /** To */
1165
1668
  to: string;
1166
1669
  };
@@ -1168,6 +1671,8 @@ interface components {
1168
1671
  PhoneNumberAssign: {
1169
1672
  /** Agent Id */
1170
1673
  agent_id?: string | null;
1674
+ /** Agent Version */
1675
+ agent_version?: number | "latest_published" | null;
1171
1676
  };
1172
1677
  /** PhoneNumberCreate */
1173
1678
  PhoneNumberCreate: {
@@ -1183,12 +1688,28 @@ interface components {
1183
1688
  flow_sms_sender_enabled?: boolean;
1184
1689
  /** Inbound Agent Id */
1185
1690
  inbound_agent_id?: string | null;
1691
+ /**
1692
+ * Inbound Agent Version
1693
+ * @default 0
1694
+ */
1695
+ inbound_agent_version?: number | "latest_published";
1696
+ /** Inbound Agents */
1697
+ inbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
1698
+ /** Inbound Webhook Url */
1699
+ inbound_webhook_url?: string | null;
1186
1700
  /** Nickname */
1187
1701
  nickname?: string | null;
1188
1702
  /** Number */
1189
1703
  number?: string | null;
1190
1704
  /** Outbound Agent Id */
1191
1705
  outbound_agent_id?: string | null;
1706
+ /**
1707
+ * Outbound Agent Version
1708
+ * @default 0
1709
+ */
1710
+ outbound_agent_version?: number | "latest_published";
1711
+ /** Outbound Agents */
1712
+ outbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
1192
1713
  /** Phone Number */
1193
1714
  phone_number?: string | null;
1194
1715
  /**
@@ -1213,12 +1734,18 @@ interface components {
1213
1734
  flow_sms_sender_enabled?: boolean | null;
1214
1735
  /** Inbound Agent Id */
1215
1736
  inbound_agent_id?: string | null;
1737
+ /** Inbound Agent Version */
1738
+ inbound_agent_version?: number | "latest_published" | null;
1216
1739
  /** Inbound Agents */
1217
1740
  inbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
1741
+ /** Inbound Webhook Url */
1742
+ inbound_webhook_url?: string | null;
1218
1743
  /** Nickname */
1219
1744
  nickname?: string | null;
1220
1745
  /** Outbound Agent Id */
1221
1746
  outbound_agent_id?: string | null;
1747
+ /** Outbound Agent Version */
1748
+ outbound_agent_version?: number | "latest_published" | null;
1222
1749
  /** Outbound Agents */
1223
1750
  outbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
1224
1751
  /** Phone Number Type */
@@ -1244,8 +1771,15 @@ interface components {
1244
1771
  * @default
1245
1772
  */
1246
1773
  description?: string;
1774
+ /** Examples */
1775
+ examples?: string[];
1247
1776
  /** Name */
1248
1777
  name: string;
1778
+ /**
1779
+ * Required
1780
+ * @default false
1781
+ */
1782
+ required?: boolean;
1249
1783
  /**
1250
1784
  * Type
1251
1785
  * @enum {string}
@@ -1374,10 +1908,34 @@ interface components {
1374
1908
  /** Variable Names */
1375
1909
  variable_names: string[];
1376
1910
  };
1911
+ /** PronunciationEntry */
1912
+ PronunciationEntry: {
1913
+ /**
1914
+ * Alias
1915
+ * @default
1916
+ */
1917
+ alias?: string;
1918
+ /** Alphabet */
1919
+ alphabet?: ("ipa" | "cmu") | null;
1920
+ /**
1921
+ * Case Sensitive
1922
+ * @default false
1923
+ */
1924
+ case_sensitive?: boolean;
1925
+ /** Phoneme */
1926
+ phoneme?: string | null;
1927
+ /** Word */
1928
+ word: string;
1929
+ };
1377
1930
  /** RegisterCallRequest */
1378
1931
  RegisterCallRequest: {
1379
1932
  /** Agent Id */
1380
1933
  agent_id: string;
1934
+ /**
1935
+ * Agent Version
1936
+ * @default 0
1937
+ */
1938
+ agent_version?: number | "latest_published";
1381
1939
  /** Call Sid */
1382
1940
  call_sid?: string | null;
1383
1941
  /** Dialgem Llm Dynamic Variables */
@@ -1407,6 +1965,40 @@ interface components {
1407
1965
  /** Stream Url */
1408
1966
  stream_url: string;
1409
1967
  };
1968
+ /** RunCreate */
1969
+ RunCreate: {
1970
+ /**
1971
+ * Agent Version
1972
+ * @default 0
1973
+ */
1974
+ agent_version?: unknown;
1975
+ /**
1976
+ * Fresh
1977
+ * @default false
1978
+ */
1979
+ fresh?: boolean;
1980
+ /** Max Model Turns */
1981
+ max_model_turns?: number | null;
1982
+ };
1983
+ /** SessionSay */
1984
+ SessionSay: {
1985
+ /**
1986
+ * Interrupt
1987
+ * @default false
1988
+ */
1989
+ interrupt?: boolean;
1990
+ /** Text */
1991
+ text: string;
1992
+ };
1993
+ /** SessionUpdate */
1994
+ SessionUpdate: {
1995
+ /** Dynamic Variables */
1996
+ dynamic_variables?: {
1997
+ [key: string]: unknown;
1998
+ } | null;
1999
+ /** System Prompt */
2000
+ system_prompt?: string | null;
2001
+ };
1410
2002
  /** SipOutboundTrunkConfigIn */
1411
2003
  SipOutboundTrunkConfigIn: {
1412
2004
  /** Auth Password */
@@ -1506,6 +2098,29 @@ interface components {
1506
2098
  } & {
1507
2099
  [key: string]: unknown;
1508
2100
  };
2101
+ /** SuiteCreate */
2102
+ SuiteCreate: {
2103
+ /** Agent Id */
2104
+ agent_id: string;
2105
+ /** Description */
2106
+ description?: string | null;
2107
+ /** Name */
2108
+ name: string;
2109
+ /**
2110
+ * Publish Gate
2111
+ * @default off
2112
+ */
2113
+ publish_gate?: string;
2114
+ };
2115
+ /** SuiteUpdate */
2116
+ SuiteUpdate: {
2117
+ /** Description */
2118
+ description?: string | null;
2119
+ /** Name */
2120
+ name?: string | null;
2121
+ /** Publish Gate */
2122
+ publish_gate?: string | null;
2123
+ };
1509
2124
  /** TransferAgent */
1510
2125
  TransferAgent: {
1511
2126
  /** Agent Id */
@@ -1583,6 +2198,18 @@ interface components {
1583
2198
  } & {
1584
2199
  [key: string]: unknown;
1585
2200
  };
2201
+ /** UserDtmfOptions */
2202
+ UserDtmfOptions: {
2203
+ /** Digit Limit */
2204
+ digit_limit?: number | null;
2205
+ /** Termination Key */
2206
+ termination_key?: ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "#" | "*") | null;
2207
+ /**
2208
+ * Timeout Ms
2209
+ * @default 2500
2210
+ */
2211
+ timeout_ms?: number;
2212
+ };
1586
2213
  /** ValidationError */
1587
2214
  ValidationError: {
1588
2215
  /** Context */
@@ -1596,6 +2223,29 @@ interface components {
1596
2223
  /** Error Type */
1597
2224
  type: string;
1598
2225
  };
2226
+ /** WebCallRequest */
2227
+ WebCallRequest: {
2228
+ /** Agent Id */
2229
+ agent_id: string;
2230
+ /**
2231
+ * Agent Version
2232
+ * @default 0
2233
+ */
2234
+ agent_version?: number | "latest_published";
2235
+ /** Dialgem Llm Dynamic Variables */
2236
+ dialgem_llm_dynamic_variables?: {
2237
+ [key: string]: unknown;
2238
+ } | null;
2239
+ /** Metadata */
2240
+ metadata?: {
2241
+ [key: string]: unknown;
2242
+ } | null;
2243
+ };
2244
+ /** WebCallSettings */
2245
+ WebCallSettings: {
2246
+ /** Allowed Origins */
2247
+ allowed_origins: string[];
2248
+ };
1599
2249
  };
1600
2250
  responses: never;
1601
2251
  parameters: never;
@@ -1610,7 +2260,7 @@ interface components {
1610
2260
  * (snake_case); the SDK sends bodies as-is.
1611
2261
  */
1612
2262
 
1613
- type Schemas = components["schemas"];
2263
+ type Schemas$5 = components["schemas"];
1614
2264
  /**
1615
2265
  * Adds `| undefined` to the optional top-level fields of a request body, so
1616
2266
  * callers compiling with `exactOptionalPropertyTypes` can write
@@ -1620,34 +2270,36 @@ type Schemas = components["schemas"];
1620
2270
  type RequestBody<T> = {
1621
2271
  [K in keyof T]: {} extends Pick<T, K> ? T[K] | undefined : T[K];
1622
2272
  };
1623
- type AgentCreateParams = RequestBody<Schemas["AgentCreate"]>;
1624
- type AgentUpdateParams = RequestBody<Schemas["AgentUpdate"]>;
1625
- type FunctionCreateParams = RequestBody<Schemas["FunctionCreate"]>;
1626
- type FunctionUpdateParams = RequestBody<Schemas["FunctionUpdate"]>;
1627
- type FunctionReorderParams = RequestBody<Schemas["FunctionReorder"]>;
1628
- type KnowledgeDocumentCreateParams = RequestBody<Schemas["DocumentCreate"]>;
1629
- type MCPServerCreateParams = RequestBody<Schemas["MCPServerCreate"]>;
1630
- type MCPServerUpdateParams = RequestBody<Schemas["MCPServerUpdate"]>;
1631
- type PhoneNumberCreateParams = RequestBody<Schemas["PhoneNumberCreate"]>;
1632
- type PhoneNumberUpdateParams = RequestBody<Schemas["PhoneNumberUpdate"]>;
1633
- type PhoneNumberAssignParams = RequestBody<Schemas["PhoneNumberAssign"]>;
2273
+ type AgentCreateParams = RequestBody<Schemas$5["AgentCreate"]>;
2274
+ type AgentUpdateParams = RequestBody<Schemas$5["AgentUpdate"]>;
2275
+ type FunctionCreateParams = RequestBody<Schemas$5["FunctionCreate"]>;
2276
+ type FunctionUpdateParams = RequestBody<Schemas$5["FunctionUpdate"]>;
2277
+ type FunctionReorderParams = RequestBody<Schemas$5["FunctionReorder"]>;
2278
+ type KnowledgeDocumentCreateParams = RequestBody<Schemas$5["DocumentCreate"]>;
2279
+ type MCPServerCreateParams = RequestBody<Schemas$5["MCPServerCreate"]>;
2280
+ type MCPServerUpdateParams = RequestBody<Schemas$5["MCPServerUpdate"]>;
2281
+ type PhoneNumberCreateParams = RequestBody<Schemas$5["PhoneNumberCreate"]>;
2282
+ type PhoneNumberUpdateParams = RequestBody<Schemas$5["PhoneNumberUpdate"]>;
2283
+ type PhoneNumberAssignParams = RequestBody<Schemas$5["PhoneNumberAssign"]>;
1634
2284
  /**
1635
2285
  * `from_`, with the trailing underscore, is the wire name (`from` is a Python
1636
2286
  * keyword on the server). It must be a number registered on your organization.
1637
2287
  */
1638
- type CallCreatePhoneCallParams = RequestBody<Schemas["OutboundCallRequest"]>;
1639
- type CallRegisterParams = RequestBody<Schemas["RegisterCallRequest"]>;
2288
+ type CallCreatePhoneCallParams = RequestBody<Schemas$5["OutboundCallRequest"]>;
2289
+ type CallRegisterParams = RequestBody<Schemas$5["RegisterCallRequest"]>;
1640
2290
  /** A conversation-flow definition (`agent_type: "flow"`). */
1641
- type FlowConfig = Schemas["FlowConfig"];
2291
+ type FlowConfig = Schemas$5["FlowConfig"];
1642
2292
  /** One state of a `multi_prompt` agent. */
1643
- type PromptState = Schemas["PromptState"];
2293
+ type PromptState = Schemas$5["PromptState"];
1644
2294
  /** A field extracted from the transcript after the call ends. */
1645
- type PostCallAnalysisVariable = Schemas["PostCallAnalysisVariable"];
1646
- type KeyValuePair = Schemas["KVPair"];
1647
- type AgentWeight = Schemas["AgentWeightIn"];
1648
- type AgentType = NonNullable<Schemas["AgentCreate"]["agent_type"]>;
1649
- type WebhookEventType = NonNullable<Schemas["AgentCreate"]["webhook_events"]>[number];
1650
- type FunctionKind = NonNullable<Schemas["FunctionCreate"]["kind"]>;
2295
+ type PostCallAnalysisVariable = Schemas$5["PostCallAnalysisVariable"];
2296
+ /** Settings for `call_summary`, `call_successful` and `user_sentiment`. */
2297
+ type PostCallBuiltinFields = Schemas$5["BuiltinAnalysisFields"];
2298
+ type KeyValuePair = Schemas$5["KVPair"];
2299
+ type AgentWeight = Schemas$5["AgentWeightIn"];
2300
+ type AgentType = NonNullable<Schemas$5["AgentCreate"]["agent_type"]>;
2301
+ type WebhookEventType = NonNullable<Schemas$5["AgentCreate"]["webhook_events"]>[number];
2302
+ type FunctionKind = NonNullable<Schemas$5["FunctionCreate"]["kind"]>;
1651
2303
 
1652
2304
  /**
1653
2305
  * An agent, as returned by `GET /v1/agents/{id}` and the create/update calls.
@@ -1675,6 +2327,11 @@ interface Agent {
1675
2327
  /** Fallback values for `{{variables}}` not supplied by the call. */
1676
2328
  default_dynamic_variables: Record<string, string>;
1677
2329
  responsiveness: number;
2330
+ /**
2331
+ * Wait a little longer (up to 1.5 s) when the caller sounds unfinished: a
2332
+ * trailing "and", a comma, a half-read number. Off by default.
2333
+ */
2334
+ adaptive_response_wait: boolean;
1678
2335
  interruption_sensitivity: number;
1679
2336
  enable_backchannel: boolean;
1680
2337
  backchannel_frequency: number;
@@ -1688,7 +2345,22 @@ interface Agent {
1688
2345
  language: string;
1689
2346
  enable_transcription_formatting: boolean;
1690
2347
  boosted_keywords: string[];
2348
+ /**
2349
+ * `noise-and-background-speech-cancellation` is a stronger setting of the same
2350
+ * stationary-noise filter, scaled by `denoising_strength`; it does not isolate
2351
+ * the caller from other voices.
2352
+ */
1691
2353
  denoising_mode: NonNullable<AgentCreateParams["denoising_mode"]>;
2354
+ /** 0-1. Only read by `noise-and-background-speech-cancellation`. */
2355
+ denoising_strength: number;
2356
+ /**
2357
+ * `fast` uses Deepgram; `accurate` uses AssemblyAI when the server has it
2358
+ * configured (English only) and falls back to Deepgram otherwise. Only
2359
+ * applies when `stt_model` is `deepgram`.
2360
+ */
2361
+ stt_mode: NonNullable<AgentCreateParams["stt_mode"]>;
2362
+ /** `medical` uses Deepgram's medical model (English only), in either `stt_mode`. */
2363
+ vocab_specialization: NonNullable<AgentCreateParams["vocab_specialization"]>;
1692
2364
  begin_message_delay_ms: number;
1693
2365
  end_call_after_silence_ms: number;
1694
2366
  max_call_duration_ms: number;
@@ -1696,8 +2368,27 @@ interface Agent {
1696
2368
  voicemail_detection_enabled: boolean;
1697
2369
  voicemail_action: NonNullable<AgentCreateParams["voicemail_action"]>;
1698
2370
  voicemail_message: string;
2371
+ /** When set, the voicemail is written by the LLM from this instruction (outbound calls). */
2372
+ voicemail_prompt: string;
2373
+ /** Hang up when an automated phone menu is detected (outbound calls). */
2374
+ ivr_hangup_enabled: boolean;
2375
+ /** How the agent should handle a menu when `ivr_hangup_enabled` is off. */
2376
+ ivr_prompt: string;
2377
+ /** Say `call_screen_message` once to a phone's call-screening assistant (outbound calls). */
2378
+ call_screen_handling_enabled: boolean;
2379
+ call_screen_message: string;
2380
+ /**
2381
+ * Offer the agent a do-not-call tool: a contact who asks to stop being called is
2382
+ * added to the organization's do-not-call list and the call ends.
2383
+ */
2384
+ dnc_detection_enabled: boolean;
1699
2385
  post_call_analysis_data: PostCallAnalysisVariable[];
1700
2386
  post_call_analysis_model: string;
2387
+ /**
2388
+ * Settings for the always-on analysis fields. A missing key means defaults;
2389
+ * `{ enabled: false }` stops that field being extracted (it is stored null).
2390
+ */
2391
+ post_call_builtin_fields: PostCallBuiltinFields;
1701
2392
  fallback_llm_provider: string | null;
1702
2393
  fallback_llm_model: string | null;
1703
2394
  fallback_voice_id: string | null;
@@ -1713,6 +2404,8 @@ interface Agent {
1713
2404
  */
1714
2405
  webhook_signing_secret: string | null;
1715
2406
  has_webhook_signing_secret: boolean;
2407
+ /** How long, in ms, a receiver gets to answer one delivery attempt. 1000–30000, default 10000. */
2408
+ webhook_timeout_ms: number;
1716
2409
  /** ISO 8601, no timezone suffix (UTC). */
1717
2410
  created_at: string | null;
1718
2411
  call_count: number;
@@ -1746,6 +2439,11 @@ interface AgentFunction {
1746
2439
  query_params: KeyValuePair[];
1747
2440
  speak_during_execution: string | null;
1748
2441
  speak_after_execution: boolean;
2442
+ /**
2443
+ * `false` (the default for new functions): the request body is
2444
+ * `{ name, call, args }`. `true`: the body is the arguments object alone.
2445
+ */
2446
+ args_at_root: boolean;
1749
2447
  sort_order: number;
1750
2448
  kind: FunctionKind;
1751
2449
  /** Kind-specific settings (e.g. Cal.com credentials for the `*_cal` kinds). */
@@ -1782,6 +2480,18 @@ interface MCPServer {
1782
2480
  last_status: MCPServerTestResult | null;
1783
2481
  created_at: string | null;
1784
2482
  }
2483
+ /** One tool an MCP server offers. */
2484
+ interface MCPTool {
2485
+ name: string;
2486
+ description: string;
2487
+ /** JSON Schema for the tool's arguments. */
2488
+ input_schema: Record<string, unknown>;
2489
+ }
2490
+ /** What `mcpServers.listTools` returns. When the server is unreachable `tools` is empty and `error` says why. */
2491
+ interface MCPToolList {
2492
+ tools: MCPTool[];
2493
+ error: string | null;
2494
+ }
1785
2495
  interface MCPServerTestResult {
1786
2496
  ok: boolean;
1787
2497
  /** Tool names the server advertised. */
@@ -1791,6 +2501,77 @@ interface MCPServerTestResult {
1791
2501
  at: string;
1792
2502
  }
1793
2503
 
2504
+ /**
2505
+ * A published agent version: a frozen copy of the agent's configuration, its
2506
+ * functions and its MCP servers.
2507
+ *
2508
+ * The editable agent is the **draft**, version `0`, and is what a call runs
2509
+ * unless something pins a version. Publishing never changes the draft, and a
2510
+ * published version never changes at all — editing a function's URL afterwards
2511
+ * does not move the copy inside a version that already shipped.
2512
+ *
2513
+ * Pin one on a phone number (`inbound_agent_version` / `outbound_agent_version`),
2514
+ * on an outbound call, or on a registered call. The version a call ran is
2515
+ * reported as `agent_version` on its call record and in every webhook.
2516
+ */
2517
+ interface AgentVersionSummary {
2518
+ id: string;
2519
+ agent_id: string;
2520
+ /** 1 for the first publish, then upwards. The draft is 0 and is not listed here. */
2521
+ version: number;
2522
+ /** The agent's name at publish time. */
2523
+ name: string;
2524
+ /** Your label for the release, if you gave one. */
2525
+ title: string | null;
2526
+ description: string | null;
2527
+ /** ISO 8601, no timezone suffix (UTC). */
2528
+ published_at: string | null;
2529
+ /** Whoever published it, as the API identity that made the call. */
2530
+ published_by: string | null;
2531
+ function_count: number;
2532
+ mcp_server_count: number;
2533
+ }
2534
+ /** A version with its snapshot, returned by `publish` and `retrieve`. */
2535
+ interface AgentVersion extends AgentVersionSummary {
2536
+ /**
2537
+ * The frozen configuration. Same fields as {@link Agent}, minus the ones that
2538
+ * belong to the agent rather than to a snapshot (`id`, `created_at`,
2539
+ * `call_count`). `webhook_signing_secret` is never included; read it from the
2540
+ * agent itself.
2541
+ */
2542
+ config: AgentVersionConfig;
2543
+ functions: AgentFunction[];
2544
+ /** `auth_token` is stripped; `has_auth_token` says whether one is set. */
2545
+ mcp_servers: AgentVersionMCPServer[];
2546
+ }
2547
+ type AgentVersionConfig = Partial<Omit<Agent, "id" | "agent_id" | "created_at" | "call_count">> & {
2548
+ has_webhook_signing_secret: boolean;
2549
+ } & Record<string, unknown>;
2550
+ type AgentVersionMCPServer = Omit<MCPServer, "id"> & {
2551
+ id: string;
2552
+ has_auth_token: boolean;
2553
+ };
2554
+ interface AgentVersionListResponse {
2555
+ /** Newest first. */
2556
+ versions: AgentVersionSummary[];
2557
+ /** Whether older versions remain below the last one returned. */
2558
+ has_more: boolean;
2559
+ }
2560
+ interface AgentVersionListParams {
2561
+ /** Versions per page, 1-100. Default 50. */
2562
+ limit?: number | undefined;
2563
+ /**
2564
+ * Return versions below this one. Page by passing the `version` of the last
2565
+ * entry you received.
2566
+ */
2567
+ before_version?: number | undefined;
2568
+ }
2569
+ interface AgentVersionPublishParams {
2570
+ /** A label for the release, e.g. "adds the refund flow". */
2571
+ title?: string | undefined;
2572
+ description?: string | undefined;
2573
+ }
2574
+
1794
2575
  declare abstract class APIResource {
1795
2576
  protected readonly _client: HttpClient;
1796
2577
  constructor(client: HttpClient);
@@ -1803,6 +2584,8 @@ declare class Agents extends APIResource {
1803
2584
  readonly knowledge: AgentKnowledge;
1804
2585
  /** Remote MCP servers whose tools are exposed to the agent. */
1805
2586
  readonly mcpServers: AgentMCPServers;
2587
+ /** Frozen snapshots of the agent that a number or a call can pin. */
2588
+ readonly versions: AgentVersions;
1806
2589
  constructor(client: HttpClient);
1807
2590
  /** Create an agent. Only `name` is required; everything else has a server default. */
1808
2591
  create(body: AgentCreateParams, options?: RequestOptions): Promise<Agent>;
@@ -1813,6 +2596,29 @@ declare class Agents extends APIResource {
1813
2596
  update(agentId: string, body: AgentUpdateParams, options?: RequestOptions): Promise<Agent>;
1814
2597
  delete(agentId: string, options?: RequestOptions): Promise<AgentDeleteResponse>;
1815
2598
  }
2599
+ /**
2600
+ * Published versions of an agent.
2601
+ *
2602
+ * The agent itself is the draft, version 0, and every call runs it unless a
2603
+ * number or a request pins a published version. Publishing takes a copy;
2604
+ * editing the agent afterwards changes only the draft.
2605
+ */
2606
+ declare class AgentVersions extends APIResource {
2607
+ /** Freeze the agent as it is now. Returns the new version, snapshot included. */
2608
+ publish(agentId: string, body?: AgentVersionPublishParams, options?: RequestOptions): Promise<AgentVersion>;
2609
+ /**
2610
+ * One page of published versions, newest first, without their snapshots.
2611
+ *
2612
+ * Returns the array. When you need to page — an agent published on every
2613
+ * deploy accumulates versions, and nothing prunes them — read `has_more` from
2614
+ * {@link listPage} instead and pass the last `version` as `before_version`.
2615
+ */
2616
+ list(agentId: string, params?: AgentVersionListParams, options?: RequestOptions): Promise<AgentVersionSummary[]>;
2617
+ /** {@link list} with the `has_more` flag, for paging. */
2618
+ listPage(agentId: string, params?: AgentVersionListParams, options?: RequestOptions): Promise<AgentVersionListResponse>;
2619
+ /** One version with its full snapshot. Version 0 is the draft: use `agents.retrieve`. */
2620
+ retrieve(agentId: string, version: number, options?: RequestOptions): Promise<AgentVersion>;
2621
+ }
1816
2622
  declare class AgentFunctions extends APIResource {
1817
2623
  list(agentId: string, options?: RequestOptions): Promise<AgentFunction[]>;
1818
2624
  create(agentId: string, body: FunctionCreateParams, options?: RequestOptions): Promise<AgentFunction>;
@@ -1833,31 +2639,33 @@ declare class AgentMCPServers extends APIResource {
1833
2639
  update(agentId: string, serverId: string, body: MCPServerUpdateParams, options?: RequestOptions): Promise<MCPServer>;
1834
2640
  delete(agentId: string, serverId: string, options?: RequestOptions): Promise<void>;
1835
2641
  /** Connect to the server now, list its tools, and store the result as `last_status`. */
2642
+ /**
2643
+ * What the server offers right now, with each tool's description and argument schema. Connects live like
2644
+ * `test`, but stores nothing. An unreachable server is not an error: `tools` is empty and `error` says why.
2645
+ */
2646
+ listTools(agentId: string, serverId: string, options?: RequestOptions): Promise<MCPToolList>;
1836
2647
  test(agentId: string, serverId: string, options?: RequestOptions): Promise<MCPServerTestResult>;
1837
2648
  }
1838
2649
 
1839
- interface PageFetcher<T> {
1840
- (page: number): Promise<PageData<T>>;
1841
- }
1842
2650
  interface PageData<T> {
1843
2651
  data: T[];
1844
- total: number;
1845
- page: number;
1846
- page_size: number;
2652
+ has_more: boolean;
2653
+ /** Pass to the next request to continue; `null` on the last page. */
2654
+ pagination_key: string | null;
1847
2655
  }
2656
+ type PageFetcher<T> = (paginationKey: string | null) => Promise<PageData<T>>;
1848
2657
  declare class Page<T> implements PageData<T> {
1849
2658
  #private;
1850
2659
  readonly data: T[];
1851
- readonly total: number;
1852
- readonly page: number;
1853
- readonly page_size: number;
2660
+ readonly has_more: boolean;
2661
+ readonly pagination_key: string | null;
1854
2662
  constructor(data: PageData<T>, fetchPage: PageFetcher<T>);
1855
2663
  hasNextPage(): boolean;
1856
2664
  getNextPage(): Promise<Page<T>>;
1857
2665
  }
1858
2666
  declare class PagePromise<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {
1859
2667
  #private;
1860
- constructor(fetchPage: PageFetcher<T>, startPage: number);
2668
+ constructor(fetchPage: PageFetcher<T>, startKey?: string | null);
1861
2669
  then<R1 = Page<T>, R2 = never>(onfulfilled?: ((value: Page<T>) => R1 | PromiseLike<R1>) | null, onrejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null): Promise<R1 | R2>;
1862
2670
  catch<R = never>(onrejected?: ((reason: unknown) => R | PromiseLike<R>) | null): Promise<Page<T> | R>;
1863
2671
  finally(onfinally?: (() => void) | null): Promise<Page<T>>;
@@ -1865,46 +2673,71 @@ declare class PagePromise<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {
1865
2673
  }
1866
2674
 
1867
2675
  /**
1868
- * A call, as returned by `GET /v1/calls` and `GET /v1/calls/{id}`.
1869
- * The shape is the same for both endpoints.
2676
+ * A call, as returned by `GET /v1/calls`, `GET /v1/calls/{id}` and every call webhook.
2677
+ * The shape is the same everywhere.
1870
2678
  */
1871
2679
  interface Call {
1872
2680
  id: string;
1873
2681
  /** Empty string when the call has no agent. */
1874
2682
  agent_id: string;
2683
+ /**
2684
+ * The published agent version this call ran. 0 is the live draft, which is
2685
+ * what a call runs unless a number or the request that created it pinned a
2686
+ * version.
2687
+ */
2688
+ agent_version: number;
1875
2689
  agent_name: string;
1876
2690
  /** Dialgem's lifecycle state. */
1877
2691
  status: CallStatus;
1878
2692
  /** The same state in session vocabulary: active→ongoing, completed→ended, failed→error, queued→registered. */
1879
2693
  call_status: CallSessionStatus;
1880
- duration_s: number;
1881
- /**
1882
- * Empty when the agent opts out of transcript storage, and once the agent's
1883
- * `data_retention_days` purge has run. PII-redacted when redaction is on.
1884
- */
1885
- transcript: TranscriptTurn[];
2694
+ call_type: "phone_call" | "web_call" | (string & {});
2695
+ direction: "inbound" | "outbound" | (string & {});
2696
+ /** Your own data, attached when the call was created or later with `calls.update`. */
2697
+ metadata: Record<string, unknown>;
2698
+ /** The dynamic variables the call was started with. */
2699
+ dynamic_variables: Record<string, string>;
1886
2700
  /** ISO 8601, no timezone suffix (UTC). Empty string if unknown. */
1887
2701
  started_at: string;
2702
+ /** ISO 8601, no timezone suffix (UTC). `null` while the call is ongoing. */
2703
+ ended_at: string | null;
2704
+ /** Epoch milliseconds. */
2705
+ start_timestamp: number | null;
2706
+ /** Epoch milliseconds. `null` while the call is ongoing. */
2707
+ end_timestamp: number | null;
2708
+ duration_s: number;
2709
+ duration_ms: number | null;
1888
2710
  phone_number: string;
1889
- direction: "inbound" | "outbound" | (string & {});
1890
- call_type: "phone_call" | "web_call" | (string & {});
1891
- /** Carrier call id (Twilio CallSid). Empty string if none. */
1892
- call_sid: string;
1893
2711
  from_number: string;
1894
2712
  to_number: string;
2713
+ /** Carrier call id (Twilio CallSid). Empty string if none. */
2714
+ call_sid: string;
1895
2715
  origination_state: string | null;
2716
+ /**
2717
+ * One entry per turn. Empty when the agent opts out of transcript storage, and
2718
+ * once the agent's `data_retention_days` purge has run. PII-redacted when
2719
+ * redaction is on.
2720
+ */
2721
+ transcript: TranscriptTurn[];
2722
+ /** The same transcript as one string, `Agent: …` / `User: …` per line. */
2723
+ transcript_text: string;
1896
2724
  /** Presigned URL that expires; download it promptly rather than storing the link. */
1897
2725
  recording_url: string | null;
1898
- amd_result: Record<string, unknown> | null;
1899
2726
  events: Record<string, unknown>[];
1900
- /** Post-call extraction. `null` until the call has ended and been analyzed, and after a retention purge. */
2727
+ disconnection_reason: DisconnectionReason | null;
2728
+ /** Whether the call reached voicemail or an answering machine. */
2729
+ in_voicemail: boolean;
2730
+ amd_result: Record<string, unknown> | null;
2731
+ /** Post-call analysis. `null` until the call has ended and been analyzed, and after a retention purge. */
1901
2732
  analysis: CallAnalysis | null;
1902
- disconnection_reason: string | null;
1903
2733
  /** Set once the call is finalized. */
1904
2734
  call_cost: CallCost | null;
1905
2735
  /** Mean time from the caller's final transcript to the agent's first audio byte. */
1906
2736
  end_to_end_latency_ms: number | null;
2737
+ /** Per-stage latency percentiles, recorded when the call ends. `null` if no turn completed. */
2738
+ latency: CallLatency | null;
1907
2739
  }
2740
+ type DisconnectionReason = "user_hangup" | "agent_hangup" | "call_transfer" | "voicemail_reached" | "inactivity" | "max_duration_reached" | "manual_stopped" | "dial_no_answer" | "flow_dead_end" | "flow_loop_guard" | "error" | (string & {});
1908
2741
  /** Every amount is an integer in units of **$0.0001**: `combined_cost: 1700` is $0.17. */
1909
2742
  interface CallCost {
1910
2743
  combined_cost: number;
@@ -1925,23 +2758,76 @@ interface TranscriptTurn {
1925
2758
  timestamp: string;
1926
2759
  }
1927
2760
  interface CallAnalysis {
2761
+ /** A one-to-three sentence summary of the call. */
2762
+ call_summary: string | null;
2763
+ user_sentiment: "Positive" | "Neutral" | "Negative" | (string & {}) | null;
2764
+ call_successful: boolean | null;
2765
+ in_voicemail: boolean;
1928
2766
  /** Values for the agent's `post_call_analysis_data` fields, keyed by name. */
1929
2767
  variables: Record<string, unknown>;
1930
2768
  model: string;
1931
2769
  extracted_at: string;
1932
- user_sentiment: "Positive" | "Neutral" | "Negative" | (string & {}) | null;
1933
- call_successful: boolean | null;
1934
2770
  /** Set when extraction failed; `variables` may then be partial or empty. */
1935
2771
  error: string | null;
1936
2772
  }
2773
+ /** Milliseconds. Each stage has at least one sample, or is omitted. */
2774
+ interface LatencyStats {
2775
+ p50: number;
2776
+ p90: number;
2777
+ p95: number;
2778
+ p99: number;
2779
+ min: number;
2780
+ max: number;
2781
+ num: number;
2782
+ }
2783
+ interface CallLatency {
2784
+ /** Caller's final transcript to the agent's first audio byte. */
2785
+ e2e?: LatencyStats;
2786
+ /** Time to the model's first sentence. */
2787
+ llm?: LatencyStats;
2788
+ /** Time to the first synthesized audio. */
2789
+ tts?: LatencyStats;
2790
+ /** How long end-of-speech detection waited. */
2791
+ endpointing?: LatencyStats;
2792
+ }
1937
2793
  interface CallListParams {
2794
+ agent_id?: string | string[] | undefined;
2795
+ status?: CallStatus | CallStatus[] | undefined;
2796
+ direction?: "inbound" | "outbound" | undefined;
2797
+ call_type?: "phone_call" | "web_call" | undefined;
2798
+ disconnection_reason?: DisconnectionReason | DisconnectionReason[] | undefined;
2799
+ from_number?: string | undefined;
2800
+ to_number?: string | undefined;
2801
+ user_sentiment?: "Positive" | "Neutral" | "Negative" | undefined;
2802
+ call_successful?: boolean | undefined;
2803
+ /** Started at or after this time, epoch ms. */
2804
+ start_after?: number | undefined;
2805
+ /** Started before this time, epoch ms. */
2806
+ start_before?: number | undefined;
2807
+ /**
2808
+ * Match calls whose metadata has these values, e.g. `{ crm_id: "42" }`.
2809
+ * Values are compared as strings.
2810
+ */
2811
+ metadata?: Record<string, string | number | boolean> | undefined;
1938
2812
  /** Case-insensitive match on the agent's name. */
1939
2813
  search?: string | undefined;
1940
- status?: CallStatus | "all" | undefined;
1941
- /** 1-based. Default 1. */
1942
- page?: number | undefined;
1943
- /** 1–100. Default 10. */
1944
- page_size?: number | undefined;
2814
+ /** Default `desc` (newest first). */
2815
+ sort_order?: "asc" | "desc" | undefined;
2816
+ /** Calls per page, 1–100. Default 10. */
2817
+ limit?: number | undefined;
2818
+ }
2819
+ interface CallUpdateParams {
2820
+ /** Replaces the call's metadata. A JSON object of at most 16 KB. */
2821
+ metadata: Record<string, unknown>;
2822
+ }
2823
+ interface CallDeleteResponse {
2824
+ deleted: true;
2825
+ id: string;
2826
+ }
2827
+ interface CallStopResponse {
2828
+ id: string;
2829
+ /** The call is tearing down; it becomes `completed` with `disconnection_reason: "manual_stopped"` shortly. */
2830
+ stopping: true;
1945
2831
  }
1946
2832
  /** Result of `calls.createPhoneCall`. The call is dialing; its outcome arrives via webhooks or `calls.retrieve`. */
1947
2833
  interface PhoneCallCreateResponse {
@@ -1960,16 +2846,43 @@ interface CallRegisterResponse {
1960
2846
 
1961
2847
  declare class Calls extends APIResource {
1962
2848
  /**
1963
- * Calls, newest first. Await for one page, or iterate for every call:
2849
+ * Calls, newest first by default. Await for one page, or iterate for every call:
1964
2850
  *
1965
- * const page = await dialgem.calls.list({ page_size: 50 })
1966
- * for await (const call of dialgem.calls.list({ status: "completed" })) {
1967
- * if (call.started_at < cutoff) break // newest first: everything after is older
1968
- * }
2851
+ * const page = await dialgem.calls.list({ limit: 50 })
2852
+ * for await (const call of dialgem.calls.list({ status: "completed", start_after: since })) { ... }
1969
2853
  */
1970
2854
  list(params?: CallListParams, options?: RequestOptions): PagePromise<Call>;
1971
- /** One call, including its transcript, analysis and recording URL. */
2855
+ /** One call, including its transcript, analysis, latency and recording URL. */
1972
2856
  retrieve(callId: string, options?: RequestOptions): Promise<Call>;
2857
+ /** Replace the call's `metadata`. */
2858
+ update(callId: string, body: CallUpdateParams, options?: RequestOptions): Promise<Call>;
2859
+ /**
2860
+ * Permanently delete a finished call: its record, transcript, analysis and
2861
+ * recording. A call still in progress is refused with `ConflictError`; stop it first.
2862
+ */
2863
+ delete(callId: string, options?: RequestOptions): Promise<CallDeleteResponse>;
2864
+ /**
2865
+ * Run a finished call's post-call analysis again, with the agent's *current* analysis
2866
+ * settings, and return the updated call. Use it after changing the fields or the model
2867
+ * and wanting an older call read the new way.
2868
+ *
2869
+ * It replaces `analysis`; it does not bill the call again and does not send `call_analyzed`
2870
+ * again, so read the result from this response or from `retrieve`. The model call can take
2871
+ * a while. `ConflictError` with `errCode` `call_in_progress` until the call has ended,
2872
+ * `no_transcript` when there is nothing to analyze, `agent_deleted` if the agent is gone.
2873
+ * Not retried by default.
2874
+ */
2875
+ rerunAnalysis(callId: string, options?: RequestOptions): Promise<Call>;
2876
+ /**
2877
+ * End an ongoing call now, as if the agent had hung up. The call becomes
2878
+ * `completed` with `disconnection_reason: "manual_stopped"` a moment later, and
2879
+ * the usual `call_ended` webhook follows.
2880
+ *
2881
+ * `ConflictError` with `errCode` `call_not_ongoing` if it already ended, or
2882
+ * `call_not_connected` if no agent is on the call yet (e.g. still ringing).
2883
+ * Not retried by default.
2884
+ */
2885
+ stop(callId: string, options?: RequestOptions): Promise<CallStopResponse>;
1973
2886
  /**
1974
2887
  * Dial `to` from one of your organization's numbers, with `agent_id` (or the
1975
2888
  * number's outbound agent) on the line.
@@ -2001,9 +2914,68 @@ interface Voice {
2001
2914
  language: string[];
2002
2915
  preview_url: string | null;
2003
2916
  raw_metadata: Record<string, unknown> | null;
2917
+ /** True for a voice your organization cloned; false for the shared catalog. */
2918
+ is_custom: boolean;
2919
+ /** Who uploaded the audio, for a cloned voice. */
2920
+ created_by: string | null;
2004
2921
  created_at: string | null;
2005
2922
  updated_at: string | null;
2006
2923
  }
2924
+ /** A model usable for an agent's post-call analysis (`post_call_analysis_model`). */
2925
+ interface ExtractionModel {
2926
+ /** Put this in `post_call_analysis_model`. */
2927
+ id: string;
2928
+ provider: "anthropic" | "openai";
2929
+ label: string;
2930
+ /**
2931
+ * Estimated USD for one typical extraction, derived from list prices. For
2932
+ * comparing models; not a metered charge.
2933
+ */
2934
+ est_cost_per_session: number;
2935
+ }
2936
+ interface ExtractionModelList {
2937
+ /** The model an agent gets when none is set. */
2938
+ default: string;
2939
+ models: ExtractionModel[];
2940
+ }
2941
+ /** One audio sample for cloning. `Blob` and `File` both satisfy this. */
2942
+ type VoiceCloneFile = Blob | {
2943
+ name?: string;
2944
+ type?: string;
2945
+ };
2946
+ interface VoiceCloneParams {
2947
+ /** Display name for the new voice. */
2948
+ name: string;
2949
+ /**
2950
+ * The audio to clone from.
2951
+ *
2952
+ * ElevenLabs takes up to 25 files; **Cartesia takes exactly one** and refuses
2953
+ * more rather than silently picking one, since that would make the same
2954
+ * upload produce a noticeably different voice on the two providers.
2955
+ */
2956
+ files: Blob[];
2957
+ /**
2958
+ * You are asserting that you hold the rights to this audio and have the
2959
+ * speaker's consent to clone their voice. Required, and recorded against
2960
+ * your API identity — a cloned voice is built from a real person's speech.
2961
+ */
2962
+ consent_confirmed: true;
2963
+ /** Which provider clones it. Defaults to `elevenlabs`. */
2964
+ engine?: "elevenlabs" | "cartesia" | undefined;
2965
+ description?: string | undefined;
2966
+ /** Cartesia clones per language; ElevenLabs ignores this. Defaults to `en`. */
2967
+ language?: string | undefined;
2968
+ /**
2969
+ * Filenames sent with each blob, in order. The provider infers the audio
2970
+ * container from the extension, so a `Blob` with no name needs one here.
2971
+ * Defaults to `clip-1.wav`, `clip-2.wav`, …
2972
+ */
2973
+ filenames?: string[] | undefined;
2974
+ }
2975
+ interface VoiceDeleteResponse {
2976
+ deleted: boolean;
2977
+ voice_id: string;
2978
+ }
2007
2979
  interface VoiceListParams {
2008
2980
  provider?: string | undefined;
2009
2981
  gender?: string | undefined;
@@ -2053,8 +3025,37 @@ interface FlowTemplate extends FlowTemplateSummary {
2053
3025
  }
2054
3026
 
2055
3027
  declare class Voices extends APIResource {
2056
- /** Voices available to agents, by name. Put a voice's `provider_voice_id` in an agent's `voice_id`. */
3028
+ /**
3029
+ * Voices available to agents: the shared catalog plus the ones your
3030
+ * organization cloned, yours first. Put a voice's `provider_voice_id` in an
3031
+ * agent's `voice_id`.
3032
+ */
2057
3033
  list(params?: VoiceListParams, options?: RequestOptions): Promise<Voice[]>;
3034
+ /**
3035
+ * Clone a voice from audio you upload. The new voice is private to your
3036
+ * organization and never appears in another one's catalog.
3037
+ *
3038
+ * Consent is required: you are asserting that you hold the rights to the
3039
+ * audio and have the speaker's consent, and that assertion is recorded
3040
+ * against your API identity.
3041
+ *
3042
+ * The upload is never retried, whatever `maxRetries` says — a retried
3043
+ * multipart body can send truncated audio, and a clone built from half the
3044
+ * recording succeeds and sounds wrong.
3045
+ */
3046
+ clone(params: VoiceCloneParams, options?: RequestOptions): Promise<Voice>;
3047
+ /**
3048
+ * Delete a voice your organization cloned, at the provider and here.
3049
+ *
3050
+ * Only your own cloned voices: the shared catalog is not deletable, and a
3051
+ * voice an agent still uses is refused with a 409 rather than leaving that
3052
+ * agent without one.
3053
+ */
3054
+ delete(voiceId: string, options?: RequestOptions): Promise<VoiceDeleteResponse>;
3055
+ }
3056
+ declare class ExtractionModels extends APIResource {
3057
+ /** Models an agent may use for post-call analysis, with an estimated cost per session. */
3058
+ list(options?: RequestOptions): Promise<ExtractionModelList>;
2058
3059
  }
2059
3060
  declare class FlowTemplates extends APIResource {
2060
3061
  /** Built-in conversation-flow templates (summaries, without `flow_config`). */
@@ -2067,107 +3068,1180 @@ declare class PromptTemplates extends APIResource {
2067
3068
  retrieve(templateId: string, options?: RequestOptions): Promise<PromptTemplate>;
2068
3069
  }
2069
3070
 
2070
- /**
2071
- * A phone number, as returned by `/v1/phone-numbers`.
2072
- * The shape is the same across all phone-number endpoints.
2073
- */
2074
- interface PhoneNumber {
2075
- /** Dialgem id. Use this (not the E.164 number) for update/assign/delete. */
3071
+ /** What an API key was granted. The secret is never returned. */
3072
+ interface ApiKeyDetails {
2076
3073
  id: string;
2077
- status: string;
2078
- provider: string;
2079
- /** E.164, e.g. `+14155550123`. */
2080
- phone_number: string;
2081
- phone_number_pretty: string;
2082
- phone_number_type: string;
2083
- nickname: string;
2084
- inbound_agent_id: string | null;
2085
- inbound_agent_version: number;
2086
- outbound_agent_id: string | null;
2087
- outbound_agent_version: number;
2088
- /** Weighted inbound routing. `inbound_agent_id` is its primary entry. */
2089
- inbound_agents: PhoneNumberAgentWeight[];
2090
- outbound_agents: PhoneNumberAgentWeight[];
2091
- custom_sms_enabled: boolean;
2092
- flow_sms_sender_enabled: boolean;
2093
- /** Epoch milliseconds (0 if unknown). */
2094
- creation_timestamp: number;
2095
- /** Epoch milliseconds (0 if unknown). */
2096
- last_modification_timestamp: number;
2097
- sip_outbound_trunk_config: SipOutboundTrunkConfig | null;
3074
+ name: string;
3075
+ /** The start of the key, to recognise it by. */
3076
+ prefix: string;
3077
+ /** True when the key has no scopes and can do everything. */
3078
+ full_access: boolean;
3079
+ /** For example `["calls:write", "agents:read"]`; `null` for a full-access key. */
3080
+ scopes: string[] | null;
3081
+ /** IP addresses or CIDR ranges the key may be used from; `null` for anywhere. */
3082
+ allowed_ips: string[] | null;
3083
+ expires_at: string | null;
3084
+ expired: boolean;
3085
+ last_used_at: string | null;
3086
+ created_at: string | null;
3087
+ revoked_at: string | null;
2098
3088
  }
2099
- interface PhoneNumberAgentWeight {
2100
- agent_id: string;
2101
- agent_version: number;
2102
- weight: number;
3089
+ interface ApiKeyInfo {
3090
+ auth: "api_key" | "session" | "service" | (string & {});
3091
+ /** Your organization's slug. */
3092
+ organization: string;
3093
+ role: string;
3094
+ /** The key being used; `null` when the request was not made with an organization API key. */
3095
+ key: ApiKeyDetails | null;
2103
3096
  }
2104
- interface SipOutboundTrunkConfig {
2105
- termination_uri?: string | null;
2106
- transport?: string | null;
2107
- auth_username?: string | null;
3097
+
3098
+ /**
3099
+ * A call in progress right now, as the service holds it in memory.
3100
+ *
3101
+ * This is live state, not a record: a finished call is a `Call`, reachable
3102
+ * through `calls.retrieve`. The shape of a session is not a stable contract
3103
+ * beyond the fields below, so it is deliberately open.
3104
+ */
3105
+ interface AgentSession {
3106
+ session_id: string;
3107
+ agent_id: string;
3108
+ status: "active" | "ended" | (string & {});
3109
+ /** ISO 8601. */
3110
+ started_at?: string;
2108
3111
  [key: string]: unknown;
2109
3112
  }
2110
3113
 
2111
- declare class PhoneNumbers extends APIResource {
2112
- /** Register a number you own (`phone_number` in E.164) with Dialgem. */
2113
- create(body: PhoneNumberCreateParams, options?: RequestOptions): Promise<PhoneNumber>;
2114
- /** Every active (not released) number in the organization, newest first. */
2115
- list(options?: RequestOptions): Promise<PhoneNumber[]>;
3114
+ type AgentSessionUpdateParams = RequestBody<components["schemas"]["SessionUpdate"]>;
3115
+ type AgentSessionSayParams = RequestBody<components["schemas"]["SessionSay"]>;
3116
+ /** What `sessions.say` returns: the line plays behind the call's audio, so this answers at once. */
3117
+ interface AgentSessionSayResult {
3118
+ status: "speaking";
3119
+ }
3120
+ /** What `sessions.release` returns. */
3121
+ interface AgentSessionReleaseResult {
3122
+ /** `not_taken_over` when nobody had the call. */
3123
+ status: "handed_back" | "not_taken_over";
3124
+ reason?: string;
3125
+ }
3126
+ /** What `sessions.update` returns. */
3127
+ interface AgentSessionUpdateResult {
3128
+ session_id: string;
3129
+ status: "active" | (string & {});
3130
+ /** Which of `system_prompt` and `dynamic_variables` were changed. */
3131
+ updated: Array<"system_prompt" | "dynamic_variables">;
3132
+ applies_from: "next_turn";
3133
+ }
3134
+ interface AgentSessionList {
3135
+ sessions: AgentSession[];
3136
+ /** How many are live. This is what "how busy am I right now?" asks for. */
3137
+ count: number;
3138
+ }
3139
+
3140
+ declare class ApiKey extends APIResource {
2116
3141
  /**
2117
- * Partial update.
3142
+ * Who this key is: your organization and the key's name, prefix, scopes, allowed addresses
3143
+ * and expiry. It answers for any valid key whatever its scopes, so an integration can check
3144
+ * what it was given. Never returns the secret.
2118
3145
  *
2119
- * `inbound_agent_id` is **ignored unless `set_inbound_agent: true`** is sent with
2120
- * it, both to set an agent and to clear one (`null`). Same for the outbound pair.
2121
- * `inbound_agents` / `outbound_agents` (weighted routing), when sent, take
3146
+ * ```ts
3147
+ * const { key } = await dialgem.apiKey.retrieve()
3148
+ * if (key && !key.full_access) console.log("scoped to", key.scopes)
3149
+ * ```
3150
+ */
3151
+ retrieve(options?: RequestOptions): Promise<ApiKeyInfo>;
3152
+ }
3153
+ declare class Sessions extends APIResource {
3154
+ /**
3155
+ * The calls your organization has in progress right now, with a `count`.
3156
+ *
3157
+ * Live state read from the service's own registry — use it for a
3158
+ * concurrency check before placing a call. For finished calls use
3159
+ * `calls.list`; a call whose teardown never arrived is not counted here.
3160
+ */
3161
+ list(options?: RequestOptions): Promise<AgentSessionList>;
3162
+ /**
3163
+ * Change a live call's prompt and/or variables. It applies from the agent's **next turn**.
3164
+ *
3165
+ * `sessionId` is a session's `session_id` from `list`, or the call's own `call_id`. Only this call changes:
3166
+ * the agent, its published versions and other calls are untouched, and the change is gone when the call ends.
3167
+ * A turn already being spoken finishes as it was. `dynamic_variables` are merged over the call's variables;
3168
+ * `system_prompt` replaces the prompt for the rest of the call.
3169
+ *
3170
+ * The call may be on any service instance. `NotFoundError` if it is not live (or is another organization's),
3171
+ * `ConflictError` with `errCode` `session_ended` once it is over, `UnprocessableEntityError` with `errCode`
3172
+ * `flow_agent_prompt` for a flow agent's prompt (its variables can still change). Not retried by default.
3173
+ *
3174
+ * ```ts
3175
+ * await dialgem.sessions.update(callId, { dynamic_variables: { plan: "pro" } })
3176
+ * ```
3177
+ */
3178
+ update(sessionId: string, body: AgentSessionUpdateParams, options?: RequestOptions): Promise<AgentSessionUpdateResult>;
3179
+ /**
3180
+ * Make the agent say `text` on a live call, in its own voice. Answers at once; the line plays behind what the
3181
+ * agent is saying, or now with `interrupt: true`. The agent's conversation records it as something it said.
3182
+ *
3183
+ * Off unless the deployment enables live control: `ForbiddenError` with `errCode` `live_control_disabled`.
3184
+ * `ConflictError` `human_has_call` while a human has taken the call. Owners, admins and API keys only.
3185
+ * Not retried by default.
3186
+ *
3187
+ * ```ts
3188
+ * await dialgem.sessions.say(callId, { text: "One moment while I check that." })
3189
+ * ```
3190
+ */
3191
+ say(sessionId: string, body: AgentSessionSayParams, options?: RequestOptions): Promise<AgentSessionSayResult>;
3192
+ /**
3193
+ * Hand a taken-over call back to the agent, for when the socket that took it is gone. The agent is told a
3194
+ * human had the call and that it did not hear what was said. Same availability and limits as `say`.
3195
+ * Listening in and taking over run over a WebSocket (`/v1/agent/sessions/{id}/live`), which this SDK does not wrap.
3196
+ */
3197
+ release(sessionId: string, options?: RequestOptions): Promise<AgentSessionReleaseResult>;
3198
+ }
3199
+
3200
+ /**
3201
+ * Agent simulations: saved conversations that a simulated caller has with your agent, in text,
3202
+ * checked afterwards. Nothing is dialled, recorded or billed, and the agent's tools are never really called.
3203
+ *
3204
+ * The API accepts free-form objects for the caller, tool answers and checks, so they are typed here.
3205
+ */
3206
+ /** What publishing a version of the agent does when the draft has not passed the suite. */
3207
+ type SimulationPublishGate = "off" | "warn" | "block";
3208
+ type SimulationCaller = {
3209
+ mode: "script";
3210
+ /** What the caller says, one line per turn (up to 20). */
3211
+ turns: string[];
3212
+ } | {
3213
+ mode: "persona";
3214
+ /** Who the caller is. A model plays them. */
3215
+ persona: string;
3216
+ /** What they want from the call. */
3217
+ goal?: string | undefined;
3218
+ /** Longest the conversation runs, in exchanges (1 to 12, default 6). */
3219
+ max_turns?: number | undefined;
3220
+ };
3221
+ interface CheckBase {
3222
+ /** Names the check in the results. */
3223
+ label?: string | undefined;
3224
+ }
3225
+ type SimulationCheck = (CheckBase & {
3226
+ type: "contains" | "not_contains";
3227
+ text: string;
3228
+ who?: "agent" | "caller" | "any" | undefined;
3229
+ }) | (CheckBase & {
3230
+ type: "tool_called";
3231
+ name: string;
3232
+ args?: Record<string, unknown> | undefined;
3233
+ }) | (CheckBase & {
3234
+ type: "tool_not_called";
3235
+ name: string;
3236
+ }) | (CheckBase & {
3237
+ type: "variable_equals";
3238
+ name: string;
3239
+ value: string;
3240
+ }) | (CheckBase & {
3241
+ type: "node_reached";
3242
+ node_id: string;
3243
+ }) | (CheckBase & {
3244
+ type: "ended";
3245
+ value?: boolean | undefined;
3246
+ }) | (CheckBase & {
3247
+ type: "rubric";
3248
+ criteria: string;
3249
+ });
3250
+ interface SimulationCaseInput {
3251
+ name: string;
3252
+ caller: SimulationCaller;
3253
+ /** Fills `{{placeholders}}` in the agent's prompt and first message. */
3254
+ dynamic_variables?: Record<string, string | number> | undefined;
3255
+ /** What each tool answers. A tool without an entry answers `{"status": "ok"}`. */
3256
+ tool_mocks?: Record<string, unknown> | undefined;
3257
+ /** At least one. The case passes when all of them hold. */
3258
+ checks: SimulationCheck[];
3259
+ }
3260
+ interface SimulationSuiteCreateParams {
3261
+ agent_id: string;
3262
+ name: string;
3263
+ description?: string | null | undefined;
3264
+ publish_gate?: SimulationPublishGate | undefined;
3265
+ }
3266
+ interface SimulationSuiteUpdateParams {
3267
+ name?: string | undefined;
3268
+ description?: string | null | undefined;
3269
+ publish_gate?: SimulationPublishGate | undefined;
3270
+ }
3271
+ interface SimulationRunCreateParams {
3272
+ /** `0` is the draft you are editing (the default), or a published version, or `"latest_published"`. */
3273
+ agent_version?: number | "latest_published" | undefined;
3274
+ /** Run every case again even if an identical one already ran against this exact agent. */
3275
+ fresh?: boolean | undefined;
3276
+ /** Spend at most this many model turns. When used up the remaining cases are skipped. */
3277
+ max_model_turns?: number | undefined;
3278
+ }
3279
+ interface SimulationCase extends Required<Pick<SimulationCaseInput, "name" | "caller" | "checks">> {
3280
+ id: string;
3281
+ suite_id: string;
3282
+ position: number;
3283
+ dynamic_variables: Record<string, string>;
3284
+ tool_mocks: Record<string, unknown>;
3285
+ created_at: string | null;
3286
+ updated_at: string | null;
3287
+ }
3288
+ type SimulationRunStatus = "queued" | "running" | "completed" | "cancelled" | "failed";
3289
+ interface SimulationRun {
3290
+ id: string;
3291
+ suite_id: string;
3292
+ agent_id: string;
3293
+ /** The version that was tested; `0` is the draft. */
3294
+ agent_version: number;
3295
+ status: SimulationRunStatus;
3296
+ trigger: string;
3297
+ fresh: boolean;
3298
+ total: number;
3299
+ passed: number;
3300
+ failed: number;
3301
+ /** The model or the case broke; this says nothing about your agent. */
3302
+ errored: number;
3303
+ /** Cancelled, or the run ran out of model turns. */
3304
+ skipped: number;
3305
+ model_turn_budget: number;
3306
+ model_turns_used: number;
3307
+ budget_exhausted: boolean;
3308
+ created_at: string | null;
3309
+ started_at: string | null;
3310
+ finished_at: string | null;
3311
+ }
3312
+ type SimulationResultStatus = "pending" | "passed" | "failed" | "errored" | "skipped";
3313
+ interface SimulationCheckResult {
3314
+ /** Position in the case's `checks`. */
3315
+ index: number;
3316
+ type: SimulationCheck["type"];
3317
+ label?: string | undefined;
3318
+ passed: boolean;
3319
+ detail: string;
3320
+ }
3321
+ interface SimulationResult {
3322
+ id: string;
3323
+ case_id: string | null;
3324
+ case_name: string;
3325
+ position: number;
3326
+ status: SimulationResultStatus;
3327
+ /** Why it failed, errored or was skipped. */
3328
+ reason: string | null;
3329
+ /** Taken from an earlier identical run rather than run again. */
3330
+ cached: boolean;
3331
+ transcript: {
3332
+ role: "caller" | "agent";
3333
+ text: string;
3334
+ node_id?: string | undefined;
3335
+ }[];
3336
+ tool_calls: {
3337
+ name: string;
3338
+ input: Record<string, unknown>;
3339
+ result: string;
3340
+ }[];
3341
+ /** A flow agent's variables at the end. */
3342
+ variables: Record<string, unknown>;
3343
+ checks: SimulationCheckResult[];
3344
+ model_turns: number;
3345
+ duration_ms: number;
3346
+ finished_at: string | null;
3347
+ }
3348
+ interface SimulationRunDetail extends SimulationRun {
3349
+ results: SimulationResult[];
3350
+ }
3351
+ interface SimulationSuite {
3352
+ id: string;
3353
+ agent_id: string;
3354
+ name: string;
3355
+ description: string | null;
3356
+ publish_gate: SimulationPublishGate;
3357
+ case_count: number;
3358
+ latest_run: SimulationRun | null;
3359
+ created_at: string | null;
3360
+ updated_at: string | null;
3361
+ }
3362
+ interface SimulationSuiteDetail extends SimulationSuite {
3363
+ cases: SimulationCase[];
3364
+ }
3365
+ interface SimulationSuiteList {
3366
+ /** Whether simulations are switched on for the platform. */
3367
+ enabled: boolean;
3368
+ suites: SimulationSuite[];
3369
+ }
3370
+ interface SimulationRunList {
3371
+ runs: SimulationRun[];
3372
+ }
3373
+
3374
+ /**
3375
+ * Test your agent before a change reaches a caller. A **suite** holds **cases**; in each, a simulated caller
3376
+ * talks to the agent in text and your **checks** decide whether it passed.
3377
+ *
3378
+ * A simulation is not a call: nothing is dialled, recorded or billed, and the agent's tools are never really
3379
+ * called. Simulations spend model usage, so they are switched on per platform; until then every method answers
3380
+ * 403 `simulations_disabled`.
3381
+ *
3382
+ * const suite = await dialgem.simulations.createSuite({ agent_id, name: "Refunds" })
3383
+ * await dialgem.simulations.createCase(suite.id, {
3384
+ * name: "Asks for a refund",
3385
+ * caller: { mode: "script", turns: ["I want my money back."] },
3386
+ * checks: [{ type: "not_contains", text: "full refund" }],
3387
+ * })
3388
+ * const run = await dialgem.simulations.run(suite.id)
3389
+ * // poll retrieveRun(run.id) until status is "completed"
3390
+ */
3391
+ declare class Simulations extends APIResource {
3392
+ /** Make a suite for one of your agents. */
3393
+ createSuite(body: SimulationSuiteCreateParams, options?: RequestOptions): Promise<SimulationSuite>;
3394
+ /** Your suites, newest first, each with its latest run. Pass `agent_id` for one agent's. */
3395
+ listSuites(params?: {
3396
+ agent_id?: string;
3397
+ }, options?: RequestOptions): Promise<SimulationSuiteList>;
3398
+ /** One suite with its cases. */
3399
+ retrieveSuite(suiteId: string, options?: RequestOptions): Promise<SimulationSuiteDetail>;
3400
+ /**
3401
+ * Rename a suite or set its publish gate: `off`, `warn` (publishing a version succeeds and lists the suites the draft
3402
+ * has not passed) or `block` (publishing is refused with 409 `simulation_required` until it has).
3403
+ */
3404
+ updateSuite(suiteId: string, body: SimulationSuiteUpdateParams, options?: RequestOptions): Promise<SimulationSuite>;
3405
+ /** Delete a suite and its cases. Past runs are deleted with it. */
3406
+ deleteSuite(suiteId: string, options?: RequestOptions): Promise<void>;
3407
+ /** Add a case (up to 50 per suite). 422 `invalid_case` says what to fix. */
3408
+ createCase(suiteId: string, body: SimulationCaseInput, options?: RequestOptions): Promise<SimulationCase>;
3409
+ /** Change a case. Fields you leave out keep their value. */
3410
+ updateCase(caseId: string, body: Partial<SimulationCaseInput>, options?: RequestOptions): Promise<SimulationCase>;
3411
+ deleteCase(caseId: string, options?: RequestOptions): Promise<void>;
3412
+ /**
3413
+ * Run every case of a suite against the draft, a published version or `"latest_published"`. Answers at once
3414
+ * (`202`); the run happens in the background, so poll `retrieveRun` until `status` is `completed`.
3415
+ *
3416
+ * 409 `suite_empty`, 422 `agent_type_not_supported` (multi-prompt agents), 429 `too_many_runs` or
3417
+ * `daily_run_limit`.
3418
+ */
3419
+ run(suiteId: string, body?: SimulationRunCreateParams, options?: RequestOptions): Promise<SimulationRun>;
3420
+ /** Runs, newest first. Pass `suite_id` for one suite's. */
3421
+ listRuns(params?: {
3422
+ suite_id?: string;
3423
+ limit?: number;
3424
+ }, options?: RequestOptions): Promise<SimulationRunList>;
3425
+ /** A run with every case's transcript, tool calls and check results. */
3426
+ retrieveRun(runId: string, options?: RequestOptions): Promise<SimulationRunDetail>;
3427
+ /** Stop a run that has not finished. Cases already under way finish; the rest are skipped. */
3428
+ cancelRun(runId: string, options?: RequestOptions): Promise<SimulationRun>;
3429
+ }
3430
+
3431
+ /**
3432
+ * Browser calls. Request bodies come from the generated OpenAPI types (see `params.ts`); the response
3433
+ * shapes are written from the API's own serializers.
3434
+ */
3435
+
3436
+ type Schemas$4 = components["schemas"];
3437
+ type WebCallCreateParams = RequestBody<Schemas$4["WebCallRequest"]>;
3438
+ type WebCallSettingsUpdateParams = RequestBody<Schemas$4["WebCallSettings"]>;
3439
+ /** What `webCalls.create` returns. Hand `access_token` to the page; keep your API key on the server. */
3440
+ interface WebCall {
3441
+ /** The call's id. The call record exists from now, with status `queued` until the browser connects. */
3442
+ call_id: string;
3443
+ agent_id: string;
3444
+ /** The published version this call will run (0 is the live draft). */
3445
+ agent_version: number;
3446
+ /**
3447
+ * A one-use credential for exactly this call and agent. It cannot be used for anything else, and it works
3448
+ * from the origins you have allowed, once.
3449
+ */
3450
+ access_token: string;
3451
+ /** ISO 8601, UTC. 60 seconds after creation: long enough to reach the page, not to be stockpiled. */
3452
+ expires_at: string;
3453
+ expires_in: number;
3454
+ }
3455
+ interface WebCallSettings {
3456
+ /** The websites (origins, like `https://app.example.com`) browser calls may start from. Empty means none. */
3457
+ allowed_origins: string[];
3458
+ /** True when the list contains `*`: any website may start a call with a token it was given. */
3459
+ any_origin: boolean;
3460
+ limits: {
3461
+ /** Browser calls that can be live at once, per organization. */
3462
+ max_concurrent_calls: number;
3463
+ /** Calls that can be created per minute, per organization. */
3464
+ tokens_per_minute: number;
3465
+ token_ttl_s: number;
3466
+ };
3467
+ }
3468
+
3469
+ /**
3470
+ * Let a visitor talk to one of your agents from a web page, with `@dialgem/client`.
3471
+ *
3472
+ * Your **backend** calls `create` with your API key and gives the returned `access_token` to the page; the
3473
+ * page connects with that token alone. The key never reaches the browser. Before the first call, allow the
3474
+ * page's origin with `updateSettings`.
3475
+ */
3476
+ declare class WebCalls extends APIResource {
3477
+ /**
3478
+ * Create a call for one visitor and get its access token.
3479
+ *
3480
+ * const { access_token } = await dialgem.webCalls.create({ agent_id, metadata: { visitor: "v_123" } })
3481
+ *
3482
+ * `metadata` and `dialgem_llm_dynamic_variables` are fixed here, by you, and cannot be changed by the page.
3483
+ * 409 `web_origins_not_configured` until an origin is allowed; 402 if the organization cannot pay for calls;
3484
+ * 429 when more than `limits.tokens_per_minute` calls are created in a minute.
3485
+ */
3486
+ create(body: WebCallCreateParams, options?: RequestOptions): Promise<WebCall>;
3487
+ /** The origins browser calls may start from, and the limits that apply. */
3488
+ retrieveSettings(options?: RequestOptions): Promise<WebCallSettings>;
3489
+ /**
3490
+ * Replace the allowed origins. Each is `scheme://host[:port]`; `https://*.example.com` allows any subdomain
3491
+ * (not the bare domain) and `*` allows any website. Tokens already issued keep the list they were issued with.
3492
+ */
3493
+ updateSettings(body: WebCallSettingsUpdateParams, options?: RequestOptions): Promise<WebCallSettings>;
3494
+ }
3495
+
3496
+ /**
3497
+ * Contacts, lists and CSV imports.
3498
+ *
3499
+ * Request bodies come from the generated OpenAPI types (see `params.ts`); the
3500
+ * response shapes are written here, from the API's own serializers.
3501
+ */
3502
+
3503
+ type Schemas$3 = components["schemas"];
3504
+ type ContactCreateParams = RequestBody<Schemas$3["ContactCreate"]>;
3505
+ type ContactUpdateParams = RequestBody<Schemas$3["ContactUpdate"]>;
3506
+ type ContactListCreateParams = RequestBody<Schemas$3["ContactListCreate"]>;
3507
+ type ContactListUpdateParams = RequestBody<Schemas$3["ContactListUpdate"]>;
3508
+ type ContactImportCreateParams = RequestBody<Schemas$3["ContactImportCreate"]>;
3509
+ interface Contact {
3510
+ id: string;
3511
+ /** E.164, for example `+14155552671`. The number is the contact's identity: one contact per number. */
3512
+ phone: string;
3513
+ first_name: string | null;
3514
+ last_name: string | null;
3515
+ email: string | null;
3516
+ /** IANA zone name, for example `America/Chicago`. */
3517
+ timezone: string | null;
3518
+ /** Your own fields, as text. */
3519
+ attributes: Record<string, string>;
3520
+ source: "api" | "dashboard" | "import" | (string & {});
3521
+ /**
3522
+ * Whether the number is on your organization's do-not-call list. Read from that list
3523
+ * each time, never stored on the contact.
3524
+ */
3525
+ do_not_call: boolean;
3526
+ /** ISO 8601, no timezone suffix (UTC). */
3527
+ created_at: string | null;
3528
+ updated_at: string | null;
3529
+ /** Present on `create`, `retrieve` and `update`. */
3530
+ lists?: {
3531
+ id: string;
3532
+ name: string;
3533
+ }[];
3534
+ /** Present on `retrieve`: calls to or from the number. */
3535
+ call_count?: number;
3536
+ last_call_at?: string | null;
3537
+ }
3538
+ interface ContactListParams {
3539
+ /** Matches name, email and phone digits. */
3540
+ q?: string | undefined;
3541
+ list_id?: string | undefined;
3542
+ /** 1 to 200. Default 50. */
3543
+ limit?: number | undefined;
3544
+ }
3545
+ interface ContactDeleteResponse {
3546
+ id: string;
3547
+ deleted: true;
3548
+ }
3549
+ interface ContactCallSummary {
3550
+ id: string;
3551
+ agent_id: string | null;
3552
+ direction: "inbound" | "outbound" | (string & {});
3553
+ status: string;
3554
+ started_at: string | null;
3555
+ ended_at: string | null;
3556
+ duration_s: number | null;
3557
+ disconnection_reason: string | null;
3558
+ /** The call's analysis summary, when it has one. No transcript. */
3559
+ summary: string | null;
3560
+ }
3561
+ interface ContactCallList {
3562
+ total: number;
3563
+ calls: ContactCallSummary[];
3564
+ }
3565
+ interface ContactListRecord {
3566
+ id: string;
3567
+ name: string;
3568
+ description: string | null;
3569
+ member_count: number;
3570
+ created_at: string | null;
3571
+ updated_at: string | null;
3572
+ }
3573
+ interface ContactListDeleteResponse {
3574
+ id: string;
3575
+ deleted: true;
3576
+ }
3577
+ interface ContactListMembersAddResponse {
3578
+ id: string;
3579
+ /** How many were not already in the list. */
3580
+ added: number;
3581
+ member_count: number;
3582
+ }
3583
+ interface ContactListMemberRemoveResponse {
3584
+ id: string;
3585
+ member_count: number;
3586
+ }
3587
+ type ContactImportStatus = "queued" | "running"
3588
+ /** A dry run finished; apply it with `commit`. */
3589
+ | "previewed" | "completed" | "failed" | "cancelled"
3590
+ /** A preview nobody confirmed within a day. */
3591
+ | "expired";
3592
+ interface ContactImport {
3593
+ id: string;
3594
+ status: ContactImportStatus;
3595
+ dry_run: boolean;
3596
+ filename: string | null;
3597
+ total_rows: number;
3598
+ /** For a preview, what would be created. */
3599
+ created: number;
3600
+ updated: number;
3601
+ /** Rows repeating an earlier number in the file, or existing contacts when `on_duplicate` is `skip`. */
3602
+ skipped: number;
3603
+ /** Rows that could not be used. See `imports.errors`. */
3604
+ errors: number;
3605
+ /** More rows were rejected than the report keeps (5,000). */
3606
+ errors_truncated: boolean;
3607
+ failure: string | null;
3608
+ mapping: Record<string, string> | null;
3609
+ attribute_columns: string[] | null;
3610
+ default_country: string | null;
3611
+ on_duplicate: "update" | "skip" | null;
3612
+ list_id: string | null;
3613
+ created_at: string | null;
3614
+ started_at: string | null;
3615
+ finished_at: string | null;
3616
+ }
3617
+ interface ContactImportList {
3618
+ imports: ContactImport[];
3619
+ }
3620
+ interface ContactCsvInspection {
3621
+ headers: string[];
3622
+ row_count: number;
3623
+ /** The guessed field-to-column mapping: `phone`, `first_name`, `last_name`, `full_name`, `email`, `timezone`. */
3624
+ mapping: Record<string, string>;
3625
+ /** Columns left over, offered as your own fields. */
3626
+ attribute_columns: string[];
3627
+ sample: Record<string, string | null>[];
3628
+ }
3629
+ interface ContactImportErrorRow {
3630
+ /** The line of the file, counting the header as line 1. */
3631
+ row: number;
3632
+ error: string;
3633
+ values: Record<string, string>;
3634
+ }
3635
+ interface ContactImportErrors {
3636
+ errors: ContactImportErrorRow[];
3637
+ total: number;
3638
+ truncated: boolean;
3639
+ }
3640
+
3641
+ /**
3642
+ * The people your organization calls. A phone number identifies each one: it is stored
3643
+ * in international form however you write it, and each number can be a contact once.
3644
+ */
3645
+ declare class Contacts extends APIResource {
3646
+ /** Bulk import from CSV, with a dry-run preview. */
3647
+ readonly imports: ContactImports;
3648
+ constructor(client: HttpClient);
3649
+ /**
3650
+ * Add a contact. `phone` is any way of writing a valid number; without a leading `+`
3651
+ * also pass `default_country` (`"US"`). A number that is already a contact answers 409
3652
+ * with its `contact_id`.
3653
+ */
3654
+ create(body: ContactCreateParams, options?: RequestOptions): Promise<Contact>;
3655
+ /**
3656
+ * Contacts, newest first. Await for one page, or iterate for every contact:
3657
+ *
3658
+ */
3659
+ list(params?: ContactListParams, options?: RequestOptions): PagePromise<Contact>;
3660
+ /**
3661
+ * The contact with this phone number. The number is matched as E.164, so
3662
+ * `("(212) 220-0001", { default_country: "US" })` finds `+12122200001`. Throws
3663
+ * `NotFoundError` if you have no such contact, and `UnprocessableEntityError` if the text is
3664
+ * not a phone number.
3665
+ */
3666
+ retrieveByPhone(phone: string, params?: {
3667
+ default_country?: string | undefined;
3668
+ }, options?: RequestOptions): Promise<Contact>;
3669
+ /** One contact, with its lists and how many calls it has had. */
3670
+ retrieve(contactId: string, options?: RequestOptions): Promise<Contact>;
3671
+ /**
3672
+ * Partial update: only the fields you send change, and `null` clears a field.
3673
+ * `attributes` replaces the whole set, so send every field you want kept.
3674
+ */
3675
+ update(contactId: string, body: ContactUpdateParams, options?: RequestOptions): Promise<Contact>;
3676
+ /**
3677
+ * Erase a contact and its list memberships. Calls already made stay in the call log, and
3678
+ * a do-not-call entry for the number stays too, so forgetting a person never makes a number
3679
+ * that asked not to be called dialable again.
3680
+ */
3681
+ delete(contactId: string, options?: RequestOptions): Promise<ContactDeleteResponse>;
3682
+ /** Calls to or from the contact's number, newest first. Summaries, not transcripts. */
3683
+ calls(contactId: string, params?: {
3684
+ limit?: number | undefined;
3685
+ }, options?: RequestOptions): Promise<ContactCallList>;
3686
+ }
3687
+ /**
3688
+ * CSV import runs in the background. Typical flow: `inspect` to see the columns, `create`
3689
+ * with `dry_run: true`, poll `retrieve` until `previewed`, look at the counts (and `errors`),
3690
+ * then `commit` and poll until `completed`.
3691
+ *
3692
+ * The CSV text is sent in the request. Downloading the rejected rows as a CSV, and exporting
3693
+ * contacts, are available over the REST API (`GET /v1/contacts/imports/{id}/errors?format=csv`,
3694
+ * `GET /v1/contacts/export`).
3695
+ */
3696
+ declare class ContactImports extends APIResource {
3697
+ /** The file's headers, a guessed column mapping and a few rows. Imports nothing. */
3698
+ inspect(csv: string, options?: RequestOptions): Promise<ContactCsvInspection>;
3699
+ /**
3700
+ * Start an import. Without `mapping` the columns are guessed from the headers. With
3701
+ * `dry_run: true` nothing is written: the import only validates and reports.
3702
+ */
3703
+ create(body: ContactImportCreateParams, options?: RequestOptions): Promise<ContactImport>;
3704
+ /** Recent imports, newest first. */
3705
+ list(options?: RequestOptions): Promise<ContactImportList>;
3706
+ /** Progress and counts. */
3707
+ retrieve(importId: string, options?: RequestOptions): Promise<ContactImport>;
3708
+ /** The rows that were rejected, with the line, the reason and what each held. */
3709
+ errors(importId: string, params?: {
3710
+ limit?: number | undefined;
3711
+ }, options?: RequestOptions): Promise<ContactImportErrors>;
3712
+ /** Apply a previewed import: the file is read again, so what is applied is what was previewed. */
3713
+ commit(importId: string, options?: RequestOptions): Promise<ContactImport>;
3714
+ /** Stop an import that has not finished. Contacts a running import already wrote stay. */
3715
+ cancel(importId: string, options?: RequestOptions): Promise<ContactImport>;
3716
+ }
3717
+ /** Named groups of contacts. Deleting a list never deletes its contacts. */
3718
+ declare class ContactLists extends APIResource {
3719
+ list(options?: RequestOptions): Promise<{
3720
+ lists: ContactListRecord[];
3721
+ }>;
3722
+ /** Names are unique within your organization, ignoring case. */
3723
+ create(body: ContactListCreateParams, options?: RequestOptions): Promise<ContactListRecord>;
3724
+ retrieve(listId: string, options?: RequestOptions): Promise<ContactListRecord>;
3725
+ update(listId: string, body: ContactListUpdateParams, options?: RequestOptions): Promise<ContactListRecord>;
3726
+ delete(listId: string, options?: RequestOptions): Promise<ContactListDeleteResponse>;
3727
+ /** Add up to 1000 of your contacts. Already-members are ignored; `added` says how many were new. */
3728
+ addContacts(listId: string, contactIds: string[], options?: RequestOptions): Promise<ContactListMembersAddResponse>;
3729
+ removeContact(listId: string, contactId: string, options?: RequestOptions): Promise<ContactListMemberRemoveResponse>;
3730
+ }
3731
+
3732
+ /**
3733
+ * Which published agent version a number answers on.
3734
+ *
3735
+ * A number is the frozen version with that number; `0` is the live draft, which
3736
+ * is what a number does when nothing is pinned. `"latest_published"` is a
3737
+ * pointer rather than a choice — it follows the newest publish, so shipping a
3738
+ * new version moves every number set to it without touching them.
3739
+ *
3740
+ * A *call* never reports this type: `Call.agent_version` is always the concrete
3741
+ * number that ran, resolved when the call was placed.
3742
+ */
3743
+ type AgentVersionRef = number | "latest_published";
3744
+ /**
3745
+ * A phone number, as returned by `/v1/phone-numbers`.
3746
+ * The shape is the same across all phone-number endpoints.
3747
+ */
3748
+ interface PhoneNumber {
3749
+ /** Dialgem id. Use this (not the E.164 number) for update/assign/delete. */
3750
+ id: string;
3751
+ status: string;
3752
+ provider: string;
3753
+ /** E.164, e.g. `+14155550123`. */
3754
+ phone_number: string;
3755
+ phone_number_pretty: string;
3756
+ phone_number_type: string;
3757
+ nickname: string;
3758
+ inbound_agent_id: string | null;
3759
+ inbound_agent_version: AgentVersionRef;
3760
+ outbound_agent_id: string | null;
3761
+ outbound_agent_version: AgentVersionRef;
3762
+ /** Weighted inbound routing. `inbound_agent_id` is its primary entry. */
3763
+ inbound_agents: PhoneNumberAgentWeight[];
3764
+ outbound_agents: PhoneNumberAgentWeight[];
3765
+ custom_sms_enabled: boolean;
3766
+ flow_sms_sender_enabled: boolean;
3767
+ /** Epoch milliseconds (0 if unknown). */
3768
+ creation_timestamp: number;
3769
+ /** Epoch milliseconds (0 if unknown). */
3770
+ last_modification_timestamp: number;
3771
+ sip_outbound_trunk_config: SipOutboundTrunkConfig | null;
3772
+ /** The inbound routing webhook, asked before an inbound call is answered. `null` when none is set. */
3773
+ inbound_webhook_url: string | null;
3774
+ /** The last four characters of the signing secret; `null` with no webhook. */
3775
+ inbound_webhook_secret_hint: string | null;
3776
+ /** The full signing secret. Present **only** in the response that created or rotated it, never again. */
3777
+ inbound_webhook_secret?: string;
3778
+ }
3779
+ /** What `phoneNumbers.testInboundWebhook` reports. */
3780
+ interface InboundWebhookTestResult {
3781
+ /** Your endpoint answered with a 2xx. */
3782
+ ok: boolean;
3783
+ status_code: number | null;
3784
+ latency_ms: number;
3785
+ /** The time your endpoint has for a real call (`INBOUND_ROUTING_TIMEOUT_S`). */
3786
+ budget_ms: number;
3787
+ error: string | null;
3788
+ /** What a real call would have done with the answer. */
3789
+ decision: {
3790
+ outcome: "unchanged" | "applied" | "rejected" | "fallback";
3791
+ note?: string;
3792
+ reject_reason?: string;
3793
+ agent_id?: string;
3794
+ agent_version?: number | null;
3795
+ /** Names of the dynamic variables that would be applied. */
3796
+ variables?: string[];
3797
+ metadata_keys?: string[];
3798
+ /** Fields that would be ignored, as `field: reason`. */
3799
+ ignored?: Record<string, string>;
3800
+ };
3801
+ }
3802
+ interface PhoneNumberAgentWeight {
3803
+ agent_id: string;
3804
+ agent_version: AgentVersionRef;
3805
+ weight: number;
3806
+ }
3807
+ interface SipOutboundTrunkConfig {
3808
+ termination_uri?: string | null;
3809
+ transport?: string | null;
3810
+ auth_username?: string | null;
3811
+ [key: string]: unknown;
3812
+ }
3813
+
3814
+ declare class PhoneNumbers extends APIResource {
3815
+ /** Register a number you own (`phone_number` in E.164) with Dialgem. */
3816
+ create(body: PhoneNumberCreateParams, options?: RequestOptions): Promise<PhoneNumber>;
3817
+ /** Every active (not released) number in the organization, newest first. */
3818
+ list(options?: RequestOptions): Promise<PhoneNumber[]>;
3819
+ /**
3820
+ * One number by its E.164 value, e.g. `+14155550123`.
3821
+ *
3822
+ * Keyed on the number rather than on `id`, because the number is what you
3823
+ * have when you are asking whether it is registered at all. Throws
3824
+ * `NotFoundError` when it is not.
3825
+ */
3826
+ retrieve(phoneNumber: string, options?: RequestOptions): Promise<PhoneNumber>;
3827
+ /**
3828
+ * Partial update.
3829
+ *
3830
+ * `inbound_agent_id` is **ignored unless `set_inbound_agent: true`** is sent with
3831
+ * it, both to set an agent and to clear one (`null`). Same for the outbound pair.
3832
+ * `inbound_agents` / `outbound_agents` (weighted routing), when sent, take
2122
3833
  * precedence over the single-agent fields.
2123
3834
  */
2124
3835
  update(phoneNumberId: string, body: PhoneNumberUpdateParams, options?: RequestOptions): Promise<PhoneNumber>;
2125
3836
  /** Set the number's **inbound** agent, or pass `agent_id: null` to clear it. For outbound, use `update`. */
2126
3837
  assign(phoneNumberId: string, body: PhoneNumberAssignParams, options?: RequestOptions): Promise<PhoneNumber>;
3838
+ /**
3839
+ * Send one signed test request to the number's inbound routing webhook and report what a real call would have done
3840
+ * with your answer: the status, how long you took against the time budget, and any field that would be ignored.
3841
+ * Throws a `ConflictError` (`inbound_webhook_not_set`) when the number has no `inbound_webhook_url`.
3842
+ */
3843
+ testInboundWebhook(phoneNumberId: string, options?: RequestOptions): Promise<InboundWebhookTestResult>;
3844
+ /**
3845
+ * Replace the inbound webhook's signing secret. The new secret is returned **once**, as `inbound_webhook_secret`
3846
+ * on the number; the old one stops working at once.
3847
+ */
3848
+ rotateInboundWebhookSecret(phoneNumberId: string, options?: RequestOptions): Promise<PhoneNumber>;
2127
3849
  /** Release the number from Dialgem. It stops routing calls and disappears from `list()`; your carrier account is untouched. */
2128
3850
  delete(phoneNumberId: string, options?: RequestOptions): Promise<void>;
2129
3851
  }
2130
3852
 
2131
3853
  /**
2132
- * Payloads Dialgem POSTs to an agent's `webhook_url`, subscribed per agent via
2133
- * `webhook_events`. Flat objects with an `event` discriminator; see
2134
- * the "Verify webhooks" section of the README.
3854
+ * Chats. Request bodies come from the generated OpenAPI types; the response shapes are written from the
3855
+ * API's own serializer (`chat_to_dict`).
3856
+ */
3857
+
3858
+ type Schemas$2 = components["schemas"];
3859
+ type ChatCreateParams = RequestBody<Schemas$2["ChatCreate"]>;
3860
+ type ChatUpdateParams = RequestBody<Schemas$2["ChatUpdate"]>;
3861
+ interface ChatListParams {
3862
+ agent_id?: string | undefined;
3863
+ status?: "ongoing" | "ended" | undefined;
3864
+ /** 1 to 100. Default 50. */
3865
+ limit?: number | undefined;
3866
+ }
3867
+ /** One entry in a chat. Tool use is shown between the user's message and the agent's reply. */
3868
+ interface ChatMessage {
3869
+ message_id: string;
3870
+ role: "user" | "agent" | "tool_call_invocation" | "tool_call_result" | (string & {});
3871
+ /** The text. Empty on a `tool_call_invocation`; the tool's answer on a `tool_call_result`. */
3872
+ content: string;
3873
+ /** Epoch milliseconds. */
3874
+ created_timestamp: number;
3875
+ /** On the two tool roles: ties an invocation to its result. */
3876
+ tool_call_id?: string;
3877
+ /** On `tool_call_invocation`. */
3878
+ name?: string;
3879
+ arguments?: Record<string, unknown>;
3880
+ }
3881
+ interface Chat {
3882
+ id: string;
3883
+ /** Same as `id`. */
3884
+ chat_id: string;
3885
+ chat_type: "api_chat" | (string & {});
3886
+ chat_status: "ongoing" | "ended" | (string & {});
3887
+ agent_id: string;
3888
+ /** The version the chat answers with; 0 is the live draft. */
3889
+ agent_version: number;
3890
+ metadata: Record<string, unknown>;
3891
+ dynamic_variables: Record<string, string>;
3892
+ /** Epoch milliseconds. */
3893
+ start_timestamp: number | null;
3894
+ end_timestamp: number | null;
3895
+ /** `user_ended`, `agent_ended`, ... `null` while ongoing. */
3896
+ end_reason: string | null;
3897
+ /** User and agent messages, not counting tool entries. */
3898
+ message_count: number;
3899
+ /** `User: ...` / `Agent: ...` lines. */
3900
+ transcript: string;
3901
+ /** Same shape as a call's `analysis`; `null` until it has run (a moment after the chat ends). */
3902
+ analysis: Record<string, unknown> | null;
3903
+ /**
3904
+ * What the chat has cost so far, in $0.0001 units (50 = $0.005), and how many agent messages it holds
3905
+ * (the greeting is one, and is not billed). `null` for a team-member session, as for a call's cost.
3906
+ * Estimates until the price list is published.
3907
+ */
3908
+ chat_cost: {
3909
+ combined_cost: number;
3910
+ reply_count: number;
3911
+ } | null;
3912
+ /** Left out of `list` entries; fetch one chat for them. */
3913
+ messages?: ChatMessage[];
3914
+ }
3915
+ /** What `chats.sendMessage` returns: only the new entries, in order. */
3916
+ interface ChatReply {
3917
+ chat_id: string;
3918
+ chat_status: "ongoing" | "ended" | (string & {});
3919
+ messages: ChatMessage[];
3920
+ }
3921
+ interface ChatDeleteResponse {
3922
+ deleted: true;
3923
+ id: string;
3924
+ }
3925
+
3926
+ /**
3927
+ * Text conversations with one of your agents, from your backend.
3928
+ *
3929
+ * const chat = await dialgem.chats.create({ agent_id, dynamic_variables: { customer: "Ada" } })
3930
+ * const { messages } = await dialgem.chats.sendMessage(chat.id, "Can I come in on Tuesday?")
3931
+ * await dialgem.chats.end(chat.id)
2135
3932
  *
2136
- * Delivery is at-least-once in practice: a failed POST is retried once after a
2137
- * second, so a slow 2xx can arrive twice. Make handlers idempotent on
2138
- * `(event, call_id)`.
3933
+ * The agent is the one that answers your phone: same prompt, model and functions. Prompt agents only; an agent
3934
+ * that keeps no transcript cannot chat. Your API key stays on your server; to put a chat box on a web page,
3935
+ * have your backend call `sendMessage` for the visitor.
2139
3936
  */
2140
- type WebhookEvent = CallStartedEvent | CallEndedEvent | CallAnalyzedEvent;
2141
- interface CallStartedEvent {
2142
- event: "call_started";
3937
+ declare class Chats extends APIResource {
3938
+ /**
3939
+ * Start a chat. If the agent has a first message it is already in `messages`.
3940
+ *
3941
+ * `UnprocessableEntityError` with `errCode` `agent_type_not_supported` (flow agents) or `chat_requires_storage`.
3942
+ * Not retried by default.
3943
+ */
3944
+ create(body: ChatCreateParams, options?: RequestOptions): Promise<Chat>;
3945
+ /**
3946
+ * Chats, newest first. Await for one page, or iterate for every chat. Entries leave out `messages`;
3947
+ * `retrieve` a chat for them.
3948
+ */
3949
+ list(params?: ChatListParams, options?: RequestOptions): PagePromise<Chat>;
3950
+ /** One chat with all its messages. */
3951
+ retrieve(chatId: string, options?: RequestOptions): Promise<Chat>;
3952
+ /** Replace the chat's `metadata` (the whole object). */
3953
+ update(chatId: string, body: ChatUpdateParams, options?: RequestOptions): Promise<Chat>;
3954
+ /** Delete a chat and its messages. */
3955
+ delete(chatId: string, options?: RequestOptions): Promise<ChatDeleteResponse>;
3956
+ /**
3957
+ * Send the user's message and wait for the agent's reply. Returns only the new entries, in order: the user's
3958
+ * message, any tool use, the agent's reply.
3959
+ *
3960
+ * If the agent's model fails (`ServerError`, `errCode` `model_error`) nothing is stored and the same message
3961
+ * can be sent again. `ConflictError` with `errCode` `chat_busy` while another reply is in progress,
3962
+ * `chat_ended` after the end, `message_limit` at the cap. If the agent calls its end-call tool, the reply's
3963
+ * `chat_status` is `ended`.
3964
+ *
3965
+ * Not retried by default: a retry after an ambiguous failure could send the message twice.
3966
+ */
3967
+ sendMessage(chatId: string, content: string, options?: RequestOptions): Promise<ChatReply>;
3968
+ /** End the chat. Ending twice is fine. The analysis arrives a moment later; read it with `retrieve`. */
3969
+ end(chatId: string, options?: RequestOptions): Promise<Chat>;
3970
+ /**
3971
+ * Analyse an ended chat again with the agent's current analysis settings and return it. `ConflictError` with
3972
+ * `errCode` `chat_in_progress` until it has ended, `no_transcript` when it has no messages.
3973
+ */
3974
+ rerunAnalysis(chatId: string, options?: RequestOptions): Promise<Chat>;
3975
+ }
3976
+
3977
+ /**
3978
+ * Saved flows. Request bodies come from the generated OpenAPI types; the response shape is written from the
3979
+ * API's own serializer (`flow_to_dict`).
3980
+ */
3981
+
3982
+ type Schemas$1 = components["schemas"];
3983
+ type FlowCreateParams = RequestBody<Schemas$1["FlowCreate"]>;
3984
+ type FlowUpdateParams = RequestBody<Schemas$1["FlowUpdate"]>;
3985
+ interface FlowListParams {
3986
+ /** 1 to 100. Default 50. */
3987
+ limit?: number | undefined;
3988
+ }
3989
+ interface Flow {
3990
+ id: string;
3991
+ /** Same as `id`. */
3992
+ flow_id: string;
3993
+ name: string;
3994
+ language: string;
3995
+ /** Bumped by the server when the flow's content changes. */
3996
+ version: number | null;
3997
+ node_count: number;
3998
+ /** Epoch milliseconds. */
3999
+ created_timestamp: number | null;
4000
+ last_modification_timestamp: number | null;
4001
+ /** Left out of `list` entries; `retrieve` a flow for it. */
4002
+ flow_config?: FlowConfig;
4003
+ /** Present on `create` / `update` when the flow saved with warnings. */
4004
+ flow_validation?: {
4005
+ issues: ErrorIssue[];
4006
+ };
4007
+ }
4008
+ interface FlowDeleteResponse {
4009
+ deleted: true;
4010
+ id: string;
4011
+ }
4012
+
4013
+ /**
4014
+ * Conversation flows you save once and attach to agents.
4015
+ *
4016
+ * const flow = await dialgem.flows.create({ name: "Intake", flow_config })
4017
+ * await dialgem.agents.create({ name: "Front desk", agent_type: "flow", flow_id: flow.id })
4018
+ *
4019
+ * A flow is checked the way an agent's `flow_config` is, so a saved flow is one that would have saved on an
4020
+ * agent. **Attaching copies it**: `agents.create` / `agents.update` with `flow_id` takes a snapshot, and editing
4021
+ * or deleting the flow afterwards changes no agent, no published version and no call.
4022
+ */
4023
+ declare class Flows extends APIResource {
4024
+ /** Validate and save a flow. `UnprocessableEntityError` (`errCode` `flow_invalid`) lists every problem. Not retried by default. */
4025
+ create(body: FlowCreateParams, options?: RequestOptions): Promise<Flow>;
4026
+ /** Flows, newest first. Await for one page, or iterate for every flow. Entries leave out `flow_config`. */
4027
+ list(params?: FlowListParams, options?: RequestOptions): PagePromise<Flow>;
4028
+ /** One flow with its `flow_config`. */
4029
+ retrieve(flowId: string, options?: RequestOptions): Promise<Flow>;
4030
+ /** Rename a flow and/or replace its `flow_config` (checked again). Agents it was attached to are not changed. */
4031
+ update(flowId: string, body: FlowUpdateParams, options?: RequestOptions): Promise<Flow>;
4032
+ /** Delete a saved flow. Agents it was attached to keep their copy. */
4033
+ delete(flowId: string, options?: RequestOptions): Promise<FlowDeleteResponse>;
4034
+ }
4035
+
4036
+ /**
4037
+ * Saved LLM settings. Request bodies come from the generated OpenAPI types; the response shape is written from
4038
+ * the API's own serializer (`llm_to_dict`).
4039
+ */
4040
+
4041
+ type Schemas = components["schemas"];
4042
+ type LLMCreateParams = RequestBody<Schemas["LLMCreate"]>;
4043
+ type LLMUpdateParams = RequestBody<Schemas["LLMUpdate"]>;
4044
+ interface LLMListParams {
4045
+ /** 1 to 100. Default 50. */
4046
+ limit?: number | undefined;
4047
+ }
4048
+ interface LLM {
4049
+ id: string;
4050
+ /** Same as `id`. */
4051
+ llm_id: string;
4052
+ name: string;
4053
+ /** Epoch milliseconds. */
4054
+ created_timestamp: number | null;
4055
+ last_modification_timestamp: number | null;
4056
+ system_prompt: string;
4057
+ first_message: string | null;
4058
+ llm_provider: "anthropic" | "openai" | (string & {});
4059
+ llm_model: string;
4060
+ temperature: number;
4061
+ max_tokens: number;
4062
+ fallback_llm_provider: "anthropic" | "openai" | (string & {}) | null;
4063
+ fallback_llm_model: string | null;
4064
+ default_dynamic_variables: Record<string, string>;
4065
+ }
4066
+ interface LLMDeleteResponse {
4067
+ deleted: true;
4068
+ id: string;
4069
+ }
4070
+
4071
+ /**
4072
+ * A prompt and model you set up once and attach to agents.
4073
+ *
4074
+ * const llm = await dialgem.llms.create({ name: "Booking", system_prompt, llm_model: "gpt-4o-mini" })
4075
+ * await dialgem.agents.create({ name: "Front desk", llm_id: llm.id })
4076
+ *
4077
+ * It holds `system_prompt`, `first_message`, `llm_provider`, `llm_model`, `temperature`, `max_tokens`, the
4078
+ * fallback pair and `default_dynamic_variables`. **Attaching copies it**: `agents.create` / `agents.update` with
4079
+ * `llm_id` writes those values into the agent, and editing or deleting the saved LLM afterwards changes no
4080
+ * agent, no published version and no call. Sending `llm_id` together with any of those fields is refused.
4081
+ */
4082
+ declare class LLMs extends APIResource {
4083
+ /** Save LLM settings. Anything left out takes the default a new agent gets. Not retried by default. */
4084
+ create(body: LLMCreateParams, options?: RequestOptions): Promise<LLM>;
4085
+ /** Saved LLMs, newest first. Await for one page, or iterate for every one. */
4086
+ list(params?: LLMListParams, options?: RequestOptions): PagePromise<LLM>;
4087
+ retrieve(llmId: string, options?: RequestOptions): Promise<LLM>;
4088
+ /** Change the fields you send. Agents it was attached to are not changed. */
4089
+ update(llmId: string, body: LLMUpdateParams, options?: RequestOptions): Promise<LLM>;
4090
+ /** Delete saved LLM settings. Agents they were attached to keep their copy. */
4091
+ delete(llmId: string, options?: RequestOptions): Promise<LLMDeleteResponse>;
4092
+ }
4093
+
4094
+ /**
4095
+ * Payloads Dialgem POSTs to an agent's `webhook_url`, for the events subscribed in
4096
+ * `webhook_events`. Each carries the full call record; see the "Verify webhooks"
4097
+ * section of the README.
4098
+ *
4099
+ * A failed delivery is retried up to three times, and every attempt carries the
4100
+ * same `x-dialgem-delivery` id. Use it (or `event` + `call_id`) to drop duplicates.
4101
+ */
4102
+ type WebhookEvent = CallStartedEvent | CallEndedEvent | CallAnalyzedEvent | TranscriptUpdatedEvent | TransferStartedEvent | TransferBridgedEvent | TransferCancelledEvent | TransferEndedEvent | ChatStartedEvent | ChatEndedEvent | ChatAnalyzedEvent;
4103
+ interface CallEventBase {
2143
4104
  call_id: string;
2144
4105
  agent_id: string;
4106
+ /** The full call record at the moment the event was sent. */
4107
+ call: Call;
2145
4108
  }
2146
- interface CallEndedEvent {
4109
+ interface CallStartedEvent extends CallEventBase {
4110
+ event: "call_started";
4111
+ }
4112
+ /** Sent as soon as the call ends; post-call analysis follows in `call_analyzed`. */
4113
+ interface CallEndedEvent extends CallEventBase {
2147
4114
  event: "call_ended";
2148
- call_id: string;
2149
- agent_id: string;
2150
- status: CallStatus;
2151
- duration_s: number | null;
2152
4115
  }
2153
- /** Sent before `call_ended`, and only for calls that produced a transcript. */
2154
- interface CallAnalyzedEvent {
4116
+ /** Sent after `call_ended`, once analysis has run, and only for calls that produced a transcript. */
4117
+ interface CallAnalyzedEvent extends CallEventBase {
2155
4118
  event: "call_analyzed";
2156
- call_id: string;
4119
+ }
4120
+ interface ChatEventBase {
4121
+ chat_id: string;
2157
4122
  agent_id: string;
2158
- analysis: CallAnalysis;
4123
+ /** The full chat record, with its messages, at the moment the event was sent. */
4124
+ chat: Chat;
4125
+ }
4126
+ /** A chat was started. Chat events carry `chat_id`, not `call_id`. */
4127
+ interface ChatStartedEvent extends ChatEventBase {
4128
+ event: "chat_started";
4129
+ }
4130
+ /** The chat ended (by `chats.end` or by the agent). Analysis follows in `chat_analyzed`. */
4131
+ interface ChatEndedEvent extends ChatEventBase {
4132
+ event: "chat_ended";
4133
+ }
4134
+ /** Sent once a chat's analysis has run. */
4135
+ interface ChatAnalyzedEvent extends ChatEventBase {
4136
+ event: "chat_analyzed";
4137
+ }
4138
+ /** A transcript turn as carried by `transcript_updated`. */
4139
+ interface WebhookTranscriptTurn {
4140
+ role: "user" | "agent";
4141
+ text: string;
4142
+ timestamp: string;
4143
+ start_ms?: number;
4144
+ }
4145
+ /**
4146
+ * Sent each time a caller or agent turn is added to the live transcript.
4147
+ *
4148
+ * `transcript` is the whole transcript so far, so a receiver that misses or
4149
+ * reorders a delivery still ends up correct. `turn_index` increases by one per
4150
+ * event within a call; keep the highest.
4151
+ */
4152
+ interface TranscriptUpdatedEvent extends CallEventBase {
4153
+ event: "transcript_updated";
4154
+ /** Who spoke the turn that triggered this event. */
4155
+ role: "user" | "agent";
4156
+ turn_index: number;
4157
+ transcript: WebhookTranscriptTurn[];
4158
+ }
4159
+ /** What a transfer event says about the transfer. Fields are present only when known. */
4160
+ interface WebhookTransferInfo {
4161
+ /** The number the call is being transferred to. */
4162
+ target?: string;
4163
+ mode?: "cold" | "warm" | string;
4164
+ /** Why a transfer was cancelled: a carrier dial status (`busy`, `no-answer`, ...) or a failure reason. */
4165
+ reason?: string;
4166
+ }
4167
+ /** The agent asked for the call to be transferred. */
4168
+ interface TransferStartedEvent extends CallEventBase {
4169
+ event: "transfer_started";
4170
+ transfer: WebhookTransferInfo;
4171
+ }
4172
+ /**
4173
+ * The transferee answered and was connected to the caller. For a cold transfer
4174
+ * this is delivered when the transferred leg finishes, immediately followed by
4175
+ * `transfer_ended`.
4176
+ */
4177
+ interface TransferBridgedEvent extends CallEventBase {
4178
+ event: "transfer_bridged";
4179
+ transfer: WebhookTransferInfo;
4180
+ }
4181
+ /** The transfer did not connect: busy, no answer, failed, or could not be placed. */
4182
+ interface TransferCancelledEvent extends CallEventBase {
4183
+ event: "transfer_cancelled";
4184
+ transfer: WebhookTransferInfo;
4185
+ }
4186
+ /** A connected transfer finished. */
4187
+ interface TransferEndedEvent extends CallEventBase {
4188
+ event: "transfer_ended";
4189
+ transfer: WebhookTransferInfo;
4190
+ }
4191
+ /**
4192
+ * The body Dialgem POSTs to a custom function's URL when the agent calls it,
4193
+ * unless the function has `args_at_root`, in which case the body is `args` alone.
4194
+ */
4195
+ interface FunctionCallRequest<Args = Record<string, unknown>> {
4196
+ /** The function's name. */
4197
+ name: string;
4198
+ call: FunctionCallContext;
4199
+ /** The arguments the agent supplied, per the function's `parameters` schema. */
4200
+ args: Args;
4201
+ }
4202
+ interface FunctionCallContext {
4203
+ call_id: string;
4204
+ agent_id: string | null;
4205
+ call_type: "phone_call" | "web_call";
4206
+ direction: "inbound" | "outbound" | null;
4207
+ from_number: string | null;
4208
+ to_number: string | null;
4209
+ dynamic_variables: Record<string, string>;
4210
+ metadata: Record<string, unknown>;
2159
4211
  }
2160
4212
 
2161
- /** Header carrying the hex HMAC-SHA256 of the raw request body. */
4213
+ /** Header carrying the request signature: `v=<timestamp_ms>,d=<hex>`. */
2162
4214
  declare const WEBHOOK_SIGNATURE_HEADER = "x-dialgem-signature";
2163
4215
  /** Header naming the event; the same value as the body's `event`. */
2164
4216
  declare const WEBHOOK_EVENT_HEADER = "x-dialgem-event";
4217
+ /**
4218
+ * During a signing-secret rotation overlap, the same body signed with the PREVIOUS
4219
+ * secret. Verify `x-dialgem-signature` with the new secret; a receiver that has not
4220
+ * switched yet can verify this one with the old secret instead.
4221
+ */
4222
+ declare const WEBHOOK_PREVIOUS_SIGNATURE_HEADER = "x-dialgem-signature-previous";
4223
+ /** Header with an id that stays the same across retries of one delivery. */
4224
+ declare const WEBHOOK_DELIVERY_HEADER = "x-dialgem-delivery";
4225
+ /** Signatures older or newer than this are rejected, so a captured request cannot be replayed. */
4226
+ declare const DEFAULT_SIGNATURE_TOLERANCE_MS: number;
2165
4227
  /** The raw request body, byte-for-byte as received. Node `Buffer` is a `Uint8Array`. */
2166
4228
  type WebhookPayload = string | Uint8Array | ArrayBuffer;
2167
4229
  /** A header value as Node's `IncomingHttpHeaders`, `Headers.get()` or a framework hands it over. */
2168
4230
  type SignatureHeader = string | string[] | null | undefined;
4231
+ interface VerifyOptions {
4232
+ /** Maximum age (and clock skew) of a signature, in ms. Default 5 minutes. */
4233
+ toleranceMs?: number | undefined;
4234
+ /** The current time in epoch ms. For tests; defaults to `Date.now()`. */
4235
+ now?: number | undefined;
4236
+ }
2169
4237
  /**
2170
- * Verifies and parses Dialgem webhooks.
4238
+ * Verifies and parses what Dialgem sends to your servers: event webhooks, and
4239
+ * requests to your custom functions. Both use one signature scheme:
4240
+ *
4241
+ * x-dialgem-signature: v=<timestamp_ms>,d=<hex>
4242
+ * hex = HMAC-SHA256(secret, raw_body + timestamp_ms)
4243
+ *
4244
+ * The secret is the agent's `webhook_signing_secret`.
2171
4245
  *
2172
4246
  * **Pass the raw body.** The signature covers the exact bytes Dialgem sent. A body
2173
4247
  * that was parsed and re-serialized (`express.json()`, `JSON.stringify(req.body)`)
@@ -2175,27 +4249,36 @@ type SignatureHeader = string | string[] | null | undefined;
2175
4249
  * Fastify's raw body, or `await request.text()` in a route handler.
2176
4250
  */
2177
4251
  declare class Webhooks {
4252
+ #private;
2178
4253
  /**
2179
- * Returns whether `signature` is the HMAC-SHA256 of `payload` under `secret`.
2180
- * Constant-time. Returns `false` for a missing or malformed signature; throws only
2181
- * if `secret` is empty, which is a configuration error rather than a bad request.
4254
+ * Returns whether `signature` is a current, valid signature of `payload` under
4255
+ * `secret`. Constant-time. Returns `false` for a missing, malformed, tampered or
4256
+ * stale signature; throws only if `secret` is empty, which is a configuration
4257
+ * error rather than a bad request.
2182
4258
  */
2183
- verify(payload: WebhookPayload, signature: SignatureHeader, secret: string): Promise<boolean>;
4259
+ verify(payload: WebhookPayload, signature: SignatureHeader, secret: string, options?: VerifyOptions): Promise<boolean>;
2184
4260
  /**
2185
- * Verifies the signature, then parses the body.
4261
+ * Verifies a webhook's signature, then parses its body.
2186
4262
  *
2187
- * @throws WebhookVerificationError if the signature is missing or does not match.
4263
+ * @throws WebhookVerificationError if the signature is missing, invalid or stale.
2188
4264
  */
2189
- constructEvent(payload: WebhookPayload, signature: SignatureHeader, secret: string): Promise<WebhookEvent>;
4265
+ constructEvent(payload: WebhookPayload, signature: SignatureHeader, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
4266
+ /**
4267
+ * Verifies a request Dialgem made to one of your custom functions, then parses
4268
+ * its body. For functions with `args_at_root`, the body is the arguments object
4269
+ * alone; use `verify` and parse it yourself.
4270
+ *
4271
+ * @throws WebhookVerificationError if the signature is missing, invalid or stale.
4272
+ */
4273
+ constructFunctionCall<Args = Record<string, unknown>>(payload: WebhookPayload, signature: SignatureHeader, secret: string, options?: VerifyOptions): Promise<FunctionCallRequest<Args>>;
2190
4274
  }
2191
4275
  declare const webhooks: Webhooks;
2192
4276
 
2193
- declare const DEFAULT_BASE_URL = "https://api.dialgem.com";
4277
+ /** The Dialgem API. Fixed: the SDK talks to Dialgem and nothing else. */
4278
+ declare const BASE_URL = "https://api.dialgem.com";
2194
4279
  interface ClientOptions {
2195
4280
  /** Organization API key (`zk_…`). Defaults to `process.env.DIALGEM_API_KEY`. */
2196
4281
  apiKey?: string | undefined;
2197
- /** Defaults to `process.env.DIALGEM_BASE_URL`, then `https://api.dialgem.com`. */
2198
- baseURL?: string | undefined;
2199
4282
  /** Per-attempt timeout in milliseconds (> 0). Default 60000. */
2200
4283
  timeout?: number | undefined;
2201
4284
  /** Retries for GET/PATCH/DELETE on 408/429/5xx and connection errors. Default 2. POST is not retried. */
@@ -2221,20 +4304,43 @@ interface ClientOptions {
2221
4304
  * ```
2222
4305
  */
2223
4306
  declare class Dialgem {
2224
- static readonly DEFAULT_BASE_URL = "https://api.dialgem.com";
4307
+ static readonly BASE_URL = "https://api.dialgem.com";
2225
4308
  /** Webhook verification without a client instance: `Dialgem.webhooks.constructEvent(...)`. */
2226
4309
  static readonly webhooks: Webhooks;
2227
4310
  readonly agents: Agents;
2228
4311
  readonly calls: Calls;
2229
4312
  readonly phoneNumbers: PhoneNumbers;
2230
4313
  readonly voices: Voices;
4314
+ /** Models available for post-call analysis. */
4315
+ readonly extractionModels: ExtractionModels;
2231
4316
  readonly flowTemplates: FlowTemplates;
2232
4317
  readonly promptTemplates: PromptTemplates;
4318
+ /** Calls in progress right now. */
4319
+ readonly sessions: Sessions;
4320
+ /** Text conversations with an agent. */
4321
+ readonly chats: Chats;
4322
+ readonly flows: Flows;
4323
+ readonly llms: LLMs;
4324
+ /** What this API key is and may do. */
4325
+ readonly apiKey: ApiKey;
4326
+ /**
4327
+ * Verify what Dialgem sends you: `dialgem.webhooks.constructEvent(rawBody, signatureHeader, secret)`.
4328
+ */
2233
4329
  readonly webhooks: Webhooks;
4330
+ /** The organization's webhook destinations: create, update, rotate the signing secret, test. */
4331
+ /** The people you call, with CSV import under `contacts.imports`. */
4332
+ readonly contacts: Contacts;
4333
+ /** Named groups of contacts. */
4334
+ readonly contactLists: ContactLists;
4335
+ /** Browser calls: tokens for `@dialgem/client`, and the origins allowed to start them. */
4336
+ readonly webCalls: WebCalls;
4337
+ /** Saved test conversations for an agent, run in text, with an optional publish gate. */
4338
+ readonly simulations: Simulations;
4339
+ /** Always `https://api.dialgem.com`. */
2234
4340
  readonly baseURL: string;
2235
4341
  constructor(options?: ClientOptions);
2236
4342
  }
2237
4343
 
2238
- declare const VERSION = "0.1.0-beta.0";
4344
+ declare const VERSION = "0.1.0-beta.2";
2239
4345
 
2240
- export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentFunction, AgentFunctions, AgentKnowledge, AgentMCPServers, type AgentType, type AgentUpdateParams, type AgentWeight, Agents, AuthenticationError, BadRequestError, type Call, type CallAnalysis, type CallAnalyzedEvent, type CallCost, type CallCreatePhoneCallParams, type CallEndedEvent, type CallListParams, type CallRegisterParams, type CallRegisterResponse, type CallSessionStatus, type CallStartedEvent, type CallStatus, Calls, type ClientOptions, ConflictError, DEFAULT_BASE_URL, Dialgem, DialgemError, type ErrorBody, type ErrorIssue, type Fetch, type FetchInit, type FetchResponse, type FlowConfig, type FlowTemplate, type FlowTemplateSummary, FlowTemplates, type FunctionCreateParams, type FunctionKind, type FunctionReorderParams, type FunctionUpdateParams, type HeadersLike, InternalServerError, type KeyValuePair, type KnowledgeDocument, type KnowledgeDocumentCreateParams, type MCPServer, type MCPServerCreateParams, type MCPServerTestResult, type MCPServerUpdateParams, NotFoundError, Page, type PageData, PagePromise, PermissionDeniedError, type PhoneCallCreateResponse, type PhoneNumber, type PhoneNumberAgentWeight, type PhoneNumberAssignParams, type PhoneNumberCreateParams, type PhoneNumberUpdateParams, PhoneNumbers, type PostCallAnalysisVariable, type PromptState, type PromptTemplate, type PromptTemplateSummary, PromptTemplates, RateLimitError, type RequestBody, type RequestOptions, type SignatureHeader, type SipOutboundTrunkConfig, type TemplateListParams, type TranscriptTurn, UnprocessableEntityError, VERSION, type Voice, type VoiceListParams, Voices, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEvent, type WebhookEventType, type WebhookPayload, WebhookVerificationError, Webhooks, webhooks };
4346
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentFunction, AgentFunctions, AgentKnowledge, AgentMCPServers, type AgentSession, type AgentSessionList, type AgentSessionReleaseResult, type AgentSessionSayParams, type AgentSessionSayResult, type AgentSessionUpdateParams, type AgentSessionUpdateResult, type AgentType, type AgentUpdateParams, type AgentVersion, type AgentVersionConfig, type AgentVersionListParams, type AgentVersionListResponse, type AgentVersionMCPServer, type AgentVersionPublishParams, type AgentVersionRef, type AgentVersionSummary, AgentVersions, type AgentWeight, Agents, ApiKey, type ApiKeyDetails, type ApiKeyInfo, AuthenticationError, BASE_URL, BadRequestError, type Call, type CallAnalysis, type CallAnalyzedEvent, type CallCost, type CallCreatePhoneCallParams, type CallDeleteResponse, type CallEndedEvent, type CallLatency, type CallListParams, type CallRegisterParams, type CallRegisterResponse, type CallSessionStatus, type CallStartedEvent, type CallStatus, type CallStopResponse, type CallUpdateParams, Calls, type Chat, type ChatAnalyzedEvent, type ChatCreateParams, type ChatDeleteResponse, type ChatEndedEvent, type ChatListParams, type ChatMessage, type ChatReply, type ChatStartedEvent, type ChatUpdateParams, Chats, type ClientOptions, ConflictError, type Contact, type ContactCallList, type ContactCallSummary, type ContactCreateParams, type ContactCsvInspection, type ContactDeleteResponse, type ContactImport, type ContactImportCreateParams, type ContactImportErrorRow, type ContactImportErrors, type ContactImportList, type ContactImportStatus, ContactImports, type ContactListCreateParams, type ContactListDeleteResponse, type ContactListMemberRemoveResponse, type ContactListMembersAddResponse, type ContactListParams, type ContactListRecord, type ContactListUpdateParams, ContactLists, type ContactUpdateParams, Contacts, DEFAULT_SIGNATURE_TOLERANCE_MS, Dialgem, DialgemError, type DisconnectionReason, type ErrorBody, type ErrorIssue, type ExtractionModel, type ExtractionModelList, ExtractionModels, type Fetch, type FetchInit, type FetchResponse, type Flow, type FlowConfig, type FlowCreateParams, type FlowDeleteResponse, type FlowListParams, type FlowTemplate, type FlowTemplateSummary, FlowTemplates, type FlowUpdateParams, Flows, type FunctionCallContext, type FunctionCallRequest, type FunctionCreateParams, type FunctionKind, type FunctionReorderParams, type FunctionUpdateParams, type HeadersLike, type InboundWebhookTestResult, InternalServerError, type KeyValuePair, type KnowledgeDocument, type KnowledgeDocumentCreateParams, type LLM, type LLMCreateParams, type LLMDeleteResponse, type LLMListParams, type LLMUpdateParams, LLMs, type LatencyStats, type MCPServer, type MCPServerCreateParams, type MCPServerTestResult, type MCPServerUpdateParams, type MCPTool, type MCPToolList, NotFoundError, Page, type PageData, PagePromise, PermissionDeniedError, type PhoneCallCreateResponse, type PhoneNumber, type PhoneNumberAgentWeight, type PhoneNumberAssignParams, type PhoneNumberCreateParams, type PhoneNumberUpdateParams, PhoneNumbers, type PostCallAnalysisVariable, type PostCallBuiltinFields, type PromptState, type PromptTemplate, type PromptTemplateSummary, PromptTemplates, RateLimitError, type RequestBody, type RequestOptions, Sessions, type SignatureHeader, type SimulationCaller, type SimulationCase, type SimulationCaseInput, type SimulationCheck, type SimulationCheckResult, type SimulationPublishGate, type SimulationResult, type SimulationResultStatus, type SimulationRun, type SimulationRunCreateParams, type SimulationRunDetail, type SimulationRunList, type SimulationRunStatus, type SimulationSuite, type SimulationSuiteCreateParams, type SimulationSuiteDetail, type SimulationSuiteList, type SimulationSuiteUpdateParams, Simulations, type SipOutboundTrunkConfig, type TemplateListParams, type TranscriptTurn, UnprocessableEntityError, VERSION, type VerifyOptions, type Voice, type VoiceCloneFile, type VoiceCloneParams, type VoiceDeleteResponse, type VoiceListParams, Voices, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_PREVIOUS_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebCall, type WebCallCreateParams, type WebCallSettings, type WebCallSettingsUpdateParams, WebCalls, type WebhookEvent, type WebhookEventType, type WebhookPayload, WebhookVerificationError, Webhooks, webhooks };