@vitrina/api 16.0.0 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.cts +2393 -190
  2. package/dist/index.d.ts +2393 -190
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -140220,7 +140220,7 @@ interface paths {
140220
140220
  query?: {
140221
140221
  contact_id?: string;
140222
140222
  state?: "pending" | "partial" | "paid" | "overpaid" | "overdue" | "overdue_partial" | "cancelled" | "waived" | "open";
140223
- kind?: "appointment_deposit" | "service" | "pack" | "product" | "vehicle_reservation_deposit" | "sale_note" | "consignment_settlement" | "real_estate_reserva" | "real_estate_pie" | "other";
140223
+ kind?: "appointment_deposit" | "service" | "pack" | "product" | "vehicle_reservation_deposit" | "sale_note" | "consignment_settlement" | "real_estate_reserva" | "real_estate_pie" | "installment" | "other";
140224
140224
  group_id?: string;
140225
140225
  limit?: number;
140226
140226
  offset?: number | null;
@@ -140417,7 +140417,7 @@ interface paths {
140417
140417
  /** Format: uuid */
140418
140418
  contact_id: string;
140419
140419
  /** @enum {string} */
140420
- kind: "appointment_deposit" | "service" | "pack" | "product" | "vehicle_reservation_deposit" | "sale_note" | "consignment_settlement" | "real_estate_reserva" | "real_estate_pie" | "other";
140420
+ kind: "appointment_deposit" | "service" | "pack" | "product" | "vehicle_reservation_deposit" | "sale_note" | "consignment_settlement" | "real_estate_reserva" | "real_estate_pie" | "installment" | "other";
140421
140421
  expected_clp: number;
140422
140422
  label: string;
140423
140423
  opened_on?: string;
@@ -141734,6 +141734,1514 @@ interface paths {
141734
141734
  patch?: never;
141735
141735
  trace?: never;
141736
141736
  };
141737
+ "/installment-plans": {
141738
+ parameters: {
141739
+ query?: never;
141740
+ header?: never;
141741
+ path?: never;
141742
+ cookie?: never;
141743
+ };
141744
+ /**
141745
+ * List installment plans
141746
+ * @description `payments:read`. Plans newest first, each with its cuotas. Filter by `contact_id` or `external_ref`.
141747
+ */
141748
+ get: {
141749
+ parameters: {
141750
+ query?: {
141751
+ contact_id?: string;
141752
+ external_ref?: string;
141753
+ limit?: number;
141754
+ offset?: number | null;
141755
+ };
141756
+ header?: never;
141757
+ path?: never;
141758
+ cookie?: never;
141759
+ };
141760
+ requestBody?: never;
141761
+ responses: {
141762
+ /** @description Installment plans */
141763
+ 200: {
141764
+ headers: {
141765
+ [name: string]: unknown;
141766
+ };
141767
+ content: {
141768
+ /**
141769
+ * @example [
141770
+ * {
141771
+ * "id": "0192f0b2-0000-7000-8000-00000000c000",
141772
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
141773
+ * "label": "Plan de cuotas",
141774
+ * "external_ref": "CONTRATO-2291",
141775
+ * "currency": "CLP",
141776
+ * "count": 6,
141777
+ * "total_amount": 510000,
141778
+ * "paid_amount": 85000,
141779
+ * "outstanding": 425000,
141780
+ * "status": "active",
141781
+ * "installments": [
141782
+ * {
141783
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
141784
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
141785
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
141786
+ * "number": 2,
141787
+ * "count": 6,
141788
+ * "amount": 85000,
141789
+ * "currency": "CLP",
141790
+ * "due_date": "2026-11-05",
141791
+ * "status": "overdue",
141792
+ * "ledger_state": "overdue",
141793
+ * "paid_amount": 0,
141794
+ * "outstanding": 85000,
141795
+ * "paid_at": null,
141796
+ * "days_overdue": 4,
141797
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
141798
+ * }
141799
+ * ],
141800
+ * "created_at": "2026-10-05T14:00:00.000Z"
141801
+ * }
141802
+ * ]
141803
+ */
141804
+ "application/json": {
141805
+ data?: unknown;
141806
+ meta?: {
141807
+ [key: string]: unknown;
141808
+ };
141809
+ };
141810
+ };
141811
+ };
141812
+ /** @description Validation error */
141813
+ 400: {
141814
+ headers: {
141815
+ [name: string]: unknown;
141816
+ };
141817
+ content: {
141818
+ "application/json": components["schemas"]["Error"];
141819
+ };
141820
+ };
141821
+ /** @description Unauthorized */
141822
+ 401: {
141823
+ headers: {
141824
+ [name: string]: unknown;
141825
+ };
141826
+ content: {
141827
+ "application/json": components["schemas"]["Error"];
141828
+ };
141829
+ };
141830
+ /** @description Forbidden */
141831
+ 403: {
141832
+ headers: {
141833
+ [name: string]: unknown;
141834
+ };
141835
+ content: {
141836
+ "application/json": components["schemas"]["Error"];
141837
+ };
141838
+ };
141839
+ /** @description Not found */
141840
+ 404: {
141841
+ headers: {
141842
+ [name: string]: unknown;
141843
+ };
141844
+ content: {
141845
+ "application/json": components["schemas"]["Error"];
141846
+ };
141847
+ };
141848
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
141849
+ 409: {
141850
+ headers: {
141851
+ [name: string]: unknown;
141852
+ };
141853
+ content: {
141854
+ "application/json": components["schemas"]["Error"];
141855
+ };
141856
+ };
141857
+ /** @description Rate limited */
141858
+ 429: {
141859
+ headers: {
141860
+ [name: string]: unknown;
141861
+ };
141862
+ content: {
141863
+ "application/json": components["schemas"]["Error"];
141864
+ };
141865
+ };
141866
+ };
141867
+ };
141868
+ put?: never;
141869
+ /**
141870
+ * Create an installment plan
141871
+ * @description `payments:write`. A customer owes money in cuotas. Send the debtor (`contact_id`, or `rut` / `phone` / `email` to find or create them) and either the cuotas (`installments`: amount, due date, optional own `payment_link_url`) or an even `schedule` (`total_amount`, `count`, `first_due_date`: monthly, the last cuota absorbs the rounding). `external_ref` is your own reference (contract, loan): it must be unique (409 otherwise) and is what the import matches on. Amounts are whole CLP. A plan is an obligation group on the payments ledger and each cuota one of its obligations: paid and overdue are derived from payments, never set. Nothing here sends a message: a debtor who is not a contact yet is created silently (no `new_contact` trigger).
141872
+ */
141873
+ post: {
141874
+ parameters: {
141875
+ query?: never;
141876
+ header?: {
141877
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
141878
+ "Idempotency-Key"?: string;
141879
+ };
141880
+ path?: never;
141881
+ cookie?: never;
141882
+ };
141883
+ requestBody?: {
141884
+ content: {
141885
+ /**
141886
+ * @example {
141887
+ * "rut": "12.345.678-5",
141888
+ * "name": "Marta Rojas",
141889
+ * "external_ref": "CONTRATO-2291",
141890
+ * "schedule": {
141891
+ * "total_amount": 510000,
141892
+ * "count": 6,
141893
+ * "first_due_date": "2026-10-05"
141894
+ * }
141895
+ * }
141896
+ */
141897
+ "application/json": {
141898
+ /** Format: uuid */
141899
+ contact_id?: string;
141900
+ name?: string;
141901
+ phone?: string;
141902
+ email?: string;
141903
+ rut?: string;
141904
+ label?: string;
141905
+ external_ref?: string;
141906
+ installments?: {
141907
+ number?: number;
141908
+ amount: number;
141909
+ due_date: string;
141910
+ /** Format: uri */
141911
+ payment_link_url?: string | null;
141912
+ }[];
141913
+ schedule?: {
141914
+ total_amount: number;
141915
+ count: number;
141916
+ first_due_date: string;
141917
+ };
141918
+ };
141919
+ };
141920
+ };
141921
+ responses: {
141922
+ /** @description The plan with its cuotas */
141923
+ 201: {
141924
+ headers: {
141925
+ [name: string]: unknown;
141926
+ };
141927
+ content: {
141928
+ /**
141929
+ * @example {
141930
+ * "id": "0192f0b2-0000-7000-8000-00000000c000",
141931
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
141932
+ * "label": "Plan de cuotas",
141933
+ * "external_ref": "CONTRATO-2291",
141934
+ * "currency": "CLP",
141935
+ * "count": 6,
141936
+ * "total_amount": 510000,
141937
+ * "paid_amount": 85000,
141938
+ * "outstanding": 425000,
141939
+ * "status": "active",
141940
+ * "installments": [
141941
+ * {
141942
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
141943
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
141944
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
141945
+ * "number": 2,
141946
+ * "count": 6,
141947
+ * "amount": 85000,
141948
+ * "currency": "CLP",
141949
+ * "due_date": "2026-11-05",
141950
+ * "status": "overdue",
141951
+ * "ledger_state": "overdue",
141952
+ * "paid_amount": 0,
141953
+ * "outstanding": 85000,
141954
+ * "paid_at": null,
141955
+ * "days_overdue": 4,
141956
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
141957
+ * }
141958
+ * ],
141959
+ * "created_at": "2026-10-05T14:00:00.000Z"
141960
+ * }
141961
+ */
141962
+ "application/json": {
141963
+ data?: unknown;
141964
+ };
141965
+ };
141966
+ };
141967
+ /** @description Validation error */
141968
+ 400: {
141969
+ headers: {
141970
+ [name: string]: unknown;
141971
+ };
141972
+ content: {
141973
+ "application/json": components["schemas"]["Error"];
141974
+ };
141975
+ };
141976
+ /** @description Unauthorized */
141977
+ 401: {
141978
+ headers: {
141979
+ [name: string]: unknown;
141980
+ };
141981
+ content: {
141982
+ "application/json": components["schemas"]["Error"];
141983
+ };
141984
+ };
141985
+ /** @description Forbidden */
141986
+ 403: {
141987
+ headers: {
141988
+ [name: string]: unknown;
141989
+ };
141990
+ content: {
141991
+ "application/json": components["schemas"]["Error"];
141992
+ };
141993
+ };
141994
+ /** @description Not found */
141995
+ 404: {
141996
+ headers: {
141997
+ [name: string]: unknown;
141998
+ };
141999
+ content: {
142000
+ "application/json": components["schemas"]["Error"];
142001
+ };
142002
+ };
142003
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142004
+ 409: {
142005
+ headers: {
142006
+ [name: string]: unknown;
142007
+ };
142008
+ content: {
142009
+ "application/json": components["schemas"]["Error"];
142010
+ };
142011
+ };
142012
+ /** @description Rate limited */
142013
+ 429: {
142014
+ headers: {
142015
+ [name: string]: unknown;
142016
+ };
142017
+ content: {
142018
+ "application/json": components["schemas"]["Error"];
142019
+ };
142020
+ };
142021
+ };
142022
+ };
142023
+ delete?: never;
142024
+ options?: never;
142025
+ head?: never;
142026
+ patch?: never;
142027
+ trace?: never;
142028
+ };
142029
+ "/installment-plans/import": {
142030
+ parameters: {
142031
+ query?: never;
142032
+ header?: never;
142033
+ path?: never;
142034
+ cookie?: never;
142035
+ };
142036
+ get?: never;
142037
+ put?: never;
142038
+ /**
142039
+ * Import cuotas in bulk (JSON)
142040
+ * @description `payments:write`. One row per cuota (`external_ref`, `number`, `amount`, `due_date`, and the debtor as `contact_id` / `rut` / `phone` / `email` + `name`; optional `count`, `payment_link_url`, `label`, `paid_on`). Rows sharing an `external_ref` are one plan. **Idempotent on `external_ref`**: the same rows again change nothing; a new amount, date or link updates a cuota that is still owing; `paid_on` marks it paid; a paid cuota never moves. Up to 2000 rows. Row problems are listed in `errors` and do not stop the rest. Nothing here sends a message: a debtor who is not a contact yet is created silently (no `new_contact` trigger).
142041
+ */
142042
+ post: {
142043
+ parameters: {
142044
+ query?: never;
142045
+ header?: {
142046
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
142047
+ "Idempotency-Key"?: string;
142048
+ };
142049
+ path?: never;
142050
+ cookie?: never;
142051
+ };
142052
+ requestBody?: {
142053
+ content: {
142054
+ /**
142055
+ * @example {
142056
+ * "rows": [
142057
+ * {
142058
+ * "external_ref": "CONTRATO-2291",
142059
+ * "number": 1,
142060
+ * "count": 6,
142061
+ * "amount": 85000,
142062
+ * "due_date": "2026-10-05",
142063
+ * "rut": "12.345.678-5",
142064
+ * "name": "Marta Rojas",
142065
+ * "paid_on": "2026-10-04"
142066
+ * },
142067
+ * {
142068
+ * "external_ref": "CONTRATO-2291",
142069
+ * "number": 2,
142070
+ * "amount": 85000,
142071
+ * "due_date": "2026-11-05",
142072
+ * "rut": "12.345.678-5"
142073
+ * }
142074
+ * ]
142075
+ * }
142076
+ */
142077
+ "application/json": {
142078
+ rows: {
142079
+ /** Format: uuid */
142080
+ contact_id?: string;
142081
+ name?: string;
142082
+ phone?: string;
142083
+ email?: string;
142084
+ rut?: string;
142085
+ external_ref: string;
142086
+ number: number;
142087
+ count?: number | null;
142088
+ amount: number;
142089
+ due_date: string;
142090
+ /** Format: uri */
142091
+ payment_link_url?: string | null;
142092
+ label?: string | null;
142093
+ paid_on?: string | null;
142094
+ }[];
142095
+ };
142096
+ };
142097
+ };
142098
+ responses: {
142099
+ /** @description What the import did */
142100
+ 200: {
142101
+ headers: {
142102
+ [name: string]: unknown;
142103
+ };
142104
+ content: {
142105
+ /**
142106
+ * @example {
142107
+ * "total_rows": 6,
142108
+ * "plans_created": 1,
142109
+ * "plans_updated": 0,
142110
+ * "installments_created": 6,
142111
+ * "installments_updated": 0,
142112
+ * "installments_unchanged": 0,
142113
+ * "marked_paid": 1,
142114
+ * "contacts_created": 1,
142115
+ * "errors": []
142116
+ * }
142117
+ */
142118
+ "application/json": {
142119
+ data?: unknown;
142120
+ meta?: {
142121
+ [key: string]: unknown;
142122
+ };
142123
+ };
142124
+ };
142125
+ };
142126
+ /** @description Validation error */
142127
+ 400: {
142128
+ headers: {
142129
+ [name: string]: unknown;
142130
+ };
142131
+ content: {
142132
+ "application/json": components["schemas"]["Error"];
142133
+ };
142134
+ };
142135
+ /** @description Unauthorized */
142136
+ 401: {
142137
+ headers: {
142138
+ [name: string]: unknown;
142139
+ };
142140
+ content: {
142141
+ "application/json": components["schemas"]["Error"];
142142
+ };
142143
+ };
142144
+ /** @description Forbidden */
142145
+ 403: {
142146
+ headers: {
142147
+ [name: string]: unknown;
142148
+ };
142149
+ content: {
142150
+ "application/json": components["schemas"]["Error"];
142151
+ };
142152
+ };
142153
+ /** @description Not found */
142154
+ 404: {
142155
+ headers: {
142156
+ [name: string]: unknown;
142157
+ };
142158
+ content: {
142159
+ "application/json": components["schemas"]["Error"];
142160
+ };
142161
+ };
142162
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142163
+ 409: {
142164
+ headers: {
142165
+ [name: string]: unknown;
142166
+ };
142167
+ content: {
142168
+ "application/json": components["schemas"]["Error"];
142169
+ };
142170
+ };
142171
+ /** @description Rate limited */
142172
+ 429: {
142173
+ headers: {
142174
+ [name: string]: unknown;
142175
+ };
142176
+ content: {
142177
+ "application/json": components["schemas"]["Error"];
142178
+ };
142179
+ };
142180
+ };
142181
+ };
142182
+ delete?: never;
142183
+ options?: never;
142184
+ head?: never;
142185
+ patch?: never;
142186
+ trace?: never;
142187
+ };
142188
+ "/installment-plans/import-file": {
142189
+ parameters: {
142190
+ query?: never;
142191
+ header?: never;
142192
+ path?: never;
142193
+ cookie?: never;
142194
+ };
142195
+ get?: never;
142196
+ put?: never;
142197
+ /**
142198
+ * Import cuotas from a CSV file
142199
+ * @description `payments:write`. The same import as `POST /installment-plans/import`, from a CSV (`file`, up to 5 MB). Headers (Spanish or English): `external_ref`/`referencia`, `number`/`cuota`, `amount`/`monto`, `due_date`/`vencimiento`, and optional `count`, `rut`, `phone`/`telefono`, `email`/`correo`, `name`/`nombre`, `contact_id`, `payment_link_url`/`link_pago`, `label`, `paid_on`/`pagado_el`. Comma or semicolon separated; pesos as `$85.000`; dates as `2026-11-05` or `05/11/2026`. Nothing here sends a message: a debtor who is not a contact yet is created silently (no `new_contact` trigger).
142200
+ *
142201
+ * **Or a JSON body** (`application/json`) — what an MCP connector sends through `call_operation`, which cannot build multipart: `{ filename, content, content_encoding?, content_type? }` plus the operation's own form fields. `content` is UTF-8 text by default, or base64 when `content_encoding` is `"base64"` (images, PDF, audio, video). The same byte cap applies to the decoded bytes (413 above it); invalid base64 is a 400; the content type defaults from the filename extension.
142202
+ */
142203
+ post: {
142204
+ parameters: {
142205
+ query?: never;
142206
+ header?: {
142207
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
142208
+ "Idempotency-Key"?: string;
142209
+ };
142210
+ path?: never;
142211
+ cookie?: never;
142212
+ };
142213
+ requestBody?: {
142214
+ content: {
142215
+ /**
142216
+ * @example {
142217
+ * "file": "(binary CSV part)"
142218
+ * }
142219
+ */
142220
+ "multipart/form-data": {
142221
+ file?: unknown;
142222
+ };
142223
+ /**
142224
+ * @example {
142225
+ * "filename": "cuotas.csv",
142226
+ * "content": "external_ref,number,amount,due_date,rut,name\nCONTRATO-2291,1,85000,2026-10-05,12.345.678-5,Marta Rojas"
142227
+ * }
142228
+ */
142229
+ "application/json": {
142230
+ /** @description File name with extension; the content type defaults from it. */
142231
+ filename: string;
142232
+ /** @description The file. UTF-8 text by default; base64 when `content_encoding` is "base64" (images, PDF, audio, video). */
142233
+ content: string;
142234
+ /**
142235
+ * @description `utf8` (default) for text, `base64` for binary files.
142236
+ * @enum {string}
142237
+ */
142238
+ content_encoding?: "utf8" | "base64";
142239
+ /** @description MIME type. Defaults from the extension (.png → image/png, …). */
142240
+ content_type?: string;
142241
+ };
142242
+ };
142243
+ };
142244
+ responses: {
142245
+ /** @description What the import did */
142246
+ 200: {
142247
+ headers: {
142248
+ [name: string]: unknown;
142249
+ };
142250
+ content: {
142251
+ /**
142252
+ * @example {
142253
+ * "total_rows": 6,
142254
+ * "plans_created": 1,
142255
+ * "plans_updated": 0,
142256
+ * "installments_created": 6,
142257
+ * "installments_updated": 0,
142258
+ * "installments_unchanged": 0,
142259
+ * "marked_paid": 1,
142260
+ * "contacts_created": 1,
142261
+ * "errors": []
142262
+ * }
142263
+ */
142264
+ "application/json": {
142265
+ data?: unknown;
142266
+ meta?: {
142267
+ [key: string]: unknown;
142268
+ };
142269
+ };
142270
+ };
142271
+ };
142272
+ /** @description Validation error */
142273
+ 400: {
142274
+ headers: {
142275
+ [name: string]: unknown;
142276
+ };
142277
+ content: {
142278
+ "application/json": components["schemas"]["Error"];
142279
+ };
142280
+ };
142281
+ /** @description Unauthorized */
142282
+ 401: {
142283
+ headers: {
142284
+ [name: string]: unknown;
142285
+ };
142286
+ content: {
142287
+ "application/json": components["schemas"]["Error"];
142288
+ };
142289
+ };
142290
+ /** @description Forbidden */
142291
+ 403: {
142292
+ headers: {
142293
+ [name: string]: unknown;
142294
+ };
142295
+ content: {
142296
+ "application/json": components["schemas"]["Error"];
142297
+ };
142298
+ };
142299
+ /** @description Not found */
142300
+ 404: {
142301
+ headers: {
142302
+ [name: string]: unknown;
142303
+ };
142304
+ content: {
142305
+ "application/json": components["schemas"]["Error"];
142306
+ };
142307
+ };
142308
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142309
+ 409: {
142310
+ headers: {
142311
+ [name: string]: unknown;
142312
+ };
142313
+ content: {
142314
+ "application/json": components["schemas"]["Error"];
142315
+ };
142316
+ };
142317
+ /** @description Rate limited */
142318
+ 429: {
142319
+ headers: {
142320
+ [name: string]: unknown;
142321
+ };
142322
+ content: {
142323
+ "application/json": components["schemas"]["Error"];
142324
+ };
142325
+ };
142326
+ };
142327
+ };
142328
+ delete?: never;
142329
+ options?: never;
142330
+ head?: never;
142331
+ patch?: never;
142332
+ trace?: never;
142333
+ };
142334
+ "/installment-plans/{id}": {
142335
+ parameters: {
142336
+ query?: never;
142337
+ header?: never;
142338
+ path?: never;
142339
+ cookie?: never;
142340
+ };
142341
+ /**
142342
+ * Fetch one installment plan
142343
+ * @description `payments:read`. The plan with every cuota, its status and what is still owed.
142344
+ */
142345
+ get: {
142346
+ parameters: {
142347
+ query?: never;
142348
+ header?: never;
142349
+ path: {
142350
+ id: string;
142351
+ };
142352
+ cookie?: never;
142353
+ };
142354
+ requestBody?: never;
142355
+ responses: {
142356
+ /** @description The plan */
142357
+ 200: {
142358
+ headers: {
142359
+ [name: string]: unknown;
142360
+ };
142361
+ content: {
142362
+ /**
142363
+ * @example {
142364
+ * "id": "0192f0b2-0000-7000-8000-00000000c000",
142365
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142366
+ * "label": "Plan de cuotas",
142367
+ * "external_ref": "CONTRATO-2291",
142368
+ * "currency": "CLP",
142369
+ * "count": 6,
142370
+ * "total_amount": 510000,
142371
+ * "paid_amount": 85000,
142372
+ * "outstanding": 425000,
142373
+ * "status": "active",
142374
+ * "installments": [
142375
+ * {
142376
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
142377
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
142378
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142379
+ * "number": 2,
142380
+ * "count": 6,
142381
+ * "amount": 85000,
142382
+ * "currency": "CLP",
142383
+ * "due_date": "2026-11-05",
142384
+ * "status": "overdue",
142385
+ * "ledger_state": "overdue",
142386
+ * "paid_amount": 0,
142387
+ * "outstanding": 85000,
142388
+ * "paid_at": null,
142389
+ * "days_overdue": 4,
142390
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
142391
+ * }
142392
+ * ],
142393
+ * "created_at": "2026-10-05T14:00:00.000Z"
142394
+ * }
142395
+ */
142396
+ "application/json": {
142397
+ data?: unknown;
142398
+ meta?: {
142399
+ [key: string]: unknown;
142400
+ };
142401
+ };
142402
+ };
142403
+ };
142404
+ /** @description Validation error */
142405
+ 400: {
142406
+ headers: {
142407
+ [name: string]: unknown;
142408
+ };
142409
+ content: {
142410
+ "application/json": components["schemas"]["Error"];
142411
+ };
142412
+ };
142413
+ /** @description Unauthorized */
142414
+ 401: {
142415
+ headers: {
142416
+ [name: string]: unknown;
142417
+ };
142418
+ content: {
142419
+ "application/json": components["schemas"]["Error"];
142420
+ };
142421
+ };
142422
+ /** @description Forbidden */
142423
+ 403: {
142424
+ headers: {
142425
+ [name: string]: unknown;
142426
+ };
142427
+ content: {
142428
+ "application/json": components["schemas"]["Error"];
142429
+ };
142430
+ };
142431
+ /** @description Not found */
142432
+ 404: {
142433
+ headers: {
142434
+ [name: string]: unknown;
142435
+ };
142436
+ content: {
142437
+ "application/json": components["schemas"]["Error"];
142438
+ };
142439
+ };
142440
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142441
+ 409: {
142442
+ headers: {
142443
+ [name: string]: unknown;
142444
+ };
142445
+ content: {
142446
+ "application/json": components["schemas"]["Error"];
142447
+ };
142448
+ };
142449
+ /** @description Rate limited */
142450
+ 429: {
142451
+ headers: {
142452
+ [name: string]: unknown;
142453
+ };
142454
+ content: {
142455
+ "application/json": components["schemas"]["Error"];
142456
+ };
142457
+ };
142458
+ };
142459
+ };
142460
+ put?: never;
142461
+ post?: never;
142462
+ delete?: never;
142463
+ options?: never;
142464
+ head?: never;
142465
+ /**
142466
+ * Rename an installment plan
142467
+ * @description `payments:write`. Changes the plan label.
142468
+ */
142469
+ patch: {
142470
+ parameters: {
142471
+ query?: never;
142472
+ header?: never;
142473
+ path: {
142474
+ id: string;
142475
+ };
142476
+ cookie?: never;
142477
+ };
142478
+ requestBody?: {
142479
+ content: {
142480
+ /**
142481
+ * @example {
142482
+ * "label": "Plan matrícula 2027"
142483
+ * }
142484
+ */
142485
+ "application/json": {
142486
+ label: string;
142487
+ };
142488
+ };
142489
+ };
142490
+ responses: {
142491
+ /** @description The plan */
142492
+ 200: {
142493
+ headers: {
142494
+ [name: string]: unknown;
142495
+ };
142496
+ content: {
142497
+ /**
142498
+ * @example {
142499
+ * "id": "0192f0b2-0000-7000-8000-00000000c000",
142500
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142501
+ * "label": "Plan de cuotas",
142502
+ * "external_ref": "CONTRATO-2291",
142503
+ * "currency": "CLP",
142504
+ * "count": 6,
142505
+ * "total_amount": 510000,
142506
+ * "paid_amount": 85000,
142507
+ * "outstanding": 425000,
142508
+ * "status": "active",
142509
+ * "installments": [
142510
+ * {
142511
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
142512
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
142513
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142514
+ * "number": 2,
142515
+ * "count": 6,
142516
+ * "amount": 85000,
142517
+ * "currency": "CLP",
142518
+ * "due_date": "2026-11-05",
142519
+ * "status": "overdue",
142520
+ * "ledger_state": "overdue",
142521
+ * "paid_amount": 0,
142522
+ * "outstanding": 85000,
142523
+ * "paid_at": null,
142524
+ * "days_overdue": 4,
142525
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
142526
+ * }
142527
+ * ],
142528
+ * "created_at": "2026-10-05T14:00:00.000Z"
142529
+ * }
142530
+ */
142531
+ "application/json": {
142532
+ data?: unknown;
142533
+ meta?: {
142534
+ [key: string]: unknown;
142535
+ };
142536
+ };
142537
+ };
142538
+ };
142539
+ /** @description Validation error */
142540
+ 400: {
142541
+ headers: {
142542
+ [name: string]: unknown;
142543
+ };
142544
+ content: {
142545
+ "application/json": components["schemas"]["Error"];
142546
+ };
142547
+ };
142548
+ /** @description Unauthorized */
142549
+ 401: {
142550
+ headers: {
142551
+ [name: string]: unknown;
142552
+ };
142553
+ content: {
142554
+ "application/json": components["schemas"]["Error"];
142555
+ };
142556
+ };
142557
+ /** @description Forbidden */
142558
+ 403: {
142559
+ headers: {
142560
+ [name: string]: unknown;
142561
+ };
142562
+ content: {
142563
+ "application/json": components["schemas"]["Error"];
142564
+ };
142565
+ };
142566
+ /** @description Not found */
142567
+ 404: {
142568
+ headers: {
142569
+ [name: string]: unknown;
142570
+ };
142571
+ content: {
142572
+ "application/json": components["schemas"]["Error"];
142573
+ };
142574
+ };
142575
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142576
+ 409: {
142577
+ headers: {
142578
+ [name: string]: unknown;
142579
+ };
142580
+ content: {
142581
+ "application/json": components["schemas"]["Error"];
142582
+ };
142583
+ };
142584
+ /** @description Rate limited */
142585
+ 429: {
142586
+ headers: {
142587
+ [name: string]: unknown;
142588
+ };
142589
+ content: {
142590
+ "application/json": components["schemas"]["Error"];
142591
+ };
142592
+ };
142593
+ };
142594
+ };
142595
+ trace?: never;
142596
+ };
142597
+ "/installment-plans/{id}/cancel": {
142598
+ parameters: {
142599
+ query?: never;
142600
+ header?: never;
142601
+ path?: never;
142602
+ cookie?: never;
142603
+ };
142604
+ get?: never;
142605
+ put?: never;
142606
+ /**
142607
+ * Cancel an installment plan
142608
+ * @description `payments:write`. Cancels every cuota still owing (money already paid stays) and ends the person's collection sequence. Needs a `reason`.
142609
+ */
142610
+ post: {
142611
+ parameters: {
142612
+ query?: never;
142613
+ header?: {
142614
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
142615
+ "Idempotency-Key"?: string;
142616
+ };
142617
+ path: {
142618
+ id: string;
142619
+ };
142620
+ cookie?: never;
142621
+ };
142622
+ requestBody?: {
142623
+ content: {
142624
+ /**
142625
+ * @example {
142626
+ * "reason": "Se refinanció la deuda"
142627
+ * }
142628
+ */
142629
+ "application/json": {
142630
+ reason: string;
142631
+ };
142632
+ };
142633
+ };
142634
+ responses: {
142635
+ /** @description The plan */
142636
+ 200: {
142637
+ headers: {
142638
+ [name: string]: unknown;
142639
+ };
142640
+ content: {
142641
+ /**
142642
+ * @example {
142643
+ * "id": "0192f0b2-0000-7000-8000-00000000c000",
142644
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142645
+ * "label": "Plan de cuotas",
142646
+ * "external_ref": "CONTRATO-2291",
142647
+ * "currency": "CLP",
142648
+ * "count": 6,
142649
+ * "total_amount": 510000,
142650
+ * "paid_amount": 85000,
142651
+ * "outstanding": 425000,
142652
+ * "status": "active",
142653
+ * "installments": [
142654
+ * {
142655
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
142656
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
142657
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142658
+ * "number": 2,
142659
+ * "count": 6,
142660
+ * "amount": 85000,
142661
+ * "currency": "CLP",
142662
+ * "due_date": "2026-11-05",
142663
+ * "status": "overdue",
142664
+ * "ledger_state": "overdue",
142665
+ * "paid_amount": 0,
142666
+ * "outstanding": 85000,
142667
+ * "paid_at": null,
142668
+ * "days_overdue": 4,
142669
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
142670
+ * }
142671
+ * ],
142672
+ * "created_at": "2026-10-05T14:00:00.000Z"
142673
+ * }
142674
+ */
142675
+ "application/json": {
142676
+ data?: unknown;
142677
+ meta?: {
142678
+ [key: string]: unknown;
142679
+ };
142680
+ };
142681
+ };
142682
+ };
142683
+ /** @description Validation error */
142684
+ 400: {
142685
+ headers: {
142686
+ [name: string]: unknown;
142687
+ };
142688
+ content: {
142689
+ "application/json": components["schemas"]["Error"];
142690
+ };
142691
+ };
142692
+ /** @description Unauthorized */
142693
+ 401: {
142694
+ headers: {
142695
+ [name: string]: unknown;
142696
+ };
142697
+ content: {
142698
+ "application/json": components["schemas"]["Error"];
142699
+ };
142700
+ };
142701
+ /** @description Forbidden */
142702
+ 403: {
142703
+ headers: {
142704
+ [name: string]: unknown;
142705
+ };
142706
+ content: {
142707
+ "application/json": components["schemas"]["Error"];
142708
+ };
142709
+ };
142710
+ /** @description Not found */
142711
+ 404: {
142712
+ headers: {
142713
+ [name: string]: unknown;
142714
+ };
142715
+ content: {
142716
+ "application/json": components["schemas"]["Error"];
142717
+ };
142718
+ };
142719
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142720
+ 409: {
142721
+ headers: {
142722
+ [name: string]: unknown;
142723
+ };
142724
+ content: {
142725
+ "application/json": components["schemas"]["Error"];
142726
+ };
142727
+ };
142728
+ /** @description Rate limited */
142729
+ 429: {
142730
+ headers: {
142731
+ [name: string]: unknown;
142732
+ };
142733
+ content: {
142734
+ "application/json": components["schemas"]["Error"];
142735
+ };
142736
+ };
142737
+ };
142738
+ };
142739
+ delete?: never;
142740
+ options?: never;
142741
+ head?: never;
142742
+ patch?: never;
142743
+ trace?: never;
142744
+ };
142745
+ "/installments": {
142746
+ parameters: {
142747
+ query?: never;
142748
+ header?: never;
142749
+ path?: never;
142750
+ cookie?: never;
142751
+ };
142752
+ /**
142753
+ * List cuotas
142754
+ * @description `payments:read`. Cuotas across plans. `status` is `pending`, `paid`, `overdue` (past the due day and still owing) or `cancelled`; it is derived from payments, so filtering on it reads a bounded window of 500. Filter by `contact_id` or `plan_id`.
142755
+ */
142756
+ get: {
142757
+ parameters: {
142758
+ query?: {
142759
+ contact_id?: string;
142760
+ plan_id?: string;
142761
+ status?: "pending" | "paid" | "overdue" | "cancelled";
142762
+ limit?: number;
142763
+ offset?: number | null;
142764
+ };
142765
+ header?: never;
142766
+ path?: never;
142767
+ cookie?: never;
142768
+ };
142769
+ requestBody?: never;
142770
+ responses: {
142771
+ /** @description Cuotas */
142772
+ 200: {
142773
+ headers: {
142774
+ [name: string]: unknown;
142775
+ };
142776
+ content: {
142777
+ /**
142778
+ * @example [
142779
+ * {
142780
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
142781
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
142782
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142783
+ * "number": 2,
142784
+ * "count": 6,
142785
+ * "amount": 85000,
142786
+ * "currency": "CLP",
142787
+ * "due_date": "2026-11-05",
142788
+ * "status": "overdue",
142789
+ * "ledger_state": "overdue",
142790
+ * "paid_amount": 0,
142791
+ * "outstanding": 85000,
142792
+ * "paid_at": null,
142793
+ * "days_overdue": 4,
142794
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
142795
+ * }
142796
+ * ]
142797
+ */
142798
+ "application/json": {
142799
+ data?: unknown;
142800
+ meta?: {
142801
+ [key: string]: unknown;
142802
+ };
142803
+ };
142804
+ };
142805
+ };
142806
+ /** @description Validation error */
142807
+ 400: {
142808
+ headers: {
142809
+ [name: string]: unknown;
142810
+ };
142811
+ content: {
142812
+ "application/json": components["schemas"]["Error"];
142813
+ };
142814
+ };
142815
+ /** @description Unauthorized */
142816
+ 401: {
142817
+ headers: {
142818
+ [name: string]: unknown;
142819
+ };
142820
+ content: {
142821
+ "application/json": components["schemas"]["Error"];
142822
+ };
142823
+ };
142824
+ /** @description Forbidden */
142825
+ 403: {
142826
+ headers: {
142827
+ [name: string]: unknown;
142828
+ };
142829
+ content: {
142830
+ "application/json": components["schemas"]["Error"];
142831
+ };
142832
+ };
142833
+ /** @description Not found */
142834
+ 404: {
142835
+ headers: {
142836
+ [name: string]: unknown;
142837
+ };
142838
+ content: {
142839
+ "application/json": components["schemas"]["Error"];
142840
+ };
142841
+ };
142842
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142843
+ 409: {
142844
+ headers: {
142845
+ [name: string]: unknown;
142846
+ };
142847
+ content: {
142848
+ "application/json": components["schemas"]["Error"];
142849
+ };
142850
+ };
142851
+ /** @description Rate limited */
142852
+ 429: {
142853
+ headers: {
142854
+ [name: string]: unknown;
142855
+ };
142856
+ content: {
142857
+ "application/json": components["schemas"]["Error"];
142858
+ };
142859
+ };
142860
+ };
142861
+ };
142862
+ put?: never;
142863
+ post?: never;
142864
+ delete?: never;
142865
+ options?: never;
142866
+ head?: never;
142867
+ patch?: never;
142868
+ trace?: never;
142869
+ };
142870
+ "/installments/{id}": {
142871
+ parameters: {
142872
+ query?: never;
142873
+ header?: never;
142874
+ path?: never;
142875
+ cookie?: never;
142876
+ };
142877
+ /**
142878
+ * Fetch one cuota
142879
+ * @description `payments:read`. One cuota with its status, what is owed and its payment link.
142880
+ */
142881
+ get: {
142882
+ parameters: {
142883
+ query?: never;
142884
+ header?: never;
142885
+ path: {
142886
+ id: string;
142887
+ };
142888
+ cookie?: never;
142889
+ };
142890
+ requestBody?: never;
142891
+ responses: {
142892
+ /** @description The cuota */
142893
+ 200: {
142894
+ headers: {
142895
+ [name: string]: unknown;
142896
+ };
142897
+ content: {
142898
+ /**
142899
+ * @example {
142900
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
142901
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
142902
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
142903
+ * "number": 2,
142904
+ * "count": 6,
142905
+ * "amount": 85000,
142906
+ * "currency": "CLP",
142907
+ * "due_date": "2026-11-05",
142908
+ * "status": "overdue",
142909
+ * "ledger_state": "overdue",
142910
+ * "paid_amount": 0,
142911
+ * "outstanding": 85000,
142912
+ * "paid_at": null,
142913
+ * "days_overdue": 4,
142914
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
142915
+ * }
142916
+ */
142917
+ "application/json": {
142918
+ data?: unknown;
142919
+ meta?: {
142920
+ [key: string]: unknown;
142921
+ };
142922
+ };
142923
+ };
142924
+ };
142925
+ /** @description Validation error */
142926
+ 400: {
142927
+ headers: {
142928
+ [name: string]: unknown;
142929
+ };
142930
+ content: {
142931
+ "application/json": components["schemas"]["Error"];
142932
+ };
142933
+ };
142934
+ /** @description Unauthorized */
142935
+ 401: {
142936
+ headers: {
142937
+ [name: string]: unknown;
142938
+ };
142939
+ content: {
142940
+ "application/json": components["schemas"]["Error"];
142941
+ };
142942
+ };
142943
+ /** @description Forbidden */
142944
+ 403: {
142945
+ headers: {
142946
+ [name: string]: unknown;
142947
+ };
142948
+ content: {
142949
+ "application/json": components["schemas"]["Error"];
142950
+ };
142951
+ };
142952
+ /** @description Not found */
142953
+ 404: {
142954
+ headers: {
142955
+ [name: string]: unknown;
142956
+ };
142957
+ content: {
142958
+ "application/json": components["schemas"]["Error"];
142959
+ };
142960
+ };
142961
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142962
+ 409: {
142963
+ headers: {
142964
+ [name: string]: unknown;
142965
+ };
142966
+ content: {
142967
+ "application/json": components["schemas"]["Error"];
142968
+ };
142969
+ };
142970
+ /** @description Rate limited */
142971
+ 429: {
142972
+ headers: {
142973
+ [name: string]: unknown;
142974
+ };
142975
+ content: {
142976
+ "application/json": components["schemas"]["Error"];
142977
+ };
142978
+ };
142979
+ };
142980
+ };
142981
+ put?: never;
142982
+ post?: never;
142983
+ delete?: never;
142984
+ options?: never;
142985
+ head?: never;
142986
+ /**
142987
+ * Change a cuota
142988
+ * @description `payments:write`. Amount, due date and/or the payment link. Amount and date only while the cuota is open; changes are audited with `reason`. `payment_link_url: null` removes the link.
142989
+ */
142990
+ patch: {
142991
+ parameters: {
142992
+ query?: never;
142993
+ header?: never;
142994
+ path: {
142995
+ id: string;
142996
+ };
142997
+ cookie?: never;
142998
+ };
142999
+ requestBody?: {
143000
+ content: {
143001
+ /**
143002
+ * @example {
143003
+ * "due_date": "2026-11-20",
143004
+ * "reason": "Pidió más plazo"
143005
+ * }
143006
+ */
143007
+ "application/json": {
143008
+ amount?: number;
143009
+ due_date?: string;
143010
+ /** Format: uri */
143011
+ payment_link_url?: string | null;
143012
+ reason?: string;
143013
+ };
143014
+ };
143015
+ };
143016
+ responses: {
143017
+ /** @description The cuota */
143018
+ 200: {
143019
+ headers: {
143020
+ [name: string]: unknown;
143021
+ };
143022
+ content: {
143023
+ /**
143024
+ * @example {
143025
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
143026
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
143027
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
143028
+ * "number": 2,
143029
+ * "count": 6,
143030
+ * "amount": 85000,
143031
+ * "currency": "CLP",
143032
+ * "due_date": "2026-11-05",
143033
+ * "status": "overdue",
143034
+ * "ledger_state": "overdue",
143035
+ * "paid_amount": 0,
143036
+ * "outstanding": 85000,
143037
+ * "paid_at": null,
143038
+ * "days_overdue": 4,
143039
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
143040
+ * }
143041
+ */
143042
+ "application/json": {
143043
+ data?: unknown;
143044
+ meta?: {
143045
+ [key: string]: unknown;
143046
+ };
143047
+ };
143048
+ };
143049
+ };
143050
+ /** @description Validation error */
143051
+ 400: {
143052
+ headers: {
143053
+ [name: string]: unknown;
143054
+ };
143055
+ content: {
143056
+ "application/json": components["schemas"]["Error"];
143057
+ };
143058
+ };
143059
+ /** @description Unauthorized */
143060
+ 401: {
143061
+ headers: {
143062
+ [name: string]: unknown;
143063
+ };
143064
+ content: {
143065
+ "application/json": components["schemas"]["Error"];
143066
+ };
143067
+ };
143068
+ /** @description Forbidden */
143069
+ 403: {
143070
+ headers: {
143071
+ [name: string]: unknown;
143072
+ };
143073
+ content: {
143074
+ "application/json": components["schemas"]["Error"];
143075
+ };
143076
+ };
143077
+ /** @description Not found */
143078
+ 404: {
143079
+ headers: {
143080
+ [name: string]: unknown;
143081
+ };
143082
+ content: {
143083
+ "application/json": components["schemas"]["Error"];
143084
+ };
143085
+ };
143086
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
143087
+ 409: {
143088
+ headers: {
143089
+ [name: string]: unknown;
143090
+ };
143091
+ content: {
143092
+ "application/json": components["schemas"]["Error"];
143093
+ };
143094
+ };
143095
+ /** @description Rate limited */
143096
+ 429: {
143097
+ headers: {
143098
+ [name: string]: unknown;
143099
+ };
143100
+ content: {
143101
+ "application/json": components["schemas"]["Error"];
143102
+ };
143103
+ };
143104
+ };
143105
+ };
143106
+ trace?: never;
143107
+ };
143108
+ "/installments/{id}/mark-paid": {
143109
+ parameters: {
143110
+ query?: never;
143111
+ header?: never;
143112
+ path?: never;
143113
+ cookie?: never;
143114
+ };
143115
+ get?: never;
143116
+ put?: never;
143117
+ /**
143118
+ * Mark a cuota paid
143119
+ * @description `payments:write`. Records a payment for what is still owed on the cuota (`instrument` default `otro`, `paid_on` default today) and ends the person's collection sequence with the goal met. Already paid: nothing changes. A cancelled cuota answers 409.
143120
+ */
143121
+ post: {
143122
+ parameters: {
143123
+ query?: never;
143124
+ header?: {
143125
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
143126
+ "Idempotency-Key"?: string;
143127
+ };
143128
+ path: {
143129
+ id: string;
143130
+ };
143131
+ cookie?: never;
143132
+ };
143133
+ requestBody?: {
143134
+ content: {
143135
+ /**
143136
+ * @example {
143137
+ * "paid_on": "2026-11-09",
143138
+ * "instrument": "transferencia"
143139
+ * }
143140
+ */
143141
+ "application/json": {
143142
+ paid_on?: string;
143143
+ /** @enum {string} */
143144
+ instrument?: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc" | "flow" | "khipu" | "bancame";
143145
+ note?: string;
143146
+ };
143147
+ };
143148
+ };
143149
+ responses: {
143150
+ /** @description The cuota */
143151
+ 200: {
143152
+ headers: {
143153
+ [name: string]: unknown;
143154
+ };
143155
+ content: {
143156
+ /**
143157
+ * @example {
143158
+ * "id": "0192f0b2-0000-7000-8000-00000000c001",
143159
+ * "plan_id": "0192f0b2-0000-7000-8000-00000000c000",
143160
+ * "contact_id": "0192f0b2-0000-7000-8000-00000000a001",
143161
+ * "number": 2,
143162
+ * "count": 6,
143163
+ * "amount": 85000,
143164
+ * "currency": "CLP",
143165
+ * "due_date": "2026-11-05",
143166
+ * "status": "paid",
143167
+ * "ledger_state": "overdue",
143168
+ * "paid_amount": 0,
143169
+ * "outstanding": 85000,
143170
+ * "paid_at": null,
143171
+ * "days_overdue": 4,
143172
+ * "payment_link_url": "https://pagos.ejemplo.cl/c/8842"
143173
+ * }
143174
+ */
143175
+ "application/json": {
143176
+ data?: unknown;
143177
+ meta?: {
143178
+ [key: string]: unknown;
143179
+ };
143180
+ };
143181
+ };
143182
+ };
143183
+ /** @description Validation error */
143184
+ 400: {
143185
+ headers: {
143186
+ [name: string]: unknown;
143187
+ };
143188
+ content: {
143189
+ "application/json": components["schemas"]["Error"];
143190
+ };
143191
+ };
143192
+ /** @description Unauthorized */
143193
+ 401: {
143194
+ headers: {
143195
+ [name: string]: unknown;
143196
+ };
143197
+ content: {
143198
+ "application/json": components["schemas"]["Error"];
143199
+ };
143200
+ };
143201
+ /** @description Forbidden */
143202
+ 403: {
143203
+ headers: {
143204
+ [name: string]: unknown;
143205
+ };
143206
+ content: {
143207
+ "application/json": components["schemas"]["Error"];
143208
+ };
143209
+ };
143210
+ /** @description Not found */
143211
+ 404: {
143212
+ headers: {
143213
+ [name: string]: unknown;
143214
+ };
143215
+ content: {
143216
+ "application/json": components["schemas"]["Error"];
143217
+ };
143218
+ };
143219
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
143220
+ 409: {
143221
+ headers: {
143222
+ [name: string]: unknown;
143223
+ };
143224
+ content: {
143225
+ "application/json": components["schemas"]["Error"];
143226
+ };
143227
+ };
143228
+ /** @description Rate limited */
143229
+ 429: {
143230
+ headers: {
143231
+ [name: string]: unknown;
143232
+ };
143233
+ content: {
143234
+ "application/json": components["schemas"]["Error"];
143235
+ };
143236
+ };
143237
+ };
143238
+ };
143239
+ delete?: never;
143240
+ options?: never;
143241
+ head?: never;
143242
+ patch?: never;
143243
+ trace?: never;
143244
+ };
141737
143245
  "/payment-links/options": {
141738
143246
  parameters: {
141739
143247
  query?: never;
@@ -165236,6 +166744,7 @@ interface paths {
165236
166744
  * "label": "Agenda visita"
165237
166745
  * },
165238
166746
  * "agent_id": null,
166747
+ * "collection": false,
165239
166748
  * "priority": 4,
165240
166749
  * "situations": [],
165241
166750
  * "steps": [
@@ -165676,6 +167185,7 @@ interface paths {
165676
167185
  * "label": "Agenda visita"
165677
167186
  * },
165678
167187
  * "agent_id": null,
167188
+ * "collection": false,
165679
167189
  * "priority": 4,
165680
167190
  * "situations": [],
165681
167191
  * "steps": [
@@ -167088,6 +168598,7 @@ interface paths {
167088
168598
  * "label": "Agenda visita"
167089
168599
  * },
167090
168600
  * "agent_id": null,
168601
+ * "collection": false,
167091
168602
  * "priority": 4,
167092
168603
  * "situations": [],
167093
168604
  * "steps": [
@@ -167528,6 +169039,7 @@ interface paths {
167528
169039
  * "label": "Agenda visita"
167529
169040
  * },
167530
169041
  * "agent_id": null,
169042
+ * "collection": false,
167531
169043
  * "priority": 4,
167532
169044
  * "situations": [],
167533
169045
  * "steps": [
@@ -167872,7 +169384,7 @@ interface paths {
167872
169384
  put?: never;
167873
169385
  /**
167874
169386
  * Simulate what one customer will receive
167875
- * @description Walks «Si no responde» for ONE person: a real `contact_id` or a test `persona` (`has_whatsapp`, `has_email` optional, `opted_out`), from the moment our last message went out (`last_message_at`), with what the customer does (`behavior`: `never_replies`, `replies_after_step`; `pays` and `promises_date` are collections behaviors and are no-ops for sequences without payment steps). Returns the `timeline` (each step with the moment the ladder draws it, `planned_at`, and the moment the engine really sends it after contact hours and pacing, `shifted_at`, with `shift_reason`, a `preview` when a stored draft or approved template exists, and a `status`) and the real `end` reason: replied, end_of_sequence, marked_lost, no_fitting_approved_message, no_channel_left, message_limit_reached or opted_out. It is the same simulation `GET /followups/recontacto/plan` renders, so it follows the engine’s rules (contact hours from 9:00, the 24 h WhatsApp window, per-person limits, opt-out). Deterministic: no model call, nothing is sent or stored. `version` is `published` (default), `draft` (the open draft, `GET /sequences/{id}/draft`) or a version id (`GET /sequences/{id}/versions`). `builtin:si-no-responde` and custom sequences are simulable (a custom sequence walks its own steps through the same engine rules; steps timed before an appointment are listed in `notes`). Custom sequences with conditions, waits until and loops follow the scenario: `replies_after_step` → the `yes` branch of «¿Respondió?» (a reply ends the sequence only when its goal is a reply), `pays` → «¿Pagó?», `promises_date` → «Esperar hasta la fecha prometida» ends that day; `decisions` (`{step key or id: branch key}`) picks any condition’s branch, and «La IA decide» is never called here (without a decision it takes its first branch). The response then carries `path` (every step passed, the branch taken, loop laps) and timeline entries met again in a loop carry `iteration`. Requires `followups:read`.
169387
+ * @description Walks «Si no responde» for ONE person: a real `contact_id` or a test `persona` (`has_whatsapp`, `has_email` optional, `opted_out`), from the moment our last message went out (`last_message_at`), with what the customer does (`behavior`: `never_replies`, `replies_after_step`; `pays` and `promises_date` are collections behaviors and are no-ops for sequences without payment steps). AI call steps end as `call_outcomes` says (`{step_id: outcome}`, default `no_answer`; nothing is called and no model runs). Returns the `timeline` (each step with the moment the ladder draws it, `planned_at`, and the moment the engine really sends it after contact hours and pacing, `shifted_at`, with `shift_reason`, a `preview` when a stored draft or approved template exists, and a `status`) and the real `end` reason: replied, end_of_sequence, marked_lost, no_fitting_approved_message, no_channel_left, message_limit_reached or opted_out. It is the same simulation `GET /followups/recontacto/plan` renders, so it follows the engine’s rules (contact hours from 9:00, the 24 h WhatsApp window, per-person limits, opt-out). Deterministic: no model call, nothing is sent or stored. `version` is `published` (default), `draft` (the open draft, `GET /sequences/{id}/draft`) or a version id (`GET /sequences/{id}/versions`). `builtin:si-no-responde` and custom sequences are simulable (a custom sequence walks its own steps through the same engine rules; steps timed before an appointment are listed in `notes`). Custom sequences with conditions, waits until and loops follow the scenario: `replies_after_step` → the `yes` branch of «¿Respondió?» (a reply ends the sequence only when its goal is a reply), `pays` → «¿Pagó?», `promises_date` → «Esperar hasta la fecha prometida» ends that day; `decisions` (`{step key or id: branch key}`) picks any condition’s branch, and «La IA decide» is never called here (without a decision it takes its first branch). The response then carries `path` (every step passed, the branch taken, loop laps) and timeline entries met again in a loop carry `iteration`. Requires `followups:read`.
167876
169388
  */
167877
169389
  post: {
167878
169390
  parameters: {
@@ -172271,162 +173783,699 @@ interface paths {
172271
173783
  };
172272
173784
  };
172273
173785
  };
172274
- options?: never;
172275
- head?: never;
172276
- patch?: never;
172277
- trace?: never;
172278
- };
172279
- "/sequences/{id}/draft/diff": {
172280
- parameters: {
172281
- query?: never;
172282
- header?: never;
172283
- path?: never;
172284
- cookie?: never;
172285
- };
173786
+ options?: never;
173787
+ head?: never;
173788
+ patch?: never;
173789
+ trace?: never;
173790
+ };
173791
+ "/sequences/{id}/draft/diff": {
173792
+ parameters: {
173793
+ query?: never;
173794
+ header?: never;
173795
+ path?: never;
173796
+ cookie?: never;
173797
+ };
173798
+ /**
173799
+ * What publishing the draft would change
173800
+ * @description Every change of the draft against the published version: `field` (`steps.stalled-2.wait`, `situations.lost.enabled`, `settings.pacing.max_per_day`), `before`, `after`, and `people_affected_now`: the people at that step (or in that situation, or in the sequence) right now. For a built-in the published version is what its engine reads today. 404 when there is no draft. Requires `followups:read`.
173801
+ */
173802
+ get: {
173803
+ parameters: {
173804
+ query?: {
173805
+ lang?: "es" | "en";
173806
+ };
173807
+ header?: never;
173808
+ path: {
173809
+ id: string;
173810
+ };
173811
+ cookie?: never;
173812
+ };
173813
+ requestBody?: never;
173814
+ responses: {
173815
+ /** @description The changes */
173816
+ 200: {
173817
+ headers: {
173818
+ [name: string]: unknown;
173819
+ };
173820
+ content: {
173821
+ /**
173822
+ * @example {
173823
+ * "data": {
173824
+ * "sequence_id": "dd63825c-cb16-553d-90cc-6cb4fa694ce8",
173825
+ * "version_id": "0192f0a1-7c3e-7b2a-9d4e-5f6a7b8c9d0e",
173826
+ * "base_version": 1,
173827
+ * "change_count": 1,
173828
+ * "changes": [
173829
+ * {
173830
+ * "kind": "changed",
173831
+ * "field": "steps.stalled-2.wait",
173832
+ * "step_key": "stalled-2",
173833
+ * "situation": "conversed",
173834
+ * "before": {
173835
+ * "value": 3,
173836
+ * "unit": "days"
173837
+ * },
173838
+ * "after": {
173839
+ * "value": 2,
173840
+ * "unit": "days"
173841
+ * },
173842
+ * "people_affected_now": 12
173843
+ * }
173844
+ * ]
173845
+ * }
173846
+ * }
173847
+ */
173848
+ "application/json": {
173849
+ data: components["schemas"]["SequenceDraftDiff"];
173850
+ };
173851
+ };
173852
+ };
173853
+ /** @description Validation error */
173854
+ 400: {
173855
+ headers: {
173856
+ [name: string]: unknown;
173857
+ };
173858
+ content: {
173859
+ "application/json": components["schemas"]["Error"];
173860
+ };
173861
+ };
173862
+ /** @description Unauthorized */
173863
+ 401: {
173864
+ headers: {
173865
+ [name: string]: unknown;
173866
+ };
173867
+ content: {
173868
+ "application/json": components["schemas"]["Error"];
173869
+ };
173870
+ };
173871
+ /** @description Forbidden */
173872
+ 403: {
173873
+ headers: {
173874
+ [name: string]: unknown;
173875
+ };
173876
+ content: {
173877
+ "application/json": components["schemas"]["Error"];
173878
+ };
173879
+ };
173880
+ /** @description Not found */
173881
+ 404: {
173882
+ headers: {
173883
+ [name: string]: unknown;
173884
+ };
173885
+ content: {
173886
+ "application/json": components["schemas"]["Error"];
173887
+ };
173888
+ };
173889
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
173890
+ 409: {
173891
+ headers: {
173892
+ [name: string]: unknown;
173893
+ };
173894
+ content: {
173895
+ "application/json": components["schemas"]["Error"];
173896
+ };
173897
+ };
173898
+ /** @description Rate limited */
173899
+ 429: {
173900
+ headers: {
173901
+ [name: string]: unknown;
173902
+ };
173903
+ content: {
173904
+ "application/json": components["schemas"]["Error"];
173905
+ };
173906
+ };
173907
+ };
173908
+ };
173909
+ put?: never;
173910
+ post?: never;
173911
+ delete?: never;
173912
+ options?: never;
173913
+ head?: never;
173914
+ patch?: never;
173915
+ trace?: never;
173916
+ };
173917
+ "/sequences/{id}/draft/validation": {
173918
+ parameters: {
173919
+ query?: never;
173920
+ header?: never;
173921
+ path?: never;
173922
+ cookie?: never;
173923
+ };
173924
+ /**
173925
+ * What blocks publishing the draft
173926
+ * @description Checks the open draft the way publishing does. `blockers` stop `POST /sequences/{id}/publish`; `warnings` do not. Each problem has a machine-readable `code`, the `step_id` it is about (null for the whole draft), a Spanish `message` and a `fix`: `kind` is `draft_template` (have the AI write the missing WhatsApp template: `POST /followups/recontacto/template-draft`), `connect_channel`, `request_review`, `remove_step`, `change_channel`, `pick_agent` or `contact_support`, with a `target` (the same vocabulary as notifications) when there is a screen for it. Blocker codes: `no_fitting_approved_template` (a WhatsApp step past the 24 h window with no approved template Vitrina can fill), `channel_not_connected` (WhatsApp, email, Instagram), `step_type_unavailable` (a channel the workspace cannot use yet, e.g. SMS), `agent_unavailable` (the chosen AI agent is no longer active), `agent_not_supported` (an agent set on «Al llegar» or «Avisos»), `review_required`. Warning codes: `instagram_past_24h`, `whatsapp_past_24h_without_template`. Steps that never send (mode `skip`, a situation switched off) are not checked. Never calls a model. 404 when there is no draft. Requires `followups:read`.
173927
+ */
173928
+ get: {
173929
+ parameters: {
173930
+ query?: {
173931
+ lang?: "es" | "en";
173932
+ };
173933
+ header?: never;
173934
+ path: {
173935
+ id: string;
173936
+ };
173937
+ cookie?: never;
173938
+ };
173939
+ requestBody?: never;
173940
+ responses: {
173941
+ /** @description The problems */
173942
+ 200: {
173943
+ headers: {
173944
+ [name: string]: unknown;
173945
+ };
173946
+ content: {
173947
+ /**
173948
+ * @example {
173949
+ * "data": {
173950
+ * "blockers": [
173951
+ * {
173952
+ * "code": "no_fitting_approved_template",
173953
+ * "step_id": "stalled-2",
173954
+ * "message": "Este paso escribe pasadas las 24 horas y para eso necesita una plantilla de WhatsApp aprobada. Todavía no hay ninguna que sirva.",
173955
+ * "fix": {
173956
+ * "kind": "draft_template",
173957
+ * "target": {
173958
+ * "kind": "page",
173959
+ * "page": "settings.templates"
173960
+ * }
173961
+ * }
173962
+ * }
173963
+ * ],
173964
+ * "warnings": [
173965
+ * {
173966
+ * "code": "instagram_past_24h",
173967
+ * "step_id": "stalled-3",
173968
+ * "message": "Instagram solo deja escribir dentro de las 24 horas desde el último mensaje del cliente. Este paso no se enviará pasado ese plazo.",
173969
+ * "fix": {
173970
+ * "kind": "change_channel"
173971
+ * }
173972
+ * }
173973
+ * ]
173974
+ * }
173975
+ * }
173976
+ */
173977
+ "application/json": {
173978
+ data: components["schemas"]["SequenceDraftValidation"];
173979
+ };
173980
+ };
173981
+ };
173982
+ /** @description Validation error */
173983
+ 400: {
173984
+ headers: {
173985
+ [name: string]: unknown;
173986
+ };
173987
+ content: {
173988
+ "application/json": components["schemas"]["Error"];
173989
+ };
173990
+ };
173991
+ /** @description Unauthorized */
173992
+ 401: {
173993
+ headers: {
173994
+ [name: string]: unknown;
173995
+ };
173996
+ content: {
173997
+ "application/json": components["schemas"]["Error"];
173998
+ };
173999
+ };
174000
+ /** @description Forbidden */
174001
+ 403: {
174002
+ headers: {
174003
+ [name: string]: unknown;
174004
+ };
174005
+ content: {
174006
+ "application/json": components["schemas"]["Error"];
174007
+ };
174008
+ };
174009
+ /** @description Not found */
174010
+ 404: {
174011
+ headers: {
174012
+ [name: string]: unknown;
174013
+ };
174014
+ content: {
174015
+ "application/json": components["schemas"]["Error"];
174016
+ };
174017
+ };
174018
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
174019
+ 409: {
174020
+ headers: {
174021
+ [name: string]: unknown;
174022
+ };
174023
+ content: {
174024
+ "application/json": components["schemas"]["Error"];
174025
+ };
174026
+ };
174027
+ /** @description Rate limited */
174028
+ 429: {
174029
+ headers: {
174030
+ [name: string]: unknown;
174031
+ };
174032
+ content: {
174033
+ "application/json": components["schemas"]["Error"];
174034
+ };
174035
+ };
174036
+ };
174037
+ };
174038
+ put?: never;
174039
+ post?: never;
174040
+ delete?: never;
174041
+ options?: never;
174042
+ head?: never;
174043
+ patch?: never;
174044
+ trace?: never;
174045
+ };
174046
+ "/sequences/collection-rules": {
174047
+ parameters: {
174048
+ query?: never;
174049
+ header?: never;
174050
+ path?: never;
174051
+ cookie?: never;
174052
+ };
174053
+ /**
174054
+ * Collection rules of the workspace
174055
+ * @description The days, hours and caps collection sequences obey on top of the shared guards (contact hours, per-person limits): `weekdays`, the `hours` window, `calls_per_day`, `calls_per_week`, `messages_per_week`, `min_spacing_hours` and `over_cap` (`skip` or `move`). The defaults are the limits of Ley 19.496 art. 37 (Ley 21.320) and CPC art. 59: Monday to Saturday except holidays, 08:00 to 20:00, one call per week, two messages per week at least 48 h apart. `ceilings` are those legal limits: a workspace may be stricter, never looser. `version` is 0 until the rules are saved. Requires `followups:read`.
174056
+ */
174057
+ get: {
174058
+ parameters: {
174059
+ query?: never;
174060
+ header?: never;
174061
+ path?: never;
174062
+ cookie?: never;
174063
+ };
174064
+ requestBody?: never;
174065
+ responses: {
174066
+ /** @description The rules */
174067
+ 200: {
174068
+ headers: {
174069
+ [name: string]: unknown;
174070
+ };
174071
+ content: {
174072
+ /**
174073
+ * @example {
174074
+ * "data": {
174075
+ * "rules": {
174076
+ * "weekdays": [
174077
+ * 1,
174078
+ * 2,
174079
+ * 3,
174080
+ * 4,
174081
+ * 5,
174082
+ * 6
174083
+ * ],
174084
+ * "hours": {
174085
+ * "start": "08:00",
174086
+ * "end": "20:00"
174087
+ * },
174088
+ * "skip_holidays": true,
174089
+ * "calls_per_day": 1,
174090
+ * "calls_per_week": 1,
174091
+ * "messages_per_week": 2,
174092
+ * "min_spacing_hours": 48,
174093
+ * "over_cap": "skip"
174094
+ * },
174095
+ * "version": 3,
174096
+ * "is_default": false,
174097
+ * "updated_at": "2027-03-02T14:20:00.000Z",
174098
+ * "updated_by": {
174099
+ * "kind": "user",
174100
+ * "id": "0192f0b2-0000-7000-8000-00000000a001"
174101
+ * },
174102
+ * "ceilings": {
174103
+ * "weekdays": [
174104
+ * 1,
174105
+ * 2,
174106
+ * 3,
174107
+ * 4,
174108
+ * 5,
174109
+ * 6
174110
+ * ],
174111
+ * "hours": {
174112
+ * "start": "08:00",
174113
+ * "end": "20:00"
174114
+ * },
174115
+ * "calls_per_day": 1,
174116
+ * "calls_per_week": 1,
174117
+ * "messages_per_week": 2,
174118
+ * "min_spacing_hours": 48
174119
+ * }
174120
+ * }
174121
+ * }
174122
+ */
174123
+ "application/json": {
174124
+ data: components["schemas"]["CollectionRulesView"];
174125
+ };
174126
+ };
174127
+ };
174128
+ /** @description Validation error */
174129
+ 400: {
174130
+ headers: {
174131
+ [name: string]: unknown;
174132
+ };
174133
+ content: {
174134
+ "application/json": components["schemas"]["Error"];
174135
+ };
174136
+ };
174137
+ /** @description Unauthorized */
174138
+ 401: {
174139
+ headers: {
174140
+ [name: string]: unknown;
174141
+ };
174142
+ content: {
174143
+ "application/json": components["schemas"]["Error"];
174144
+ };
174145
+ };
174146
+ /** @description Forbidden */
174147
+ 403: {
174148
+ headers: {
174149
+ [name: string]: unknown;
174150
+ };
174151
+ content: {
174152
+ "application/json": components["schemas"]["Error"];
174153
+ };
174154
+ };
174155
+ /** @description Not found */
174156
+ 404: {
174157
+ headers: {
174158
+ [name: string]: unknown;
174159
+ };
174160
+ content: {
174161
+ "application/json": components["schemas"]["Error"];
174162
+ };
174163
+ };
174164
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
174165
+ 409: {
174166
+ headers: {
174167
+ [name: string]: unknown;
174168
+ };
174169
+ content: {
174170
+ "application/json": components["schemas"]["Error"];
174171
+ };
174172
+ };
174173
+ /** @description Rate limited */
174174
+ 429: {
174175
+ headers: {
174176
+ [name: string]: unknown;
174177
+ };
174178
+ content: {
174179
+ "application/json": components["schemas"]["Error"];
174180
+ };
174181
+ };
174182
+ };
174183
+ };
174184
+ /**
174185
+ * Replace the collection rules
174186
+ * @description Replaces the rules (fields left out take the platform defaults). 422 `VALIDATION_ERROR` with `details.problems` when a value is looser than the law allows. A real change raises `version`, which makes every recorded legal review outdated: collection sequences need a new review before they publish again. Saving the rules already in force changes nothing. Requires `followups:write`.
174187
+ */
174188
+ put: {
174189
+ parameters: {
174190
+ query?: never;
174191
+ header?: never;
174192
+ path?: never;
174193
+ cookie?: never;
174194
+ };
174195
+ requestBody: {
174196
+ content: {
174197
+ /**
174198
+ * @example {
174199
+ * "messages_per_week": 1,
174200
+ * "hours": {
174201
+ * "start": "09:00",
174202
+ * "end": "19:00"
174203
+ * }
174204
+ * }
174205
+ */
174206
+ "application/json": components["schemas"]["CollectionRulesReplaceRequest"];
174207
+ };
174208
+ };
174209
+ responses: {
174210
+ /** @description The rules */
174211
+ 200: {
174212
+ headers: {
174213
+ [name: string]: unknown;
174214
+ };
174215
+ content: {
174216
+ /**
174217
+ * @example {
174218
+ * "data": {
174219
+ * "rules": {
174220
+ * "weekdays": [
174221
+ * 1,
174222
+ * 2,
174223
+ * 3,
174224
+ * 4,
174225
+ * 5,
174226
+ * 6
174227
+ * ],
174228
+ * "hours": {
174229
+ * "start": "09:00",
174230
+ * "end": "19:00"
174231
+ * },
174232
+ * "skip_holidays": true,
174233
+ * "calls_per_day": 1,
174234
+ * "calls_per_week": 1,
174235
+ * "messages_per_week": 1,
174236
+ * "min_spacing_hours": 48,
174237
+ * "over_cap": "skip"
174238
+ * },
174239
+ * "version": 3,
174240
+ * "is_default": false,
174241
+ * "updated_at": "2027-03-02T14:20:00.000Z",
174242
+ * "updated_by": {
174243
+ * "kind": "user",
174244
+ * "id": "0192f0b2-0000-7000-8000-00000000a001"
174245
+ * },
174246
+ * "ceilings": {
174247
+ * "weekdays": [
174248
+ * 1,
174249
+ * 2,
174250
+ * 3,
174251
+ * 4,
174252
+ * 5,
174253
+ * 6
174254
+ * ],
174255
+ * "hours": {
174256
+ * "start": "08:00",
174257
+ * "end": "20:00"
174258
+ * },
174259
+ * "calls_per_day": 1,
174260
+ * "calls_per_week": 1,
174261
+ * "messages_per_week": 2,
174262
+ * "min_spacing_hours": 48
174263
+ * }
174264
+ * }
174265
+ * }
174266
+ */
174267
+ "application/json": {
174268
+ data: components["schemas"]["CollectionRulesView"];
174269
+ };
174270
+ };
174271
+ };
174272
+ /** @description Validation error */
174273
+ 400: {
174274
+ headers: {
174275
+ [name: string]: unknown;
174276
+ };
174277
+ content: {
174278
+ "application/json": components["schemas"]["Error"];
174279
+ };
174280
+ };
174281
+ /** @description Unauthorized */
174282
+ 401: {
174283
+ headers: {
174284
+ [name: string]: unknown;
174285
+ };
174286
+ content: {
174287
+ "application/json": components["schemas"]["Error"];
174288
+ };
174289
+ };
174290
+ /** @description Forbidden */
174291
+ 403: {
174292
+ headers: {
174293
+ [name: string]: unknown;
174294
+ };
174295
+ content: {
174296
+ "application/json": components["schemas"]["Error"];
174297
+ };
174298
+ };
174299
+ /** @description Not found */
174300
+ 404: {
174301
+ headers: {
174302
+ [name: string]: unknown;
174303
+ };
174304
+ content: {
174305
+ "application/json": components["schemas"]["Error"];
174306
+ };
174307
+ };
174308
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
174309
+ 409: {
174310
+ headers: {
174311
+ [name: string]: unknown;
174312
+ };
174313
+ content: {
174314
+ "application/json": components["schemas"]["Error"];
174315
+ };
174316
+ };
174317
+ /** @description Rate limited */
174318
+ 429: {
174319
+ headers: {
174320
+ [name: string]: unknown;
174321
+ };
174322
+ content: {
174323
+ "application/json": components["schemas"]["Error"];
174324
+ };
174325
+ };
174326
+ };
174327
+ };
174328
+ post?: never;
174329
+ delete?: never;
174330
+ options?: never;
174331
+ head?: never;
174332
+ patch?: never;
174333
+ trace?: never;
174334
+ };
174335
+ "/sequences/{id}/legal-review": {
174336
+ parameters: {
174337
+ query?: never;
174338
+ header?: never;
174339
+ path?: never;
174340
+ cookie?: never;
174341
+ };
174342
+ /**
174343
+ * Where the legal review of a collection sequence stands
174344
+ * @description `status`: `not_required` (not a collection sequence), `missing`, `valid` (recorded against the current rules version) or `outdated` (the rules changed since). `review` is the newest recorded one. Publishing a collection sequence is refused with `review_required` unless the status is `valid`. Requires `followups:read`.
174345
+ */
174346
+ get: {
174347
+ parameters: {
174348
+ query?: never;
174349
+ header?: never;
174350
+ path: {
174351
+ id: string;
174352
+ };
174353
+ cookie?: never;
174354
+ };
174355
+ requestBody?: never;
174356
+ responses: {
174357
+ /** @description The review state */
174358
+ 200: {
174359
+ headers: {
174360
+ [name: string]: unknown;
174361
+ };
174362
+ content: {
174363
+ /**
174364
+ * @example {
174365
+ * "data": {
174366
+ * "sequence_id": "0192f0b2-0000-7000-8000-00000000c001",
174367
+ * "required": true,
174368
+ * "status": "valid",
174369
+ * "rules_version": 3,
174370
+ * "review": {
174371
+ * "id": "0192f0b2-0000-7000-8000-00000000d001",
174372
+ * "reviewer_member_id": "0192f0b2-0000-7000-8000-00000000a002",
174373
+ * "reviewed_on": "2027-03-02",
174374
+ * "note": "Revisado con la abogada del estudio",
174375
+ * "attachment_url": "https://docs.ejemplo.cl/opinion-legal.pdf",
174376
+ * "rules_version": 3,
174377
+ * "created_at": "2027-03-02T14:25:00.000Z",
174378
+ * "created_by": {
174379
+ * "kind": "user",
174380
+ * "id": "0192f0b2-0000-7000-8000-00000000a001"
174381
+ * }
174382
+ * }
174383
+ * }
174384
+ * }
174385
+ */
174386
+ "application/json": {
174387
+ data: components["schemas"]["SequenceLegalReview"];
174388
+ };
174389
+ };
174390
+ };
174391
+ /** @description Validation error */
174392
+ 400: {
174393
+ headers: {
174394
+ [name: string]: unknown;
174395
+ };
174396
+ content: {
174397
+ "application/json": components["schemas"]["Error"];
174398
+ };
174399
+ };
174400
+ /** @description Unauthorized */
174401
+ 401: {
174402
+ headers: {
174403
+ [name: string]: unknown;
174404
+ };
174405
+ content: {
174406
+ "application/json": components["schemas"]["Error"];
174407
+ };
174408
+ };
174409
+ /** @description Forbidden */
174410
+ 403: {
174411
+ headers: {
174412
+ [name: string]: unknown;
174413
+ };
174414
+ content: {
174415
+ "application/json": components["schemas"]["Error"];
174416
+ };
174417
+ };
174418
+ /** @description Not found */
174419
+ 404: {
174420
+ headers: {
174421
+ [name: string]: unknown;
174422
+ };
174423
+ content: {
174424
+ "application/json": components["schemas"]["Error"];
174425
+ };
174426
+ };
174427
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
174428
+ 409: {
174429
+ headers: {
174430
+ [name: string]: unknown;
174431
+ };
174432
+ content: {
174433
+ "application/json": components["schemas"]["Error"];
174434
+ };
174435
+ };
174436
+ /** @description Rate limited */
174437
+ 429: {
174438
+ headers: {
174439
+ [name: string]: unknown;
174440
+ };
174441
+ content: {
174442
+ "application/json": components["schemas"]["Error"];
174443
+ };
174444
+ };
174445
+ };
174446
+ };
174447
+ put?: never;
172286
174448
  /**
172287
- * What publishing the draft would change
172288
- * @description Every change of the draft against the published version: `field` (`steps.stalled-2.wait`, `situations.lost.enabled`, `settings.pacing.max_per_day`), `before`, `after`, and `people_affected_now`: the people at that step (or in that situation, or in the sequence) right now. For a built-in the published version is what its engine reads today. 404 when there is no draft. Requires `followups:read`.
174449
+ * Record the legal review of a collection sequence
174450
+ * @description Records who reviewed the sequence and the rules (`reviewer_member_id`, `reviewed_on`, a `note` and/or an `attachment_url`) against the current rules version, which clears the `review_required` blocker. Append-only: the history is kept. 422 for a sequence that is not a collection sequence; 409 `rules_version_stale` when `rules_version` is no longer current. Requires `followups:write`.
172289
174451
  */
172290
- get: {
174452
+ post: {
172291
174453
  parameters: {
172292
- query?: {
172293
- lang?: "es" | "en";
174454
+ query?: never;
174455
+ header?: {
174456
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
174457
+ "Idempotency-Key"?: string;
172294
174458
  };
172295
- header?: never;
172296
174459
  path: {
172297
174460
  id: string;
172298
174461
  };
172299
174462
  cookie?: never;
172300
174463
  };
172301
- requestBody?: never;
172302
- responses: {
172303
- /** @description The changes */
172304
- 200: {
172305
- headers: {
172306
- [name: string]: unknown;
172307
- };
172308
- content: {
172309
- /**
172310
- * @example {
172311
- * "data": {
172312
- * "sequence_id": "dd63825c-cb16-553d-90cc-6cb4fa694ce8",
172313
- * "version_id": "0192f0a1-7c3e-7b2a-9d4e-5f6a7b8c9d0e",
172314
- * "base_version": 1,
172315
- * "change_count": 1,
172316
- * "changes": [
172317
- * {
172318
- * "kind": "changed",
172319
- * "field": "steps.stalled-2.wait",
172320
- * "step_key": "stalled-2",
172321
- * "situation": "conversed",
172322
- * "before": {
172323
- * "value": 3,
172324
- * "unit": "days"
172325
- * },
172326
- * "after": {
172327
- * "value": 2,
172328
- * "unit": "days"
172329
- * },
172330
- * "people_affected_now": 12
172331
- * }
172332
- * ]
172333
- * }
172334
- * }
172335
- */
172336
- "application/json": {
172337
- data: components["schemas"]["SequenceDraftDiff"];
172338
- };
172339
- };
172340
- };
172341
- /** @description Validation error */
172342
- 400: {
172343
- headers: {
172344
- [name: string]: unknown;
172345
- };
172346
- content: {
172347
- "application/json": components["schemas"]["Error"];
172348
- };
172349
- };
172350
- /** @description Unauthorized */
172351
- 401: {
172352
- headers: {
172353
- [name: string]: unknown;
172354
- };
172355
- content: {
172356
- "application/json": components["schemas"]["Error"];
172357
- };
172358
- };
172359
- /** @description Forbidden */
172360
- 403: {
172361
- headers: {
172362
- [name: string]: unknown;
172363
- };
172364
- content: {
172365
- "application/json": components["schemas"]["Error"];
172366
- };
172367
- };
172368
- /** @description Not found */
172369
- 404: {
172370
- headers: {
172371
- [name: string]: unknown;
172372
- };
172373
- content: {
172374
- "application/json": components["schemas"]["Error"];
172375
- };
172376
- };
172377
- /** @description Conflict (incl. Idempotency-Key reuse with different body) */
172378
- 409: {
172379
- headers: {
172380
- [name: string]: unknown;
172381
- };
172382
- content: {
172383
- "application/json": components["schemas"]["Error"];
172384
- };
172385
- };
172386
- /** @description Rate limited */
172387
- 429: {
172388
- headers: {
172389
- [name: string]: unknown;
172390
- };
172391
- content: {
172392
- "application/json": components["schemas"]["Error"];
172393
- };
172394
- };
172395
- };
172396
- };
172397
- put?: never;
172398
- post?: never;
172399
- delete?: never;
172400
- options?: never;
172401
- head?: never;
172402
- patch?: never;
172403
- trace?: never;
172404
- };
172405
- "/sequences/{id}/draft/validation": {
172406
- parameters: {
172407
- query?: never;
172408
- header?: never;
172409
- path?: never;
172410
- cookie?: never;
172411
- };
172412
- /**
172413
- * What blocks publishing the draft
172414
- * @description Checks the open draft the way publishing does. `blockers` stop `POST /sequences/{id}/publish`; `warnings` do not. Each problem has a machine-readable `code`, the `step_id` it is about (null for the whole draft), a Spanish `message` and a `fix`: `kind` is `draft_template` (have the AI write the missing WhatsApp template: `POST /followups/recontacto/template-draft`), `connect_channel`, `request_review`, `remove_step`, `change_channel`, `pick_agent` or `contact_support`, with a `target` (the same vocabulary as notifications) when there is a screen for it. Blocker codes: `no_fitting_approved_template` (a WhatsApp step past the 24 h window with no approved template Vitrina can fill), `channel_not_connected` (WhatsApp, email, Instagram), `step_type_unavailable` (a channel the workspace cannot use yet, e.g. SMS), `agent_unavailable` (the chosen AI agent is no longer active), `agent_not_supported` (an agent set on «Al llegar» or «Avisos»), `review_required`. Warning codes: `instagram_past_24h`, `whatsapp_past_24h_without_template`. Steps that never send (mode `skip`, a situation switched off) are not checked. Never calls a model. 404 when there is no draft. Requires `followups:read`.
172415
- */
172416
- get: {
172417
- parameters: {
172418
- query?: {
172419
- lang?: "es" | "en";
172420
- };
172421
- header?: never;
172422
- path: {
172423
- id: string;
174464
+ requestBody: {
174465
+ content: {
174466
+ /**
174467
+ * @example {
174468
+ * "reviewer_member_id": "0192f0b2-0000-7000-8000-00000000a002",
174469
+ * "reviewed_on": "2027-03-02",
174470
+ * "note": "Revisado con la abogada del estudio",
174471
+ * "attachment_url": "https://docs.ejemplo.cl/opinion-legal.pdf"
174472
+ * }
174473
+ */
174474
+ "application/json": components["schemas"]["SequenceLegalReviewRequest"];
172424
174475
  };
172425
- cookie?: never;
172426
174476
  };
172427
- requestBody?: never;
172428
174477
  responses: {
172429
- /** @description The problems */
174478
+ /** @description The review state */
172430
174479
  200: {
172431
174480
  headers: {
172432
174481
  [name: string]: unknown;
@@ -172435,35 +174484,28 @@ interface paths {
172435
174484
  /**
172436
174485
  * @example {
172437
174486
  * "data": {
172438
- * "blockers": [
172439
- * {
172440
- * "code": "no_fitting_approved_template",
172441
- * "step_id": "stalled-2",
172442
- * "message": "Este paso escribe pasadas las 24 horas y para eso necesita una plantilla de WhatsApp aprobada. Todavía no hay ninguna que sirva.",
172443
- * "fix": {
172444
- * "kind": "draft_template",
172445
- * "target": {
172446
- * "kind": "page",
172447
- * "page": "settings.templates"
172448
- * }
172449
- * }
172450
- * }
172451
- * ],
172452
- * "warnings": [
172453
- * {
172454
- * "code": "instagram_past_24h",
172455
- * "step_id": "stalled-3",
172456
- * "message": "Instagram solo deja escribir dentro de las 24 horas desde el último mensaje del cliente. Este paso no se enviará pasado ese plazo.",
172457
- * "fix": {
172458
- * "kind": "change_channel"
172459
- * }
174487
+ * "sequence_id": "0192f0b2-0000-7000-8000-00000000c001",
174488
+ * "required": true,
174489
+ * "status": "valid",
174490
+ * "rules_version": 3,
174491
+ * "review": {
174492
+ * "id": "0192f0b2-0000-7000-8000-00000000d001",
174493
+ * "reviewer_member_id": "0192f0b2-0000-7000-8000-00000000a002",
174494
+ * "reviewed_on": "2027-03-02",
174495
+ * "note": "Revisado con la abogada del estudio",
174496
+ * "attachment_url": "https://docs.ejemplo.cl/opinion-legal.pdf",
174497
+ * "rules_version": 3,
174498
+ * "created_at": "2027-03-02T14:25:00.000Z",
174499
+ * "created_by": {
174500
+ * "kind": "user",
174501
+ * "id": "0192f0b2-0000-7000-8000-00000000a001"
172460
174502
  * }
172461
- * ]
174503
+ * }
172462
174504
  * }
172463
174505
  * }
172464
174506
  */
172465
174507
  "application/json": {
172466
- data: components["schemas"]["SequenceDraftValidation"];
174508
+ data: components["schemas"]["SequenceLegalReview"];
172467
174509
  };
172468
174510
  };
172469
174511
  };
@@ -172523,8 +174565,6 @@ interface paths {
172523
174565
  };
172524
174566
  };
172525
174567
  };
172526
- put?: never;
172527
- post?: never;
172528
174568
  delete?: never;
172529
174569
  options?: never;
172530
174570
  head?: never;
@@ -281733,10 +283773,10 @@ interface components {
281733
283773
  } | null;
281734
283774
  at_hours: number | null;
281735
283775
  /**
281736
- * @description `replied` (the customer wrote since our last message), `paid` (unavailable until app#6456), `booked` (an appointment since entering), `ai_decides` (the sequence agent picks a branch; `default_branch` on failure). The fixed tests have exactly the branches `yes` and `no`.
283776
+ * @description `replied` (the customer wrote since our last message), `paid` (unavailable until app#6456), `booked` (an appointment since entering), `ai_decides` (the sequence agent picks a branch; `default_branch` on failure). `call_outcome` (how the latest AI call step ended: one branch per outcome answered | promised_pay | promised_visit | call_later | no_answer | do_not_contact, 2 to 6, the branch key is the outcome; `default_branch` for an outcome with no branch). The fixed tests (replied, paid, booked) have exactly the branches `yes` and `no`.
281737
283777
  * @enum {string}
281738
283778
  */
281739
- test: "replied" | "paid" | "booked" | "ai_decides";
283779
+ test: "replied" | "paid" | "booked" | "ai_decides" | "call_outcome";
281740
283780
  ai_prompt: string | null;
281741
283781
  branches: components["schemas"]["SequenceBranch"][];
281742
283782
  default_branch: string | null;
@@ -281922,13 +283962,22 @@ interface components {
281922
283962
  type: "event";
281923
283963
  /** @enum {string} */
281924
283964
  event: "lead_arrived" | "customer_went_quiet" | "customer_asked_reminder" | "stage_changed" | "quoted_not_booked" | "appointment_booked" | "signed_up_not_bought" | "installment_overdue";
281925
- filters: {
283965
+ filters: ({
281926
283966
  /** @description Custom sequences filter on `interest`, `source`, `stage` (stage id) or `tag` (tag name). */
281927
283967
  field: string;
281928
283968
  /** @enum {string} */
281929
283969
  op: "in";
281930
283970
  values: string[];
281931
- }[];
283971
+ } | {
283972
+ /**
283973
+ * @description Only for the `installment_overdue` entry: `days_overdue` (days past the due day) or `amount` (pesos still owed), at least `value`.
283974
+ * @enum {string}
283975
+ */
283976
+ field: "days_overdue" | "amount";
283977
+ /** @enum {string} */
283978
+ op: "gte";
283979
+ value: number;
283980
+ })[];
281932
283981
  } | {
281933
283982
  /** @enum {string} */
281934
283983
  type: "list";
@@ -281942,6 +283991,8 @@ interface components {
281942
283991
  };
281943
283992
  /** Format: uuid */
281944
283993
  agent_id: string | null;
283994
+ /** @description A collection sequence (Cobranza): it obeys the workspace’s collection rules (`GET /sequences/collection-rules`) and needs a recorded legal review to publish (`POST /sequences/{id}/legal-review`). True for the «Cobranza de cuotas» template, an entry of `installment_overdue` or a goal of `pays`. */
283995
+ collection: boolean;
281945
283996
  priority: number;
281946
283997
  situations: {
281947
283998
  key: string;
@@ -282004,6 +284055,11 @@ interface components {
282004
284055
  updated_at: string;
282005
284056
  } | null;
282006
284057
  };
284058
+ /**
284059
+ * @description AI call steps only: the outcome the scenario supplied (default no_answer).
284060
+ * @enum {string}
284061
+ */
284062
+ SequenceCallOutcome: "answered" | "promised_pay" | "promised_visit" | "call_later" | "no_answer" | "do_not_contact";
282007
284063
  SequenceSimulation: {
282008
284064
  timeline: {
282009
284065
  /** Format: uuid */
@@ -282016,16 +284072,22 @@ interface components {
282016
284072
  /** Format: date-time */
282017
284073
  shifted_at: string;
282018
284074
  /** @enum {string} */
282019
- shift_reason?: "outside_contact_hours" | "previous_late" | "unanswered_hold" | "agreed_reminder" | "min_gap" | "max_per_day" | "automated_gap" | "person_ceiling" | "appointment_soon" | "daily_cap";
284075
+ shift_reason?: "outside_contact_hours" | "previous_late" | "unanswered_hold" | "agreed_reminder" | "min_gap" | "max_per_day" | "automated_gap" | "person_ceiling" | "appointment_soon" | "daily_cap" | "non_collection_day" | "holiday" | "outside_collection_hours" | "min_spacing" | "calls_per_day" | "calls_per_week" | "messages_per_week";
284076
+ /**
284077
+ * @description Why the collection rules skipped the step (status `skipped_by_collection_rules`).
284078
+ * @enum {string}
284079
+ */
284080
+ skip_reason?: "non_collection_day" | "holiday" | "outside_collection_hours" | "min_spacing" | "calls_per_day" | "calls_per_week" | "messages_per_week";
282020
284081
  preview?: string;
284082
+ call_outcome?: components["schemas"]["SequenceCallOutcome"];
282021
284083
  /** @enum {string} */
282022
- status: "sends" | "awaits_approval" | "skipped_no_channel" | "skipped_no_template";
284084
+ status: "sends" | "awaits_approval" | "skipped_no_channel" | "skipped_no_template" | "skipped_by_collection_rules";
282023
284085
  /** @description Custom sequences: 2 on the first lap back through a loop, 3 on the next (absent = first pass). */
282024
284086
  iteration?: number;
282025
284087
  }[];
282026
284088
  end: {
282027
284089
  /** @enum {string} */
282028
- reason: "replied" | "end_of_sequence" | "marked_lost" | "no_fitting_approved_message" | "no_channel_left" | "message_limit_reached" | "opted_out";
284090
+ reason: "replied" | "paid" | "end_of_sequence" | "marked_lost" | "no_fitting_approved_message" | "no_channel_left" | "blocked_by_collection_rules" | "message_limit_reached" | "opted_out";
282029
284091
  /** Format: uuid */
282030
284092
  at_step?: string;
282031
284093
  /** Format: date-time */
@@ -282090,6 +284152,10 @@ interface components {
282090
284152
  };
282091
284153
  /** @description `published` (default), `draft` (the open draft) or a version id from `GET /sequences/{id}/versions`. */
282092
284154
  version?: string;
284155
+ /** @description AI call steps: how each call ends in this scenario, keyed by step id. A call step not named ends `no_answer`. Nothing is called and no model runs; `do_not_contact` ends the walk at that call. */
284156
+ call_outcomes?: {
284157
+ [key: string]: components["schemas"]["SequenceCallOutcome"] & unknown;
284158
+ };
282093
284159
  /** @description Custom sequences: the branch each condition takes, `{ <step key or step id>: <branch key> }`. «La IA decide» is never called in a simulation; without an entry it takes its first branch. Other conditions follow `behavior` unless listed here. */
282094
284160
  decisions?: {
282095
284161
  [key: string]: string;
@@ -282223,10 +284289,10 @@ interface components {
282223
284289
  hours: number;
282224
284290
  };
282225
284291
  /**
282226
- * @description `replied` (the customer wrote since our last message), `paid` (unavailable until app#6456), `booked` (an appointment since entering), `ai_decides` (the sequence agent picks a branch; `default_branch` on failure). The fixed tests have exactly the branches `yes` and `no`.
284292
+ * @description `replied` (the customer wrote since our last message), `paid` (unavailable until app#6456), `booked` (an appointment since entering), `ai_decides` (the sequence agent picks a branch; `default_branch` on failure). `call_outcome` (how the latest AI call step ended: one branch per outcome answered | promised_pay | promised_visit | call_later | no_answer | do_not_contact, 2 to 6, the branch key is the outcome; `default_branch` for an outcome with no branch). The fixed tests (replied, paid, booked) have exactly the branches `yes` and `no`.
282227
284293
  * @enum {string}
282228
284294
  */
282229
- test: "replied" | "paid" | "booked" | "ai_decides";
284295
+ test: "replied" | "paid" | "booked" | "ai_decides" | "call_outcome";
282230
284296
  /** @default null */
282231
284297
  ai_prompt: string | null;
282232
284298
  branches: components["schemas"]["SequenceBranch"][];
@@ -282272,13 +284338,22 @@ interface components {
282272
284338
  type: "event";
282273
284339
  /** @enum {string} */
282274
284340
  event: "lead_arrived" | "customer_went_quiet" | "customer_asked_reminder" | "stage_changed" | "quoted_not_booked" | "appointment_booked" | "signed_up_not_bought" | "installment_overdue";
282275
- filters: {
284341
+ filters: ({
282276
284342
  /** @description Custom sequences filter on `interest`, `source`, `stage` (stage id) or `tag` (tag name). */
282277
284343
  field: string;
282278
284344
  /** @enum {string} */
282279
284345
  op: "in";
282280
284346
  values: string[];
282281
- }[];
284347
+ } | {
284348
+ /**
284349
+ * @description Only for the `installment_overdue` entry: `days_overdue` (days past the due day) or `amount` (pesos still owed), at least `value`.
284350
+ * @enum {string}
284351
+ */
284352
+ field: "days_overdue" | "amount";
284353
+ /** @enum {string} */
284354
+ op: "gte";
284355
+ value: number;
284356
+ })[];
282282
284357
  } | {
282283
284358
  /** @enum {string} */
282284
284359
  type: "list";
@@ -282291,6 +284366,8 @@ interface components {
282291
284366
  };
282292
284367
  /** Format: uuid */
282293
284368
  agent_id: string | null;
284369
+ /** @description Mark the sequence as a collection sequence. Optional (false when left out); an entry of `installment_overdue` or a goal of `pays` makes it one anyway. */
284370
+ collection?: boolean;
282294
284371
  priority: number;
282295
284372
  situations: {
282296
284373
  key: string;
@@ -282466,6 +284543,105 @@ interface components {
282466
284543
  blockers: components["schemas"]["SequenceValidationProblem"][];
282467
284544
  warnings: components["schemas"]["SequenceValidationProblem"][];
282468
284545
  };
284546
+ CollectionRules: {
284547
+ /** @description Days collection may contact, ISO (1 = Monday … 7 = Sunday). Sunday is never allowed. */
284548
+ weekdays: number[];
284549
+ /** @description Local window (workspace time zone), start inclusive, end exclusive. */
284550
+ hours: {
284551
+ start: string;
284552
+ end: string;
284553
+ };
284554
+ /** @description National public holidays never allow a contact. Must be true. */
284555
+ skip_holidays: boolean;
284556
+ calls_per_day: number;
284557
+ calls_per_week: number;
284558
+ messages_per_week: number;
284559
+ min_spacing_hours: number;
284560
+ /**
284561
+ * @description `skip` drops a step that would go over a cap; `move` pushes it to the next week.
284562
+ * @enum {string}
284563
+ */
284564
+ over_cap: "skip" | "move";
284565
+ };
284566
+ CollectionRulesView: {
284567
+ rules: components["schemas"]["CollectionRules"];
284568
+ /** @description 0 = the platform defaults, never saved. Goes up on every real change; a legal review names the version it reviewed. */
284569
+ version: number;
284570
+ is_default: boolean;
284571
+ updated_at: string | null;
284572
+ updated_by: {
284573
+ kind: string | null;
284574
+ id: string | null;
284575
+ via?: string | null;
284576
+ } | null;
284577
+ ceilings: {
284578
+ weekdays: number[];
284579
+ hours: {
284580
+ start: string;
284581
+ end: string;
284582
+ };
284583
+ calls_per_day: number;
284584
+ calls_per_week: number;
284585
+ messages_per_week: number;
284586
+ min_spacing_hours: number;
284587
+ };
284588
+ };
284589
+ CollectionRulesReplaceRequest: {
284590
+ /** @description Days collection may contact, ISO (1 = Monday … 7 = Sunday). Sunday is never allowed. */
284591
+ weekdays?: number[];
284592
+ /** @description Local window (workspace time zone), start inclusive, end exclusive. */
284593
+ hours?: {
284594
+ start: string;
284595
+ end: string;
284596
+ };
284597
+ /** @description National public holidays never allow a contact. Must be true. */
284598
+ skip_holidays?: boolean;
284599
+ calls_per_day?: number;
284600
+ calls_per_week?: number;
284601
+ messages_per_week?: number;
284602
+ min_spacing_hours?: number;
284603
+ /**
284604
+ * @description `skip` drops a step that would go over a cap; `move` pushes it to the next week.
284605
+ * @enum {string}
284606
+ */
284607
+ over_cap?: "skip" | "move";
284608
+ };
284609
+ SequenceLegalReview: {
284610
+ /** Format: uuid */
284611
+ sequence_id: string;
284612
+ /** @description True for a collection sequence. */
284613
+ required: boolean;
284614
+ /** @enum {string} */
284615
+ status: "not_required" | "missing" | "valid" | "outdated";
284616
+ rules_version: number;
284617
+ review: {
284618
+ /** Format: uuid */
284619
+ id: string;
284620
+ /** Format: uuid */
284621
+ reviewer_member_id: string;
284622
+ reviewed_on: string;
284623
+ note: string | null;
284624
+ attachment_url: string | null;
284625
+ rules_version: number;
284626
+ created_at: string;
284627
+ created_by: {
284628
+ kind: string | null;
284629
+ id: string | null;
284630
+ via?: string | null;
284631
+ } | null;
284632
+ } | null;
284633
+ };
284634
+ SequenceLegalReviewRequest: {
284635
+ /** Format: uuid */
284636
+ reviewer_member_id: string;
284637
+ /** @description Day of the review (YYYY-MM-DD). Default today; not in the future. */
284638
+ reviewed_on?: string;
284639
+ note?: string | null;
284640
+ /** Format: uri */
284641
+ attachment_url?: string | null;
284642
+ /** @description The rules version the reviewer looked at. 409 `rules_version_stale` when the rules changed since; default the current version. */
284643
+ rules_version?: number;
284644
+ };
282469
284645
  SequencePublishResult: {
282470
284646
  /** Format: uuid */
282471
284647
  sequence_id: string;
@@ -282513,13 +284689,22 @@ interface components {
282513
284689
  type: "event";
282514
284690
  /** @enum {string} */
282515
284691
  event: "lead_arrived" | "customer_went_quiet" | "customer_asked_reminder" | "stage_changed" | "quoted_not_booked" | "appointment_booked" | "signed_up_not_bought" | "installment_overdue";
282516
- filters: {
284692
+ filters: ({
282517
284693
  /** @description Custom sequences filter on `interest`, `source`, `stage` (stage id) or `tag` (tag name). */
282518
284694
  field: string;
282519
284695
  /** @enum {string} */
282520
284696
  op: "in";
282521
284697
  values: string[];
282522
- }[];
284698
+ } | {
284699
+ /**
284700
+ * @description Only for the `installment_overdue` entry: `days_overdue` (days past the due day) or `amount` (pesos still owed), at least `value`.
284701
+ * @enum {string}
284702
+ */
284703
+ field: "days_overdue" | "amount";
284704
+ /** @enum {string} */
284705
+ op: "gte";
284706
+ value: number;
284707
+ })[];
282523
284708
  } | {
282524
284709
  /** @enum {string} */
282525
284710
  type: "list";
@@ -282647,13 +284832,22 @@ interface components {
282647
284832
  type: "event";
282648
284833
  /** @enum {string} */
282649
284834
  event: "lead_arrived" | "customer_went_quiet" | "customer_asked_reminder" | "stage_changed" | "quoted_not_booked" | "appointment_booked" | "signed_up_not_bought" | "installment_overdue";
282650
- filters: {
284835
+ filters: ({
282651
284836
  /** @description Custom sequences filter on `interest`, `source`, `stage` (stage id) or `tag` (tag name). */
282652
284837
  field: string;
282653
284838
  /** @enum {string} */
282654
284839
  op: "in";
282655
284840
  values: string[];
282656
- }[];
284841
+ } | {
284842
+ /**
284843
+ * @description Only for the `installment_overdue` entry: `days_overdue` (days past the due day) or `amount` (pesos still owed), at least `value`.
284844
+ * @enum {string}
284845
+ */
284846
+ field: "days_overdue" | "amount";
284847
+ /** @enum {string} */
284848
+ op: "gte";
284849
+ value: number;
284850
+ })[];
282657
284851
  } | {
282658
284852
  /** @enum {string} */
282659
284853
  type: "list";
@@ -282678,13 +284872,22 @@ interface components {
282678
284872
  type: "event";
282679
284873
  /** @enum {string} */
282680
284874
  event: "lead_arrived" | "customer_went_quiet" | "customer_asked_reminder" | "stage_changed" | "quoted_not_booked" | "appointment_booked" | "signed_up_not_bought" | "installment_overdue";
282681
- filters: {
284875
+ filters: ({
282682
284876
  /** @description Custom sequences filter on `interest`, `source`, `stage` (stage id) or `tag` (tag name). */
282683
284877
  field: string;
282684
284878
  /** @enum {string} */
282685
284879
  op: "in";
282686
284880
  values: string[];
282687
- }[];
284881
+ } | {
284882
+ /**
284883
+ * @description Only for the `installment_overdue` entry: `days_overdue` (days past the due day) or `amount` (pesos still owed), at least `value`.
284884
+ * @enum {string}
284885
+ */
284886
+ field: "days_overdue" | "amount";
284887
+ /** @enum {string} */
284888
+ op: "gte";
284889
+ value: number;
284890
+ })[];
282688
284891
  } | {
282689
284892
  /** @enum {string} */
282690
284893
  type: "list";