@operla-ai/sdk 0.2.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,23 +6,11 @@ export type ListData = {
6
6
  path?: never;
7
7
  query?: {
8
8
  /**
9
- * Filter: only list conversations linked to this entity.
9
+ * Target a specific entity (under the caller's organization).
10
10
  */
11
11
  entityId?: string;
12
- /**
13
- * Filter: only list conversations in this status.
14
- */
15
- status?: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
16
- /**
17
- * Max number of conversations to return (1-100, default 20).
18
- */
19
- limit?: number;
20
- /**
21
- * Number of conversations to skip for pagination (default 0).
22
- */
23
- offset?: number | null;
24
12
  };
25
- url: '/conversations';
13
+ url: '/agents';
26
14
  };
27
15
  export type ListErrors = {
28
16
  /**
@@ -62,88 +50,245 @@ export type ListResponses = {
62
50
  * Successful response
63
51
  */
64
52
  200: {
65
- /**
66
- * Conversations matching the query, sorted by last activity (most recent first).
67
- */
68
- conversations: Array<{
53
+ agents: Array<{
54
+ name: string;
55
+ label: string;
56
+ scope: {
57
+ level: 'global' | 'organization' | 'entity';
58
+ organizationId?: string;
59
+ entityId?: string;
60
+ };
69
61
  /**
70
- * Conversation ID (format: conv_xxxxxxxxxxxx).
62
+ * Version of the resolved config at this scope.
71
63
  */
72
- conversationId: string;
64
+ version: number;
73
65
  /**
74
- * Organization linked to the conversation (when you use organizations).
66
+ * True when an override draft exists at this scope.
75
67
  */
68
+ hasDraft: boolean;
69
+ }>;
70
+ };
71
+ };
72
+ export type ListResponse = ListResponses[keyof ListResponses];
73
+ export type CreateData = {
74
+ body?: {
75
+ /**
76
+ * Human-readable label shown in the dashboard. The machine name is derived from this (slugified, prefixed with `specialist_`).
77
+ */
78
+ label: string;
79
+ /**
80
+ * System prompt for the agent.
81
+ */
82
+ prompt: string;
83
+ /**
84
+ * Hard rules to attach to the agent at creation.
85
+ */
86
+ hardRules?: Array<{
87
+ name: string;
88
+ instruction: string;
89
+ triggers?: {
90
+ intents?: Array<string>;
91
+ };
92
+ priority?: number;
93
+ disabled?: boolean;
94
+ }>;
95
+ };
96
+ path?: never;
97
+ query?: never;
98
+ url: '/agents';
99
+ };
100
+ export type CreateErrors = {
101
+ /**
102
+ * Bad request
103
+ */
104
+ 400: {
105
+ statusCode: number;
106
+ error: {
107
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
108
+ message: string;
109
+ };
110
+ };
111
+ /**
112
+ * Authentication required
113
+ */
114
+ 401: {
115
+ statusCode: number;
116
+ error: {
117
+ code: 'AUTH';
118
+ message: string;
119
+ };
120
+ };
121
+ /**
122
+ * Insufficient permissions
123
+ */
124
+ 403: {
125
+ statusCode: number;
126
+ error: {
127
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
128
+ message: string;
129
+ };
130
+ };
131
+ };
132
+ export type CreateError = CreateErrors[keyof CreateErrors];
133
+ export type CreateResponses = {
134
+ /**
135
+ * Successful response
136
+ */
137
+ 200: {
138
+ name: string;
139
+ label: string;
140
+ scope: {
141
+ level: 'global' | 'organization' | 'entity';
76
142
  organizationId?: string;
77
- /**
78
- * Current lifecycle status of the conversation.
79
- */
80
- status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
81
- /**
82
- * Short human-readable subject computed from the first messages or the user's identity.
83
- */
84
- subject: string;
85
- /**
86
- * The person in the conversation, if identified. Null when no user is known yet.
87
- */
88
- user: {
89
- /**
90
- * Unique identifier of the person in the conversation, in your system.
91
- */
92
- userId: string;
93
- /**
94
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
95
- */
96
- resolved?: boolean;
97
- /**
98
- * Custom data attached to the user (name, email, account info, etc.).
99
- */
100
- data?: {
101
- [key: string]: unknown;
102
- };
103
- } | null;
104
- /**
105
- * Entity linked to the conversation (when you use entities).
106
- */
107
143
  entityId?: string;
108
- /**
109
- * Total number of messages exchanged so far (user + agent).
110
- */
111
- messageCount: number;
112
- /**
113
- * ISO timestamp of the last message, or null if no messages yet.
114
- */
115
- lastMessageAt: string | null;
116
- /**
117
- * ISO timestamp when the conversation was created.
118
- */
119
- createdAt: string;
120
- /**
121
- * ISO timestamp of the last modification (message, status change, etc.).
122
- */
123
- updatedAt: string;
124
- }>;
144
+ };
125
145
  /**
126
- * Total number of conversations matching the query (across all pages).
146
+ * The agent config the runtime sees at the request scope, after cascade resolution.
127
147
  */
128
- total: number;
148
+ resolved: {
149
+ version: number;
150
+ prompt?: string;
151
+ hardRules?: Array<{
152
+ name: string;
153
+ instruction: string;
154
+ triggers?: {
155
+ intents?: Array<string>;
156
+ };
157
+ priority?: number;
158
+ disabled?: boolean;
159
+ }>;
160
+ userContextConfig?: {
161
+ [key: string]: boolean;
162
+ };
163
+ responseConfig?: {
164
+ email?: {
165
+ greeting?: string;
166
+ signature?: string;
167
+ tone?: 'empathetic' | 'formal' | 'friendly';
168
+ addressForm?: 'formal' | 'informal';
169
+ allowEmojis?: boolean;
170
+ };
171
+ chat?: {
172
+ greeting?: string;
173
+ signature?: string;
174
+ tone?: 'empathetic' | 'formal' | 'friendly';
175
+ addressForm?: 'formal' | 'informal';
176
+ allowEmojis?: boolean;
177
+ };
178
+ };
179
+ message?: string;
180
+ publishedAt?: string;
181
+ updatedAt?: string;
182
+ };
129
183
  /**
130
- * Page size applied to this response.
184
+ * Override draft at this scope, when one exists.
131
185
  */
132
- limit: number;
186
+ draft?: {
187
+ version: number;
188
+ prompt?: string;
189
+ hardRules?: Array<{
190
+ name: string;
191
+ instruction: string;
192
+ triggers?: {
193
+ intents?: Array<string>;
194
+ };
195
+ priority?: number;
196
+ disabled?: boolean;
197
+ }>;
198
+ userContextConfig?: {
199
+ [key: string]: boolean;
200
+ };
201
+ responseConfig?: {
202
+ email?: {
203
+ greeting?: string;
204
+ signature?: string;
205
+ tone?: 'empathetic' | 'formal' | 'friendly';
206
+ addressForm?: 'formal' | 'informal';
207
+ allowEmojis?: boolean;
208
+ };
209
+ chat?: {
210
+ greeting?: string;
211
+ signature?: string;
212
+ tone?: 'empathetic' | 'formal' | 'friendly';
213
+ addressForm?: 'formal' | 'informal';
214
+ allowEmojis?: boolean;
215
+ };
216
+ };
217
+ message?: string;
218
+ publishedAt?: string;
219
+ updatedAt?: string;
220
+ };
221
+ };
222
+ };
223
+ export type CreateResponse = CreateResponses[keyof CreateResponses];
224
+ export type DeleteData = {
225
+ body?: never;
226
+ path: {
133
227
  /**
134
- * Offset applied to this response.
228
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
135
229
  */
136
- offset: number;
230
+ name: string;
137
231
  };
232
+ query?: never;
233
+ url: '/agents/{name}';
138
234
  };
139
- export type ListResponse = ListResponses[keyof ListResponses];
235
+ export type DeleteErrors = {
236
+ /**
237
+ * Bad request
238
+ */
239
+ 400: {
240
+ statusCode: number;
241
+ error: {
242
+ code: 'MISSING-ORG';
243
+ message: string;
244
+ };
245
+ };
246
+ /**
247
+ * Authentication required
248
+ */
249
+ 401: {
250
+ statusCode: number;
251
+ error: {
252
+ code: 'AUTH';
253
+ message: string;
254
+ };
255
+ };
256
+ /**
257
+ * Insufficient permissions
258
+ */
259
+ 403: {
260
+ statusCode: number;
261
+ error: {
262
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
263
+ message: string;
264
+ };
265
+ };
266
+ };
267
+ export type DeleteError = DeleteErrors[keyof DeleteErrors];
268
+ export type DeleteResponses = {
269
+ /**
270
+ * Successful response
271
+ */
272
+ 200: {
273
+ message: string;
274
+ };
275
+ };
276
+ export type DeleteResponse = DeleteResponses[keyof DeleteResponses];
140
277
  export type GetData = {
141
278
  body?: never;
142
279
  path: {
143
- conversationId: string;
280
+ /**
281
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
282
+ */
283
+ name: string;
144
284
  };
145
- query?: never;
146
- url: '/conversations/{conversationId}';
285
+ query?: {
286
+ /**
287
+ * Target a specific entity (under the caller's organization).
288
+ */
289
+ entityId?: string;
290
+ };
291
+ url: '/agents/{name}';
147
292
  };
148
293
  export type GetErrors = {
149
294
  /**
@@ -152,7 +297,7 @@ export type GetErrors = {
152
297
  400: {
153
298
  statusCode: number;
154
299
  error: {
155
- code: 'MISSING-ORG';
300
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
156
301
  message: string;
157
302
  };
158
303
  };
@@ -183,159 +328,1531 @@ export type GetResponses = {
183
328
  * Successful response
184
329
  */
185
330
  200: {
331
+ name: string;
332
+ label: string;
333
+ scope: {
334
+ level: 'global' | 'organization' | 'entity';
335
+ organizationId?: string;
336
+ entityId?: string;
337
+ };
186
338
  /**
187
- * Conversation ID (format: conv_xxxxxxxxxxxx).
339
+ * The agent config the runtime sees at the request scope, after cascade resolution.
188
340
  */
189
- conversationId: string;
341
+ resolved: {
342
+ version: number;
343
+ prompt?: string;
344
+ hardRules?: Array<{
345
+ name: string;
346
+ instruction: string;
347
+ triggers?: {
348
+ intents?: Array<string>;
349
+ };
350
+ priority?: number;
351
+ disabled?: boolean;
352
+ }>;
353
+ userContextConfig?: {
354
+ [key: string]: boolean;
355
+ };
356
+ responseConfig?: {
357
+ email?: {
358
+ greeting?: string;
359
+ signature?: string;
360
+ tone?: 'empathetic' | 'formal' | 'friendly';
361
+ addressForm?: 'formal' | 'informal';
362
+ allowEmojis?: boolean;
363
+ };
364
+ chat?: {
365
+ greeting?: string;
366
+ signature?: string;
367
+ tone?: 'empathetic' | 'formal' | 'friendly';
368
+ addressForm?: 'formal' | 'informal';
369
+ allowEmojis?: boolean;
370
+ };
371
+ };
372
+ message?: string;
373
+ publishedAt?: string;
374
+ updatedAt?: string;
375
+ };
190
376
  /**
191
- * Organization linked to the conversation (when you use organizations).
377
+ * Override draft at this scope, when one exists.
192
378
  */
193
- organizationId?: string;
379
+ draft?: {
380
+ version: number;
381
+ prompt?: string;
382
+ hardRules?: Array<{
383
+ name: string;
384
+ instruction: string;
385
+ triggers?: {
386
+ intents?: Array<string>;
387
+ };
388
+ priority?: number;
389
+ disabled?: boolean;
390
+ }>;
391
+ userContextConfig?: {
392
+ [key: string]: boolean;
393
+ };
394
+ responseConfig?: {
395
+ email?: {
396
+ greeting?: string;
397
+ signature?: string;
398
+ tone?: 'empathetic' | 'formal' | 'friendly';
399
+ addressForm?: 'formal' | 'informal';
400
+ allowEmojis?: boolean;
401
+ };
402
+ chat?: {
403
+ greeting?: string;
404
+ signature?: string;
405
+ tone?: 'empathetic' | 'formal' | 'friendly';
406
+ addressForm?: 'formal' | 'informal';
407
+ allowEmojis?: boolean;
408
+ };
409
+ };
410
+ message?: string;
411
+ publishedAt?: string;
412
+ updatedAt?: string;
413
+ };
414
+ };
415
+ };
416
+ export type GetResponse = GetResponses[keyof GetResponses];
417
+ export type UpdateData = {
418
+ body?: {
194
419
  /**
195
- * Current lifecycle status of the conversation.
420
+ * System prompt for the agent.
196
421
  */
197
- status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
422
+ prompt?: string;
198
423
  /**
199
- * Short human-readable subject computed from the first messages or the user's identity.
424
+ * Hard rules enforced after the LLM call. Names act as merge keys when overriding the cascade.
200
425
  */
201
- subject: string;
426
+ hardRules?: Array<{
427
+ name: string;
428
+ instruction: string;
429
+ triggers?: {
430
+ intents?: Array<string>;
431
+ };
432
+ priority?: number;
433
+ disabled?: boolean;
434
+ }>;
202
435
  /**
203
- * The person in the conversation, if identified. Null when no user is known yet.
436
+ * Toggle which user-context fields are exposed to the agent.
204
437
  */
205
- user: {
206
- /**
207
- * Unique identifier of the person in the conversation, in your system.
208
- */
209
- userId: string;
210
- /**
211
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
212
- */
213
- resolved?: boolean;
214
- /**
215
- * Custom data attached to the user (name, email, account info, etc.).
216
- */
217
- data?: {
218
- [key: string]: unknown;
219
- };
220
- } | null;
438
+ userContextConfig?: {
439
+ [key: string]: boolean;
440
+ };
221
441
  /**
222
- * Entity linked to the conversation (when you use entities).
442
+ * Per-channel writing style. Only meaningful on the response agent. Sparse: omitted fields inherit from the cascade.
223
443
  */
224
- entityId?: string;
444
+ responseConfig?: {
445
+ email?: {
446
+ greeting?: string;
447
+ signature?: string;
448
+ tone?: 'empathetic' | 'formal' | 'friendly';
449
+ addressForm?: 'formal' | 'informal';
450
+ allowEmojis?: boolean;
451
+ };
452
+ chat?: {
453
+ greeting?: string;
454
+ signature?: string;
455
+ tone?: 'empathetic' | 'formal' | 'friendly';
456
+ addressForm?: 'formal' | 'informal';
457
+ allowEmojis?: boolean;
458
+ };
459
+ };
225
460
  /**
226
- * Total number of messages exchanged so far (user + agent).
461
+ * When true, the changes are written to draft and immediately promoted to published (a version snapshot is still created so rollback remains possible). When false (default), the changes stay in draft until you publish them via the dashboard.
227
462
  */
228
- messageCount: number;
463
+ publish?: boolean;
464
+ };
465
+ path: {
229
466
  /**
230
- * ISO timestamp of the last message, or null if no messages yet.
467
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
231
468
  */
232
- lastMessageAt: string | null;
469
+ name: string;
470
+ };
471
+ query?: {
233
472
  /**
234
- * ISO timestamp when the conversation was created.
473
+ * Target a specific entity (under the caller's organization).
235
474
  */
236
- createdAt: string;
475
+ entityId?: string;
476
+ };
477
+ url: '/agents/{name}';
478
+ };
479
+ export type UpdateErrors = {
480
+ /**
481
+ * Bad request
482
+ */
483
+ 400: {
484
+ statusCode: number;
485
+ error: {
486
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
487
+ message: string;
488
+ };
489
+ };
490
+ /**
491
+ * Authentication required
492
+ */
493
+ 401: {
494
+ statusCode: number;
495
+ error: {
496
+ code: 'AUTH';
497
+ message: string;
498
+ };
499
+ };
500
+ /**
501
+ * Insufficient permissions
502
+ */
503
+ 403: {
504
+ statusCode: number;
505
+ error: {
506
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
507
+ message: string;
508
+ };
509
+ };
510
+ };
511
+ export type UpdateError = UpdateErrors[keyof UpdateErrors];
512
+ export type UpdateResponses = {
513
+ /**
514
+ * Successful response
515
+ */
516
+ 200: {
517
+ name: string;
518
+ label: string;
519
+ scope: {
520
+ level: 'global' | 'organization' | 'entity';
521
+ organizationId?: string;
522
+ entityId?: string;
523
+ };
237
524
  /**
238
- * ISO timestamp of the last modification (message, status change, etc.).
525
+ * The agent config the runtime sees at the request scope, after cascade resolution.
239
526
  */
240
- updatedAt: string;
527
+ resolved: {
528
+ version: number;
529
+ prompt?: string;
530
+ hardRules?: Array<{
531
+ name: string;
532
+ instruction: string;
533
+ triggers?: {
534
+ intents?: Array<string>;
535
+ };
536
+ priority?: number;
537
+ disabled?: boolean;
538
+ }>;
539
+ userContextConfig?: {
540
+ [key: string]: boolean;
541
+ };
542
+ responseConfig?: {
543
+ email?: {
544
+ greeting?: string;
545
+ signature?: string;
546
+ tone?: 'empathetic' | 'formal' | 'friendly';
547
+ addressForm?: 'formal' | 'informal';
548
+ allowEmojis?: boolean;
549
+ };
550
+ chat?: {
551
+ greeting?: string;
552
+ signature?: string;
553
+ tone?: 'empathetic' | 'formal' | 'friendly';
554
+ addressForm?: 'formal' | 'informal';
555
+ allowEmojis?: boolean;
556
+ };
557
+ };
558
+ message?: string;
559
+ publishedAt?: string;
560
+ updatedAt?: string;
561
+ };
241
562
  /**
242
- * Full message history in chronological order.
563
+ * Override draft at this scope, when one exists.
243
564
  */
244
- thread: Array<{
245
- /**
246
- * Who emitted the message — the user or your AI agent.
247
- */
248
- role: 'user' | 'agent';
249
- /**
250
- * Message body.
251
- */
252
- content: string;
253
- /**
254
- * ISO timestamp when the message was recorded.
255
- */
256
- timestamp: string;
257
- /**
258
- * Display name of the author (when available).
259
- */
260
- authorName?: string;
261
- }>;
565
+ draft?: {
566
+ version: number;
567
+ prompt?: string;
568
+ hardRules?: Array<{
569
+ name: string;
570
+ instruction: string;
571
+ triggers?: {
572
+ intents?: Array<string>;
573
+ };
574
+ priority?: number;
575
+ disabled?: boolean;
576
+ }>;
577
+ userContextConfig?: {
578
+ [key: string]: boolean;
579
+ };
580
+ responseConfig?: {
581
+ email?: {
582
+ greeting?: string;
583
+ signature?: string;
584
+ tone?: 'empathetic' | 'formal' | 'friendly';
585
+ addressForm?: 'formal' | 'informal';
586
+ allowEmojis?: boolean;
587
+ };
588
+ chat?: {
589
+ greeting?: string;
590
+ signature?: string;
591
+ tone?: 'empathetic' | 'formal' | 'friendly';
592
+ addressForm?: 'formal' | 'informal';
593
+ allowEmojis?: boolean;
594
+ };
595
+ };
596
+ message?: string;
597
+ publishedAt?: string;
598
+ updatedAt?: string;
599
+ };
600
+ };
601
+ };
602
+ export type UpdateResponse = UpdateResponses[keyof UpdateResponses];
603
+ export type DeleteOverrideData = {
604
+ body?: never;
605
+ path: {
262
606
  /**
263
- * Origin tag provided when the conversation was created.
607
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
264
608
  */
265
- source?: string;
609
+ name: string;
610
+ };
611
+ query?: {
266
612
  /**
267
- * Cross-reference ID in your external ticketing system (e.g. Zendesk), when applicable.
613
+ * Target a specific entity (under the caller's organization).
268
614
  */
269
- externalTicketId?: string;
615
+ entityId?: string;
270
616
  };
617
+ url: '/agents/{name}/overrides';
271
618
  };
272
- export type GetResponse = GetResponses[keyof GetResponses];
273
- export type SendMessageData = {
619
+ export type DeleteOverrideErrors = {
620
+ /**
621
+ * Bad request
622
+ */
623
+ 400: {
624
+ statusCode: number;
625
+ error: {
626
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
627
+ message: string;
628
+ };
629
+ };
630
+ /**
631
+ * Authentication required
632
+ */
633
+ 401: {
634
+ statusCode: number;
635
+ error: {
636
+ code: 'AUTH';
637
+ message: string;
638
+ };
639
+ };
640
+ /**
641
+ * Insufficient permissions
642
+ */
643
+ 403: {
644
+ statusCode: number;
645
+ error: {
646
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
647
+ message: string;
648
+ };
649
+ };
650
+ };
651
+ export type DeleteOverrideError = DeleteOverrideErrors[keyof DeleteOverrideErrors];
652
+ export type DeleteOverrideResponses = {
653
+ /**
654
+ * Successful response
655
+ */
656
+ 200: {
657
+ message: string;
658
+ };
659
+ };
660
+ export type DeleteOverrideResponse = DeleteOverrideResponses[keyof DeleteOverrideResponses];
661
+ export type PublishData = {
274
662
  body?: {
275
663
  /**
276
- * Message text sent by the user.
664
+ * Optional changelog message attached to the new version.
277
665
  */
278
- message: string;
666
+ message?: string;
667
+ };
668
+ path: {
279
669
  /**
280
- * Conversation ID (format: conv_xxxxxxxxxxxx). Omit on the first call — the server generates one and returns it.
670
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
281
671
  */
282
- conversationId?: string;
672
+ name: string;
673
+ };
674
+ query?: {
283
675
  /**
284
- * Link the conversation to an entity (only applied when creating the conversation; ignored on subsequent messages for the same conversationId).
676
+ * Target a specific entity (under the caller's organization).
285
677
  */
286
678
  entityId?: string;
679
+ };
680
+ url: '/agents/{name}/publish';
681
+ };
682
+ export type PublishErrors = {
683
+ /**
684
+ * Bad request
685
+ */
686
+ 400: {
687
+ statusCode: number;
688
+ error: {
689
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
690
+ message: string;
691
+ };
692
+ };
693
+ /**
694
+ * Authentication required
695
+ */
696
+ 401: {
697
+ statusCode: number;
698
+ error: {
699
+ code: 'AUTH';
700
+ message: string;
701
+ };
702
+ };
703
+ /**
704
+ * Insufficient permissions
705
+ */
706
+ 403: {
707
+ statusCode: number;
708
+ error: {
709
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
710
+ message: string;
711
+ };
712
+ };
713
+ };
714
+ export type PublishError = PublishErrors[keyof PublishErrors];
715
+ export type PublishResponses = {
716
+ /**
717
+ * Successful response
718
+ */
719
+ 200: {
720
+ name: string;
721
+ label: string;
722
+ scope: {
723
+ level: 'global' | 'organization' | 'entity';
724
+ organizationId?: string;
725
+ entityId?: string;
726
+ };
287
727
  /**
288
- * The user sending the message. Set `resolved: true` on the user object to skip identity resolution when you already have a complete profile.
728
+ * The agent config the runtime sees at the request scope, after cascade resolution.
289
729
  */
290
- user?: {
291
- /**
292
- * Unique identifier of the person in the conversation, in your system.
293
- */
294
- userId: string;
295
- /**
296
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
297
- */
298
- resolved?: boolean;
299
- /**
300
- * Custom data attached to the user (name, email, account info, etc.).
301
- */
302
- data?: {
303
- [key: string]: unknown;
730
+ resolved: {
731
+ version: number;
732
+ prompt?: string;
733
+ hardRules?: Array<{
734
+ name: string;
735
+ instruction: string;
736
+ triggers?: {
737
+ intents?: Array<string>;
738
+ };
739
+ priority?: number;
740
+ disabled?: boolean;
741
+ }>;
742
+ userContextConfig?: {
743
+ [key: string]: boolean;
304
744
  };
745
+ responseConfig?: {
746
+ email?: {
747
+ greeting?: string;
748
+ signature?: string;
749
+ tone?: 'empathetic' | 'formal' | 'friendly';
750
+ addressForm?: 'formal' | 'informal';
751
+ allowEmojis?: boolean;
752
+ };
753
+ chat?: {
754
+ greeting?: string;
755
+ signature?: string;
756
+ tone?: 'empathetic' | 'formal' | 'friendly';
757
+ addressForm?: 'formal' | 'informal';
758
+ allowEmojis?: boolean;
759
+ };
760
+ };
761
+ message?: string;
762
+ publishedAt?: string;
763
+ updatedAt?: string;
305
764
  };
306
765
  /**
307
- * Overrides the configured KBs for this message. Not stored.
766
+ * Override draft at this scope, when one exists.
308
767
  */
309
- kbArticles?: Array<{
310
- /**
311
- * Article title shown to the agent.
312
- */
313
- title: string;
314
- /**
315
- * Article body (markdown-friendly).
316
- */
317
- content: string;
318
- /**
319
- * Intent identifiers this article serves. Empty or omitted = always-on. Otherwise the article is only injected when one of these intents is detected on the message.
320
- */
321
- intents?: Array<string>;
322
- }>;
768
+ draft?: {
769
+ version: number;
770
+ prompt?: string;
771
+ hardRules?: Array<{
772
+ name: string;
773
+ instruction: string;
774
+ triggers?: {
775
+ intents?: Array<string>;
776
+ };
777
+ priority?: number;
778
+ disabled?: boolean;
779
+ }>;
780
+ userContextConfig?: {
781
+ [key: string]: boolean;
782
+ };
783
+ responseConfig?: {
784
+ email?: {
785
+ greeting?: string;
786
+ signature?: string;
787
+ tone?: 'empathetic' | 'formal' | 'friendly';
788
+ addressForm?: 'formal' | 'informal';
789
+ allowEmojis?: boolean;
790
+ };
791
+ chat?: {
792
+ greeting?: string;
793
+ signature?: string;
794
+ tone?: 'empathetic' | 'formal' | 'friendly';
795
+ addressForm?: 'formal' | 'informal';
796
+ allowEmojis?: boolean;
797
+ };
798
+ };
799
+ message?: string;
800
+ publishedAt?: string;
801
+ updatedAt?: string;
802
+ };
803
+ };
804
+ };
805
+ export type PublishResponse = PublishResponses[keyof PublishResponses];
806
+ export type RollbackData = {
807
+ body?: {
808
+ /**
809
+ * Archived version number to restore as the new published.
810
+ */
811
+ targetVersion: number;
812
+ };
813
+ path: {
814
+ /**
815
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
816
+ */
817
+ name: string;
818
+ };
819
+ query?: {
820
+ /**
821
+ * Target a specific entity (under the caller's organization).
822
+ */
823
+ entityId?: string;
824
+ };
825
+ url: '/agents/{name}/rollback';
826
+ };
827
+ export type RollbackErrors = {
828
+ /**
829
+ * Bad request
830
+ */
831
+ 400: {
832
+ statusCode: number;
833
+ error: {
834
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
835
+ message: string;
836
+ };
837
+ };
838
+ /**
839
+ * Authentication required
840
+ */
841
+ 401: {
842
+ statusCode: number;
843
+ error: {
844
+ code: 'AUTH';
845
+ message: string;
846
+ };
847
+ };
848
+ /**
849
+ * Insufficient permissions
850
+ */
851
+ 403: {
852
+ statusCode: number;
853
+ error: {
854
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
855
+ message: string;
856
+ };
857
+ };
858
+ };
859
+ export type RollbackError = RollbackErrors[keyof RollbackErrors];
860
+ export type RollbackResponses = {
861
+ /**
862
+ * Successful response
863
+ */
864
+ 200: {
865
+ name: string;
866
+ label: string;
867
+ scope: {
868
+ level: 'global' | 'organization' | 'entity';
869
+ organizationId?: string;
870
+ entityId?: string;
871
+ };
872
+ /**
873
+ * The agent config the runtime sees at the request scope, after cascade resolution.
874
+ */
875
+ resolved: {
876
+ version: number;
877
+ prompt?: string;
878
+ hardRules?: Array<{
879
+ name: string;
880
+ instruction: string;
881
+ triggers?: {
882
+ intents?: Array<string>;
883
+ };
884
+ priority?: number;
885
+ disabled?: boolean;
886
+ }>;
887
+ userContextConfig?: {
888
+ [key: string]: boolean;
889
+ };
890
+ responseConfig?: {
891
+ email?: {
892
+ greeting?: string;
893
+ signature?: string;
894
+ tone?: 'empathetic' | 'formal' | 'friendly';
895
+ addressForm?: 'formal' | 'informal';
896
+ allowEmojis?: boolean;
897
+ };
898
+ chat?: {
899
+ greeting?: string;
900
+ signature?: string;
901
+ tone?: 'empathetic' | 'formal' | 'friendly';
902
+ addressForm?: 'formal' | 'informal';
903
+ allowEmojis?: boolean;
904
+ };
905
+ };
906
+ message?: string;
907
+ publishedAt?: string;
908
+ updatedAt?: string;
909
+ };
910
+ /**
911
+ * Override draft at this scope, when one exists.
912
+ */
913
+ draft?: {
914
+ version: number;
915
+ prompt?: string;
916
+ hardRules?: Array<{
917
+ name: string;
918
+ instruction: string;
919
+ triggers?: {
920
+ intents?: Array<string>;
921
+ };
922
+ priority?: number;
923
+ disabled?: boolean;
924
+ }>;
925
+ userContextConfig?: {
926
+ [key: string]: boolean;
927
+ };
928
+ responseConfig?: {
929
+ email?: {
930
+ greeting?: string;
931
+ signature?: string;
932
+ tone?: 'empathetic' | 'formal' | 'friendly';
933
+ addressForm?: 'formal' | 'informal';
934
+ allowEmojis?: boolean;
935
+ };
936
+ chat?: {
937
+ greeting?: string;
938
+ signature?: string;
939
+ tone?: 'empathetic' | 'formal' | 'friendly';
940
+ addressForm?: 'formal' | 'informal';
941
+ allowEmojis?: boolean;
942
+ };
943
+ };
944
+ message?: string;
945
+ publishedAt?: string;
946
+ updatedAt?: string;
947
+ };
948
+ };
949
+ };
950
+ export type RollbackResponse = RollbackResponses[keyof RollbackResponses];
951
+ export type List2Data = {
952
+ body?: never;
953
+ path?: never;
954
+ query?: {
955
+ /**
956
+ * Max number of items to return per page (1-100).
957
+ */
958
+ limit?: number;
959
+ /**
960
+ * Number of items to skip for pagination.
961
+ */
962
+ offset?: number | null;
963
+ /**
964
+ * Target a specific entity (under the caller's organization).
965
+ */
966
+ entityId?: string;
967
+ /**
968
+ * Only list conversations in this status.
969
+ */
970
+ status?: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
971
+ };
972
+ url: '/conversations';
973
+ };
974
+ export type List2Errors = {
975
+ /**
976
+ * Bad request
977
+ */
978
+ 400: {
979
+ statusCode: number;
980
+ error: {
981
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
982
+ message: string;
983
+ };
984
+ };
985
+ /**
986
+ * Authentication required
987
+ */
988
+ 401: {
989
+ statusCode: number;
990
+ error: {
991
+ code: 'AUTH';
992
+ message: string;
993
+ };
994
+ };
995
+ /**
996
+ * Insufficient permissions
997
+ */
998
+ 403: {
999
+ statusCode: number;
1000
+ error: {
1001
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1002
+ message: string;
1003
+ };
1004
+ };
1005
+ };
1006
+ export type List2Error = List2Errors[keyof List2Errors];
1007
+ export type List2Responses = {
1008
+ /**
1009
+ * Successful response
1010
+ */
1011
+ 200: {
1012
+ conversations: Array<{
1013
+ /**
1014
+ * Conversation ID (format: conv_xxxxxxxxxxxx).
1015
+ */
1016
+ conversationId: string;
1017
+ /**
1018
+ * Organization linked to the conversation (when you use organizations).
1019
+ */
1020
+ organizationId?: string;
1021
+ /**
1022
+ * Current lifecycle status of the conversation.
1023
+ */
1024
+ status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
1025
+ /**
1026
+ * Short human-readable subject computed from the first messages or the user's identity.
1027
+ */
1028
+ subject: string;
1029
+ /**
1030
+ * The person in the conversation, if identified. Null when no user is known yet. Custom user `data` is omitted here — fetch a single conversation to get it.
1031
+ */
1032
+ user: {
1033
+ /**
1034
+ * Unique identifier of the person in the conversation, in your system.
1035
+ */
1036
+ userId: string;
1037
+ /**
1038
+ * Whether the user is fully identified.
1039
+ */
1040
+ resolved?: boolean;
1041
+ } | null;
1042
+ /**
1043
+ * Entity linked to the conversation (when you use entities).
1044
+ */
1045
+ entityId?: string;
1046
+ /**
1047
+ * Total number of messages exchanged so far (user + agent).
1048
+ */
1049
+ messageCount: number;
1050
+ /**
1051
+ * ISO timestamp of the last message, or null if no messages yet.
1052
+ */
1053
+ lastMessageAt: string | null;
1054
+ /**
1055
+ * ISO timestamp when the conversation was created.
1056
+ */
1057
+ createdAt: string;
1058
+ /**
1059
+ * ISO timestamp of the last modification (message, status change, etc.).
1060
+ */
1061
+ updatedAt: string;
1062
+ }>;
1063
+ /**
1064
+ * Total number of items matching the query.
1065
+ */
1066
+ total: number;
1067
+ /**
1068
+ * Page size applied to this response.
1069
+ */
1070
+ limit: number;
1071
+ /**
1072
+ * Offset applied to this response.
1073
+ */
1074
+ offset: number;
1075
+ };
1076
+ };
1077
+ export type List2Response = List2Responses[keyof List2Responses];
1078
+ export type Get2Data = {
1079
+ body?: never;
1080
+ path: {
1081
+ /**
1082
+ * Conversation ID (format: `conv_xxxxxxxxxxxx`).
1083
+ */
1084
+ conversationId: string;
1085
+ };
1086
+ query?: never;
1087
+ url: '/conversations/{conversationId}';
1088
+ };
1089
+ export type Get2Errors = {
1090
+ /**
1091
+ * Bad request
1092
+ */
1093
+ 400: {
1094
+ statusCode: number;
1095
+ error: {
1096
+ code: 'MISSING-ORG';
1097
+ message: string;
1098
+ };
1099
+ };
1100
+ /**
1101
+ * Authentication required
1102
+ */
1103
+ 401: {
1104
+ statusCode: number;
1105
+ error: {
1106
+ code: 'AUTH';
1107
+ message: string;
1108
+ };
1109
+ };
1110
+ /**
1111
+ * Insufficient permissions
1112
+ */
1113
+ 403: {
1114
+ statusCode: number;
1115
+ error: {
1116
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1117
+ message: string;
1118
+ };
1119
+ };
1120
+ };
1121
+ export type Get2Error = Get2Errors[keyof Get2Errors];
1122
+ export type Get2Responses = {
1123
+ /**
1124
+ * Successful response
1125
+ */
1126
+ 200: {
1127
+ /**
1128
+ * Conversation ID (format: conv_xxxxxxxxxxxx).
1129
+ */
1130
+ conversationId: string;
1131
+ /**
1132
+ * Organization linked to the conversation (when you use organizations).
1133
+ */
1134
+ organizationId?: string;
1135
+ /**
1136
+ * Current lifecycle status of the conversation.
1137
+ */
1138
+ status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
1139
+ /**
1140
+ * Short human-readable subject computed from the first messages or the user's identity.
1141
+ */
1142
+ subject: string;
1143
+ /**
1144
+ * The person in the conversation, if identified. Null when no user is known yet.
1145
+ */
1146
+ user: {
1147
+ /**
1148
+ * Unique identifier of the person in the conversation, in your system.
1149
+ */
1150
+ userId: string;
1151
+ /**
1152
+ * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
1153
+ */
1154
+ resolved?: boolean;
1155
+ /**
1156
+ * Custom data attached to the user (name, email, account info, etc.).
1157
+ */
1158
+ data?: {
1159
+ [key: string]: unknown;
1160
+ };
1161
+ } | null;
1162
+ /**
1163
+ * Entity linked to the conversation (when you use entities).
1164
+ */
1165
+ entityId?: string;
1166
+ /**
1167
+ * Total number of messages exchanged so far (user + agent).
1168
+ */
1169
+ messageCount: number;
1170
+ /**
1171
+ * ISO timestamp of the last message, or null if no messages yet.
1172
+ */
1173
+ lastMessageAt: string | null;
1174
+ /**
1175
+ * ISO timestamp when the conversation was created.
1176
+ */
1177
+ createdAt: string;
1178
+ /**
1179
+ * ISO timestamp of the last modification (message, status change, etc.).
1180
+ */
1181
+ updatedAt: string;
1182
+ /**
1183
+ * Full message history in chronological order.
1184
+ */
1185
+ thread: Array<{
1186
+ /**
1187
+ * Who emitted the message — the user or your AI agent.
1188
+ */
1189
+ role: 'user' | 'agent';
1190
+ /**
1191
+ * Message body.
1192
+ */
1193
+ content: string;
1194
+ /**
1195
+ * ISO timestamp when the message was recorded.
1196
+ */
1197
+ timestamp: string;
1198
+ /**
1199
+ * Display name of the author (when available).
1200
+ */
1201
+ authorName?: string;
1202
+ }>;
1203
+ /**
1204
+ * Origin tag provided when the conversation was created.
1205
+ */
1206
+ source?: string;
1207
+ /**
1208
+ * Cross-reference ID in your external ticketing system (e.g. Zendesk), when applicable.
1209
+ */
1210
+ externalTicketId?: string;
1211
+ };
1212
+ };
1213
+ export type Get2Response = Get2Responses[keyof Get2Responses];
1214
+ export type SendMessageData = {
1215
+ body?: {
1216
+ /**
1217
+ * Message text sent by the user.
1218
+ */
1219
+ message: string;
1220
+ /**
1221
+ * Conversation ID (format: conv_xxxxxxxxxxxx). Omit on the first call — the server generates one and returns it.
1222
+ */
1223
+ conversationId?: string;
1224
+ /**
1225
+ * Link the conversation to an entity (only applied when creating the conversation; ignored on subsequent messages for the same conversationId).
1226
+ */
1227
+ entityId?: string;
1228
+ /**
1229
+ * The user sending the message. Set `resolved: true` on the user object to skip identity resolution when you already have a complete profile.
1230
+ */
1231
+ user?: {
1232
+ /**
1233
+ * Unique identifier of the person in the conversation, in your system.
1234
+ */
1235
+ userId: string;
1236
+ /**
1237
+ * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
1238
+ */
1239
+ resolved?: boolean;
1240
+ /**
1241
+ * Custom data attached to the user (name, email, account info, etc.).
1242
+ */
1243
+ data?: {
1244
+ [key: string]: unknown;
1245
+ };
1246
+ };
1247
+ /**
1248
+ * Overrides the configured KBs for this message. Not stored.
1249
+ */
1250
+ kbArticles?: Array<{
1251
+ /**
1252
+ * Article title shown to the agent.
1253
+ */
1254
+ title: string;
1255
+ /**
1256
+ * Article body (markdown-friendly).
1257
+ */
1258
+ content: string;
1259
+ /**
1260
+ * Intent identifiers this article serves. Empty or omitted = always-on. Otherwise the article is only injected when one of these intents is detected on the message.
1261
+ */
1262
+ intents?: Array<string>;
1263
+ }>;
1264
+ /**
1265
+ * Origin tag for the conversation (e.g. "website", "chat_page"). Stored on the conversation for analytics.
1266
+ */
1267
+ source?: string;
1268
+ /**
1269
+ * Custom key/value pairs attached to the conversation. Available as variables in your agent prompts.
1270
+ */
1271
+ metadata?: {
1272
+ [key: string]: string;
1273
+ };
1274
+ };
1275
+ path?: never;
1276
+ query?: never;
1277
+ url: '/conversations/messages';
1278
+ };
1279
+ export type SendMessageErrors = {
1280
+ /**
1281
+ * Bad request
1282
+ */
1283
+ 400: {
1284
+ statusCode: number;
1285
+ error: {
1286
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1287
+ message: string;
1288
+ };
1289
+ };
1290
+ /**
1291
+ * Authentication required
1292
+ */
1293
+ 401: {
1294
+ statusCode: number;
1295
+ error: {
1296
+ code: 'AUTH';
1297
+ message: string;
1298
+ };
1299
+ };
1300
+ /**
1301
+ * Insufficient permissions
1302
+ */
1303
+ 403: {
1304
+ statusCode: number;
1305
+ error: {
1306
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1307
+ message: string;
1308
+ };
1309
+ };
1310
+ };
1311
+ export type SendMessageError = SendMessageErrors[keyof SendMessageErrors];
1312
+ export type SendMessageResponses = {
1313
+ /**
1314
+ * Successful response
1315
+ */
1316
+ 200: {
1317
+ /**
1318
+ * Conversation ID — pass it back on subsequent calls to continue the conversation.
1319
+ */
1320
+ conversationId: string;
1321
+ /**
1322
+ * Organization linked to the conversation (when you use organizations).
1323
+ */
1324
+ organizationId?: string;
1325
+ /**
1326
+ * Index of the user message that was just processed. Pass this to [`validateResponse`](#tag/conversations/POST/conversations/{conversationId}/validate-response) if `mode` is `copilot` and you need to validate the response later.
1327
+ */
1328
+ messageIndex: number;
1329
+ /**
1330
+ * The person in the conversation, if identified. Null when no user is known yet.
1331
+ */
1332
+ user: {
1333
+ /**
1334
+ * Unique identifier of the person in the conversation, in your system.
1335
+ */
1336
+ userId: string;
1337
+ /**
1338
+ * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
1339
+ */
1340
+ resolved?: boolean;
1341
+ /**
1342
+ * Custom data attached to the user (name, email, account info, etc.).
1343
+ */
1344
+ data?: {
1345
+ [key: string]: unknown;
1346
+ };
1347
+ } | null;
1348
+ /**
1349
+ * Entity linked to the conversation (when you use entities).
1350
+ */
1351
+ entityId?: string;
1352
+ /**
1353
+ * AI-generated response to the user message.
1354
+ */
1355
+ content: string;
1356
+ /**
1357
+ * How the AI labels this response. `autopilot`: every involved intent and action is cleared for automation — safe to send the content as-is. `copilot`: at least one intent or action is configured for human review — hold the content for an agent to validate before sending. The actual delivery is up to you.
1358
+ */
1359
+ mode: 'autopilot' | 'copilot';
1360
+ /**
1361
+ * True when the conversation has been escalated to a human agent (hard-rule trigger, action failure, unidentifiable user, message limit reached, etc.). The `content` is then a notice for the user that their request was forwarded.
1362
+ */
1363
+ escalated: boolean;
1364
+ };
1365
+ };
1366
+ export type SendMessageResponse = SendMessageResponses[keyof SendMessageResponses];
1367
+ export type ValidateResponseData = {
1368
+ body?: {
1369
+ /**
1370
+ * Index of the user message whose AI response should be validated.
1371
+ */
1372
+ messageIndex: number;
1373
+ /**
1374
+ * Edited content to send instead of the original AI response. Omit to deliver the AI response as-is.
1375
+ */
1376
+ editedContent?: string;
1377
+ };
1378
+ path: {
1379
+ /**
1380
+ * Conversation ID (format: `conv_xxxxxxxxxxxx`).
1381
+ */
1382
+ conversationId: string;
1383
+ };
1384
+ query?: never;
1385
+ url: '/conversations/{conversationId}/validate-response';
1386
+ };
1387
+ export type ValidateResponseErrors = {
1388
+ /**
1389
+ * The response cannot be validated in its current state.
1390
+ */
1391
+ 400: {
1392
+ statusCode: number;
1393
+ error: {
1394
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON' | 'ALREADY_VALIDATED' | 'NO_RESPONSE';
1395
+ message: string;
1396
+ };
1397
+ };
1398
+ /**
1399
+ * Authentication required
1400
+ */
1401
+ 401: {
1402
+ statusCode: number;
1403
+ error: {
1404
+ code: 'AUTH';
1405
+ message: string;
1406
+ };
1407
+ };
1408
+ /**
1409
+ * Insufficient permissions
1410
+ */
1411
+ 403: {
1412
+ statusCode: number;
1413
+ error: {
1414
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1415
+ message: string;
1416
+ };
1417
+ };
1418
+ /**
1419
+ * Conversation or message at the given index does not exist.
1420
+ */
1421
+ 404: {
1422
+ statusCode: number;
1423
+ error: {
1424
+ code: 'NOT-FOUND';
1425
+ message: string;
1426
+ };
1427
+ };
1428
+ };
1429
+ export type ValidateResponseError = ValidateResponseErrors[keyof ValidateResponseErrors];
1430
+ export type ValidateResponseResponses = {
1431
+ /**
1432
+ * Successful response
1433
+ */
1434
+ 200: {
1435
+ /**
1436
+ * Outcome of every action attached to the response that was executed at validation time.
1437
+ */
1438
+ actionsExecuted: Array<{
1439
+ /**
1440
+ * Action type identifier.
1441
+ */
1442
+ type: string;
1443
+ /**
1444
+ * Whether the action ran successfully.
1445
+ */
1446
+ success: boolean;
1447
+ /**
1448
+ * Error message when the action failed.
1449
+ */
1450
+ error?: string;
1451
+ }>;
1452
+ };
1453
+ };
1454
+ export type ValidateResponseResponse = ValidateResponseResponses[keyof ValidateResponseResponses];
1455
+ export type AppendMessageData = {
1456
+ body?: {
1457
+ /**
1458
+ * Message text to append to the conversation thread.
1459
+ */
1460
+ content: string;
1461
+ /**
1462
+ * Who the message is attributed to. `user` to inject an end-user message; `agent` for an operator/human-agent reply that should appear alongside AI responses.
1463
+ */
1464
+ role: 'user' | 'agent';
1465
+ /**
1466
+ * Display name shown alongside the message (e.g. "Alice"). Falls back to the role's default when omitted.
1467
+ */
1468
+ authorName?: string;
1469
+ };
1470
+ path: {
1471
+ /**
1472
+ * Conversation ID (format: `conv_xxxxxxxxxxxx`).
1473
+ */
1474
+ conversationId: string;
1475
+ };
1476
+ query?: never;
1477
+ url: '/conversations/{conversationId}/messages';
1478
+ };
1479
+ export type AppendMessageErrors = {
1480
+ /**
1481
+ * Bad request
1482
+ */
1483
+ 400: {
1484
+ statusCode: number;
1485
+ error: {
1486
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1487
+ message: string;
1488
+ };
1489
+ };
1490
+ /**
1491
+ * Authentication required
1492
+ */
1493
+ 401: {
1494
+ statusCode: number;
1495
+ error: {
1496
+ code: 'AUTH';
1497
+ message: string;
1498
+ };
1499
+ };
1500
+ /**
1501
+ * Insufficient permissions
1502
+ */
1503
+ 403: {
1504
+ statusCode: number;
1505
+ error: {
1506
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1507
+ message: string;
1508
+ };
1509
+ };
1510
+ /**
1511
+ * Conversation does not exist.
1512
+ */
1513
+ 404: {
1514
+ statusCode: number;
1515
+ error: {
1516
+ code: 'NOT-FOUND';
1517
+ message: string;
1518
+ };
1519
+ };
1520
+ };
1521
+ export type AppendMessageError = AppendMessageErrors[keyof AppendMessageErrors];
1522
+ export type AppendMessageResponses = {
1523
+ /**
1524
+ * Successful response
1525
+ */
1526
+ 200: {
1527
+ /**
1528
+ * Index of the appended message in the conversation thread.
1529
+ */
1530
+ messageIndex: number;
1531
+ };
1532
+ };
1533
+ export type AppendMessageResponse = AppendMessageResponses[keyof AppendMessageResponses];
1534
+ export type List3Data = {
1535
+ body?: never;
1536
+ path?: never;
1537
+ query?: {
1538
+ /**
1539
+ * Max number of items to return per page (1-100).
1540
+ */
1541
+ limit?: number;
1542
+ /**
1543
+ * Number of items to skip for pagination.
1544
+ */
1545
+ offset?: number | null;
1546
+ };
1547
+ url: '/entities';
1548
+ };
1549
+ export type List3Errors = {
1550
+ /**
1551
+ * Bad request
1552
+ */
1553
+ 400: {
1554
+ statusCode: number;
1555
+ error: {
1556
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1557
+ message: string;
1558
+ };
1559
+ };
1560
+ /**
1561
+ * Authentication required
1562
+ */
1563
+ 401: {
1564
+ statusCode: number;
1565
+ error: {
1566
+ code: 'AUTH';
1567
+ message: string;
1568
+ };
1569
+ };
1570
+ /**
1571
+ * Insufficient permissions
1572
+ */
1573
+ 403: {
1574
+ statusCode: number;
1575
+ error: {
1576
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1577
+ message: string;
1578
+ };
1579
+ };
1580
+ };
1581
+ export type List3Error = List3Errors[keyof List3Errors];
1582
+ export type List3Responses = {
1583
+ /**
1584
+ * Successful response
1585
+ */
1586
+ 200: {
1587
+ entities: Array<{
1588
+ /**
1589
+ * Entity ID (format: ent_xxxxxxxxxxxx).
1590
+ */
1591
+ id: string;
1592
+ organizationId?: string | null;
1593
+ /**
1594
+ * Human-readable name of the entity.
1595
+ */
1596
+ name: string;
1597
+ /**
1598
+ * ISO timestamp when the entity was created.
1599
+ */
1600
+ createdAt: string;
1601
+ /**
1602
+ * ISO timestamp of the last update.
1603
+ */
1604
+ updatedAt: string;
1605
+ }>;
1606
+ /**
1607
+ * Total number of items matching the query.
1608
+ */
1609
+ total: number;
1610
+ /**
1611
+ * Page size applied to this response.
1612
+ */
1613
+ limit: number;
1614
+ /**
1615
+ * Offset applied to this response.
1616
+ */
1617
+ offset: number;
1618
+ };
1619
+ };
1620
+ export type List3Response = List3Responses[keyof List3Responses];
1621
+ export type Create2Data = {
1622
+ body?: {
1623
+ /**
1624
+ * Human-readable name of the entity.
1625
+ */
1626
+ name: string;
1627
+ /**
1628
+ * Free-form metadata attached to the entity (shape is up to you).
1629
+ */
1630
+ metadata?: {
1631
+ [key: string]: unknown;
1632
+ };
1633
+ };
1634
+ path?: never;
1635
+ query?: never;
1636
+ url: '/entities';
1637
+ };
1638
+ export type Create2Errors = {
1639
+ /**
1640
+ * Bad request
1641
+ */
1642
+ 400: {
1643
+ statusCode: number;
1644
+ error: {
1645
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1646
+ message: string;
1647
+ };
1648
+ };
1649
+ /**
1650
+ * Authentication required
1651
+ */
1652
+ 401: {
1653
+ statusCode: number;
1654
+ error: {
1655
+ code: 'AUTH';
1656
+ message: string;
1657
+ };
1658
+ };
1659
+ /**
1660
+ * Insufficient permissions
1661
+ */
1662
+ 403: {
1663
+ statusCode: number;
1664
+ error: {
1665
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1666
+ message: string;
1667
+ };
1668
+ };
1669
+ };
1670
+ export type Create2Error = Create2Errors[keyof Create2Errors];
1671
+ export type Create2Responses = {
1672
+ /**
1673
+ * Successful response
1674
+ */
1675
+ 200: {
1676
+ /**
1677
+ * Entity ID (format: ent_xxxxxxxxxxxx).
1678
+ */
1679
+ id: string;
1680
+ organizationId?: string | null;
1681
+ /**
1682
+ * Human-readable name of the entity.
1683
+ */
1684
+ name: string;
1685
+ /**
1686
+ * ISO timestamp when the entity was created.
1687
+ */
1688
+ createdAt: string;
1689
+ /**
1690
+ * ISO timestamp of the last update.
1691
+ */
1692
+ updatedAt: string;
1693
+ /**
1694
+ * Free-form metadata attached to the entity (shape is up to you).
1695
+ */
1696
+ metadata?: {
1697
+ [key: string]: unknown;
1698
+ };
1699
+ };
1700
+ };
1701
+ export type Create2Response = Create2Responses[keyof Create2Responses];
1702
+ export type Delete2Data = {
1703
+ body?: never;
1704
+ path: {
1705
+ /**
1706
+ * Entity ID (format: `ent_xxxxxxxxxxxx`).
1707
+ */
1708
+ id: string;
1709
+ };
1710
+ query?: never;
1711
+ url: '/entities/{id}';
1712
+ };
1713
+ export type Delete2Errors = {
1714
+ /**
1715
+ * Bad request
1716
+ */
1717
+ 400: {
1718
+ statusCode: number;
1719
+ error: {
1720
+ code: 'MISSING-ORG';
1721
+ message: string;
1722
+ };
1723
+ };
1724
+ /**
1725
+ * Authentication required
1726
+ */
1727
+ 401: {
1728
+ statusCode: number;
1729
+ error: {
1730
+ code: 'AUTH';
1731
+ message: string;
1732
+ };
1733
+ };
1734
+ /**
1735
+ * Insufficient permissions
1736
+ */
1737
+ 403: {
1738
+ statusCode: number;
1739
+ error: {
1740
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1741
+ message: string;
1742
+ };
1743
+ };
1744
+ };
1745
+ export type Delete2Error = Delete2Errors[keyof Delete2Errors];
1746
+ export type Delete2Responses = {
1747
+ /**
1748
+ * Successful response
1749
+ */
1750
+ 200: {
1751
+ /**
1752
+ * Confirmation message.
1753
+ */
1754
+ message: string;
1755
+ };
1756
+ };
1757
+ export type Delete2Response = Delete2Responses[keyof Delete2Responses];
1758
+ export type Get3Data = {
1759
+ body?: never;
1760
+ path: {
1761
+ /**
1762
+ * Entity ID (format: `ent_xxxxxxxxxxxx`).
1763
+ */
1764
+ id: string;
1765
+ };
1766
+ query?: never;
1767
+ url: '/entities/{id}';
1768
+ };
1769
+ export type Get3Errors = {
1770
+ /**
1771
+ * Bad request
1772
+ */
1773
+ 400: {
1774
+ statusCode: number;
1775
+ error: {
1776
+ code: 'MISSING-ORG';
1777
+ message: string;
1778
+ };
1779
+ };
1780
+ /**
1781
+ * Authentication required
1782
+ */
1783
+ 401: {
1784
+ statusCode: number;
1785
+ error: {
1786
+ code: 'AUTH';
1787
+ message: string;
1788
+ };
1789
+ };
1790
+ /**
1791
+ * Insufficient permissions
1792
+ */
1793
+ 403: {
1794
+ statusCode: number;
1795
+ error: {
1796
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1797
+ message: string;
1798
+ };
1799
+ };
1800
+ };
1801
+ export type Get3Error = Get3Errors[keyof Get3Errors];
1802
+ export type Get3Responses = {
1803
+ /**
1804
+ * Successful response
1805
+ */
1806
+ 200: {
1807
+ /**
1808
+ * Entity ID (format: ent_xxxxxxxxxxxx).
1809
+ */
1810
+ id: string;
1811
+ organizationId?: string | null;
1812
+ /**
1813
+ * Human-readable name of the entity.
1814
+ */
1815
+ name: string;
1816
+ /**
1817
+ * ISO timestamp when the entity was created.
1818
+ */
1819
+ createdAt: string;
323
1820
  /**
324
- * Origin tag for the conversation (e.g. "website", "chat_page"). Stored on the conversation for analytics.
1821
+ * ISO timestamp of the last update.
325
1822
  */
326
- source?: string;
1823
+ updatedAt: string;
327
1824
  /**
328
- * Custom key/value pairs attached to the conversation. Available as variables in your agent prompts.
1825
+ * Free-form metadata attached to the entity (shape is up to you).
329
1826
  */
330
1827
  metadata?: {
331
- [key: string]: string;
1828
+ [key: string]: unknown;
332
1829
  };
333
1830
  };
334
- path?: never;
1831
+ };
1832
+ export type Get3Response = Get3Responses[keyof Get3Responses];
1833
+ export type Update2Data = {
1834
+ body?: {
1835
+ /**
1836
+ * New name for the entity.
1837
+ */
1838
+ name?: string;
1839
+ /**
1840
+ * Replace the free-form metadata attached to the entity.
1841
+ */
1842
+ metadata?: {
1843
+ [key: string]: unknown;
1844
+ };
1845
+ };
1846
+ path: {
1847
+ /**
1848
+ * Entity ID (format: `ent_xxxxxxxxxxxx`).
1849
+ */
1850
+ id: string;
1851
+ };
335
1852
  query?: never;
336
- url: '/conversations/messages';
1853
+ url: '/entities/{id}';
337
1854
  };
338
- export type SendMessageErrors = {
1855
+ export type Update2Errors = {
339
1856
  /**
340
1857
  * Bad request
341
1858
  */
@@ -367,87 +1884,65 @@ export type SendMessageErrors = {
367
1884
  };
368
1885
  };
369
1886
  };
370
- export type SendMessageError = SendMessageErrors[keyof SendMessageErrors];
371
- export type SendMessageResponses = {
1887
+ export type Update2Error = Update2Errors[keyof Update2Errors];
1888
+ export type Update2Responses = {
372
1889
  /**
373
1890
  * Successful response
374
1891
  */
375
1892
  200: {
376
1893
  /**
377
- * Conversation ID — pass it back on subsequent calls to continue the conversation.
378
- */
379
- conversationId: string;
380
- /**
381
- * Organization linked to the conversation (when you use organizations).
382
- */
383
- organizationId?: string;
384
- /**
385
- * Index of the user message that was just processed. Pass this to [`validateResponse`](#tag/conversations/POST/conversations/{conversationId}/validate-response) if `mode` is `copilot` and you need to validate the response later.
386
- */
387
- messageIndex: number;
388
- /**
389
- * The person in the conversation, if identified. Null when no user is known yet.
1894
+ * Entity ID (format: ent_xxxxxxxxxxxx).
390
1895
  */
391
- user: {
392
- /**
393
- * Unique identifier of the person in the conversation, in your system.
394
- */
395
- userId: string;
396
- /**
397
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
398
- */
399
- resolved?: boolean;
400
- /**
401
- * Custom data attached to the user (name, email, account info, etc.).
402
- */
403
- data?: {
404
- [key: string]: unknown;
405
- };
406
- } | null;
1896
+ id: string;
1897
+ organizationId?: string | null;
407
1898
  /**
408
- * Entity linked to the conversation (when you use entities).
1899
+ * Human-readable name of the entity.
409
1900
  */
410
- entityId?: string;
1901
+ name: string;
411
1902
  /**
412
- * AI-generated response to the user message.
1903
+ * ISO timestamp when the entity was created.
413
1904
  */
414
- content: string;
1905
+ createdAt: string;
415
1906
  /**
416
- * How the AI labels this response. `autopilot`: every involved intent and action is cleared for automation — safe to send the content as-is. `copilot`: at least one intent or action is configured for human review — hold the content for an agent to validate before sending. The actual delivery is up to you.
1907
+ * ISO timestamp of the last update.
417
1908
  */
418
- mode: 'autopilot' | 'copilot';
1909
+ updatedAt: string;
419
1910
  /**
420
- * True when the conversation has been escalated to a human agent (hard-rule trigger, action failure, unidentifiable user, message limit reached, etc.). The `content` is then a notice for the user that their request was forwarded.
1911
+ * Free-form metadata attached to the entity (shape is up to you).
421
1912
  */
422
- escalated: boolean;
1913
+ metadata?: {
1914
+ [key: string]: unknown;
1915
+ };
423
1916
  };
424
1917
  };
425
- export type SendMessageResponse = SendMessageResponses[keyof SendMessageResponses];
426
- export type ValidateResponseData = {
427
- body?: {
1918
+ export type Update2Response = Update2Responses[keyof Update2Responses];
1919
+ export type List4Data = {
1920
+ body?: never;
1921
+ path?: never;
1922
+ query?: {
428
1923
  /**
429
- * Index of the user message whose AI response should be validated.
1924
+ * Max number of items to return per page (1-100).
430
1925
  */
431
- messageIndex: number;
1926
+ limit?: number;
432
1927
  /**
433
- * Edited content to send instead of the original AI response. Omit to deliver the AI response as-is.
1928
+ * Number of items to skip for pagination.
434
1929
  */
435
- editedContent?: string;
436
- };
437
- path: {
438
- conversationId: string;
1930
+ offset?: number | null;
1931
+ /**
1932
+ * Target a specific entity (under the caller's organization).
1933
+ */
1934
+ entityId?: string;
439
1935
  };
440
- query?: never;
441
- url: '/conversations/{conversationId}/validate-response';
1936
+ url: '/kb';
442
1937
  };
443
- export type ValidateResponseErrors = {
1938
+ export type List4Errors = {
444
1939
  /**
445
- * The response cannot be validated in its current state.
1940
+ * Bad request
446
1941
  */
447
1942
  400: {
448
1943
  statusCode: number;
449
1944
  error: {
450
- code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON' | 'ALREADY_VALIDATED' | 'NO_RESPONSE';
1945
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
451
1946
  message: string;
452
1947
  };
453
1948
  };
@@ -471,65 +1966,67 @@ export type ValidateResponseErrors = {
471
1966
  message: string;
472
1967
  };
473
1968
  };
474
- /**
475
- * Conversation or message at the given index does not exist.
476
- */
477
- 404: {
478
- statusCode: number;
479
- error: {
480
- code: 'NOT-FOUND';
481
- message: string;
482
- };
483
- };
484
1969
  };
485
- export type ValidateResponseError = ValidateResponseErrors[keyof ValidateResponseErrors];
486
- export type ValidateResponseResponses = {
1970
+ export type List4Error = List4Errors[keyof List4Errors];
1971
+ export type List4Responses = {
487
1972
  /**
488
1973
  * Successful response
489
1974
  */
490
1975
  200: {
1976
+ articles: Array<{
1977
+ id: string;
1978
+ title: string;
1979
+ intents: Array<string>;
1980
+ scope: {
1981
+ level: 'global' | 'organization' | 'entity';
1982
+ organizationId?: string;
1983
+ entityId?: string;
1984
+ };
1985
+ version: number;
1986
+ hasDraft: boolean;
1987
+ publishedAt?: string;
1988
+ updatedAt: string;
1989
+ }>;
491
1990
  /**
492
- * Outcome of every action attached to the response that was executed at validation time.
1991
+ * Total number of items matching the query.
493
1992
  */
494
- actionsExecuted: Array<{
495
- /**
496
- * Action type identifier.
497
- */
498
- type: string;
499
- /**
500
- * Whether the action ran successfully.
501
- */
502
- success: boolean;
503
- /**
504
- * Error message when the action failed.
505
- */
506
- error?: string;
507
- }>;
1993
+ total: number;
1994
+ /**
1995
+ * Page size applied to this response.
1996
+ */
1997
+ limit: number;
1998
+ /**
1999
+ * Offset applied to this response.
2000
+ */
2001
+ offset: number;
508
2002
  };
509
2003
  };
510
- export type ValidateResponseResponse = ValidateResponseResponses[keyof ValidateResponseResponses];
511
- export type AppendMessageData = {
2004
+ export type List4Response = List4Responses[keyof List4Responses];
2005
+ export type Create3Data = {
512
2006
  body?: {
513
2007
  /**
514
- * Message text to append to the conversation thread.
2008
+ * Article title.
515
2009
  */
516
- content: string;
2010
+ title: string;
517
2011
  /**
518
- * Who the message is attributed to. `user` to inject an end-user message; `agent` for an operator/human-agent reply that should appear alongside AI responses.
2012
+ * Article body (Markdown).
519
2013
  */
520
- role: 'user' | 'agent';
2014
+ content: string;
521
2015
  /**
522
- * Display name shown alongside the message (e.g. "Alice"). Falls back to the role's default when omitted.
2016
+ * Intent IDs this article serves. Empty = always-on within its scope.
523
2017
  */
524
- authorName?: string;
2018
+ intents?: Array<string>;
525
2019
  };
526
- path: {
527
- conversationId: string;
2020
+ path?: never;
2021
+ query?: {
2022
+ /**
2023
+ * Target a specific entity (under the caller's organization).
2024
+ */
2025
+ entityId?: string;
528
2026
  };
529
- query?: never;
530
- url: '/conversations/{conversationId}/messages';
2027
+ url: '/kb';
531
2028
  };
532
- export type AppendMessageErrors = {
2029
+ export type Create3Errors = {
533
2030
  /**
534
2031
  * Bad request
535
2032
  */
@@ -560,49 +2057,61 @@ export type AppendMessageErrors = {
560
2057
  message: string;
561
2058
  };
562
2059
  };
563
- /**
564
- * Conversation does not exist.
565
- */
566
- 404: {
567
- statusCode: number;
568
- error: {
569
- code: 'NOT-FOUND';
570
- message: string;
571
- };
572
- };
573
2060
  };
574
- export type AppendMessageError = AppendMessageErrors[keyof AppendMessageErrors];
575
- export type AppendMessageResponses = {
2061
+ export type Create3Error = Create3Errors[keyof Create3Errors];
2062
+ export type Create3Responses = {
576
2063
  /**
577
2064
  * Successful response
578
2065
  */
579
2066
  200: {
580
2067
  /**
581
- * Index of the appended message in the conversation thread.
2068
+ * KB article ID (format: kb_xxxxxxxxxxxx).
582
2069
  */
583
- messageIndex: number;
2070
+ id: string;
2071
+ scope: {
2072
+ level: 'global' | 'organization' | 'entity';
2073
+ organizationId?: string;
2074
+ entityId?: string;
2075
+ };
2076
+ intents: Array<string>;
2077
+ published: {
2078
+ version: number;
2079
+ title: string;
2080
+ content: string;
2081
+ publishedAt?: string;
2082
+ updatedAt?: string;
2083
+ };
2084
+ draft?: {
2085
+ version: number;
2086
+ title: string;
2087
+ content: string;
2088
+ publishedAt?: string;
2089
+ updatedAt?: string;
2090
+ };
2091
+ createdAt: string;
2092
+ updatedAt: string;
584
2093
  };
585
2094
  };
586
- export type AppendMessageResponse = AppendMessageResponses[keyof AppendMessageResponses];
587
- export type List2Data = {
2095
+ export type Create3Response = Create3Responses[keyof Create3Responses];
2096
+ export type Delete3Data = {
588
2097
  body?: never;
589
- path?: never;
590
- query?: {
2098
+ path: {
591
2099
  /**
592
- * Filter: only list entities under this organization (when you use organizations).
2100
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
593
2101
  */
594
- organizationId?: string;
2102
+ id: string;
595
2103
  };
596
- url: '/entities';
2104
+ query?: never;
2105
+ url: '/kb/{id}';
597
2106
  };
598
- export type List2Errors = {
2107
+ export type Delete3Errors = {
599
2108
  /**
600
2109
  * Bad request
601
2110
  */
602
2111
  400: {
603
2112
  statusCode: number;
604
2113
  error: {
605
- code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
2114
+ code: 'MISSING-ORG';
606
2115
  message: string;
607
2116
  };
608
2117
  };
@@ -618,81 +2127,44 @@ export type List2Errors = {
618
2127
  };
619
2128
  /**
620
2129
  * Insufficient permissions
621
- */
622
- 403: {
623
- statusCode: number;
624
- error: {
625
- code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
626
- message: string;
627
- };
628
- };
629
- };
630
- export type List2Error = List2Errors[keyof List2Errors];
631
- export type List2Responses = {
632
- /**
633
- * Successful response
634
- */
635
- 200: {
636
- /**
637
- * Entities matching the query.
638
- */
639
- entities: Array<{
640
- /**
641
- * Entity ID (format: ent_xxxxxxxxxxxx).
642
- */
643
- id: string;
644
- organizationId?: string | null;
645
- /**
646
- * Human-readable name of the entity.
647
- */
648
- name: string;
649
- /**
650
- * Free-form metadata attached to the entity (shape is up to you).
651
- */
652
- metadata?: {
653
- [key: string]: unknown;
654
- };
655
- /**
656
- * ISO timestamp when the entity was created.
657
- */
658
- createdAt: string;
659
- /**
660
- * ISO timestamp of the last update.
661
- */
662
- updatedAt: string;
663
- }>;
664
- /**
665
- * Total number of entities matching the query.
666
- */
667
- total: number;
2130
+ */
2131
+ 403: {
2132
+ statusCode: number;
2133
+ error: {
2134
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
2135
+ message: string;
2136
+ };
668
2137
  };
669
2138
  };
670
- export type List2Response = List2Responses[keyof List2Responses];
671
- export type CreateData = {
672
- body?: {
673
- /**
674
- * Human-readable name of the entity.
675
- */
676
- name: string;
2139
+ export type Delete3Error = Delete3Errors[keyof Delete3Errors];
2140
+ export type Delete3Responses = {
2141
+ /**
2142
+ * Successful response
2143
+ */
2144
+ 200: {
2145
+ message: string;
2146
+ };
2147
+ };
2148
+ export type Delete3Response = Delete3Responses[keyof Delete3Responses];
2149
+ export type Get4Data = {
2150
+ body?: never;
2151
+ path: {
677
2152
  /**
678
- * Free-form metadata attached to the entity (shape is up to you).
2153
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
679
2154
  */
680
- metadata?: {
681
- [key: string]: unknown;
682
- };
2155
+ id: string;
683
2156
  };
684
- path?: never;
685
2157
  query?: never;
686
- url: '/entities';
2158
+ url: '/kb/{id}';
687
2159
  };
688
- export type CreateErrors = {
2160
+ export type Get4Errors = {
689
2161
  /**
690
2162
  * Bad request
691
2163
  */
692
2164
  400: {
693
2165
  statusCode: number;
694
2166
  error: {
695
- code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
2167
+ code: 'MISSING-ORG';
696
2168
  message: string;
697
2169
  };
698
2170
  };
@@ -717,54 +2189,77 @@ export type CreateErrors = {
717
2189
  };
718
2190
  };
719
2191
  };
720
- export type CreateError = CreateErrors[keyof CreateErrors];
721
- export type CreateResponses = {
2192
+ export type Get4Error = Get4Errors[keyof Get4Errors];
2193
+ export type Get4Responses = {
722
2194
  /**
723
2195
  * Successful response
724
2196
  */
725
2197
  200: {
726
2198
  /**
727
- * Entity ID (format: ent_xxxxxxxxxxxx).
2199
+ * KB article ID (format: kb_xxxxxxxxxxxx).
728
2200
  */
729
2201
  id: string;
730
- organizationId?: string | null;
2202
+ scope: {
2203
+ level: 'global' | 'organization' | 'entity';
2204
+ organizationId?: string;
2205
+ entityId?: string;
2206
+ };
2207
+ intents: Array<string>;
2208
+ published: {
2209
+ version: number;
2210
+ title: string;
2211
+ content: string;
2212
+ publishedAt?: string;
2213
+ updatedAt?: string;
2214
+ };
2215
+ draft?: {
2216
+ version: number;
2217
+ title: string;
2218
+ content: string;
2219
+ publishedAt?: string;
2220
+ updatedAt?: string;
2221
+ };
2222
+ createdAt: string;
2223
+ updatedAt: string;
2224
+ };
2225
+ };
2226
+ export type Get4Response = Get4Responses[keyof Get4Responses];
2227
+ export type Update3Data = {
2228
+ body?: {
731
2229
  /**
732
- * Human-readable name of the entity.
2230
+ * New article title.
733
2231
  */
734
- name: string;
2232
+ title?: string;
735
2233
  /**
736
- * Free-form metadata attached to the entity (shape is up to you).
2234
+ * New article body.
737
2235
  */
738
- metadata?: {
739
- [key: string]: unknown;
740
- };
2236
+ content?: string;
741
2237
  /**
742
- * ISO timestamp when the entity was created.
2238
+ * Replace the intents list. Pass `[]` to make the article always-on.
743
2239
  */
744
- createdAt: string;
2240
+ intents?: Array<string>;
745
2241
  /**
746
- * ISO timestamp of the last update.
2242
+ * When true and `title`/`content` is provided, the changes are written to draft and immediately promoted to published (a version snapshot is still created so rollback remains possible). When false (default), the content stays in draft. Routing changes (`intents`) bypass this flag.
747
2243
  */
748
- updatedAt: string;
2244
+ publish?: boolean;
749
2245
  };
750
- };
751
- export type CreateResponse = CreateResponses[keyof CreateResponses];
752
- export type DeleteData = {
753
- body?: never;
754
2246
  path: {
2247
+ /**
2248
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
2249
+ */
755
2250
  id: string;
756
2251
  };
757
2252
  query?: never;
758
- url: '/entities/{id}';
2253
+ url: '/kb/{id}';
759
2254
  };
760
- export type DeleteErrors = {
2255
+ export type Update3Errors = {
761
2256
  /**
762
2257
  * Bad request
763
2258
  */
764
2259
  400: {
765
2260
  statusCode: number;
766
2261
  error: {
767
- code: 'MISSING-ORG';
2262
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
768
2263
  message: string;
769
2264
  };
770
2265
  };
@@ -789,28 +2284,53 @@ export type DeleteErrors = {
789
2284
  };
790
2285
  };
791
2286
  };
792
- export type DeleteError = DeleteErrors[keyof DeleteErrors];
793
- export type DeleteResponses = {
2287
+ export type Update3Error = Update3Errors[keyof Update3Errors];
2288
+ export type Update3Responses = {
794
2289
  /**
795
2290
  * Successful response
796
2291
  */
797
2292
  200: {
798
2293
  /**
799
- * Confirmation message.
2294
+ * KB article ID (format: kb_xxxxxxxxxxxx).
800
2295
  */
801
- message: string;
2296
+ id: string;
2297
+ scope: {
2298
+ level: 'global' | 'organization' | 'entity';
2299
+ organizationId?: string;
2300
+ entityId?: string;
2301
+ };
2302
+ intents: Array<string>;
2303
+ published: {
2304
+ version: number;
2305
+ title: string;
2306
+ content: string;
2307
+ publishedAt?: string;
2308
+ updatedAt?: string;
2309
+ };
2310
+ draft?: {
2311
+ version: number;
2312
+ title: string;
2313
+ content: string;
2314
+ publishedAt?: string;
2315
+ updatedAt?: string;
2316
+ };
2317
+ createdAt: string;
2318
+ updatedAt: string;
802
2319
  };
803
2320
  };
804
- export type DeleteResponse = DeleteResponses[keyof DeleteResponses];
805
- export type Get2Data = {
2321
+ export type Update3Response = Update3Responses[keyof Update3Responses];
2322
+ export type Publish2Data = {
806
2323
  body?: never;
807
2324
  path: {
2325
+ /**
2326
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
2327
+ */
808
2328
  id: string;
809
2329
  };
810
2330
  query?: never;
811
- url: '/entities/{id}';
2331
+ url: '/kb/{id}/publish';
812
2332
  };
813
- export type Get2Errors = {
2333
+ export type Publish2Errors = {
814
2334
  /**
815
2335
  * Bad request
816
2336
  */
@@ -842,58 +2362,58 @@ export type Get2Errors = {
842
2362
  };
843
2363
  };
844
2364
  };
845
- export type Get2Error = Get2Errors[keyof Get2Errors];
846
- export type Get2Responses = {
2365
+ export type Publish2Error = Publish2Errors[keyof Publish2Errors];
2366
+ export type Publish2Responses = {
847
2367
  /**
848
2368
  * Successful response
849
2369
  */
850
2370
  200: {
851
2371
  /**
852
- * Entity ID (format: ent_xxxxxxxxxxxx).
2372
+ * KB article ID (format: kb_xxxxxxxxxxxx).
853
2373
  */
854
2374
  id: string;
855
- organizationId?: string | null;
856
- /**
857
- * Human-readable name of the entity.
858
- */
859
- name: string;
860
- /**
861
- * Free-form metadata attached to the entity (shape is up to you).
862
- */
863
- metadata?: {
864
- [key: string]: unknown;
2375
+ scope: {
2376
+ level: 'global' | 'organization' | 'entity';
2377
+ organizationId?: string;
2378
+ entityId?: string;
2379
+ };
2380
+ intents: Array<string>;
2381
+ published: {
2382
+ version: number;
2383
+ title: string;
2384
+ content: string;
2385
+ publishedAt?: string;
2386
+ updatedAt?: string;
2387
+ };
2388
+ draft?: {
2389
+ version: number;
2390
+ title: string;
2391
+ content: string;
2392
+ publishedAt?: string;
2393
+ updatedAt?: string;
865
2394
  };
866
- /**
867
- * ISO timestamp when the entity was created.
868
- */
869
2395
  createdAt: string;
870
- /**
871
- * ISO timestamp of the last update.
872
- */
873
2396
  updatedAt: string;
874
2397
  };
875
2398
  };
876
- export type Get2Response = Get2Responses[keyof Get2Responses];
877
- export type UpdateData = {
2399
+ export type Publish2Response = Publish2Responses[keyof Publish2Responses];
2400
+ export type Rollback2Data = {
878
2401
  body?: {
879
2402
  /**
880
- * New name for the entity.
881
- */
882
- name?: string;
883
- /**
884
- * Replace the free-form metadata attached to the entity.
2403
+ * Archived version number to restore as the new published.
885
2404
  */
886
- metadata?: {
887
- [key: string]: unknown;
888
- };
2405
+ targetVersion: number;
889
2406
  };
890
2407
  path: {
2408
+ /**
2409
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
2410
+ */
891
2411
  id: string;
892
2412
  };
893
2413
  query?: never;
894
- url: '/entities/{id}';
2414
+ url: '/kb/{id}/rollback';
895
2415
  };
896
- export type UpdateErrors = {
2416
+ export type Rollback2Errors = {
897
2417
  /**
898
2418
  * Bad request
899
2419
  */
@@ -925,52 +2445,64 @@ export type UpdateErrors = {
925
2445
  };
926
2446
  };
927
2447
  };
928
- export type UpdateError = UpdateErrors[keyof UpdateErrors];
929
- export type UpdateResponses = {
2448
+ export type Rollback2Error = Rollback2Errors[keyof Rollback2Errors];
2449
+ export type Rollback2Responses = {
930
2450
  /**
931
2451
  * Successful response
932
2452
  */
933
2453
  200: {
934
2454
  /**
935
- * Entity ID (format: ent_xxxxxxxxxxxx).
2455
+ * KB article ID (format: kb_xxxxxxxxxxxx).
936
2456
  */
937
2457
  id: string;
938
- organizationId?: string | null;
939
- /**
940
- * Human-readable name of the entity.
941
- */
942
- name: string;
943
- /**
944
- * Free-form metadata attached to the entity (shape is up to you).
945
- */
946
- metadata?: {
947
- [key: string]: unknown;
2458
+ scope: {
2459
+ level: 'global' | 'organization' | 'entity';
2460
+ organizationId?: string;
2461
+ entityId?: string;
2462
+ };
2463
+ intents: Array<string>;
2464
+ published: {
2465
+ version: number;
2466
+ title: string;
2467
+ content: string;
2468
+ publishedAt?: string;
2469
+ updatedAt?: string;
2470
+ };
2471
+ draft?: {
2472
+ version: number;
2473
+ title: string;
2474
+ content: string;
2475
+ publishedAt?: string;
2476
+ updatedAt?: string;
948
2477
  };
949
- /**
950
- * ISO timestamp when the entity was created.
951
- */
952
2478
  createdAt: string;
953
- /**
954
- * ISO timestamp of the last update.
955
- */
956
2479
  updatedAt: string;
957
2480
  };
958
2481
  };
959
- export type UpdateResponse = UpdateResponses[keyof UpdateResponses];
960
- export type List3Data = {
2482
+ export type Rollback2Response = Rollback2Responses[keyof Rollback2Responses];
2483
+ export type List5Data = {
961
2484
  body?: never;
962
2485
  path?: never;
963
- query?: never;
2486
+ query?: {
2487
+ /**
2488
+ * Max number of items to return per page (1-100).
2489
+ */
2490
+ limit?: number;
2491
+ /**
2492
+ * Number of items to skip for pagination.
2493
+ */
2494
+ offset?: number | null;
2495
+ };
964
2496
  url: '/organizations';
965
2497
  };
966
- export type List3Errors = {
2498
+ export type List5Errors = {
967
2499
  /**
968
2500
  * Bad request
969
2501
  */
970
2502
  400: {
971
2503
  statusCode: number;
972
2504
  error: {
973
- code: 'MISSING-ORG';
2505
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
974
2506
  message: string;
975
2507
  };
976
2508
  };
@@ -995,15 +2527,12 @@ export type List3Errors = {
995
2527
  };
996
2528
  };
997
2529
  };
998
- export type List3Error = List3Errors[keyof List3Errors];
999
- export type List3Responses = {
2530
+ export type List5Error = List5Errors[keyof List5Errors];
2531
+ export type List5Responses = {
1000
2532
  /**
1001
2533
  * Successful response
1002
2534
  */
1003
2535
  200: {
1004
- /**
1005
- * Organizations matching the query.
1006
- */
1007
2536
  organizations: Array<{
1008
2537
  /**
1009
2538
  * Organization ID (format: org_xxxxxxxxxxxx).
@@ -1013,12 +2542,6 @@ export type List3Responses = {
1013
2542
  * Human-readable name of the organization.
1014
2543
  */
1015
2544
  name: string;
1016
- /**
1017
- * Free-form metadata attached to the organization (shape is up to you).
1018
- */
1019
- metadata?: {
1020
- [key: string]: unknown;
1021
- };
1022
2545
  /**
1023
2546
  * ISO timestamp when the organization was created.
1024
2547
  */
@@ -1029,13 +2552,21 @@ export type List3Responses = {
1029
2552
  updatedAt: string;
1030
2553
  }>;
1031
2554
  /**
1032
- * Total number of organizations matching the query.
2555
+ * Total number of items matching the query.
1033
2556
  */
1034
2557
  total: number;
2558
+ /**
2559
+ * Page size applied to this response.
2560
+ */
2561
+ limit: number;
2562
+ /**
2563
+ * Offset applied to this response.
2564
+ */
2565
+ offset: number;
1035
2566
  };
1036
2567
  };
1037
- export type List3Response = List3Responses[keyof List3Responses];
1038
- export type Create2Data = {
2568
+ export type List5Response = List5Responses[keyof List5Responses];
2569
+ export type Create4Data = {
1039
2570
  body?: {
1040
2571
  /**
1041
2572
  * Human-readable name of the organization (must be unique).
@@ -1056,7 +2587,7 @@ export type Create2Data = {
1056
2587
  query?: never;
1057
2588
  url: '/organizations';
1058
2589
  };
1059
- export type Create2Errors = {
2590
+ export type Create4Errors = {
1060
2591
  /**
1061
2592
  * Bad request
1062
2593
  */
@@ -1088,8 +2619,8 @@ export type Create2Errors = {
1088
2619
  };
1089
2620
  };
1090
2621
  };
1091
- export type Create2Error = Create2Errors[keyof Create2Errors];
1092
- export type Create2Responses = {
2622
+ export type Create4Error = Create4Errors[keyof Create4Errors];
2623
+ export type Create4Responses = {
1093
2624
  /**
1094
2625
  * Successful response
1095
2626
  */
@@ -1106,12 +2637,6 @@ export type Create2Responses = {
1106
2637
  * Human-readable name of the organization.
1107
2638
  */
1108
2639
  name: string;
1109
- /**
1110
- * Free-form metadata attached to the organization (shape is up to you).
1111
- */
1112
- metadata?: {
1113
- [key: string]: unknown;
1114
- };
1115
2640
  /**
1116
2641
  * ISO timestamp when the organization was created.
1117
2642
  */
@@ -1120,6 +2645,12 @@ export type Create2Responses = {
1120
2645
  * ISO timestamp of the last update.
1121
2646
  */
1122
2647
  updatedAt: string;
2648
+ /**
2649
+ * Free-form metadata attached to the organization (shape is up to you).
2650
+ */
2651
+ metadata?: {
2652
+ [key: string]: unknown;
2653
+ };
1123
2654
  };
1124
2655
  /**
1125
2656
  * Scoped API key for the newly-created organization — shown only once. Store it securely; it cannot be retrieved later. Present only when `generateApiKey: true` was passed in the request.
@@ -1127,16 +2658,19 @@ export type Create2Responses = {
1127
2658
  apiKey?: string;
1128
2659
  };
1129
2660
  };
1130
- export type Create2Response = Create2Responses[keyof Create2Responses];
1131
- export type Delete2Data = {
2661
+ export type Create4Response = Create4Responses[keyof Create4Responses];
2662
+ export type Delete4Data = {
1132
2663
  body?: never;
1133
2664
  path: {
2665
+ /**
2666
+ * Organization ID (format: `org_xxxxxxxxxxxx`).
2667
+ */
1134
2668
  id: string;
1135
2669
  };
1136
2670
  query?: never;
1137
2671
  url: '/organizations/{id}';
1138
2672
  };
1139
- export type Delete2Errors = {
2673
+ export type Delete4Errors = {
1140
2674
  /**
1141
2675
  * Bad request
1142
2676
  */
@@ -1168,8 +2702,8 @@ export type Delete2Errors = {
1168
2702
  };
1169
2703
  };
1170
2704
  };
1171
- export type Delete2Error = Delete2Errors[keyof Delete2Errors];
1172
- export type Delete2Responses = {
2705
+ export type Delete4Error = Delete4Errors[keyof Delete4Errors];
2706
+ export type Delete4Responses = {
1173
2707
  /**
1174
2708
  * Successful response
1175
2709
  */
@@ -1180,16 +2714,19 @@ export type Delete2Responses = {
1180
2714
  message: string;
1181
2715
  };
1182
2716
  };
1183
- export type Delete2Response = Delete2Responses[keyof Delete2Responses];
1184
- export type Get3Data = {
2717
+ export type Delete4Response = Delete4Responses[keyof Delete4Responses];
2718
+ export type Get5Data = {
1185
2719
  body?: never;
1186
2720
  path: {
2721
+ /**
2722
+ * Organization ID (format: `org_xxxxxxxxxxxx`).
2723
+ */
1187
2724
  id: string;
1188
2725
  };
1189
2726
  query?: never;
1190
2727
  url: '/organizations/{id}';
1191
2728
  };
1192
- export type Get3Errors = {
2729
+ export type Get5Errors = {
1193
2730
  /**
1194
2731
  * Bad request
1195
2732
  */
@@ -1221,8 +2758,8 @@ export type Get3Errors = {
1221
2758
  };
1222
2759
  };
1223
2760
  };
1224
- export type Get3Error = Get3Errors[keyof Get3Errors];
1225
- export type Get3Responses = {
2761
+ export type Get5Error = Get5Errors[keyof Get5Errors];
2762
+ export type Get5Responses = {
1226
2763
  /**
1227
2764
  * Successful response
1228
2765
  */
@@ -1235,12 +2772,6 @@ export type Get3Responses = {
1235
2772
  * Human-readable name of the organization.
1236
2773
  */
1237
2774
  name: string;
1238
- /**
1239
- * Free-form metadata attached to the organization (shape is up to you).
1240
- */
1241
- metadata?: {
1242
- [key: string]: unknown;
1243
- };
1244
2775
  /**
1245
2776
  * ISO timestamp when the organization was created.
1246
2777
  */
@@ -1249,10 +2780,16 @@ export type Get3Responses = {
1249
2780
  * ISO timestamp of the last update.
1250
2781
  */
1251
2782
  updatedAt: string;
2783
+ /**
2784
+ * Free-form metadata attached to the organization (shape is up to you).
2785
+ */
2786
+ metadata?: {
2787
+ [key: string]: unknown;
2788
+ };
1252
2789
  };
1253
2790
  };
1254
- export type Get3Response = Get3Responses[keyof Get3Responses];
1255
- export type Update2Data = {
2791
+ export type Get5Response = Get5Responses[keyof Get5Responses];
2792
+ export type Update4Data = {
1256
2793
  body?: {
1257
2794
  /**
1258
2795
  * New name for the organization.
@@ -1266,12 +2803,15 @@ export type Update2Data = {
1266
2803
  };
1267
2804
  };
1268
2805
  path: {
2806
+ /**
2807
+ * Organization ID (format: `org_xxxxxxxxxxxx`).
2808
+ */
1269
2809
  id: string;
1270
2810
  };
1271
2811
  query?: never;
1272
2812
  url: '/organizations/{id}';
1273
2813
  };
1274
- export type Update2Errors = {
2814
+ export type Update4Errors = {
1275
2815
  /**
1276
2816
  * Bad request
1277
2817
  */
@@ -1303,8 +2843,8 @@ export type Update2Errors = {
1303
2843
  };
1304
2844
  };
1305
2845
  };
1306
- export type Update2Error = Update2Errors[keyof Update2Errors];
1307
- export type Update2Responses = {
2846
+ export type Update4Error = Update4Errors[keyof Update4Errors];
2847
+ export type Update4Responses = {
1308
2848
  /**
1309
2849
  * Successful response
1310
2850
  */
@@ -1317,12 +2857,6 @@ export type Update2Responses = {
1317
2857
  * Human-readable name of the organization.
1318
2858
  */
1319
2859
  name: string;
1320
- /**
1321
- * Free-form metadata attached to the organization (shape is up to you).
1322
- */
1323
- metadata?: {
1324
- [key: string]: unknown;
1325
- };
1326
2860
  /**
1327
2861
  * ISO timestamp when the organization was created.
1328
2862
  */
@@ -1331,7 +2865,13 @@ export type Update2Responses = {
1331
2865
  * ISO timestamp of the last update.
1332
2866
  */
1333
2867
  updatedAt: string;
2868
+ /**
2869
+ * Free-form metadata attached to the organization (shape is up to you).
2870
+ */
2871
+ metadata?: {
2872
+ [key: string]: unknown;
2873
+ };
1334
2874
  };
1335
2875
  };
1336
- export type Update2Response = Update2Responses[keyof Update2Responses];
2876
+ export type Update4Response = Update4Responses[keyof Update4Responses];
1337
2877
  //# sourceMappingURL=types.gen.d.ts.map