@celigo/api-specs 0.2.305 → 0.2.306

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1900 @@
1
+ openapi: 3.2.0
2
+ info:
3
+ version: 1.0.0
4
+ title: Knowledge bases
5
+ description: API for managing knowledge bases, the indexed PDF collections AI agents and guardrails retrieve from.
6
+ servers:
7
+ - url: https://api.integrator.io
8
+ description: Production (US / default region)
9
+ - url: https://api.eu.integrator.io
10
+ description: Production (EU region)
11
+ - url: https://api.au.integrator.io
12
+ description: Production (AU region)
13
+ - url: https://api.ca.integrator.io
14
+ description: Production (CA region)
15
+ security:
16
+ - bearerAuth: []
17
+ tags:
18
+ - name: Knowledge bases
19
+ description: |-
20
+ A knowledge base is a named set of PDF files, indexed for retrieval by the AI agents and guardrails
21
+ that list it in `attachedKnowledgeBaseIds`. Files are uploaded to Storage first, then linked here;
22
+ linking and removing are asynchronous and return the queued run. A knowledge base is registered on
23
+ integrations, on create through `__integrationIds` and afterwards through
24
+ `PUT /v1/integrations/{_id}/knowledgebases/register`, and lists them in `__integrationIds`.
25
+
26
+ ## Knowledge base schema
27
+
28
+ {% openapi-schemas spec="knowledgebase" schemas="KnowledgeBase" grouped="true" %}
29
+ paths:
30
+ /v1/knowledgebases:
31
+ get:
32
+ x-internal: false
33
+ summary: List knowledge bases
34
+ description: |-
35
+ Returns the account's knowledge bases, sorted by name unless `sort_by` says otherwise. An empty
36
+ result is `200` with `[]`.
37
+ operationId: listKnowledgeBases
38
+ tags:
39
+ - Knowledge bases
40
+ parameters:
41
+ - name: limit
42
+ in: query
43
+ required: false
44
+ description: Maximum number of knowledge bases per page. Out of range answers 422 `invalid_query_param`.
45
+ schema:
46
+ type: integer
47
+ minimum: 1
48
+ maximum: 1000
49
+ examples:
50
+ - 100
51
+ - name: sort_by
52
+ in: query
53
+ required: false
54
+ description: Sort order. Any other value answers 422 `invalid_query_param`.
55
+ schema:
56
+ type: string
57
+ enum:
58
+ - name
59
+ - lastModified
60
+ default: name
61
+ x-enumDescriptions:
62
+ name: By name, ascending.
63
+ lastModified: Most recently changed first.
64
+ - name: after
65
+ in: query
66
+ required: false
67
+ description: |-
68
+ Opaque cursor from the `rel="next"` link of a previous page. Sending both `after` and `before`
69
+ answers 422 `invalid_query_param`.
70
+ schema:
71
+ type: string
72
+ - name: before
73
+ in: query
74
+ required: false
75
+ description: Opaque cursor from the `rel="prev"` link of a previous page.
76
+ schema:
77
+ type: string
78
+ - name: _integrationId
79
+ in: query
80
+ required: false
81
+ description: |-
82
+ Return only knowledge bases registered on this integration. It picks the rows only: each row's
83
+ `__integrationIds` still lists every registration. An id no integration has returns `[]`.
84
+ schema:
85
+ type: string
86
+ format: objectId
87
+ x-celigo-refModel: integrations
88
+ - name: ids
89
+ in: query
90
+ required: false
91
+ description: |-
92
+ Comma-separated knowledge base ids to return, at most 50. Ids that match no knowledge base
93
+ are left out rather than reported.
94
+ schema:
95
+ type: string
96
+ examples:
97
+ - 6720c3d4e5f6a7b8c9d0e1f2,6720c3d4e5f6a7b8c9d0e1f3
98
+ responses:
99
+ '200':
100
+ description: Array of knowledge bases.
101
+ headers:
102
+ Link:
103
+ description: RFC 8288 pagination links with `rel="next"` and `rel="prev"` when those pages exist.
104
+ schema:
105
+ type: string
106
+ content:
107
+ application/json:
108
+ schema:
109
+ type: array
110
+ items:
111
+ $ref: '#/components/schemas/KnowledgeBase'
112
+ examples:
113
+ default:
114
+ value:
115
+ - _id: 6720c3d4e5f6a7b8c9d0e1f3
116
+ name: Product glossary
117
+ contentExpiration: never
118
+ createdAt: '2026-10-21T08:00:00.000Z'
119
+ lastModified: '2026-10-21T08:00:00.003Z'
120
+ __integrationIds: []
121
+ - _id: 6720c3d4e5f6a7b8c9d0e1f2
122
+ name: Returns policy
123
+ contentExpiration: warn
124
+ description: Customer-facing returns and refunds policy, current edition.
125
+ contentAge:
126
+ value: 90
127
+ unit: days
128
+ createdAt: '2026-10-20T09:15:00.000Z'
129
+ lastModified: '2026-10-22T14:02:11.000Z'
130
+ __integrationIds:
131
+ - 65a1b2c3d4e5f6a7b8c9d0e1
132
+ - 65a1b2c3d4e5f6a7b8c9d0e2
133
+ '400':
134
+ description: '`_integrationId` is not a valid ObjectId.'
135
+ content:
136
+ application/json:
137
+ schema:
138
+ $ref: '#/components/schemas/Error'
139
+ examples:
140
+ invalid-integration-id:
141
+ value:
142
+ errors:
143
+ - code: invalid_ref
144
+ message: Please provide a valid _integrationId.
145
+ source: resource
146
+ '401':
147
+ $ref: '#/components/responses/401-unauthorized'
148
+ '403':
149
+ $ref: '#/components/responses/403-forbidden'
150
+ '422':
151
+ description: A query parameter was invalid.
152
+ content:
153
+ application/json:
154
+ schema:
155
+ $ref: '#/components/schemas/Error'
156
+ examples:
157
+ invalid-sort:
158
+ value:
159
+ errors:
160
+ - code: invalid_query_param
161
+ message: The query parameter "sort_by" has invalid value.
162
+ source: resource
163
+ both-cursors:
164
+ value:
165
+ errors:
166
+ - code: invalid_query_param
167
+ message: Please provide either before or after query param and not both.
168
+ source: resource
169
+ too-many-ids:
170
+ value:
171
+ errors:
172
+ - code: invalid_query_param
173
+ message: The query parameter "ids" accepts at most 50 knowledge base ids.
174
+ source: resource
175
+ invalid-ids:
176
+ summary: An entry in `ids` is not a valid ObjectId
177
+ value:
178
+ errors:
179
+ - code: invalid_query_param
180
+ message: The query parameter "ids" has invalid value.
181
+ source: resource
182
+ post:
183
+ x-internal: false
184
+ summary: Create a knowledge base
185
+ description: |-
186
+ Creates an empty knowledge base and registers it on the integrations in `__integrationIds`. Add
187
+ files afterwards with `POST /v1/knowledgebases/{_id}/files/link`. Fields not in the request schema
188
+ are ignored.
189
+ operationId: createKnowledgeBase
190
+ tags:
191
+ - Knowledge bases
192
+ requestBody:
193
+ required: true
194
+ content:
195
+ application/json:
196
+ schema:
197
+ $ref: '#/components/schemas/Request'
198
+ examples:
199
+ expiring:
200
+ summary: Warn when content is older than 90 days, on two integrations
201
+ value:
202
+ name: Returns policy
203
+ description: Customer-facing returns and refunds policy, current edition.
204
+ contentExpiration: warn
205
+ contentAge:
206
+ value: 90
207
+ unit: days
208
+ __integrationIds:
209
+ - 65a1b2c3d4e5f6a7b8c9d0e1
210
+ - 65a1b2c3d4e5f6a7b8c9d0e2
211
+ never-expires:
212
+ summary: Reference material that does not go stale, on no integration
213
+ value:
214
+ name: Product glossary
215
+ responses:
216
+ '201':
217
+ description: Created knowledge base.
218
+ content:
219
+ application/json:
220
+ schema:
221
+ $ref: '#/components/schemas/KnowledgeBase'
222
+ examples:
223
+ created:
224
+ value:
225
+ _id: 6720c3d4e5f6a7b8c9d0e1f2
226
+ name: Returns policy
227
+ contentExpiration: warn
228
+ description: Customer-facing returns and refunds policy, current edition.
229
+ contentAge:
230
+ value: 90
231
+ unit: days
232
+ createdAt: '2026-10-20T09:15:00.000Z'
233
+ lastModified: '2026-10-20T09:15:00.003Z'
234
+ __integrationIds:
235
+ - 65a1b2c3d4e5f6a7b8c9d0e1
236
+ - 65a1b2c3d4e5f6a7b8c9d0e2
237
+ never-expires:
238
+ value:
239
+ _id: 6720c3d4e5f6a7b8c9d0e1f3
240
+ name: Product glossary
241
+ contentExpiration: never
242
+ createdAt: '2026-10-21T08:00:00.000Z'
243
+ lastModified: '2026-10-21T08:00:00.003Z'
244
+ __integrationIds: []
245
+ '400':
246
+ description: The body is not valid JSON (`invalid_json`) or not a JSON object (`invalid_request`).
247
+ content:
248
+ application/json:
249
+ schema:
250
+ $ref: '#/components/schemas/Error'
251
+ examples:
252
+ not-an-object:
253
+ value:
254
+ errors:
255
+ - code: invalid_request
256
+ message: Knowledge base document should be a JSON object.
257
+ source: internal
258
+ invalid-json:
259
+ value:
260
+ errors:
261
+ - code: invalid_json
262
+ message: The request body is not valid JSON.
263
+ source: internal
264
+ '401':
265
+ $ref: '#/components/responses/401-unauthorized'
266
+ '403':
267
+ $ref: '#/components/responses/403-forbidden'
268
+ '415':
269
+ $ref: '#/components/responses/UnsupportedMediaType'
270
+ '422':
271
+ $ref: '#/components/responses/ValidationFailed'
272
+ /v1/knowledgebases/health:
273
+ get:
274
+ x-internal: false
275
+ summary: List knowledge base health
276
+ description: |-
277
+ Returns the health roll-up for several knowledge bases in one call. Ids that match no knowledge
278
+ base are left out of the result rather than reported; when none match the result is `[]`.
279
+ operationId: listKnowledgeBaseHealth
280
+ tags:
281
+ - Knowledge bases
282
+ parameters:
283
+ - name: ids
284
+ in: query
285
+ required: true
286
+ description: Comma-separated knowledge base ids, at most 50.
287
+ schema:
288
+ type: string
289
+ examples:
290
+ - 6720c3d4e5f6a7b8c9d0e1f2,6720c3d4e5f6a7b8c9d0e1f3
291
+ responses:
292
+ '200':
293
+ description: Health roll-ups for the knowledge bases found.
294
+ content:
295
+ application/json:
296
+ schema:
297
+ type: array
298
+ items:
299
+ $ref: '#/components/schemas/KnowledgeBaseHealth'
300
+ examples:
301
+ default:
302
+ value:
303
+ - _id: 6720c3d4e5f6a7b8c9d0e1f2
304
+ availabilityState: Current
305
+ needsAttention: false
306
+ reasons: []
307
+ filesTotal: 3
308
+ filesIndexed: 3
309
+ filesProcessing: 0
310
+ filesFailed: 0
311
+ contentExpiration: warn
312
+ contentAge:
313
+ value: 90
314
+ unit: days
315
+ contentAgeSeconds: 518400
316
+ contentAgeLimitSeconds: 7776000
317
+ lastContentChangedAt: '2026-10-20T09:59:12.260000Z'
318
+ contentExpiresAt: '2027-01-18T09:59:12.260000Z'
319
+ lastProcessingRunAt: '2026-10-20T09:58:00.430000Z'
320
+ - _id: 6720c3d4e5f6a7b8c9d0e1f4
321
+ availabilityState: Limited
322
+ needsAttention: true
323
+ reasons:
324
+ - fileFailed
325
+ filesTotal: 2
326
+ filesIndexed: 1
327
+ filesProcessing: 0
328
+ filesFailed: 1
329
+ contentExpiration: block
330
+ contentAge:
331
+ value: 1
332
+ unit: days
333
+ contentAgeSeconds: 775
334
+ contentAgeLimitSeconds: 86400
335
+ lastContentChangedAt: '2026-10-21T08:02:36.744000Z'
336
+ contentExpiresAt: '2026-10-22T08:02:36.744000Z'
337
+ lastProcessingRunAt: '2026-10-21T08:05:03.879000Z'
338
+ - _id: 6720c3d4e5f6a7b8c9d0e1f3
339
+ availabilityState: Current
340
+ needsAttention: false
341
+ reasons: []
342
+ filesTotal: 0
343
+ filesIndexed: 0
344
+ filesProcessing: 0
345
+ filesFailed: 0
346
+ contentExpiration: never
347
+ contentAge: null
348
+ contentAgeSeconds: null
349
+ contentAgeLimitSeconds: null
350
+ lastContentChangedAt: null
351
+ contentExpiresAt: null
352
+ lastProcessingRunAt: null
353
+ '401':
354
+ $ref: '#/components/responses/401-unauthorized'
355
+ '403':
356
+ $ref: '#/components/responses/403-forbidden'
357
+ '422':
358
+ description: '`ids` is missing, has more than 50 ids, or has a value that is not an ObjectId.'
359
+ content:
360
+ application/json:
361
+ schema:
362
+ $ref: '#/components/schemas/Error'
363
+ examples:
364
+ missing-ids:
365
+ value:
366
+ errors:
367
+ - code: missing_query_param
368
+ message: Required query parameter ids is missing
369
+ source: resource
370
+ too-many-ids:
371
+ value:
372
+ errors:
373
+ - code: invalid_query_param
374
+ message: The query parameter "ids" accepts at most 50 knowledge base ids.
375
+ source: resource
376
+ invalid-id:
377
+ value:
378
+ errors:
379
+ - code: invalid_query_param
380
+ message: The query parameter "ids" has invalid value.
381
+ source: resource
382
+ /v1/knowledgebases/{_id}:
383
+ parameters:
384
+ - name: _id
385
+ in: path
386
+ required: true
387
+ description: Knowledge base resource ID.
388
+ schema:
389
+ type: string
390
+ format: objectId
391
+ x-celigo-refModel: knowledgebases
392
+ get:
393
+ x-internal: false
394
+ summary: Get a knowledge base
395
+ description: Returns one knowledge base. Optional fields are omitted when not set.
396
+ operationId: getKnowledgeBase
397
+ tags:
398
+ - Knowledge bases
399
+ responses:
400
+ '200':
401
+ description: Knowledge base.
402
+ content:
403
+ application/json:
404
+ schema:
405
+ $ref: '#/components/schemas/KnowledgeBase'
406
+ examples:
407
+ expiring:
408
+ value:
409
+ _id: 6720c3d4e5f6a7b8c9d0e1f2
410
+ name: Returns policy
411
+ contentExpiration: warn
412
+ description: Customer-facing returns and refunds policy, current edition.
413
+ contentAge:
414
+ value: 90
415
+ unit: days
416
+ createdAt: '2026-10-20T09:15:00.000Z'
417
+ lastModified: '2026-10-22T14:02:11.000Z'
418
+ __integrationIds:
419
+ - 65a1b2c3d4e5f6a7b8c9d0e1
420
+ never-expires:
421
+ value:
422
+ _id: 6720c3d4e5f6a7b8c9d0e1f3
423
+ name: Product glossary
424
+ contentExpiration: never
425
+ createdAt: '2026-10-21T08:00:00.000Z'
426
+ lastModified: '2026-10-21T08:00:00.003Z'
427
+ __integrationIds: []
428
+ '400':
429
+ $ref: '#/components/responses/InvalidRef'
430
+ '401':
431
+ $ref: '#/components/responses/401-unauthorized'
432
+ '403':
433
+ $ref: '#/components/responses/403-forbidden'
434
+ '404':
435
+ $ref: '#/components/responses/NotFound'
436
+ put:
437
+ x-internal: false
438
+ summary: Replace a knowledge base
439
+ description: |-
440
+ Replaces every settable field. This is a **full replace, not a merge**: a field left out is
441
+ cleared, and `contentExpiration` returns to `never`. Registrations do not change here —
442
+ `__integrationIds` in the body is ignored. Use PATCH to change one field.
443
+ operationId: replaceKnowledgeBase
444
+ tags:
445
+ - Knowledge bases
446
+ requestBody:
447
+ required: true
448
+ content:
449
+ application/json:
450
+ schema:
451
+ $ref: '#/components/schemas/Request'
452
+ examples:
453
+ block-stale:
454
+ summary: Block content older than 6 months
455
+ value:
456
+ name: Returns policy
457
+ description: Customer-facing returns and refunds policy, current edition.
458
+ contentExpiration: block
459
+ contentAge:
460
+ value: 6
461
+ unit: months
462
+ responses:
463
+ '200':
464
+ description: Updated knowledge base.
465
+ content:
466
+ application/json:
467
+ schema:
468
+ $ref: '#/components/schemas/KnowledgeBase'
469
+ examples:
470
+ updated:
471
+ value:
472
+ _id: 6720c3d4e5f6a7b8c9d0e1f2
473
+ name: Returns policy
474
+ contentExpiration: block
475
+ description: Customer-facing returns and refunds policy, current edition.
476
+ contentAge:
477
+ value: 6
478
+ unit: months
479
+ createdAt: '2026-10-20T09:15:00.000Z'
480
+ lastModified: '2026-10-26T12:30:00.000Z'
481
+ __integrationIds:
482
+ - 65a1b2c3d4e5f6a7b8c9d0e1
483
+ '400':
484
+ $ref: '#/components/responses/BadBody'
485
+ '401':
486
+ $ref: '#/components/responses/401-unauthorized'
487
+ '403':
488
+ $ref: '#/components/responses/403-forbidden'
489
+ '404':
490
+ $ref: '#/components/responses/NotFound'
491
+ '415':
492
+ $ref: '#/components/responses/UnsupportedMediaType'
493
+ '422':
494
+ $ref: '#/components/responses/ValidationFailed'
495
+ patch:
496
+ x-internal: false
497
+ summary: Update a knowledge base
498
+ description: |-
499
+ Changes only the fields in the body, sent as `application/json`. Send `null` to clear an optional
500
+ field; on `contentExpiration` it sets `never`. The merged knowledge base must still pass every create
501
+ rule, so switching `contentExpiration` to `warn` or `block` needs a `contentAge` in the same request
502
+ or already set. Registrations do not change here.
503
+ operationId: updateKnowledgeBase
504
+ tags:
505
+ - Knowledge bases
506
+ requestBody:
507
+ required: true
508
+ content:
509
+ application/json:
510
+ schema:
511
+ $ref: '#/components/schemas/PatchRequest'
512
+ examples:
513
+ rename:
514
+ summary: Rename only
515
+ value:
516
+ name: Returns and refunds policy
517
+ stop-expiring:
518
+ summary: Stop expiring content and clear the age limit
519
+ value:
520
+ contentExpiration: never
521
+ contentAge: null
522
+ responses:
523
+ '200':
524
+ description: Updated knowledge base.
525
+ content:
526
+ application/json:
527
+ schema:
528
+ $ref: '#/components/schemas/KnowledgeBase'
529
+ examples:
530
+ renamed:
531
+ value:
532
+ _id: 6720c3d4e5f6a7b8c9d0e1f2
533
+ name: Returns and refunds policy
534
+ contentExpiration: warn
535
+ description: Customer-facing returns and refunds policy, current edition.
536
+ contentAge:
537
+ value: 90
538
+ unit: days
539
+ createdAt: '2026-10-20T09:15:00.000Z'
540
+ lastModified: '2026-10-26T12:31:00.000Z'
541
+ __integrationIds:
542
+ - 65a1b2c3d4e5f6a7b8c9d0e1
543
+ '400':
544
+ $ref: '#/components/responses/BadBody'
545
+ '401':
546
+ $ref: '#/components/responses/401-unauthorized'
547
+ '403':
548
+ $ref: '#/components/responses/403-forbidden'
549
+ '404':
550
+ $ref: '#/components/responses/NotFound'
551
+ '415':
552
+ $ref: '#/components/responses/UnsupportedMediaType'
553
+ '422':
554
+ $ref: '#/components/responses/ValidationFailed'
555
+ delete:
556
+ x-internal: false
557
+ summary: Delete a knowledge base
558
+ description: |-
559
+ Deletes the knowledge base and removes it from the `_registeredKnowledgeBaseIds` of every
560
+ integration it is registered on. There is no recycle bin, so a deleted knowledge base cannot be
561
+ restored. Blocked with 409 while an AI agent import lists it in `attachedKnowledgeBaseIds`; detach
562
+ it from those first.
563
+ operationId: deleteKnowledgeBase
564
+ tags:
565
+ - Knowledge bases
566
+ responses:
567
+ '204':
568
+ description: Knowledge base deleted.
569
+ '400':
570
+ $ref: '#/components/responses/InvalidRef'
571
+ '401':
572
+ $ref: '#/components/responses/401-unauthorized'
573
+ '403':
574
+ $ref: '#/components/responses/403-forbidden'
575
+ '404':
576
+ $ref: '#/components/responses/NotFound'
577
+ '409':
578
+ description: |-
579
+ An AI agent import still lists this knowledge base. The message gives the count and names the
580
+ import.
581
+ content:
582
+ application/json:
583
+ schema:
584
+ $ref: '#/components/schemas/Error'
585
+ examples:
586
+ in-use:
587
+ value:
588
+ errors:
589
+ - code: knowledge_base_in_use
590
+ message: This knowledge base is attached to 1 AI agent(s) and cannot be deleted. Detach it from Returns agent and try again.
591
+ source: resource
592
+ /v1/knowledgebases/{_id}/health:
593
+ parameters:
594
+ - name: _id
595
+ in: path
596
+ required: true
597
+ description: Knowledge base resource ID.
598
+ schema:
599
+ type: string
600
+ format: objectId
601
+ x-celigo-refModel: knowledgebases
602
+ get:
603
+ x-internal: false
604
+ summary: Get knowledge base health
605
+ description: |-
606
+ Returns the indexing and content-age roll-up for one knowledge base. Use `needsAttention` and
607
+ `reasons` to decide whether a user must act.
608
+ operationId: getKnowledgeBaseHealth
609
+ tags:
610
+ - Knowledge bases
611
+ responses:
612
+ '200':
613
+ description: Health roll-up.
614
+ content:
615
+ application/json:
616
+ schema:
617
+ $ref: '#/components/schemas/KnowledgeBaseHealth'
618
+ examples:
619
+ healthy:
620
+ value:
621
+ _id: 6720c3d4e5f6a7b8c9d0e1f2
622
+ availabilityState: Current
623
+ needsAttention: false
624
+ reasons: []
625
+ filesTotal: 3
626
+ filesIndexed: 3
627
+ filesProcessing: 0
628
+ filesFailed: 0
629
+ contentExpiration: warn
630
+ contentAge:
631
+ value: 90
632
+ unit: days
633
+ contentAgeSeconds: 518400
634
+ contentAgeLimitSeconds: 7776000
635
+ lastContentChangedAt: '2026-10-20T09:59:12.260000Z'
636
+ contentExpiresAt: '2027-01-18T09:59:12.260000Z'
637
+ lastProcessingRunAt: '2026-10-20T09:58:00.430000Z'
638
+ failed:
639
+ summary: The only file failed to index
640
+ value:
641
+ _id: 6720c3d4e5f6a7b8c9d0e1f4
642
+ availabilityState: Error
643
+ needsAttention: true
644
+ reasons:
645
+ - fileFailed
646
+ filesTotal: 1
647
+ filesIndexed: 0
648
+ filesProcessing: 0
649
+ filesFailed: 1
650
+ contentExpiration: never
651
+ contentAge: null
652
+ contentAgeSeconds: null
653
+ contentAgeLimitSeconds: null
654
+ lastContentChangedAt: null
655
+ contentExpiresAt: null
656
+ lastProcessingRunAt: '2026-10-21T08:05:06.263000Z'
657
+ indexing:
658
+ summary: One file still being indexed, no content age set
659
+ value:
660
+ _id: 6720c3d4e5f6a7b8c9d0e1f3
661
+ availabilityState: Processing
662
+ needsAttention: false
663
+ reasons: []
664
+ filesTotal: 1
665
+ filesIndexed: 0
666
+ filesProcessing: 1
667
+ filesFailed: 0
668
+ contentExpiration: never
669
+ contentAge: null
670
+ contentAgeSeconds: null
671
+ contentAgeLimitSeconds: null
672
+ lastContentChangedAt: null
673
+ contentExpiresAt: null
674
+ lastProcessingRunAt: '2026-10-21T08:05:06.430000Z'
675
+ '400':
676
+ $ref: '#/components/responses/InvalidRef'
677
+ '401':
678
+ $ref: '#/components/responses/401-unauthorized'
679
+ '403':
680
+ $ref: '#/components/responses/403-forbidden'
681
+ '404':
682
+ $ref: '#/components/responses/NotFound'
683
+ /v1/knowledgebases/{_id}/dependencies:
684
+ parameters:
685
+ - name: _id
686
+ in: path
687
+ required: true
688
+ description: Knowledge base resource ID.
689
+ schema:
690
+ type: string
691
+ format: objectId
692
+ x-celigo-refModel: knowledgebases
693
+ get:
694
+ x-internal: false
695
+ summary: List knowledge base dependencies
696
+ description: |-
697
+ Lists the imports that use this knowledge base: those that list it in
698
+ `attachedKnowledgeBaseIds`. Returns an empty object when nothing uses the knowledge base. While
699
+ the list is not empty, `DELETE /v1/knowledgebases/{_id}` answers 409.
700
+ operationId: listKnowledgeBaseDependencies
701
+ tags:
702
+ - Knowledge bases
703
+ responses:
704
+ '200':
705
+ description: Imports that use the knowledge base, or an empty object when there are none.
706
+ content:
707
+ application/json:
708
+ schema:
709
+ $ref: '#/components/schemas/KnowledgeBaseDependencies'
710
+ examples:
711
+ used:
712
+ summary: Used by one AI agent import
713
+ value:
714
+ imports:
715
+ - id: 6720c3d4e5f6a7b8c9d0e1f3
716
+ name: Answer support questions
717
+ type: import
718
+ accessLevel: manage
719
+ unused:
720
+ summary: Not used by anything
721
+ value: {}
722
+ '400':
723
+ $ref: '#/components/responses/InvalidRef'
724
+ '401':
725
+ $ref: '#/components/responses/401-unauthorized'
726
+ '403':
727
+ $ref: '#/components/responses/403-forbidden'
728
+ '404':
729
+ $ref: '#/components/responses/NotFound'
730
+ /v1/knowledgebases/{_id}/files:
731
+ parameters:
732
+ - name: _id
733
+ in: path
734
+ required: true
735
+ description: Knowledge base resource ID.
736
+ schema:
737
+ type: string
738
+ format: objectId
739
+ x-celigo-refModel: knowledgebases
740
+ get:
741
+ x-internal: false
742
+ summary: List knowledge base files
743
+ description: |-
744
+ Returns the files linked to a knowledge base with their indexing state, most recently linked first,
745
+ one page at a time. Follow the `rel="next"` link for the next page. A knowledge base with no files
746
+ answers `200` with `[]`.
747
+ operationId: listKnowledgeBaseFiles
748
+ tags:
749
+ - Knowledge bases
750
+ parameters:
751
+ - name: limit
752
+ in: query
753
+ required: false
754
+ description: Maximum number of files per page. Out of range answers 422 `invalid_query_param`.
755
+ schema:
756
+ type: integer
757
+ minimum: 1
758
+ maximum: 200
759
+ examples:
760
+ - 50
761
+ - name: after
762
+ in: query
763
+ required: false
764
+ description: |-
765
+ Opaque cursor from the `rel="next"` link of the previous page. A value that did not come from
766
+ such a link answers 502 `downstream_error`.
767
+ schema:
768
+ type: string
769
+ responses:
770
+ '200':
771
+ description: Array of files.
772
+ headers:
773
+ Link:
774
+ description: RFC 8288 link with `rel="next"` when more files remain; absent on the last page.
775
+ schema:
776
+ type: string
777
+ content:
778
+ application/json:
779
+ schema:
780
+ type: array
781
+ items:
782
+ $ref: '#/components/schemas/KnowledgeBaseFile'
783
+ examples:
784
+ default:
785
+ value:
786
+ - _id: 6720e5f6a7b8c9d0e1f2a303
787
+ _fileId: 6720d1e2f3a4b5c6d7e8f902
788
+ filename: exchange-faq.pdf
789
+ source: manual
790
+ status: processing
791
+ errorMessage: null
792
+ chunkCount: null
793
+ indexedAt: null
794
+ sizeBytes: 98304
795
+ lastModified: '2026-10-20T10:01:00.257000Z'
796
+ _lastRunId: 6720e5f6a7b8c9d0e1f2a304
797
+ addedAt: '2026-10-20T10:01:00.205000Z'
798
+ _addedByUserId: 5f1a2b3c4d5e6f7a8b9c0d1e
799
+ - _id: 6720e5f6a7b8c9d0e1f2a305
800
+ _fileId: 6720d1e2f3a4b5c6d7e8f903
801
+ filename: damaged-export.pdf
802
+ source: manual
803
+ status: failed
804
+ errorMessage: parse_failed
805
+ chunkCount: null
806
+ indexedAt: null
807
+ sizeBytes: 2097
808
+ lastModified: '2026-10-20T10:00:30.257000Z'
809
+ _lastRunId: 6720e5f6a7b8c9d0e1f2a306
810
+ addedAt: '2026-10-20T10:00:30.205000Z'
811
+ _addedByUserId: 5f1a2b3c4d5e6f7a8b9c0d1e
812
+ - _id: 6720e5f6a7b8c9d0e1f2a301
813
+ _fileId: 6720d1e2f3a4b5c6d7e8f901
814
+ filename: returns-policy-2026.pdf
815
+ source: manual
816
+ status: indexed
817
+ errorMessage: null
818
+ chunkCount: 42
819
+ indexedAt: '2026-10-20T09:59:12.245000Z'
820
+ sizeBytes: 1843200
821
+ lastModified: '2026-10-20T09:59:12.260000Z'
822
+ _lastRunId: 6720e5f6a7b8c9d0e1f2a302
823
+ addedAt: '2026-10-20T09:58:00.302000Z'
824
+ _addedByUserId: 5f1a2b3c4d5e6f7a8b9c0d1e
825
+ '400':
826
+ $ref: '#/components/responses/InvalidRef'
827
+ '401':
828
+ $ref: '#/components/responses/401-unauthorized'
829
+ '403':
830
+ $ref: '#/components/responses/403-forbidden'
831
+ '404':
832
+ $ref: '#/components/responses/NotFound'
833
+ '422':
834
+ description: '`limit` is not an integer from 1 to 200.'
835
+ content:
836
+ application/json:
837
+ schema:
838
+ $ref: '#/components/schemas/Error'
839
+ examples:
840
+ invalid-limit:
841
+ value:
842
+ errors:
843
+ - code: invalid_query_param
844
+ message: The query parameter "limit" has invalid value.
845
+ source: resource
846
+ '502':
847
+ description: The file listing could not be read; an `after` cursor that no `rel="next"` link returned answers this.
848
+ content:
849
+ application/json:
850
+ schema:
851
+ $ref: '#/components/schemas/Error'
852
+ examples:
853
+ downstream-error:
854
+ value:
855
+ errors:
856
+ - code: downstream_error
857
+ message: A dependent service could not complete the request.
858
+ source: internal
859
+ /v1/knowledgebases/{_id}/files/link:
860
+ parameters:
861
+ - name: _id
862
+ in: path
863
+ required: true
864
+ description: Knowledge base resource ID.
865
+ schema:
866
+ type: string
867
+ format: objectId
868
+ x-celigo-refModel: knowledgebases
869
+ post:
870
+ x-internal: false
871
+ summary: Link a file to a knowledge base
872
+ description: |-
873
+ Queues a PDF that is already uploaded to Storage for indexing into the knowledge base. The call
874
+ returns as soon as the run is queued; poll `GET /v1/knowledgebases/{_id}/files` or the health
875
+ endpoint for the outcome. One Storage item can be linked to several knowledge bases, once each.
876
+ operationId: linkKnowledgeBaseFile
877
+ tags:
878
+ - Knowledge bases
879
+ requestBody:
880
+ required: true
881
+ content:
882
+ application/json:
883
+ schema:
884
+ $ref: '#/components/schemas/KnowledgeBaseFileLinkRequest'
885
+ examples:
886
+ link:
887
+ value:
888
+ _fileId: 6720d1e2f3a4b5c6d7e8f901
889
+ filename: returns-policy-2026.pdf
890
+ responses:
891
+ '202':
892
+ description: Indexing run queued.
893
+ content:
894
+ application/json:
895
+ schema:
896
+ $ref: '#/components/schemas/KnowledgeBaseFileAccepted'
897
+ examples:
898
+ queued:
899
+ value:
900
+ status: queued
901
+ _runId: 6720e5f6a7b8c9d0e1f2a302
902
+ _id: 6720e5f6a7b8c9d0e1f2a301
903
+ _fileId: 6720d1e2f3a4b5c6d7e8f901
904
+ filename: returns-policy-2026.pdf
905
+ '400':
906
+ description: |-
907
+ The body is not valid JSON (`invalid_json`) or not a JSON object (`invalid_request`), or the path
908
+ `_id` or the body's `_fileId` is not a valid ObjectId (`invalid_ref`).
909
+ content:
910
+ application/json:
911
+ schema:
912
+ $ref: '#/components/schemas/Error'
913
+ examples:
914
+ not-an-object:
915
+ value:
916
+ errors:
917
+ - code: invalid_request
918
+ message: Knowledge base document should be a JSON object.
919
+ source: internal
920
+ invalid-id:
921
+ value:
922
+ errors:
923
+ - code: invalid_ref
924
+ message: Please provide a valid _id.
925
+ source: resource
926
+ invalid-file-id:
927
+ value:
928
+ errors:
929
+ - code: invalid_ref
930
+ message: Please provide a valid _fileId.
931
+ source: resource
932
+ '401':
933
+ $ref: '#/components/responses/401-unauthorized'
934
+ '403':
935
+ $ref: '#/components/responses/403-forbidden'
936
+ '404':
937
+ description: |-
938
+ No knowledge base has this id (`knowledge_base_not_found`), or `_fileId` names no Storage item
939
+ or one whose upload has not finished (`storage_file_not_found`).
940
+ content:
941
+ application/json:
942
+ schema:
943
+ $ref: '#/components/schemas/Error'
944
+ examples:
945
+ not-found:
946
+ value:
947
+ errors:
948
+ - code: knowledge_base_not_found
949
+ message: Knowledge base not found.
950
+ source: resource
951
+ storage-file-not-found:
952
+ value:
953
+ errors:
954
+ - code: storage_file_not_found
955
+ message: File not found.
956
+ source: resource
957
+ '409':
958
+ description: The file is already linked to this knowledge base.
959
+ content:
960
+ application/json:
961
+ schema:
962
+ $ref: '#/components/schemas/Error'
963
+ examples:
964
+ already-linked:
965
+ value:
966
+ errors:
967
+ - code: FileAlreadyLinked
968
+ message: This file is already linked to the knowledge base.
969
+ source: resource
970
+ '413':
971
+ description: The file is larger than 50 MB.
972
+ content:
973
+ application/json:
974
+ schema:
975
+ $ref: '#/components/schemas/Error'
976
+ examples:
977
+ too-large:
978
+ value:
979
+ errors:
980
+ - code: UploadAssetTooLarge
981
+ message: The file is larger than the 50 MB limit.
982
+ source: resource
983
+ '415':
984
+ description: The `Content-Type` header is not `application/json`, or the file is not a PDF.
985
+ content:
986
+ application/json:
987
+ schema:
988
+ $ref: '#/components/schemas/Error'
989
+ examples:
990
+ not-a-pdf:
991
+ value:
992
+ errors:
993
+ - code: UploadAssetUnsupported
994
+ message: This file type cannot be indexed. Convert it to PDF and link again.
995
+ source: resource
996
+ wrong-content-type:
997
+ value:
998
+ errors:
999
+ - code: invalid_content_type
1000
+ message: Content-Type should equal application/json
1001
+ source: internal
1002
+ '422':
1003
+ description: '`_fileId` or `filename` is missing, or `filename` is not a string of at most 256 characters.'
1004
+ content:
1005
+ application/json:
1006
+ schema:
1007
+ $ref: '#/components/schemas/Error'
1008
+ examples:
1009
+ missing-file-id:
1010
+ value:
1011
+ errors:
1012
+ - code: missing_required_field
1013
+ message: 'Expected field: _fileId to be present.'
1014
+ source: resource
1015
+ missing-filename:
1016
+ value:
1017
+ errors:
1018
+ - code: missing_required_field
1019
+ message: 'Expected field: filename to be present.'
1020
+ source: resource
1021
+ filename-too-long:
1022
+ value:
1023
+ errors:
1024
+ - code: invalid_field
1025
+ message: filename must be a string of at most 256 characters.
1026
+ source: resource
1027
+ /v1/knowledgebases/{_id}/files/{_kbFileId}:
1028
+ parameters:
1029
+ - name: _id
1030
+ in: path
1031
+ required: true
1032
+ description: Knowledge base resource ID.
1033
+ schema:
1034
+ type: string
1035
+ format: objectId
1036
+ x-celigo-refModel: knowledgebases
1037
+ - name: _kbFileId
1038
+ in: path
1039
+ required: true
1040
+ description: Knowledge base file id, the `_id` of an entry from `GET /v1/knowledgebases/{_id}/files`.
1041
+ schema:
1042
+ type: string
1043
+ format: objectId
1044
+ examples:
1045
+ - 6720e5f6a7b8c9d0e1f2a301
1046
+ delete:
1047
+ x-internal: false
1048
+ summary: Remove a file from a knowledge base
1049
+ description: |-
1050
+ Queues removal of the file and its indexed content from the knowledge base. The Storage item is not
1051
+ deleted. The file leaves the file list once the removal run finishes; until then it reads
1052
+ `processing`, and a second remove answers 404 `knowledge_base_file_not_found`.
1053
+ operationId: removeKnowledgeBaseFile
1054
+ tags:
1055
+ - Knowledge bases
1056
+ responses:
1057
+ '202':
1058
+ description: Removal run queued.
1059
+ content:
1060
+ application/json:
1061
+ schema:
1062
+ $ref: '#/components/schemas/KnowledgeBaseFileAccepted'
1063
+ examples:
1064
+ queued:
1065
+ value:
1066
+ status: queued
1067
+ _runId: 6720e5f6a7b8c9d0e1f2a305
1068
+ _id: 6720e5f6a7b8c9d0e1f2a301
1069
+ '400':
1070
+ description: The path `_id` or `_kbFileId` is not a valid ObjectId.
1071
+ content:
1072
+ application/json:
1073
+ schema:
1074
+ $ref: '#/components/schemas/Error'
1075
+ examples:
1076
+ invalid-id:
1077
+ value:
1078
+ errors:
1079
+ - code: invalid_ref
1080
+ message: Please provide a valid _id.
1081
+ source: resource
1082
+ invalid-file-id:
1083
+ value:
1084
+ errors:
1085
+ - code: invalid_ref
1086
+ message: Please provide a valid _kbFileId.
1087
+ source: resource
1088
+ '401':
1089
+ $ref: '#/components/responses/401-unauthorized'
1090
+ '403':
1091
+ $ref: '#/components/responses/403-forbidden'
1092
+ '404':
1093
+ description: |-
1094
+ No knowledge base has this id (`knowledge_base_not_found`), or the knowledge base has no file
1095
+ with this `_kbFileId` (`knowledge_base_file_not_found`).
1096
+ content:
1097
+ application/json:
1098
+ schema:
1099
+ $ref: '#/components/schemas/Error'
1100
+ examples:
1101
+ file-not-found:
1102
+ value:
1103
+ errors:
1104
+ - code: knowledge_base_file_not_found
1105
+ message: Knowledge base file not found.
1106
+ source: resource
1107
+ not-found:
1108
+ value:
1109
+ errors:
1110
+ - code: knowledge_base_not_found
1111
+ message: Knowledge base not found.
1112
+ source: resource
1113
+ components:
1114
+ securitySchemes:
1115
+ bearerAuth:
1116
+ type: http
1117
+ scheme: bearer
1118
+ schemas:
1119
+ ContentAge:
1120
+ type: object
1121
+ required:
1122
+ - value
1123
+ - unit
1124
+ description: |-
1125
+ How old the indexed content may get before `contentExpiration` applies, counted from the latest
1126
+ indexed content change.
1127
+ properties:
1128
+ value:
1129
+ type: integer
1130
+ minimum: 1
1131
+ maximum: 10000
1132
+ description: Number of `unit`s; a non-integer is rejected with 422 `invalid_field`.
1133
+ examples:
1134
+ - 90
1135
+ unit:
1136
+ type: string
1137
+ enum:
1138
+ - days
1139
+ - weeks
1140
+ - months
1141
+ x-enumDescriptions:
1142
+ days: Counts `value` in days.
1143
+ weeks: Counts `value` in weeks.
1144
+ months: Counts `value` in months of 30 days.
1145
+ description: Unit `value` is counted in.
1146
+ examples:
1147
+ - days
1148
+ KnowledgeBase:
1149
+ type: object
1150
+ required:
1151
+ - _id
1152
+ - name
1153
+ - contentExpiration
1154
+ - __integrationIds
1155
+ - createdAt
1156
+ - lastModified
1157
+ properties:
1158
+ _id:
1159
+ type: string
1160
+ format: objectId
1161
+ readOnly: true
1162
+ description: Knowledge base id. List it in an AI agent's or guardrail's `attachedKnowledgeBaseIds`.
1163
+ examples:
1164
+ - 6720c3d4e5f6a7b8c9d0e1f2
1165
+ name:
1166
+ type: string
1167
+ maxLength: 100
1168
+ description: Display name, unique in the account regardless of case.
1169
+ examples:
1170
+ - Returns policy
1171
+ description:
1172
+ type: string
1173
+ maxLength: 2000
1174
+ description: Free-text summary of what the files cover. Present when set.
1175
+ contentExpiration:
1176
+ type: string
1177
+ enum:
1178
+ - warn
1179
+ - block
1180
+ - never
1181
+ x-enumDescriptions:
1182
+ warn: Content older than `contentAge` is flagged as expired.
1183
+ block: Content older than `contentAge` is blocked.
1184
+ never: Content never expires.
1185
+ description: What happens to content older than `contentAge`.
1186
+ contentAge:
1187
+ description: Maximum content age before `contentExpiration` applies. Present when set.
1188
+ allOf:
1189
+ - $ref: '#/components/schemas/ContentAge'
1190
+ __integrationIds:
1191
+ type: array
1192
+ readOnly: true
1193
+ items:
1194
+ type: string
1195
+ format: objectId
1196
+ x-celigo-refModel: integrations
1197
+ description: |-
1198
+ Integrations whose `_registeredKnowledgeBaseIds` hold the knowledge base; `[]` when it is on
1199
+ none. Set on create, then changed through the integration's register routes
1200
+ (`/v1/integrations/{_id}/knowledgebases/{_knowledgeBaseId}/register`, PUT to add and DELETE to
1201
+ remove), by a flow save that registers it, and by deleting the integration. PUT and PATCH here
1202
+ ignore it, and a registration change leaves `lastModified` as is.
1203
+ examples:
1204
+ - - 65a1b2c3d4e5f6a7b8c9d0e1
1205
+ createdAt:
1206
+ type: string
1207
+ format: date-time
1208
+ readOnly: true
1209
+ description: Timestamp when the knowledge base was created.
1210
+ lastModified:
1211
+ type: string
1212
+ format: date-time
1213
+ readOnly: true
1214
+ description: Timestamp of the last change to a field. A PUT or PATCH that changes nothing leaves it as is.
1215
+ Error:
1216
+ type: object
1217
+ description: Standard error response envelope returned by integrator.io APIs.
1218
+ properties:
1219
+ errors:
1220
+ type: array
1221
+ description: List of errors that occurred while processing the request.
1222
+ items:
1223
+ type: object
1224
+ properties:
1225
+ code:
1226
+ oneOf:
1227
+ - type: string
1228
+ - type: integer
1229
+ description: |-
1230
+ Machine-readable error code. Usually a string like
1231
+ `invalid_ref`, `missing_required_field`, or `unauthorized`;
1232
+ may be an **integer** when the error mirrors an upstream HTTP
1233
+ status (e.g. `500`) — most commonly returned by connection-ping
1234
+ and adaptor-proxy responses.
1235
+ message:
1236
+ type: string
1237
+ description: Human-readable description of the error.
1238
+ field:
1239
+ type: string
1240
+ description: |-
1241
+ Optional pointer to the document field that caused the error.
1242
+ Used by structural validation errors (`missing_required_field`,
1243
+ `invalid_ref`) to indicate which field is at fault
1244
+ (e.g. `_id`, `type`, `http.baseURI`).
1245
+ source:
1246
+ type: string
1247
+ description: |-
1248
+ Optional origin layer for the error — e.g. `application` when
1249
+ the error came from the remote system the adaptor called,
1250
+ `connector` when the adaptor itself rejected the request.
1251
+ required:
1252
+ - message
1253
+ required:
1254
+ - errors
1255
+ Request:
1256
+ type: object
1257
+ required:
1258
+ - name
1259
+ description: |-
1260
+ Settable knowledge base fields. Any other body field is ignored. On PUT a field left out is
1261
+ cleared and `contentExpiration` returns to `never`; `__integrationIds` is read on create only.
1262
+ properties:
1263
+ name:
1264
+ type: string
1265
+ minLength: 1
1266
+ maxLength: 100
1267
+ description: |-
1268
+ Display name. Unique in the account after trimming, case folding, and Unicode (NFC)
1269
+ normalization; a clash answers 422 `name_already_taken`. A non-string answers 422 `invalid_field`.
1270
+ examples:
1271
+ - Returns policy
1272
+ description:
1273
+ type: string
1274
+ maxLength: 2000
1275
+ description: Free-text summary of what the files cover.
1276
+ examples:
1277
+ - Customer-facing returns and refunds policy, current edition.
1278
+ contentExpiration:
1279
+ type:
1280
+ - string
1281
+ - 'null'
1282
+ enum:
1283
+ - warn
1284
+ - block
1285
+ - never
1286
+ - null
1287
+ default: never
1288
+ x-enumDescriptions:
1289
+ warn: Content older than `contentAge` is flagged as expired.
1290
+ block: Content older than `contentAge` is blocked.
1291
+ never: Content never expires; `contentAge` is not required.
1292
+ description: |-
1293
+ What happens to content older than `contentAge`. Leave it out (or send `null`) for reference
1294
+ material that does not go stale; `warn` and `block` need `contentAge` too.
1295
+ contentAge:
1296
+ description: |-
1297
+ Required when `contentExpiration` is `warn` or `block`; missing, it answers 422
1298
+ `missing_required_field`.
1299
+ allOf:
1300
+ - $ref: '#/components/schemas/ContentAge'
1301
+ __integrationIds:
1302
+ type: array
1303
+ maxItems: 50
1304
+ items:
1305
+ type: string
1306
+ format: objectId
1307
+ x-celigo-refModel: integrations
1308
+ description: |-
1309
+ Integrations to register the new knowledge base on; each one gets it in its
1310
+ `_registeredKnowledgeBaseIds`. Read on create only and never stored on the knowledge base — the
1311
+ response lists the registrations in `__integrationIds`, and PUT ignores the field.
1312
+ x-celigo-ai-guidance:
1313
+ - |-
1314
+ An unknown integration id fails the whole create with 422 `knowledge_base_invalid_integration`
1315
+ ("<id> is not an existing integration of this account."); a non-array value, a malformed id or
1316
+ more than 50 ids fails with 422 `invalid_field` ("__integrationIds must be an array of at most
1317
+ 50 integration ids."). Nothing is created.
1318
+ - |-
1319
+ Duplicate and upper-case ids collapse to one registration. Send `[]` (or leave it out) to
1320
+ create a knowledge base on no integration, then register it with
1321
+ `PUT /v1/integrations/{_id}/knowledgebases/{_knowledgeBaseId}/register`.
1322
+ examples:
1323
+ - - 65a1b2c3d4e5f6a7b8c9d0e1
1324
+ if:
1325
+ properties:
1326
+ contentExpiration:
1327
+ enum:
1328
+ - warn
1329
+ - block
1330
+ required:
1331
+ - contentExpiration
1332
+ then:
1333
+ required:
1334
+ - contentAge
1335
+ KnowledgeBaseHealth:
1336
+ type: object
1337
+ required:
1338
+ - _id
1339
+ - availabilityState
1340
+ - needsAttention
1341
+ - reasons
1342
+ - filesTotal
1343
+ - filesIndexed
1344
+ - filesProcessing
1345
+ - filesFailed
1346
+ - contentExpiration
1347
+ - contentAge
1348
+ - contentAgeSeconds
1349
+ - contentAgeLimitSeconds
1350
+ - lastContentChangedAt
1351
+ - contentExpiresAt
1352
+ - lastProcessingRunAt
1353
+ properties:
1354
+ _id:
1355
+ type: string
1356
+ format: objectId
1357
+ description: Knowledge base the roll-up describes.
1358
+ availabilityState:
1359
+ type: string
1360
+ enum:
1361
+ - Processing
1362
+ - Current
1363
+ - Limited
1364
+ - Error
1365
+ x-enumDescriptions:
1366
+ Processing: A file is being indexed.
1367
+ Current: No file is being indexed and nothing needs attention; also the state of a knowledge base with no files.
1368
+ Limited: At least one file is indexed and at least one failed to index; check `reasons`.
1369
+ Error: A file failed to index and none is indexed; check `reasons`.
1370
+ description: |-
1371
+ Overall availability of the indexed content. Use `needsAttention` and `reasons` to decide
1372
+ whether a user must act.
1373
+ needsAttention:
1374
+ type: boolean
1375
+ description: When true, at least one entry in `reasons` applies and a user should act.
1376
+ reasons:
1377
+ type: array
1378
+ description: Why the knowledge base needs attention. Empty when `needsAttention` is false.
1379
+ items:
1380
+ type: string
1381
+ enum:
1382
+ - fileFailed
1383
+ - contentExpired
1384
+ - contentBlocked
1385
+ x-enumDescriptions:
1386
+ fileFailed: At least one file failed to index.
1387
+ contentExpired: Content is older than `contentAge` and `contentExpiration` is `warn`.
1388
+ contentBlocked: Content is older than `contentAge` and `contentExpiration` is `block`.
1389
+ filesTotal:
1390
+ type: integer
1391
+ description: Files linked to the knowledge base.
1392
+ filesIndexed:
1393
+ type: integer
1394
+ description: Files with status `indexed`.
1395
+ filesProcessing:
1396
+ type: integer
1397
+ description: Files still being indexed.
1398
+ filesFailed:
1399
+ type: integer
1400
+ description: Files with status `failed`.
1401
+ contentExpiration:
1402
+ type: string
1403
+ enum:
1404
+ - warn
1405
+ - block
1406
+ - never
1407
+ x-enumDescriptions:
1408
+ warn: Content older than `contentAge` is flagged as expired.
1409
+ block: Content older than `contentAge` is blocked.
1410
+ never: Content never expires.
1411
+ description: The knowledge base's `contentExpiration`.
1412
+ contentAge:
1413
+ description: The knowledge base's `contentAge`. Null when none is set.
1414
+ oneOf:
1415
+ - $ref: '#/components/schemas/ContentAge'
1416
+ - type: 'null'
1417
+ contentAgeSeconds:
1418
+ type:
1419
+ - integer
1420
+ - 'null'
1421
+ description: Age of the content in seconds, measured from `lastContentChangedAt`. Null until a file has indexed.
1422
+ contentAgeLimitSeconds:
1423
+ type:
1424
+ - integer
1425
+ - 'null'
1426
+ description: '`contentAge` converted to seconds, also while `contentExpiration` is `never`. Null when no `contentAge` is set.'
1427
+ lastContentChangedAt:
1428
+ type:
1429
+ - string
1430
+ - 'null'
1431
+ format: date-time
1432
+ description: Timestamp of the latest indexed content change across the files. Null until a file has indexed.
1433
+ contentExpiresAt:
1434
+ type:
1435
+ - string
1436
+ - 'null'
1437
+ format: date-time
1438
+ description: |-
1439
+ Timestamp when the content passes its `contentAge` (`lastContentChangedAt` plus `contentAge`).
1440
+ Null when `contentExpiration` is `never` or until a file has indexed.
1441
+ lastProcessingRunAt:
1442
+ type:
1443
+ - string
1444
+ - 'null'
1445
+ format: date-time
1446
+ description: Timestamp of the latest indexing or removal run. Null before the first run.
1447
+ PatchRequest:
1448
+ type: object
1449
+ description: |-
1450
+ Partial update. Only fields present in the body change, and `null` clears an optional field. The
1451
+ merged record must still pass every create rule. Registrations do not change here:
1452
+ `__integrationIds` is ignored.
1453
+ properties:
1454
+ name:
1455
+ type: string
1456
+ minLength: 1
1457
+ maxLength: 100
1458
+ description: |-
1459
+ Display name. Unique in the account after trimming, case folding, and Unicode (NFC)
1460
+ normalization; a clash answers 422 `name_already_taken`. `null` answers 422
1461
+ `missing_required_field`.
1462
+ examples:
1463
+ - Returns and refunds policy
1464
+ description:
1465
+ type:
1466
+ - string
1467
+ - 'null'
1468
+ maxLength: 2000
1469
+ description: Free-text summary of what the files cover. Send `null` to clear it.
1470
+ contentExpiration:
1471
+ type:
1472
+ - string
1473
+ - 'null'
1474
+ enum:
1475
+ - warn
1476
+ - block
1477
+ - never
1478
+ - null
1479
+ x-enumDescriptions:
1480
+ warn: Content older than `contentAge` is flagged as expired.
1481
+ block: Content older than `contentAge` is blocked.
1482
+ never: Content never expires; `contentAge` is not required.
1483
+ description: |-
1484
+ What happens to content older than `contentAge`. Sending `null` sets it to `never` and keeps
1485
+ any stored `contentAge`.
1486
+ contentAge:
1487
+ description: Replaces the whole `contentAge` object. Send `null` to clear it.
1488
+ oneOf:
1489
+ - $ref: '#/components/schemas/ContentAge'
1490
+ - type: 'null'
1491
+ KnowledgeBaseDependency:
1492
+ type: object
1493
+ description: One import that uses the knowledge base.
1494
+ required:
1495
+ - id
1496
+ - name
1497
+ - type
1498
+ - accessLevel
1499
+ properties:
1500
+ id:
1501
+ type: string
1502
+ format: objectId
1503
+ x-celigo-refModel: imports
1504
+ description: Import id.
1505
+ examples:
1506
+ - 6720c3d4e5f6a7b8c9d0e1f3
1507
+ name:
1508
+ type: string
1509
+ description: Import name.
1510
+ examples:
1511
+ - Answer support questions
1512
+ type:
1513
+ type: string
1514
+ enum:
1515
+ - import
1516
+ description: Resource type of the row.
1517
+ x-enumDescriptions:
1518
+ import: The row is an import.
1519
+ examples:
1520
+ - import
1521
+ accessLevel:
1522
+ type: string
1523
+ enum:
1524
+ - administrator
1525
+ - manage
1526
+ - monitor
1527
+ - none
1528
+ description: The caller's access to the import. The account owner gets `manage`.
1529
+ x-enumDescriptions:
1530
+ administrator: The caller has administrator access.
1531
+ manage: The caller can edit the import.
1532
+ monitor: The caller can view the import but not edit it.
1533
+ none: The caller cannot open the import.
1534
+ examples:
1535
+ - manage
1536
+ KnowledgeBaseDependencies:
1537
+ type: object
1538
+ description: Resources that use a knowledge base. Empty when nothing uses it.
1539
+ properties:
1540
+ imports:
1541
+ type: array
1542
+ description: Imports that list the knowledge base in `attachedKnowledgeBaseIds`. Present only when at least one import uses the knowledge base.
1543
+ items:
1544
+ $ref: '#/components/schemas/KnowledgeBaseDependency'
1545
+ KnowledgeBaseFile:
1546
+ type: object
1547
+ required:
1548
+ - _id
1549
+ - _fileId
1550
+ - filename
1551
+ - source
1552
+ - status
1553
+ - errorMessage
1554
+ - chunkCount
1555
+ - indexedAt
1556
+ - sizeBytes
1557
+ - lastModified
1558
+ - _lastRunId
1559
+ - addedAt
1560
+ - _addedByUserId
1561
+ properties:
1562
+ _id:
1563
+ type: string
1564
+ format: objectId
1565
+ readOnly: true
1566
+ description: Knowledge base file id. Use as `{_kbFileId}` to remove the file.
1567
+ _fileId:
1568
+ type: string
1569
+ format: objectId
1570
+ x-celigo-refModel: storageitems
1571
+ description: Storage item the file was linked from.
1572
+ filename:
1573
+ type: string
1574
+ description: File name given when the file was linked.
1575
+ source:
1576
+ type: string
1577
+ enum:
1578
+ - manual
1579
+ - folder
1580
+ x-enumDescriptions:
1581
+ manual: Linked one file at a time through `POST /v1/knowledgebases/{_id}/files/link`.
1582
+ folder: Added from a linked Storage folder.
1583
+ description: How the file was added.
1584
+ status:
1585
+ type: string
1586
+ enum:
1587
+ - queued
1588
+ - processing
1589
+ - indexed
1590
+ - failed
1591
+ x-enumDescriptions:
1592
+ queued: Waiting for an indexing run.
1593
+ processing: Being indexed.
1594
+ indexed: Indexed and available to retrieval.
1595
+ failed: The last indexing run failed; see `errorMessage`.
1596
+ description: |-
1597
+ Indexing state. A newly linked file reads `processing` until its run ends, then `indexed`
1598
+ once its content is available, or `failed` with the reason in `errorMessage`.
1599
+ errorMessage:
1600
+ type:
1601
+ - string
1602
+ - 'null'
1603
+ description: |-
1604
+ Short code for why the last indexing run failed, such as `parse_failed` for a PDF that
1605
+ cannot be parsed. Null on a file that is processing or indexed.
1606
+ examples:
1607
+ - parse_failed
1608
+ chunkCount:
1609
+ type:
1610
+ - integer
1611
+ - 'null'
1612
+ description: Number of retrieval chunks the file was split into. Null until the file is indexed.
1613
+ indexedAt:
1614
+ type:
1615
+ - string
1616
+ - 'null'
1617
+ format: date-time
1618
+ description: Timestamp when the file was last indexed. Null until the file is indexed.
1619
+ sizeBytes:
1620
+ type:
1621
+ - integer
1622
+ - 'null'
1623
+ description: File size in bytes.
1624
+ lastModified:
1625
+ type:
1626
+ - string
1627
+ - 'null'
1628
+ format: date-time
1629
+ description: Timestamp when the file record last changed.
1630
+ _lastRunId:
1631
+ type:
1632
+ - string
1633
+ - 'null'
1634
+ format: objectId
1635
+ description: Last indexing run for this file; after a link, the `_runId` the link returned.
1636
+ addedAt:
1637
+ type:
1638
+ - string
1639
+ - 'null'
1640
+ format: date-time
1641
+ description: Timestamp when the file was linked.
1642
+ _addedByUserId:
1643
+ type:
1644
+ - string
1645
+ - 'null'
1646
+ format: objectId
1647
+ x-celigo-refModel: users
1648
+ description: User who linked the file.
1649
+ KnowledgeBaseFileLinkRequest:
1650
+ type: object
1651
+ required:
1652
+ - _fileId
1653
+ - filename
1654
+ properties:
1655
+ _fileId:
1656
+ type: string
1657
+ format: objectId
1658
+ x-celigo-refModel: storageitems
1659
+ description: |-
1660
+ Storage item to index: a PDF of at most 50 MB whose upload is complete. A value that is not
1661
+ an ObjectId answers 400 `invalid_ref`; an id no Storage item has, or one whose upload has not
1662
+ finished, answers 404 `storage_file_not_found`.
1663
+ examples:
1664
+ - 6720d1e2f3a4b5c6d7e8f901
1665
+ filename:
1666
+ type: string
1667
+ minLength: 1
1668
+ maxLength: 256
1669
+ description: Name to show for the file. Trimmed; empty after trimming answers 422 `missing_required_field`.
1670
+ examples:
1671
+ - returns-policy-2026.pdf
1672
+ KnowledgeBaseFileAccepted:
1673
+ type: object
1674
+ required:
1675
+ - status
1676
+ - _runId
1677
+ - _id
1678
+ properties:
1679
+ _id:
1680
+ type: string
1681
+ format: objectId
1682
+ description: Knowledge base file id.
1683
+ _fileId:
1684
+ type: string
1685
+ format: objectId
1686
+ x-celigo-refModel: storageitems
1687
+ description: Storage item from the link request. Present on link only.
1688
+ filename:
1689
+ type: string
1690
+ description: File name from the link request, trimmed. Present on link only.
1691
+ status:
1692
+ type: string
1693
+ enum:
1694
+ - queued
1695
+ - processing
1696
+ - completed
1697
+ - failed
1698
+ x-enumDescriptions:
1699
+ queued: The run is waiting to start.
1700
+ processing: The run has started.
1701
+ completed: The run finished.
1702
+ failed: The run failed.
1703
+ description: State of the run when the request was accepted.
1704
+ _runId:
1705
+ type: string
1706
+ format: objectId
1707
+ description: Run that performs the change.
1708
+ responses:
1709
+ 401-unauthorized:
1710
+ description: |-
1711
+ Unauthorized, in one of two shapes.
1712
+
1713
+ No valid bearer token: the auth middleware answers before the endpoint
1714
+ handler runs, with a bare `{message: string}` body — no `code`, no
1715
+ `errors` array — so key off the HTTP status and `message`.
1716
+
1717
+ An API token with a custom scope calling an operation its scope does not
1718
+ grant: the token authenticated, and the body is the standard
1719
+ `{errors: [...]}` envelope with code `access_restricted`. Observed on
1720
+ `GET /v1/connections` and `GET /v1/exports/{_id}`: a full-access API token
1721
+ passed both, a personal access token `GET /v1/exports/{_id}`.
1722
+ content:
1723
+ application/json:
1724
+ schema:
1725
+ oneOf:
1726
+ - type: object
1727
+ description: The auth middleware's bare body for a missing or invalid token.
1728
+ properties:
1729
+ message:
1730
+ type: string
1731
+ description: |-
1732
+ Human-readable description of the auth failure. Known values:
1733
+ - `"Unauthorized"` — no `Authorization` header on the request.
1734
+ - `"Bearer Authentication Failed"` — header present but token
1735
+ is invalid, revoked, or expired.
1736
+ required:
1737
+ - message
1738
+ - $ref: '#/components/schemas/Error'
1739
+ examples:
1740
+ missing_token:
1741
+ summary: No Authorization header sent
1742
+ value:
1743
+ message: Unauthorized
1744
+ invalid_token:
1745
+ summary: Bearer token invalid or revoked
1746
+ value:
1747
+ message: Bearer Authentication Failed
1748
+ scoped_token:
1749
+ summary: An API token with a custom scope reading a resource
1750
+ value:
1751
+ errors:
1752
+ - code: access_restricted
1753
+ message: You don't have the required permissions to perform the action.
1754
+ 403-forbidden:
1755
+ description: |
1756
+ Forbidden. The authenticated caller does not have permission to perform this operation.
1757
+ content:
1758
+ application/json:
1759
+ schema:
1760
+ $ref: '#/components/schemas/Error'
1761
+ examples:
1762
+ default:
1763
+ value:
1764
+ errors:
1765
+ - code: forbidden
1766
+ message: You do not have permission to access this resource.
1767
+ UnsupportedMediaType:
1768
+ description: The `Content-Type` header is not `application/json`.
1769
+ content:
1770
+ application/json:
1771
+ schema:
1772
+ $ref: '#/components/schemas/Error'
1773
+ examples:
1774
+ wrong-content-type:
1775
+ value:
1776
+ errors:
1777
+ - code: invalid_content_type
1778
+ message: Content-Type should equal application/json
1779
+ source: internal
1780
+ ValidationFailed:
1781
+ description: |-
1782
+ The knowledge base failed validation. One entry per failing field, named in `field`; an
1783
+ `invalid_field` message names the field and its limit. The `__integrationIds` errors come from
1784
+ create only.
1785
+ content:
1786
+ application/json:
1787
+ schema:
1788
+ $ref: '#/components/schemas/Error'
1789
+ examples:
1790
+ missing-name:
1791
+ value:
1792
+ errors:
1793
+ - field: name
1794
+ code: missing_required_field
1795
+ message: 'Expected field: name to be present.'
1796
+ source: resource
1797
+ name-taken:
1798
+ value:
1799
+ errors:
1800
+ - field: name
1801
+ code: name_already_taken
1802
+ message: A knowledge base named 'Returns policy' already exists in this account. Knowledge base names are case insensitive.
1803
+ source: resource
1804
+ name-too-long:
1805
+ value:
1806
+ errors:
1807
+ - field: name
1808
+ code: invalid_field
1809
+ message: name must be a string of at most 100 characters.
1810
+ source: resource
1811
+ content-age-required:
1812
+ value:
1813
+ errors:
1814
+ - field: contentAge
1815
+ code: missing_required_field
1816
+ message: contentAge is required when contentExpiration is 'warn'. Provide contentAge.value and contentAge.unit, or set contentExpiration to 'never'.
1817
+ source: resource
1818
+ content-age-value:
1819
+ value:
1820
+ errors:
1821
+ - field: contentAge.value
1822
+ code: invalid_field
1823
+ message: contentAge.value must be a whole number between 1 and 10000.
1824
+ source: resource
1825
+ content-age-unit:
1826
+ value:
1827
+ errors:
1828
+ - field: contentAge.unit
1829
+ code: invalid_field
1830
+ message: 'contentAge.unit must be one of: days, weeks, months.'
1831
+ source: resource
1832
+ invalid-integration:
1833
+ value:
1834
+ errors:
1835
+ - field: __integrationIds
1836
+ code: knowledge_base_invalid_integration
1837
+ message: 65a1b2c3d4e5f6a7b8c9d0e1 is not an existing integration of this account.
1838
+ source: resource
1839
+ invalid-integration-ids:
1840
+ value:
1841
+ errors:
1842
+ - field: __integrationIds
1843
+ code: invalid_field
1844
+ message: __integrationIds must be an array of at most 50 integration ids.
1845
+ source: resource
1846
+ InvalidRef:
1847
+ description: A path id or `_*Id` query parameter is not a valid ObjectId.
1848
+ content:
1849
+ application/json:
1850
+ schema:
1851
+ $ref: '#/components/schemas/Error'
1852
+ examples:
1853
+ invalid-id:
1854
+ value:
1855
+ errors:
1856
+ - code: invalid_ref
1857
+ message: Please provide a valid _id.
1858
+ source: resource
1859
+ NotFound:
1860
+ description: No knowledge base has this id.
1861
+ content:
1862
+ application/json:
1863
+ schema:
1864
+ $ref: '#/components/schemas/Error'
1865
+ examples:
1866
+ not-found:
1867
+ value:
1868
+ errors:
1869
+ - code: knowledge_base_not_found
1870
+ message: Knowledge base not found.
1871
+ source: resource
1872
+ BadBody:
1873
+ description: |-
1874
+ The body is not valid JSON (`invalid_json`) or not a JSON object (`invalid_request`), or the path
1875
+ `_id` is not a valid ObjectId (`invalid_ref`).
1876
+ content:
1877
+ application/json:
1878
+ schema:
1879
+ $ref: '#/components/schemas/Error'
1880
+ examples:
1881
+ not-an-object:
1882
+ value:
1883
+ errors:
1884
+ - code: invalid_request
1885
+ message: Knowledge base document should be a JSON object.
1886
+ source: internal
1887
+ invalid-json:
1888
+ value:
1889
+ errors:
1890
+ - code: invalid_json
1891
+ message: The request body is not valid JSON.
1892
+ source: internal
1893
+ invalid-id:
1894
+ value:
1895
+ errors:
1896
+ - code: invalid_ref
1897
+ message: Please provide a valid _id.
1898
+ source: resource
1899
+ x-enable-proxy: true
1900
+ x-internal: false