@celigo/api-specs 0.2.103 → 0.2.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/alert.yml ADDED
@@ -0,0 +1,1226 @@
1
+ openapi: 3.2.0
2
+ info:
3
+ version: 1.0.0
4
+ title: Alerts
5
+ description: |-
6
+ API for managing proactive alerts — account-configured rules that notify
7
+ recipients when flows exceed a long-runtime threshold.
8
+
9
+ Recipients are supplied as `_recipientEmails` on write; the API resolves
10
+ emails to users (creating invites or granting integration access when
11
+ needed) and persists `_recipientUserIds`. Soft-deleted alerts are excluded
12
+ from list and get responses.
13
+
14
+ The Alerts page UI list uses `GET /api/bff/alerts` (grouped by type); that
15
+ route is UI-only and is not part of this public `/v1` contract.
16
+
17
+ ## Alert schema
18
+
19
+ {% openapi-schemas spec="alert" schemas="Alert" grouped="true" %}
20
+ servers:
21
+ - url: https://api.integrator.io
22
+ description: Production (US / default region)
23
+ - url: https://api.eu.integrator.io
24
+ description: Production (EU region)
25
+ - url: https://api.au.integrator.io
26
+ description: Production (AU region)
27
+ - url: https://api.ca.integrator.io
28
+ description: Production (CA region)
29
+ security:
30
+ - bearerAuth: []
31
+ tags:
32
+ - name: Alerts
33
+ description: |-
34
+ Proactive alerts define long-runtime thresholds and recipients for flows
35
+ or whole integrations. Create, list, update, and delete alerts; bulk-update
36
+ recipients across many alerts; and fetch per-alert audit history.
37
+
38
+ ## Alert schema
39
+
40
+ {% openapi-schemas spec="alert" schemas="Alert" grouped="true" %}
41
+ paths:
42
+ /v1/alerts:
43
+ get:
44
+ x-internal: false
45
+ operationId: listAlerts
46
+ tags:
47
+ - Alerts
48
+ summary: List alerts
49
+ description: |-
50
+ Returns proactive alerts for the account. Soft-deleted alerts are excluded.
51
+ Requires permission `get:alert:models`. Returns `403` when the
52
+ `ENABLE_PROACTIVE_ALERTS` feature flag is off.
53
+
54
+ With `populate=true`, nested `flow` / `integration` summaries and
55
+ recipient `{ _id, name, email }` objects are returned. Without populate,
56
+ foreign keys are raw ObjectIds.
57
+
58
+ Tile-level (shared) users must include `_integrationId`.
59
+ parameters:
60
+ - name: populate
61
+ in: query
62
+ required: false
63
+ description: When `true`, populate flow, integration, and recipient user fields.
64
+ schema:
65
+ type: string
66
+ enum:
67
+ - 'true'
68
+ x-enumDescriptions:
69
+ 'true': Return nested objects for referenced resources.
70
+ - name: type
71
+ in: query
72
+ required: false
73
+ description: Filter by alert type.
74
+ schema:
75
+ type: string
76
+ enum:
77
+ - long-runtime
78
+ x-enumDescriptions:
79
+ long-runtime: Long-runtime threshold alerts.
80
+ - name: _integrationId
81
+ in: query
82
+ required: false
83
+ description: Filter by integration id. Required for tile-level (shared) users.
84
+ schema:
85
+ type: string
86
+ format: objectId
87
+ x-celigo-refModel: integrations
88
+ examples:
89
+ - 5e5eb06fdd83ed4f8206a4ea
90
+ - name: _flowId
91
+ in: query
92
+ required: false
93
+ description: Filter by flow id.
94
+ schema:
95
+ type: string
96
+ format: objectId
97
+ x-celigo-refModel: flows
98
+ examples:
99
+ - 69497fc443fc1f9a03d31bd9
100
+ - name: _recipientUserId
101
+ in: query
102
+ required: false
103
+ description: Filter alerts that include this user as a recipient.
104
+ schema:
105
+ type: string
106
+ format: objectId
107
+ x-celigo-refModel: users
108
+ examples:
109
+ - 624cb0346309dc3a543733a2
110
+ - name: lastTriggeredAt
111
+ in: query
112
+ required: false
113
+ description: |-
114
+ Filter by last triggered time. Use `never` for alerts that have not
115
+ fired. Prefer `lastTriggeredAt_gte` / `lastTriggeredAt_lte` for ranges.
116
+ schema:
117
+ type: string
118
+ examples:
119
+ - never
120
+ - name: lastTriggeredAt_gte
121
+ in: query
122
+ required: false
123
+ description: Include alerts last triggered at or after this ISO-8601 timestamp.
124
+ schema:
125
+ type: string
126
+ format: date-time
127
+ examples:
128
+ - '2026-05-01T00:00:00.000Z'
129
+ - name: lastTriggeredAt_lte
130
+ in: query
131
+ required: false
132
+ description: Include alerts last triggered at or before this ISO-8601 timestamp.
133
+ schema:
134
+ type: string
135
+ format: date-time
136
+ examples:
137
+ - '2026-06-01T00:00:00.000Z'
138
+ responses:
139
+ '200':
140
+ description: Array of alerts (empty array when none match).
141
+ content:
142
+ application/json:
143
+ schema:
144
+ type: array
145
+ items:
146
+ $ref: '#/components/schemas/Alert'
147
+ examples:
148
+ unpopulated:
149
+ summary: Unpopulated list
150
+ value:
151
+ - _id: 674a1b2c3d4e5f6789012345
152
+ type: long-runtime
153
+ _userId: 624cb0346309dc3a543733a2
154
+ _integrationId: 5e5eb06fdd83ed4f8206a4ea
155
+ _flowId: 69497fc443fc1f9a03d31bd9
156
+ longRuntime:
157
+ thresholdMinutes: 30
158
+ _recipientUserIds:
159
+ - 624cb0346309dc3a543733a2
160
+ lastTriggeredAt: null
161
+ createdAt: '2026-05-01T10:00:00.000Z'
162
+ lastModified: '2026-05-01T10:00:00.000Z'
163
+ '400':
164
+ $ref: '#/components/responses/400-bad-request'
165
+ '401':
166
+ $ref: '#/components/responses/401-unauthorized'
167
+ '403':
168
+ $ref: '#/components/responses/403-forbidden'
169
+ post:
170
+ x-internal: false
171
+ operationId: createAlert
172
+ tags:
173
+ - Alerts
174
+ summary: Create an alert
175
+ description: |-
176
+ Creates a proactive alert. Validates type, flow/integration, and duplicate
177
+ constraints, then resolves `_recipientEmails` to `_recipientUserIds` and
178
+ dual-writes the long-runtime threshold onto the related flow document(s).
179
+
180
+ Requires permission `put:alert:models`. Returns `403` when
181
+ `ENABLE_PROACTIVE_ALERTS` is off. Response is always unpopulated.
182
+ requestBody:
183
+ required: true
184
+ content:
185
+ application/json:
186
+ schema:
187
+ $ref: '#/components/schemas/AlertCreateRequest'
188
+ examples:
189
+ flowLevel:
190
+ summary: Flow-level long-runtime alert
191
+ value:
192
+ type: long-runtime
193
+ _flowId: 69497fc443fc1f9a03d31bd9
194
+ longRuntime:
195
+ thresholdMinutes: 30
196
+ _recipientEmails:
197
+ - ops@example.com
198
+ - jane@example.com
199
+ integrationLevel:
200
+ summary: Integration-level long-runtime alert
201
+ value:
202
+ type: long-runtime
203
+ _integrationId: 5e5eb06fdd83ed4f8206a4ea
204
+ longRuntime:
205
+ thresholdMinutes: 60
206
+ _recipientEmails:
207
+ - ops@example.com
208
+ responses:
209
+ '201':
210
+ description: Created alert (unpopulated ObjectIds).
211
+ content:
212
+ application/json:
213
+ schema:
214
+ $ref: '#/components/schemas/Alert'
215
+ examples:
216
+ default:
217
+ value:
218
+ _id: 674a1b2c3d4e5f6789012345
219
+ type: long-runtime
220
+ _userId: 624cb0346309dc3a543733a2
221
+ _integrationId: 5e5eb06fdd83ed4f8206a4ea
222
+ _flowId: 69497fc443fc1f9a03d31bd9
223
+ longRuntime:
224
+ thresholdMinutes: 30
225
+ _recipientUserIds:
226
+ - 624cb0346309dc3a543733a2
227
+ - 6356f24327114d57ab843e1f
228
+ lastTriggeredAt: null
229
+ createdAt: '2026-05-01T10:00:00.000Z'
230
+ lastModified: '2026-05-01T10:00:00.000Z'
231
+ '400':
232
+ $ref: '#/components/responses/400-bad-request'
233
+ '401':
234
+ $ref: '#/components/responses/401-unauthorized'
235
+ '403':
236
+ $ref: '#/components/responses/403-forbidden'
237
+ '409':
238
+ description: An alert with the same type, flow, and integration already exists.
239
+ content:
240
+ application/json:
241
+ schema:
242
+ $ref: '#/components/schemas/Error'
243
+ examples:
244
+ duplicate:
245
+ value:
246
+ errors:
247
+ - code: ROUTES_ALERT_DUPLICATE
248
+ message: An alert already exists for this flow / integration and type.
249
+ '422':
250
+ $ref: '#/components/responses/422-unprocessable-entity'
251
+ /v1/alerts/bulk/recipients:
252
+ patch:
253
+ x-internal: false
254
+ operationId: bulkUpdateAlertRecipients
255
+ tags:
256
+ - Alerts
257
+ summary: Bulk update alert recipients
258
+ description: |-
259
+ Adds or removes recipients across many alerts in one call. Provide either
260
+ `_alertIds` or `_integrationId` (not both). Both `add` and `remove` accept
261
+ `_recipientEmails`.
262
+
263
+ Full success returns `204` with no body. Partial failure returns `200` with
264
+ `{ failed: [...] }` only — successful alerts are omitted. There is no
265
+ `success` or `skipped` array.
266
+
267
+ Requires permission `put:alert:models`. Returns `403` when
268
+ `ENABLE_PROACTIVE_ALERTS` is off. `add` is limited to one integration per
269
+ call; `remove` may span integrations.
270
+ requestBody:
271
+ required: true
272
+ content:
273
+ application/json:
274
+ schema:
275
+ $ref: '#/components/schemas/AlertBulkRecipientsRequest'
276
+ examples:
277
+ addByIds:
278
+ summary: Add a recipient to specific alerts
279
+ value:
280
+ action: add
281
+ _alertIds:
282
+ - 674a1b2c3d4e5f6789012345
283
+ - 674a1b2c3d4e5f6789012346
284
+ _recipientEmails:
285
+ - ops@example.com
286
+ removeByIntegration:
287
+ summary: Remove a recipient from all alerts in an integration
288
+ value:
289
+ action: remove
290
+ _integrationId: 5e5eb06fdd83ed4f8206a4ea
291
+ _recipientEmails:
292
+ - ops@example.com
293
+ responses:
294
+ '200':
295
+ description: |-
296
+ One or more alerts failed. Body contains only `failed[]`; each entry
297
+ includes `_id`, optional `affectedRecipientEmails`, and `errors[]`.
298
+ content:
299
+ application/json:
300
+ schema:
301
+ $ref: '#/components/schemas/AlertBulkRecipientsFailed'
302
+ examples:
303
+ lastRecipient:
304
+ summary: Could not remove the last recipient from one alert
305
+ value:
306
+ failed:
307
+ - _id: 674a1b2c3d4e5f6789012345
308
+ affectedRecipientEmails:
309
+ - ops@example.com
310
+ errors:
311
+ - code: ROUTES_ALERT_BULK_LAST_RECIPIENT
312
+ message: Cannot remove the last recipient from an alert.
313
+ '204':
314
+ description: All targeted alerts updated successfully.
315
+ '400':
316
+ $ref: '#/components/responses/400-bad-request'
317
+ '401':
318
+ $ref: '#/components/responses/401-unauthorized'
319
+ '403':
320
+ $ref: '#/components/responses/403-forbidden'
321
+ '404':
322
+ description: No alerts exist for the specified `_integrationId`.
323
+ content:
324
+ application/json:
325
+ schema:
326
+ $ref: '#/components/schemas/Error'
327
+ examples:
328
+ noAlerts:
329
+ value:
330
+ errors:
331
+ - code: ROUTES_ALERT_BULK_NO_ALERTS_FOR_INTEGRATION
332
+ message: No alerts found for this integration.
333
+ '422':
334
+ $ref: '#/components/responses/422-unprocessable-entity'
335
+ /v1/alerts/{_id}:
336
+ get:
337
+ x-internal: false
338
+ operationId: getAlertById
339
+ tags:
340
+ - Alerts
341
+ summary: Get an alert
342
+ description: |-
343
+ Returns a single proactive alert by id. Soft-deleted alerts return `404`.
344
+ Requires permission `get:alert:model`. Returns `403` when
345
+ `ENABLE_PROACTIVE_ALERTS` is off.
346
+
347
+ With `populate=true`, nested flow / integration / recipient objects are
348
+ returned; otherwise foreign keys are raw ObjectIds.
349
+ parameters:
350
+ - name: _id
351
+ in: path
352
+ required: true
353
+ description: Alert id.
354
+ schema:
355
+ type: string
356
+ format: objectId
357
+ x-celigo-refModel: alerts
358
+ examples:
359
+ - 674a1b2c3d4e5f6789012345
360
+ - name: populate
361
+ in: query
362
+ required: false
363
+ description: When `true`, populate flow, integration, and recipient user fields.
364
+ schema:
365
+ type: string
366
+ enum:
367
+ - 'true'
368
+ x-enumDescriptions:
369
+ 'true': Return nested objects for referenced resources.
370
+ responses:
371
+ '200':
372
+ description: Alert object.
373
+ content:
374
+ application/json:
375
+ schema:
376
+ $ref: '#/components/schemas/Alert'
377
+ examples:
378
+ default:
379
+ value:
380
+ _id: 674a1b2c3d4e5f6789012345
381
+ type: long-runtime
382
+ _userId: 624cb0346309dc3a543733a2
383
+ _integrationId: 5e5eb06fdd83ed4f8206a4ea
384
+ _flowId: 69497fc443fc1f9a03d31bd9
385
+ longRuntime:
386
+ thresholdMinutes: 30
387
+ _recipientUserIds:
388
+ - 624cb0346309dc3a543733a2
389
+ lastTriggeredAt: null
390
+ createdAt: '2026-05-01T10:00:00.000Z'
391
+ lastModified: '2026-05-01T10:00:00.000Z'
392
+ '401':
393
+ $ref: '#/components/responses/401-unauthorized'
394
+ '403':
395
+ $ref: '#/components/responses/403-forbidden'
396
+ '404':
397
+ $ref: '#/components/responses/404-not-found'
398
+ put:
399
+ x-internal: false
400
+ operationId: updateAlert
401
+ tags:
402
+ - Alerts
403
+ summary: Update an alert
404
+ description: |-
405
+ Replace-all update of threshold and recipients. `type`, `_flowId`, and
406
+ `_integrationId` are immutable. Resolves `_recipientEmails` the same way
407
+ as create, then dual-writes the updated threshold to related flow(s).
408
+
409
+ Requires permission `put:alert:models`. Returns `403` when
410
+ `ENABLE_PROACTIVE_ALERTS` is off. Response is always unpopulated.
411
+ parameters:
412
+ - name: _id
413
+ in: path
414
+ required: true
415
+ description: Alert id.
416
+ schema:
417
+ type: string
418
+ format: objectId
419
+ x-celigo-refModel: alerts
420
+ examples:
421
+ - 674a1b2c3d4e5f6789012345
422
+ requestBody:
423
+ required: true
424
+ content:
425
+ application/json:
426
+ schema:
427
+ $ref: '#/components/schemas/AlertUpdateRequest'
428
+ examples:
429
+ default:
430
+ value:
431
+ longRuntime:
432
+ thresholdMinutes: 45
433
+ _recipientEmails:
434
+ - ops@example.com
435
+ - jane@example.com
436
+ responses:
437
+ '200':
438
+ description: Updated alert (unpopulated ObjectIds).
439
+ content:
440
+ application/json:
441
+ schema:
442
+ $ref: '#/components/schemas/Alert'
443
+ examples:
444
+ default:
445
+ value:
446
+ _id: 674a1b2c3d4e5f6789012345
447
+ type: long-runtime
448
+ _userId: 624cb0346309dc3a543733a2
449
+ _integrationId: 5e5eb06fdd83ed4f8206a4ea
450
+ _flowId: 69497fc443fc1f9a03d31bd9
451
+ longRuntime:
452
+ thresholdMinutes: 45
453
+ _recipientUserIds:
454
+ - 624cb0346309dc3a543733a2
455
+ - 6356f24327114d57ab843e1f
456
+ lastTriggeredAt: null
457
+ createdAt: '2026-05-01T10:00:00.000Z'
458
+ lastModified: '2026-05-15T14:30:00.000Z'
459
+ '400':
460
+ $ref: '#/components/responses/400-bad-request'
461
+ '401':
462
+ $ref: '#/components/responses/401-unauthorized'
463
+ '403':
464
+ $ref: '#/components/responses/403-forbidden'
465
+ '404':
466
+ $ref: '#/components/responses/404-not-found'
467
+ '422':
468
+ $ref: '#/components/responses/422-unprocessable-entity'
469
+ delete:
470
+ x-internal: false
471
+ operationId: deleteAlert
472
+ tags:
473
+ - Alerts
474
+ summary: Delete an alert
475
+ description: |-
476
+ Soft-deletes an alert and clears `__longRuntimeThresholdMinutes` on the
477
+ related flow document(s). Requires permission `put:alert:models`. Returns
478
+ `403` when `ENABLE_PROACTIVE_ALERTS` is off.
479
+ parameters:
480
+ - name: _id
481
+ in: path
482
+ required: true
483
+ description: Alert id.
484
+ schema:
485
+ type: string
486
+ format: objectId
487
+ x-celigo-refModel: alerts
488
+ examples:
489
+ - 674a1b2c3d4e5f6789012345
490
+ responses:
491
+ '204':
492
+ description: Alert soft-deleted.
493
+ '401':
494
+ $ref: '#/components/responses/401-unauthorized'
495
+ '403':
496
+ $ref: '#/components/responses/403-forbidden'
497
+ '404':
498
+ $ref: '#/components/responses/404-not-found'
499
+ /v1/alerts/{_id}/audit:
500
+ get:
501
+ x-internal: false
502
+ operationId: getAlertAudit
503
+ tags:
504
+ - Alerts
505
+ summary: Get audit log for an alert
506
+ description: |-
507
+ Returns the change history for an alert. Each entry records a mutation
508
+ event with who made the change, when, and which fields were affected.
509
+
510
+ Requires permission to read the alert (`get:alert:model`). Returns `403`
511
+ when `ENABLE_PROACTIVE_ALERTS` is off or the caller lacks access.
512
+ parameters:
513
+ - name: _id
514
+ in: path
515
+ description: Alert ID.
516
+ required: true
517
+ schema:
518
+ type: string
519
+ format: objectId
520
+ x-celigo-refModel: alerts
521
+ examples:
522
+ - 674a1b2c3d4e5f6789012345
523
+ - name: limit
524
+ in: query
525
+ description: Maximum number of audit entries to return per page.
526
+ required: false
527
+ schema:
528
+ type: integer
529
+ minimum: 1
530
+ maximum: 1000
531
+ default: 1000
532
+ examples:
533
+ - 100
534
+ - name: after
535
+ in: query
536
+ required: false
537
+ description: |-
538
+ Opaque pagination cursor for the next page. Take it from the `after` value in the `Link`
539
+ response header's `rel="next"` URL rather than constructing it.
540
+ schema:
541
+ type: string
542
+ examples:
543
+ - W3siJGRhdGUiOiIyMDI2LTA1LTAxVDAwOjAwOjAwLjAwMFoifSwiNjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIl0
544
+ - name: from
545
+ in: query
546
+ required: false
547
+ description: Only return entries at or after this timestamp.
548
+ schema:
549
+ type: string
550
+ format: date-time
551
+ examples:
552
+ - '2026-05-01T00:00:00.000Z'
553
+ - name: to
554
+ in: query
555
+ required: false
556
+ description: Only return entries at or before this timestamp.
557
+ schema:
558
+ type: string
559
+ format: date-time
560
+ examples:
561
+ - '2026-06-01T00:00:00.000Z'
562
+ responses:
563
+ '200':
564
+ description: Audit entries for the alert.
565
+ headers:
566
+ Link:
567
+ description: |-
568
+ Pagination link header. When more results exist, includes
569
+ `rel="next"` with an `after` cursor.
570
+ schema:
571
+ type: string
572
+ examples:
573
+ - </v1/alerts/674a1b2c3d4e5f6789012345/audit?after=W3siJGRhdGUiOiIyMDI2LTA1LTAxVDAwOjAwOjAwLjAwMFoifSwiNjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIl0>; rel="next"
574
+ content:
575
+ application/json:
576
+ schema:
577
+ type: array
578
+ items:
579
+ type: object
580
+ properties:
581
+ _id:
582
+ type: string
583
+ format: objectId
584
+ description: Audit entry id.
585
+ examples:
586
+ - 69e38cb1a749d34a9732a270
587
+ resourceType:
588
+ type: string
589
+ description: Resource type for this entry.
590
+ enum:
591
+ - alert
592
+ x-enumDescriptions:
593
+ alert: Alert resource.
594
+ examples:
595
+ - alert
596
+ _resourceId:
597
+ type: string
598
+ format: objectId
599
+ x-celigo-refModel: alerts
600
+ description: Alert id.
601
+ examples:
602
+ - 674a1b2c3d4e5f6789012345
603
+ event:
604
+ type: string
605
+ description: Mutation event type.
606
+ enum:
607
+ - create
608
+ - update
609
+ - delete
610
+ x-enumDescriptions:
611
+ create: Alert was created.
612
+ update: Alert was modified.
613
+ delete: Alert was soft-deleted.
614
+ examples:
615
+ - update
616
+ source:
617
+ type: string
618
+ description: How the change was initiated.
619
+ enum:
620
+ - api
621
+ - ui
622
+ - system
623
+ x-enumDescriptions:
624
+ api: Change made via the REST API.
625
+ ui: Change made through the Celigo UI.
626
+ system: Change made by an automated platform process.
627
+ time:
628
+ type: string
629
+ format: date-time
630
+ description: When the change occurred.
631
+ examples:
632
+ - '2026-04-18T13:52:49.729Z'
633
+ byUser:
634
+ type: object
635
+ description: User who made the change.
636
+ properties:
637
+ _id:
638
+ type: string
639
+ format: objectId
640
+ x-celigo-refModel: users
641
+ description: User ID.
642
+ examples:
643
+ - 624cb0346309dc3a543733a2
644
+ email:
645
+ type: string
646
+ format: email
647
+ description: User email address.
648
+ examples:
649
+ - user@example.com
650
+ name:
651
+ type: string
652
+ description: User display name.
653
+ examples:
654
+ - Tyler Lamparter
655
+ fieldChanges:
656
+ type: array
657
+ description: Fields that were modified.
658
+ items:
659
+ type: object
660
+ properties:
661
+ fieldPath:
662
+ type: string
663
+ description: Dot-notation path of the changed field.
664
+ examples:
665
+ - longRuntime.thresholdMinutes
666
+ oldValue:
667
+ description: Previous value (absent on create).
668
+ newValue:
669
+ description: New value (absent on delete).
670
+ deletedInfo:
671
+ type: object
672
+ description: Metadata about the deleted resource. Present on `delete` events.
673
+ properties:
674
+ name:
675
+ type: string
676
+ description: Name of the resource at the time of deletion.
677
+ examples:
678
+ default:
679
+ value:
680
+ - _id: 69e38cb1a749d34a9732a270
681
+ resourceType: alert
682
+ _resourceId: 674a1b2c3d4e5f6789012345
683
+ source: api
684
+ event: update
685
+ time: '2026-04-18T13:52:49.729Z'
686
+ byUser:
687
+ _id: 624cb0346309dc3a543733a2
688
+ email: user@example.com
689
+ name: Tyler Lamparter
690
+ fieldChanges:
691
+ - fieldPath: longRuntime.thresholdMinutes
692
+ oldValue: 30
693
+ newValue: 45
694
+ '204':
695
+ description: No audit entries exist for this alert.
696
+ '400':
697
+ $ref: '#/components/responses/400-bad-request'
698
+ '401':
699
+ $ref: '#/components/responses/401-unauthorized'
700
+ '403':
701
+ $ref: '#/components/responses/403-forbidden'
702
+ '404':
703
+ $ref: '#/components/responses/404-not-found'
704
+ '422':
705
+ $ref: '#/components/responses/422-unprocessable-entity'
706
+ components:
707
+ securitySchemes:
708
+ bearerAuth:
709
+ type: http
710
+ scheme: bearer
711
+ schemas:
712
+ Alert:
713
+ type: object
714
+ description: |-
715
+ Proactive alert configuration. Soft-deleted alerts are omitted from list
716
+ and get responses. With `populate=true` on GET, `_flowId` and
717
+ `_integrationId` stay ObjectId strings and the `flow` / `integration`
718
+ enrichment objects are added alongside them; `_recipientUserIds` entries
719
+ become `{ _id, name, email }`. POST and PUT always return the unpopulated
720
+ shape.
721
+ required:
722
+ - _id
723
+ - type
724
+ - _userId
725
+ - _integrationId
726
+ - longRuntime
727
+ - _recipientUserIds
728
+ - createdAt
729
+ - lastModified
730
+ properties:
731
+ _id:
732
+ type: string
733
+ format: objectId
734
+ readOnly: true
735
+ description: Unique identifier for the alert.
736
+ examples:
737
+ - 674a1b2c3d4e5f6789012345
738
+ type:
739
+ type: string
740
+ description: Alert type.
741
+ enum:
742
+ - long-runtime
743
+ x-enumDescriptions:
744
+ long-runtime: Notify when a flow run exceeds the configured runtime threshold.
745
+ examples:
746
+ - long-runtime
747
+ _userId:
748
+ type: string
749
+ format: objectId
750
+ readOnly: true
751
+ x-celigo-refModel: users
752
+ description: Account owner user id for the alert.
753
+ examples:
754
+ - 624cb0346309dc3a543733a2
755
+ _integrationId:
756
+ type: string
757
+ format: objectId
758
+ x-celigo-refModel: integrations
759
+ description: |-
760
+ Integration the alert belongs to. Always an ObjectId string. With
761
+ `populate=true` on an integration-level alert, a sibling `integration`
762
+ object `{ flowCount }` is added; this id is not replaced.
763
+ examples:
764
+ - 5e5eb06fdd83ed4f8206a4ea
765
+ _flowId:
766
+ type: string
767
+ format: objectId
768
+ x-celigo-refModel: flows
769
+ description: |-
770
+ Flow for a flow-level alert; omitted on integration-level alerts.
771
+ Always an ObjectId string — with `populate=true` the display fields
772
+ arrive in the sibling `flow` object instead of replacing this value.
773
+ examples:
774
+ - 69497fc443fc1f9a03d31bd9
775
+ longRuntime:
776
+ type: object
777
+ description: Configuration for `long-runtime` alerts.
778
+ required:
779
+ - thresholdMinutes
780
+ properties:
781
+ thresholdMinutes:
782
+ type: integer
783
+ minimum: 5
784
+ maximum: 59940
785
+ description: Runtime threshold in minutes. Runs at or above this duration trigger the alert.
786
+ examples:
787
+ - 30
788
+ _recipientUserIds:
789
+ type: array
790
+ description: |-
791
+ Recipient user ids. Unpopulated responses return ObjectId strings;
792
+ with `populate=true`, each entry is `{ _id, name, email }`.
793
+ minItems: 1
794
+ items:
795
+ oneOf:
796
+ - type: string
797
+ format: objectId
798
+ x-celigo-refModel: users
799
+ examples:
800
+ - 624cb0346309dc3a543733a2
801
+ - type: object
802
+ required:
803
+ - _id
804
+ properties:
805
+ _id:
806
+ type: string
807
+ format: objectId
808
+ x-celigo-refModel: users
809
+ name:
810
+ type: string
811
+ examples:
812
+ - Jane Doe
813
+ email:
814
+ type: string
815
+ format: email
816
+ examples:
817
+ - jane@example.com
818
+ flow:
819
+ type: object
820
+ readOnly: true
821
+ description: |-
822
+ Flow enrichment object. Present on populated GET responses for
823
+ flow-level alerts only (`populate=true`). Never returned on POST or PUT.
824
+ Fields: `name`, `isInstanceFlow`, `flowGroupName`.
825
+ properties:
826
+ name:
827
+ type: string
828
+ description: Flow display name.
829
+ examples:
830
+ - Order sync
831
+ isInstanceFlow:
832
+ type: boolean
833
+ description: Whether this is an instance of an abstract (Integration App) flow.
834
+ flowGroupName:
835
+ type: string
836
+ description: Name of the flow grouping this flow belongs to, if any.
837
+ integration:
838
+ type: object
839
+ readOnly: true
840
+ description: |-
841
+ Integration enrichment object. Present on populated GET responses for
842
+ integration-level alerts only (`populate=true`, no `_flowId`). Only
843
+ `flowCount` is returned (not `name`).
844
+ properties:
845
+ flowCount:
846
+ type: integer
847
+ description: Number of non-deleted flows under this integration.
848
+ examples:
849
+ - 12
850
+ lastTriggeredAt:
851
+ type:
852
+ - string
853
+ - 'null'
854
+ format: date-time
855
+ readOnly: true
856
+ description: When the alert last fired. `null` when it has never triggered.
857
+ examples:
858
+ - '2026-06-01T12:00:00.000Z'
859
+ createdAt:
860
+ type: string
861
+ format: date-time
862
+ readOnly: true
863
+ description: When the alert was created.
864
+ examples:
865
+ - '2026-05-01T10:00:00.000Z'
866
+ lastModified:
867
+ type: string
868
+ format: date-time
869
+ readOnly: true
870
+ description: When the alert was last updated.
871
+ examples:
872
+ - '2026-05-15T14:30:00.000Z'
873
+ Error:
874
+ type: object
875
+ description: Standard error response envelope returned by integrator.io APIs.
876
+ properties:
877
+ errors:
878
+ type: array
879
+ description: List of errors that occurred while processing the request.
880
+ items:
881
+ type: object
882
+ properties:
883
+ code:
884
+ oneOf:
885
+ - type: string
886
+ - type: integer
887
+ description: |-
888
+ Machine-readable error code. Usually a string like
889
+ `invalid_ref`, `missing_required_field`, or `unauthorized`;
890
+ may be an **integer** when the error mirrors an upstream HTTP
891
+ status (e.g. `500`) — most commonly returned by connection-ping
892
+ and adaptor-proxy responses.
893
+ message:
894
+ type: string
895
+ description: Human-readable description of the error.
896
+ field:
897
+ type: string
898
+ description: |-
899
+ Optional pointer to the document field that caused the error.
900
+ Used by structural validation errors (`missing_required_field`,
901
+ `invalid_ref`) to indicate which field is at fault
902
+ (e.g. `_id`, `type`, `http.baseURI`).
903
+ source:
904
+ type: string
905
+ description: |-
906
+ Optional origin layer for the error — e.g. `application` when
907
+ the error came from the remote system the adaptor called,
908
+ `connector` when the adaptor itself rejected the request.
909
+ required:
910
+ - message
911
+ required:
912
+ - errors
913
+ AlertCreateRequest:
914
+ type: object
915
+ description: |-
916
+ Create a proactive alert. Recipients are supplied as `_recipientEmails`;
917
+ the API resolves them to `_recipientUserIds` (inviting users or granting
918
+ integration access when needed). Response never echoes `_recipientEmails`.
919
+
920
+ Either `_flowId` or `_integrationId` (or both) must be provided. When
921
+ `_flowId` is set, `_integrationId` may be omitted (inferred from the flow).
922
+ Integration-level alerts require `_integrationId` without `_flowId`.
923
+ required:
924
+ - type
925
+ - longRuntime
926
+ - _recipientEmails
927
+ if:
928
+ not:
929
+ required:
930
+ - _flowId
931
+ then:
932
+ required:
933
+ - _integrationId
934
+ properties:
935
+ type:
936
+ type: string
937
+ description: Alert type.
938
+ enum:
939
+ - long-runtime
940
+ x-enumDescriptions:
941
+ long-runtime: Notify when a flow run exceeds the configured runtime threshold.
942
+ examples:
943
+ - long-runtime
944
+ _flowId:
945
+ type: string
946
+ format: objectId
947
+ x-celigo-refModel: flows
948
+ description: |-
949
+ Flow id for a flow-level alert. When set, `_integrationId` may be
950
+ omitted and is inferred from the flow.
951
+ examples:
952
+ - 69497fc443fc1f9a03d31bd9
953
+ _integrationId:
954
+ type: string
955
+ format: objectId
956
+ x-celigo-refModel: integrations
957
+ description: |-
958
+ Integration id. Required for integration-level alerts (no `_flowId`).
959
+ Required for `long-runtime` unless inferred from `_flowId`.
960
+ examples:
961
+ - 5e5eb06fdd83ed4f8206a4ea
962
+ longRuntime:
963
+ type: object
964
+ required:
965
+ - thresholdMinutes
966
+ properties:
967
+ thresholdMinutes:
968
+ type: integer
969
+ minimum: 5
970
+ maximum: 59940
971
+ description: Runtime threshold in minutes.
972
+ examples:
973
+ - 30
974
+ _recipientEmails:
975
+ type: array
976
+ description: |-
977
+ Recipient email addresses. Trimmed, lowercased, and deduplicated
978
+ server-side. Minimum 1; maximum controlled by `ALERT_MAX_RECIPIENT_EMAILS`
979
+ (default 50).
980
+ minItems: 1
981
+ maxItems: 50
982
+ items:
983
+ type: string
984
+ format: email
985
+ examples:
986
+ - ops@example.com
987
+ AlertBulkRecipientsRequest:
988
+ type: object
989
+ description: |-
990
+ Add or remove recipients across one or more alerts. Provide exactly one
991
+ target: `_alertIds` or `_integrationId` (not both). Both actions use
992
+ `_recipientEmails` (resolved to user ids server-side). `add` is limited to
993
+ one integration per call; `remove` may span integrations.
994
+
995
+ Sending both `_alertIds` and `_integrationId` returns `400`.
996
+ required:
997
+ - action
998
+ - _recipientEmails
999
+ if:
1000
+ required:
1001
+ - _alertIds
1002
+ then:
1003
+ not:
1004
+ required:
1005
+ - _integrationId
1006
+ else:
1007
+ required:
1008
+ - _integrationId
1009
+ properties:
1010
+ action:
1011
+ type: string
1012
+ description: Whether to add or remove the listed recipients.
1013
+ enum:
1014
+ - add
1015
+ - remove
1016
+ x-enumDescriptions:
1017
+ add: Resolve emails and `$addToSet` onto `_recipientUserIds`.
1018
+ remove: Resolve emails and `$pull` from `_recipientUserIds`.
1019
+ examples:
1020
+ - add
1021
+ _alertIds:
1022
+ type: array
1023
+ description: Explicit alert ids to update. Mutually exclusive with `_integrationId`.
1024
+ minItems: 1
1025
+ items:
1026
+ type: string
1027
+ format: objectId
1028
+ x-celigo-refModel: alerts
1029
+ examples:
1030
+ - 674a1b2c3d4e5f6789012345
1031
+ _integrationId:
1032
+ type: string
1033
+ format: objectId
1034
+ x-celigo-refModel: integrations
1035
+ description: |-
1036
+ When set, the operation applies to every alert under this integration.
1037
+ Mutually exclusive with `_alertIds`.
1038
+ examples:
1039
+ - 5e5eb06fdd83ed4f8206a4ea
1040
+ _recipientEmails:
1041
+ type: array
1042
+ description: Recipient emails to add or remove. Trimmed, lowercased, and deduplicated.
1043
+ minItems: 1
1044
+ maxItems: 50
1045
+ items:
1046
+ type: string
1047
+ format: email
1048
+ examples:
1049
+ - ops@example.com
1050
+ AlertBulkRecipientsFailed:
1051
+ type: object
1052
+ description: |-
1053
+ Partial-failure body returned with HTTP 200 when at least one alert in the
1054
+ bulk recipients call could not be fully updated. Full success returns 204
1055
+ with no body.
1056
+ required:
1057
+ - failed
1058
+ properties:
1059
+ failed:
1060
+ type: array
1061
+ description: Per-alert failures. Successful alerts are omitted.
1062
+ items:
1063
+ type: object
1064
+ required:
1065
+ - _id
1066
+ - errors
1067
+ properties:
1068
+ _id:
1069
+ type: string
1070
+ format: objectId
1071
+ x-celigo-refModel: alerts
1072
+ description: Alert id that failed.
1073
+ examples:
1074
+ - 674a1b2c3d4e5f6789012345
1075
+ affectedRecipientEmails:
1076
+ type: array
1077
+ description: |-
1078
+ Emails implicated in this failure (for example, recipients that
1079
+ could not be removed because they are the last remaining recipient).
1080
+ items:
1081
+ type: string
1082
+ format: email
1083
+ examples:
1084
+ - ops@example.com
1085
+ errors:
1086
+ type: array
1087
+ description: Error details for this alert.
1088
+ minItems: 1
1089
+ items:
1090
+ type: object
1091
+ properties:
1092
+ code:
1093
+ type: string
1094
+ examples:
1095
+ - ROUTES_ALERT_BULK_LAST_RECIPIENT
1096
+ message:
1097
+ type: string
1098
+ examples:
1099
+ - Cannot remove the last recipient from an alert.
1100
+ field:
1101
+ type: string
1102
+ examples:
1103
+ - _recipientEmails
1104
+ AlertUpdateRequest:
1105
+ type: object
1106
+ description: |-
1107
+ Replace-all update for an alert. `type`, `_flowId`, and `_integrationId`
1108
+ are immutable and ignored if sent. Recipients are replace-all via
1109
+ `_recipientEmails` (same resolution/invite behavior as create).
1110
+ required:
1111
+ - longRuntime
1112
+ - _recipientEmails
1113
+ properties:
1114
+ longRuntime:
1115
+ type: object
1116
+ required:
1117
+ - thresholdMinutes
1118
+ properties:
1119
+ thresholdMinutes:
1120
+ type: integer
1121
+ minimum: 5
1122
+ maximum: 59940
1123
+ description: Runtime threshold in minutes.
1124
+ examples:
1125
+ - 45
1126
+ _recipientEmails:
1127
+ type: array
1128
+ description: |-
1129
+ Full replacement recipient email list. Trimmed, lowercased, and
1130
+ deduplicated server-side. Must contain at least one address.
1131
+ minItems: 1
1132
+ maxItems: 50
1133
+ items:
1134
+ type: string
1135
+ format: email
1136
+ examples:
1137
+ - ops@example.com
1138
+ responses:
1139
+ 400-bad-request:
1140
+ description: |
1141
+ Bad request. The server could not understand the request because of malformed syntax or invalid parameters.
1142
+ content:
1143
+ application/json:
1144
+ schema:
1145
+ $ref: '#/components/schemas/Error'
1146
+ examples:
1147
+ default:
1148
+ value:
1149
+ errors:
1150
+ - code: invalid_request
1151
+ message: The request body failed validation.
1152
+ 401-unauthorized:
1153
+ description: |-
1154
+ Unauthorized. The request lacks a valid bearer token, or the provided token
1155
+ failed to authenticate.
1156
+
1157
+ Note: the 401 response is produced by the auth middleware **before** the
1158
+ request reaches the endpoint handler, so it does **not** follow the
1159
+ standard `{errors: [...]}` envelope. Instead the body is a bare
1160
+ `{message: string}` object with no `code`, no `errors` array. Callers
1161
+ handling 401s should key off the HTTP status and the `message` string,
1162
+ not try to destructure an `errors[]`.
1163
+ content:
1164
+ application/json:
1165
+ schema:
1166
+ type: object
1167
+ properties:
1168
+ message:
1169
+ type: string
1170
+ description: |-
1171
+ Human-readable description of the auth failure. Known values:
1172
+ - `"Unauthorized"` — no `Authorization` header on the request.
1173
+ - `"Bearer Authentication Failed"` — header present but token
1174
+ is invalid, revoked, or expired.
1175
+ required:
1176
+ - message
1177
+ examples:
1178
+ missing_token:
1179
+ summary: No Authorization header sent
1180
+ value:
1181
+ message: Unauthorized
1182
+ invalid_token:
1183
+ summary: Bearer token invalid or revoked
1184
+ value:
1185
+ message: Bearer Authentication Failed
1186
+ 403-forbidden:
1187
+ description: |
1188
+ Forbidden. The authenticated caller does not have permission to perform this operation.
1189
+ content:
1190
+ application/json:
1191
+ schema:
1192
+ $ref: '#/components/schemas/Error'
1193
+ examples:
1194
+ default:
1195
+ value:
1196
+ errors:
1197
+ - code: forbidden
1198
+ message: You do not have permission to access this resource.
1199
+ 422-unprocessable-entity:
1200
+ description: |
1201
+ Unprocessable entity. The request was well-formed but was unable to be followed due to semantic errors.
1202
+ content:
1203
+ application/json:
1204
+ schema:
1205
+ $ref: '#/components/schemas/Error'
1206
+ examples:
1207
+ default:
1208
+ value:
1209
+ errors:
1210
+ - code: unprocessable_entity
1211
+ message: The request could not be processed due to a semantic error.
1212
+ 404-not-found:
1213
+ description: |
1214
+ Not found. The requested resource does not exist or is not visible to the caller.
1215
+ content:
1216
+ application/json:
1217
+ schema:
1218
+ $ref: '#/components/schemas/Error'
1219
+ examples:
1220
+ default:
1221
+ value:
1222
+ errors:
1223
+ - code: not_found
1224
+ message: The requested resource was not found.
1225
+ x-enable-proxy: true
1226
+ x-internal: false