@vitrina/api 17.116.0 → 17.118.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 +2927 -438
  2. package/dist/index.d.ts +2927 -438
  3. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -86890,6 +86890,7 @@ interface paths {
86890
86890
  * "kind": "gasto",
86891
86891
  * "behavior": "fijo",
86892
86892
  * "no_document": false,
86893
+ * "tax_role": "other_deductible",
86893
86894
  * "position": 2,
86894
86895
  * "depth": 1,
86895
86896
  * "path": "Gastos de administración",
@@ -86907,6 +86908,7 @@ interface paths {
86907
86908
  * "kind": "gasto",
86908
86909
  * "behavior": "fijo",
86909
86910
  * "no_document": false,
86911
+ * "tax_role": "rent",
86910
86912
  * "position": 0,
86911
86913
  * "depth": 2,
86912
86914
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -87025,6 +87027,7 @@ interface paths {
87025
87027
  * "kind": "gasto",
87026
87028
  * "behavior": "fijo",
87027
87029
  * "no_document": false,
87030
+ * "tax_role": "rent",
87028
87031
  * "position": 0,
87029
87032
  * "depth": 2,
87030
87033
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -87495,6 +87498,7 @@ interface paths {
87495
87498
  * "kind": "gasto",
87496
87499
  * "behavior": "fijo",
87497
87500
  * "no_document": false,
87501
+ * "tax_role": "rent",
87498
87502
  * "position": 1,
87499
87503
  * "depth": 2,
87500
87504
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -87612,6 +87616,7 @@ interface paths {
87612
87616
  * "kind": "gasto",
87613
87617
  * "behavior": "fijo",
87614
87618
  * "no_document": false,
87619
+ * "tax_role": "rent",
87615
87620
  * "position": 0,
87616
87621
  * "depth": 2,
87617
87622
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -87733,6 +87738,7 @@ interface paths {
87733
87738
  * "kind": "gasto",
87734
87739
  * "behavior": "fijo",
87735
87740
  * "no_document": false,
87741
+ * "tax_role": "rent",
87736
87742
  * "position": 0,
87737
87743
  * "depth": 2,
87738
87744
  * "path": "Gastos de administración > Arriendo de oficina",
@@ -105480,7 +105486,9 @@ interface paths {
105480
105486
  * "kind": "ingreso",
105481
105487
  * "path": "Ingresos › Ingresos de explotación",
105482
105488
  * "archived": false,
105483
- * "has_children": true
105489
+ * "has_children": true,
105490
+ * "tax_role": null,
105491
+ * "tax_role_label": null
105484
105492
  * },
105485
105493
  * "sign": 1,
105486
105494
  * "values": [
@@ -105509,7 +105517,9 @@ interface paths {
105509
105517
  * "kind": "ingreso",
105510
105518
  * "path": "Ingresos › Ingresos de explotación › Atención odontológica",
105511
105519
  * "archived": false,
105512
- * "has_children": false
105520
+ * "has_children": false,
105521
+ * "tax_role": null,
105522
+ * "tax_role_label": null
105513
105523
  * },
105514
105524
  * "sign": 1,
105515
105525
  * "values": [
@@ -105587,7 +105597,9 @@ interface paths {
105587
105597
  * "kind": "costo",
105588
105598
  * "path": "Costos de explotación",
105589
105599
  * "archived": false,
105590
- * "has_children": true
105600
+ * "has_children": true,
105601
+ * "tax_role": null,
105602
+ * "tax_role_label": null
105591
105603
  * },
105592
105604
  * "sign": -1,
105593
105605
  * "values": [
@@ -105616,7 +105628,9 @@ interface paths {
105616
105628
  * "kind": "costo",
105617
105629
  * "path": "Costos de explotación › Laboratorios",
105618
105630
  * "archived": false,
105619
- * "has_children": false
105631
+ * "has_children": false,
105632
+ * "tax_role": null,
105633
+ * "tax_role_label": null
105620
105634
  * },
105621
105635
  * "sign": -1,
105622
105636
  * "values": [
@@ -105694,7 +105708,9 @@ interface paths {
105694
105708
  * "kind": "gasto",
105695
105709
  * "path": "Gastos de administración y venta",
105696
105710
  * "archived": false,
105697
- * "has_children": true
105711
+ * "has_children": true,
105712
+ * "tax_role": null,
105713
+ * "tax_role_label": null
105698
105714
  * },
105699
105715
  * "sign": -1,
105700
105716
  * "values": [
@@ -105723,7 +105739,9 @@ interface paths {
105723
105739
  * "kind": "gasto",
105724
105740
  * "path": "Gastos de administración y venta › Gastos generales › Arriendo",
105725
105741
  * "archived": false,
105726
- * "has_children": false
105742
+ * "has_children": false,
105743
+ * "tax_role": null,
105744
+ * "tax_role_label": null
105727
105745
  * },
105728
105746
  * "sign": -1,
105729
105747
  * "values": [
@@ -105862,6 +105880,20 @@ interface paths {
105862
105880
  * "drillable": true
105863
105881
  * }
105864
105882
  * ],
105883
+ * "by_role": [
105884
+ * {
105885
+ * "tax_role": null,
105886
+ * "tax_role_label": null,
105887
+ * "section": null,
105888
+ * "total": 0,
105889
+ * "count": 0,
105890
+ * "non_deductible": {
105891
+ * "tax_40": 0,
105892
+ * "owner": 0,
105893
+ * "left_out": 0
105894
+ * }
105895
+ * }
105896
+ * ],
105865
105897
  * "summary": {
105866
105898
  * "resultado_operacional_clp": 23100000,
105867
105899
  * "ingresos_clp": 49650000,
@@ -106319,11 +106351,15 @@ interface paths {
106319
106351
  * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8102",
106320
106352
  * "name": "Atención odontológica",
106321
106353
  * "kind": "ingreso",
106322
- * "no_document": false
106354
+ * "no_document": false,
106355
+ * "tax_role": "business_income"
106323
106356
  * },
106324
106357
  * "no_vat_breakdown": false,
106325
106358
  * "undocumented": false,
106326
106359
  * "non_result_kind": null,
106360
+ * "tax_role": "business_income",
106361
+ * "tax_role_source": "account",
106362
+ * "non_deductible": null,
106327
106363
  * "settled_clp": 1190000,
106328
106364
  * "gross_clp": 1190000,
106329
106365
  * "base_clp": 1000000,
@@ -106366,11 +106402,15 @@ interface paths {
106366
106402
  * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8108",
106367
106403
  * "name": "Sueldos",
106368
106404
  * "kind": "gasto",
106369
- * "no_document": true
106405
+ * "no_document": true,
106406
+ * "tax_role": "remunerations"
106370
106407
  * },
106371
106408
  * "no_vat_breakdown": false,
106372
106409
  * "undocumented": false,
106373
106410
  * "non_result_kind": null,
106411
+ * "tax_role": "remunerations",
106412
+ * "tax_role_source": "account",
106413
+ * "non_deductible": null,
106374
106414
  * "settled_clp": 850000,
106375
106415
  * "gross_clp": 850000,
106376
106416
  * "base_clp": 850000,
@@ -106611,7 +106651,8 @@ interface paths {
106611
106651
  * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8102",
106612
106652
  * "name": "Atención odontológica",
106613
106653
  * "kind": "ingreso",
106614
- * "no_document": false
106654
+ * "no_document": false,
106655
+ * "tax_role": "business_income"
106615
106656
  * },
106616
106657
  * "undocumented": false,
106617
106658
  * "non_result_kind": null,
@@ -106631,7 +106672,8 @@ interface paths {
106631
106672
  * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8108",
106632
106673
  * "name": "Sueldos",
106633
106674
  * "kind": "gasto",
106634
- * "no_document": true
106675
+ * "no_document": true,
106676
+ * "tax_role": "remunerations"
106635
106677
  * },
106636
106678
  * "undocumented": false,
106637
106679
  * "non_result_kind": null,
@@ -106645,6 +106687,44 @@ interface paths {
106645
106687
  * "retention_clp": 0
106646
106688
  * }
106647
106689
  * ],
106690
+ * "by_role": [
106691
+ * {
106692
+ * "side": "collection",
106693
+ * "document_year": "earlier",
106694
+ * "tax_role": "business_income",
106695
+ * "tax_role_label": "Ingresos del giro",
106696
+ * "section": "income",
106697
+ * "non_result": false,
106698
+ * "non_deductible": null,
106699
+ * "owner": null,
106700
+ * "lines": 1,
106701
+ * "settled_clp": 1190000,
106702
+ * "gross_clp": 1190000,
106703
+ * "base_clp": 1000000,
106704
+ * "net_clp": 1000000,
106705
+ * "exempt_clp": 0,
106706
+ * "vat_excluded_clp": 190000,
106707
+ * "retention_clp": 0
106708
+ * },
106709
+ * {
106710
+ * "side": "payment",
106711
+ * "document_year": "current",
106712
+ * "tax_role": "remunerations",
106713
+ * "tax_role_label": "Remuneraciones",
106714
+ * "section": "outlay",
106715
+ * "non_result": false,
106716
+ * "non_deductible": null,
106717
+ * "owner": null,
106718
+ * "lines": 1,
106719
+ * "settled_clp": 850000,
106720
+ * "gross_clp": 850000,
106721
+ * "base_clp": 850000,
106722
+ * "net_clp": 0,
106723
+ * "exempt_clp": 0,
106724
+ * "vat_excluded_clp": 0,
106725
+ * "retention_clp": 0
106726
+ * }
106727
+ * ],
106648
106728
  * "by_kind": [
106649
106729
  * {
106650
106730
  * "side": "collection",
@@ -113113,7 +113193,7 @@ interface paths {
113113
113193
  patch?: never;
113114
113194
  trace?: never;
113115
113195
  };
113116
- "/finanzas/resumen": {
113196
+ "/finanzas/tax-tags/roles": {
113117
113197
  parameters: {
113118
113198
  query?: never;
113119
113199
  header?: never;
@@ -113121,19 +113201,21 @@ interface paths {
113121
113201
  cookie?: never;
113122
113202
  };
113123
113203
  /**
113124
- * Resumen: the Finanzas home, three answers and the context
113125
- * @description The Finanzas home in one read, every figure from its detail screen: **cash** («¿cuánto me queda a fin de mes?») = the Flujo de caja projection — today’s balance of the operating accounts, the month-end and 30-day balance, the lowest point and `runs_out` (the first day under zero within 30 days, with its biggest payment); **result** («¿cuánto gasto? / ¿este mes gana plata?») = Costos y equilibrio for the current month at net amounts (ingresos, gastos = variables + fijos, «sin clasificar» apart and counted as variable, resultado operacional) against the punto de equilibrio of the last closed month; **inbox** («Te necesita») = the open «Por resolver» cases and the previous month’s close state; **automatic** = this month’s «Hecho por Vitrina» totals and the newest 3; **accounts** with their balances. `problem` is the one thing shown in red (cash running out, else a bank connection that needs a person). A caller without `finanzas_reports:read` gets `cash`, `result` and every account balance (`balance_clp`, `balance_as_of`) null; account names stay (`reports_visible: false`). A Contador sees patients as initials. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
113204
+ * Tax roles of accounts, the F22 codes they feed, and art. 21 outcomes
113205
+ * @description The vocabulary an account's tax meaning is chosen from, and, for the tax year, the F22 code each role feeds in 14 A, 14 D N°3 and 14 D N°8 (`earlier` is the twin code for documents of an earlier year paid in this one). A role names what the money is for in plain words; the code derives from it, so a new tax year re-tags nothing. Also the art. 21 outcomes of a non-deductible mark and the regimes where each applies (14 D N°8 has only `left_out`), and the reasons a movement is non-deductible by default. 404 for a tax year with no code table. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_reports:read` (owner, admin, Contador seat).
113126
113206
  */
113127
113207
  get: {
113128
113208
  parameters: {
113129
- query?: never;
113209
+ query?: {
113210
+ tax_year?: number;
113211
+ };
113130
113212
  header?: never;
113131
113213
  path?: never;
113132
113214
  cookie?: never;
113133
113215
  };
113134
113216
  requestBody?: never;
113135
113217
  responses: {
113136
- /** @description The Resumen */
113218
+ /** @description Roles and outcomes */
113137
113219
  200: {
113138
113220
  headers: {
113139
113221
  [name: string]: unknown;
@@ -113142,243 +113224,1200 @@ interface paths {
113142
113224
  /**
113143
113225
  * @example {
113144
113226
  * "data": {
113145
- * "as_of": "2026-10-30",
113146
- * "month": "2026-10",
113147
- * "month_label": "octubre 2026",
113148
- * "currency": "CLP",
113149
- * "reports_visible": true,
113150
- * "synced_at": "2026-10-30T11:02:00.000Z",
113151
- * "problem": {
113152
- * "kind": "cash_runs_out",
113153
- * "date": "2026-11-06",
113154
- * "balance_clp": -412000
113155
- * },
113156
- * "cash": {
113157
- * "today_clp": 4917109,
113158
- * "balance_as_of": "2026-10-30T11:02:00.000Z",
113159
- * "accounts_count": 3,
113160
- * "unknown_count": 0,
113161
- * "savings_clp": 12000000,
113162
- * "month_end": {
113163
- * "date": "2026-10-31",
113164
- * "balance_clp": 5102000,
113165
- * "band": {
113166
- * "low_clp": 4980000,
113167
- * "high_clp": 5260000
113168
- * }
113169
- * },
113170
- * "in_30_days": {
113171
- * "date": "2026-11-29",
113172
- * "balance_clp": 3880000,
113173
- * "band": {
113174
- * "low_clp": 2100000,
113175
- * "high_clp": 5400000
113176
- * }
113177
- * },
113178
- * "lowest": {
113179
- * "date": "2026-11-06",
113180
- * "balance_clp": -412000,
113181
- * "negative": true,
113182
- * "is_today": false,
113183
- * "cause": {
113184
- * "key": "document:0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
113185
- * "source": "payable",
113186
- * "direction": "outflow",
113187
- * "label": "Factura 4410 · Laboratorio Andes SpA",
113188
- * "amount_clp": 5800000,
113189
- * "date": "2026-11-06",
113190
- * "due_date": "2026-11-06",
113191
- * "overdue": false,
113192
- * "movable": true,
113193
- * "move": null,
113194
- * "document": {
113195
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
113196
- * "kind": "purchase",
113197
- * "dte_type": 33,
113198
- * "folio": "4410"
113199
- * },
113200
- * "contraparte": {
113201
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6601",
113202
- * "name": "Laboratorio Andes SpA"
113203
- * },
113204
- * "recurring_item_id": null,
113205
- * "rescue_id": null,
113206
- * "count": null
113207
- * }
113208
- * },
113209
- * "runs_out": {
113210
- * "date": "2026-11-06",
113211
- * "covered_until": "2026-11-05",
113212
- * "balance_clp": -412000,
113213
- * "cause": {
113214
- * "key": "document:0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
113215
- * "source": "payable",
113216
- * "direction": "outflow",
113217
- * "label": "Factura 4410 · Laboratorio Andes SpA",
113218
- * "amount_clp": 5800000,
113219
- * "date": "2026-11-06",
113220
- * "due_date": "2026-11-06",
113221
- * "overdue": false,
113222
- * "movable": true,
113223
- * "move": null,
113224
- * "document": {
113225
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
113226
- * "kind": "purchase",
113227
- * "dte_type": 33,
113228
- * "folio": "4410"
113227
+ * "tax_year": 2026,
113228
+ * "tax_years": [
113229
+ * 2026
113230
+ * ],
113231
+ * "roles": [
113232
+ * {
113233
+ * "role": "rent",
113234
+ * "label_es": "Arriendos",
113235
+ * "section": "outlay",
113236
+ * "hint_es": "Arriendo del local, oficina o equipos.",
113237
+ * "codes": {
113238
+ * "14A": {
113239
+ * "code": 1140,
113240
+ * "earlier": null
113229
113241
  * },
113230
- * "contraparte": {
113231
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6601",
113232
- * "name": "Laboratorio Andes SpA"
113242
+ * "14D3": {
113243
+ * "code": 1415,
113244
+ * "earlier": null
113233
113245
  * },
113234
- * "recurring_item_id": null,
113235
- * "rescue_id": null,
113236
- * "count": null
113237
- * }
113238
- * },
113239
- * "overdue": {
113240
- * "payables_clp": 0,
113241
- * "payables_count": 0,
113242
- * "stale_payables_clp": 0,
113243
- * "stale_payables_count": 0,
113244
- * "receivables_clp": 380000,
113245
- * "receivables_count": 2
113246
- * },
113247
- * "inherited_overdue": {
113248
- * "count": 0,
113249
- * "amount_clp": 0
113250
- * },
113251
- * "points": [
113252
- * {
113253
- * "date": "2026-10-30",
113254
- * "balance_clp": 4917109,
113255
- * "band": {
113256
- * "low_clp": 4917109,
113257
- * "high_clp": 4917109
113258
- * }
113259
- * },
113260
- * {
113261
- * "date": "2026-10-31",
113262
- * "balance_clp": 5102000,
113263
- * "band": {
113264
- * "low_clp": 4980000,
113265
- * "high_clp": 5260000
113246
+ * "14D8": {
113247
+ * "code": 1620,
113248
+ * "earlier": null
113266
113249
  * }
113267
113250
  * }
113268
- * ]
113269
- * },
113270
- * "result": {
113271
- * "month": "2026-10",
113272
- * "label": "octubre 2026",
113273
- * "proforma": true,
113274
- * "ingresos_clp": 41200000,
113275
- * "gastos_clp": 38900000,
113276
- * "variables_clp": 17400000,
113277
- * "fijos_clp": 21500000,
113278
- * "sin_clasificar_clp": 900000,
113279
- * "resultado_clp": 2300000,
113280
- * "equilibrio": {
113281
- * "month": "2026-09",
113282
- * "label": "septiembre 2026",
113283
- * "equilibrio_clp": 44600000,
113284
- * "sin_calculo": null,
113285
- * "produccion": null,
113286
- * "skipped_incompleto": null
113287
- * },
113288
- * "target_clp": 44600000,
113289
- * "cobertura_pct": 92.4,
113290
- * "brecha_clp": -3400000
113291
- * },
113292
- * "inbox": {
113293
- * "open": 4,
113294
- * "amount_at_stake_clp": 2860000,
113295
- * "by_kind": {
113296
- * "reconcile": 2,
113297
- * "transfer": 0,
113298
- * "classify": 1,
113299
- * "missing_document": 1,
113300
- * "unknown": 0
113301
- * },
113302
- * "close": {
113303
- * "month": "2026-09",
113304
- * "label": "septiembre 2026",
113305
- * "state": "closed",
113306
- * "open_cases": 0
113307
113251
  * }
113308
- * },
113309
- * "automatic": {
113310
- * "month": "2026-10",
113311
- * "count": 240,
113312
- * "total_clp": 61200000,
113313
- * "unreviewed_count": 31,
113314
- * "by_actor": {
113315
- * "rule": 150,
113316
- * "match": 72,
113317
- * "ai": 18
113318
- * },
113319
- * "recent": [
113320
- * {
113321
- * "kind": "link",
113322
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6701",
113323
- * "actor": "match",
113324
- * "label": "Pago de la factura 4388 de Laboratorio Andes SpA",
113325
- * "day": "2026-10-29",
113326
- * "amount_clp": 1240000,
113327
- * "applied_at": "2026-10-29T14:10:00.000Z",
113328
- * "movement": {
113329
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6801",
113330
- * "day": "2026-10-29",
113331
- * "amount_clp": 1240000,
113332
- * "direction": "outbound",
113333
- * "description": "Transferencia a Laboratorio Andes"
113334
- * },
113335
- * "document": null,
113336
- * "target": "document",
113337
- * "reasons": [
113338
- * "rut",
113339
- * "amount"
113340
- * ],
113341
- * "account": null,
113342
- * "split": false,
113343
- * "rule": null,
113344
- * "reviewed_at": null,
113345
- * "reviewed_by": null,
113346
- * "group_name": "Laboratorio Andes SpA",
113347
- * "group_key": "contraparte:3f6c1d2e-5b7a-4c1e-9d0f-2a8b6c4e1f70",
113348
- * "group_count": 1,
113349
- * "group_total_clp": 1240000
113350
- * }
113351
- * ]
113352
- * },
113353
- * "accounts": [
113252
+ * ],
113253
+ * "outcomes": [
113354
113254
  * {
113355
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6401",
113356
- * "name": "Cuenta corriente",
113357
- * "institution_name": "Banco de Chile",
113358
- * "number_masked": "··4821",
113359
- * "type": "cuenta_corriente",
113360
- * "currency": "CLP",
113361
- * "balance_clp": 3719083,
113362
- * "balance_as_of": "2026-10-30T11:02:00.000Z",
113363
- * "in_cash": true
113364
- * },
113255
+ * "outcome": "left_out",
113256
+ * "label_es": "Solo se excluye de la base",
113257
+ * "hint_es": "No se descuenta de la base y no paga impuesto aparte.",
113258
+ * "regimes": [
113259
+ * "14A",
113260
+ * "14D3",
113261
+ * "14D8"
113262
+ * ]
113263
+ * }
113264
+ * ],
113265
+ * "default_reasons": [
113365
113266
  * {
113366
- * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6402",
113367
- * "name": "Ahorro",
113368
- * "institution_name": "Banco de Chile",
113369
- * "number_masked": "··0057",
113370
- * "type": "cuenta_ahorro",
113371
- * "currency": "CLP",
113372
- * "balance_clp": 12000000,
113373
- * "balance_as_of": "2026-10-30T11:02:00.000Z",
113374
- * "in_cash": false
113267
+ * "reason": "fine",
113268
+ * "label_es": "Multa"
113375
113269
  * }
113376
113270
  * ]
113377
113271
  * }
113378
113272
  * }
113379
113273
  */
113380
113274
  "application/json": {
113381
- data: components["schemas"]["FinanzasResumen"];
113275
+ data: components["schemas"]["FinanzasTaxRoles"];
113276
+ };
113277
+ };
113278
+ };
113279
+ /** @description Validation error */
113280
+ 400: {
113281
+ headers: {
113282
+ [name: string]: unknown;
113283
+ };
113284
+ content: {
113285
+ "application/json": components["schemas"]["Error"];
113286
+ };
113287
+ };
113288
+ /** @description Unauthorized */
113289
+ 401: {
113290
+ headers: {
113291
+ [name: string]: unknown;
113292
+ };
113293
+ content: {
113294
+ "application/json": components["schemas"]["Error"];
113295
+ };
113296
+ };
113297
+ /** @description Forbidden */
113298
+ 403: {
113299
+ headers: {
113300
+ [name: string]: unknown;
113301
+ };
113302
+ content: {
113303
+ "application/json": components["schemas"]["Error"];
113304
+ };
113305
+ };
113306
+ /** @description Not found */
113307
+ 404: {
113308
+ headers: {
113309
+ [name: string]: unknown;
113310
+ };
113311
+ content: {
113312
+ "application/json": components["schemas"]["Error"];
113313
+ };
113314
+ };
113315
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
113316
+ 409: {
113317
+ headers: {
113318
+ [name: string]: unknown;
113319
+ };
113320
+ content: {
113321
+ "application/json": components["schemas"]["Error"];
113322
+ };
113323
+ };
113324
+ /** @description Rate limited */
113325
+ 429: {
113326
+ headers: {
113327
+ [name: string]: unknown;
113328
+ };
113329
+ content: {
113330
+ "application/json": components["schemas"]["Error"];
113331
+ };
113332
+ };
113333
+ };
113334
+ };
113335
+ put?: never;
113336
+ post?: never;
113337
+ delete?: never;
113338
+ options?: never;
113339
+ head?: never;
113340
+ patch?: never;
113341
+ trace?: never;
113342
+ };
113343
+ "/finanzas/tax-tags/accounts": {
113344
+ parameters: {
113345
+ query?: never;
113346
+ header?: never;
113347
+ path?: never;
113348
+ cookie?: never;
113349
+ };
113350
+ /**
113351
+ * Every account with its tax meaning
113352
+ * @description The plan de cuentas with each account's role (`tax_role`), the F22 code it feeds per regime for `tax_year`, and, for an account with none (`without_tax_meaning`), a `suggestion` from its name. The accounts of the starter charts carry their role; a tenant-created or imported account is «sin significado tributario» until an owner sets one: consumers show its amounts apart, never drop them. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_reports:read` (owner, admin, Contador seat).
113353
+ */
113354
+ get: {
113355
+ parameters: {
113356
+ query?: {
113357
+ tax_year?: number;
113358
+ include_archived?: "true" | "false";
113359
+ };
113360
+ header?: never;
113361
+ path?: never;
113362
+ cookie?: never;
113363
+ };
113364
+ requestBody?: never;
113365
+ responses: {
113366
+ /** @description Accounts with their tax meaning */
113367
+ 200: {
113368
+ headers: {
113369
+ [name: string]: unknown;
113370
+ };
113371
+ content: {
113372
+ /**
113373
+ * @example {
113374
+ * "data": {
113375
+ * "tax_year": 2026,
113376
+ * "without_tax_meaning": 1,
113377
+ * "accounts": [
113378
+ * {
113379
+ * "account_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8201",
113380
+ * "name": "Arriendo",
113381
+ * "path": "Gastos de administración y venta › Gastos generales › Arriendo",
113382
+ * "kind": "gasto",
113383
+ * "archived": false,
113384
+ * "seeded": true,
113385
+ * "tax_role": "rent",
113386
+ * "tax_role_label": "Arriendos",
113387
+ * "without_tax_meaning": false,
113388
+ * "codes": {
113389
+ * "14A": {
113390
+ * "code": 1140,
113391
+ * "earlier": null
113392
+ * },
113393
+ * "14D3": {
113394
+ * "code": 1415,
113395
+ * "earlier": null
113396
+ * },
113397
+ * "14D8": {
113398
+ * "code": 1620,
113399
+ * "earlier": null
113400
+ * }
113401
+ * },
113402
+ * "suggestion": null
113403
+ * }
113404
+ * ]
113405
+ * }
113406
+ * }
113407
+ */
113408
+ "application/json": {
113409
+ data: components["schemas"]["FinanzasAccountTaxList"];
113410
+ };
113411
+ };
113412
+ };
113413
+ /** @description Validation error */
113414
+ 400: {
113415
+ headers: {
113416
+ [name: string]: unknown;
113417
+ };
113418
+ content: {
113419
+ "application/json": components["schemas"]["Error"];
113420
+ };
113421
+ };
113422
+ /** @description Unauthorized */
113423
+ 401: {
113424
+ headers: {
113425
+ [name: string]: unknown;
113426
+ };
113427
+ content: {
113428
+ "application/json": components["schemas"]["Error"];
113429
+ };
113430
+ };
113431
+ /** @description Forbidden */
113432
+ 403: {
113433
+ headers: {
113434
+ [name: string]: unknown;
113435
+ };
113436
+ content: {
113437
+ "application/json": components["schemas"]["Error"];
113438
+ };
113439
+ };
113440
+ /** @description Not found */
113441
+ 404: {
113442
+ headers: {
113443
+ [name: string]: unknown;
113444
+ };
113445
+ content: {
113446
+ "application/json": components["schemas"]["Error"];
113447
+ };
113448
+ };
113449
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
113450
+ 409: {
113451
+ headers: {
113452
+ [name: string]: unknown;
113453
+ };
113454
+ content: {
113455
+ "application/json": components["schemas"]["Error"];
113456
+ };
113457
+ };
113458
+ /** @description Rate limited */
113459
+ 429: {
113460
+ headers: {
113461
+ [name: string]: unknown;
113462
+ };
113463
+ content: {
113464
+ "application/json": components["schemas"]["Error"];
113465
+ };
113466
+ };
113467
+ };
113468
+ };
113469
+ put?: never;
113470
+ post?: never;
113471
+ delete?: never;
113472
+ options?: never;
113473
+ head?: never;
113474
+ patch?: never;
113475
+ trace?: never;
113476
+ };
113477
+ "/finanzas/tax-tags/accounts/{accountId}": {
113478
+ parameters: {
113479
+ query?: never;
113480
+ header?: never;
113481
+ path?: never;
113482
+ cookie?: never;
113483
+ };
113484
+ get?: never;
113485
+ /**
113486
+ * Set or clear an account's tax role
113487
+ * @description Sets the role of an account (null clears it). The role must fit the account's type: 422 `FINANZAS_ACCOUNT_INVALID` (`tax_role_kind_mismatch`) otherwise. Sub-accounts do not inherit it: set each one. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_admin:write` (owner, admin). Audited.
113488
+ */
113489
+ put: {
113490
+ parameters: {
113491
+ query?: never;
113492
+ header?: never;
113493
+ path: {
113494
+ accountId: string;
113495
+ };
113496
+ cookie?: never;
113497
+ };
113498
+ requestBody?: {
113499
+ content: {
113500
+ /**
113501
+ * @example {
113502
+ * "tax_role": "rent"
113503
+ * }
113504
+ */
113505
+ "application/json": components["schemas"]["FinanzasAccountTaxBody"];
113506
+ };
113507
+ };
113508
+ responses: {
113509
+ /** @description The account's role */
113510
+ 200: {
113511
+ headers: {
113512
+ [name: string]: unknown;
113513
+ };
113514
+ content: {
113515
+ /**
113516
+ * @example {
113517
+ * "data": {
113518
+ * "account_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8201",
113519
+ * "tax_role": "rent",
113520
+ * "tax_role_label": "Arriendos"
113521
+ * }
113522
+ * }
113523
+ */
113524
+ "application/json": {
113525
+ data: {
113526
+ /** Format: uuid */
113527
+ account_id: string;
113528
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
113529
+ tax_role_label: string | null;
113530
+ };
113531
+ };
113532
+ };
113533
+ };
113534
+ /** @description Validation error */
113535
+ 400: {
113536
+ headers: {
113537
+ [name: string]: unknown;
113538
+ };
113539
+ content: {
113540
+ "application/json": components["schemas"]["Error"];
113541
+ };
113542
+ };
113543
+ /** @description Unauthorized */
113544
+ 401: {
113545
+ headers: {
113546
+ [name: string]: unknown;
113547
+ };
113548
+ content: {
113549
+ "application/json": components["schemas"]["Error"];
113550
+ };
113551
+ };
113552
+ /** @description Forbidden */
113553
+ 403: {
113554
+ headers: {
113555
+ [name: string]: unknown;
113556
+ };
113557
+ content: {
113558
+ "application/json": components["schemas"]["Error"];
113559
+ };
113560
+ };
113561
+ /** @description Not found */
113562
+ 404: {
113563
+ headers: {
113564
+ [name: string]: unknown;
113565
+ };
113566
+ content: {
113567
+ "application/json": components["schemas"]["Error"];
113568
+ };
113569
+ };
113570
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
113571
+ 409: {
113572
+ headers: {
113573
+ [name: string]: unknown;
113574
+ };
113575
+ content: {
113576
+ "application/json": components["schemas"]["Error"];
113577
+ };
113578
+ };
113579
+ /** @description Rate limited */
113580
+ 429: {
113581
+ headers: {
113582
+ [name: string]: unknown;
113583
+ };
113584
+ content: {
113585
+ "application/json": components["schemas"]["Error"];
113586
+ };
113587
+ };
113588
+ };
113589
+ };
113590
+ post?: never;
113591
+ delete?: never;
113592
+ options?: never;
113593
+ head?: never;
113594
+ patch?: never;
113595
+ trace?: never;
113596
+ };
113597
+ "/finanzas/tax-tags/non-deductible": {
113598
+ parameters: {
113599
+ query?: never;
113600
+ header?: never;
113601
+ path?: never;
113602
+ cookie?: never;
113603
+ };
113604
+ /**
113605
+ * Non-deductible marks of a year
113606
+ * @description The documents (by issue date) and bank movements (by day) of the commercial year that a person marked, and `defaults`: the fines and income-tax payments (`idpc` kind of `GET /finanzas/tax/payments`) that are non-deductible until a person says otherwise. A mark whose `overrides_default` is true says «deductible» over a default. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_reports:read` (owner, admin, Contador seat).
113607
+ */
113608
+ get: {
113609
+ parameters: {
113610
+ query: {
113611
+ year: number;
113612
+ };
113613
+ header?: never;
113614
+ path?: never;
113615
+ cookie?: never;
113616
+ };
113617
+ requestBody?: never;
113618
+ responses: {
113619
+ /** @description Marks and defaults */
113620
+ 200: {
113621
+ headers: {
113622
+ [name: string]: unknown;
113623
+ };
113624
+ content: {
113625
+ /**
113626
+ * @example {
113627
+ * "data": {
113628
+ * "year": 2025,
113629
+ * "items": [
113630
+ * {
113631
+ * "target": "document",
113632
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8202",
113633
+ * "date": "2025-06-12",
113634
+ * "amount_clp": 119000,
113635
+ * "label": "Restaurante X",
113636
+ * "non_deductible": {
113637
+ * "outcome": "tax_40",
113638
+ * "outcome_label": "Paga impuesto único de 40 % la empresa",
113639
+ * "owner": null,
113640
+ * "note": null,
113641
+ * "source": "person",
113642
+ * "reason": null,
113643
+ * "reason_label": null
113644
+ * },
113645
+ * "overrides_default": false
113646
+ * }
113647
+ * ],
113648
+ * "defaults": []
113649
+ * }
113650
+ * }
113651
+ */
113652
+ "application/json": {
113653
+ data: components["schemas"]["FinanzasNonDeductibleList"];
113654
+ };
113655
+ };
113656
+ };
113657
+ /** @description Validation error */
113658
+ 400: {
113659
+ headers: {
113660
+ [name: string]: unknown;
113661
+ };
113662
+ content: {
113663
+ "application/json": components["schemas"]["Error"];
113664
+ };
113665
+ };
113666
+ /** @description Unauthorized */
113667
+ 401: {
113668
+ headers: {
113669
+ [name: string]: unknown;
113670
+ };
113671
+ content: {
113672
+ "application/json": components["schemas"]["Error"];
113673
+ };
113674
+ };
113675
+ /** @description Forbidden */
113676
+ 403: {
113677
+ headers: {
113678
+ [name: string]: unknown;
113679
+ };
113680
+ content: {
113681
+ "application/json": components["schemas"]["Error"];
113682
+ };
113683
+ };
113684
+ /** @description Not found */
113685
+ 404: {
113686
+ headers: {
113687
+ [name: string]: unknown;
113688
+ };
113689
+ content: {
113690
+ "application/json": components["schemas"]["Error"];
113691
+ };
113692
+ };
113693
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
113694
+ 409: {
113695
+ headers: {
113696
+ [name: string]: unknown;
113697
+ };
113698
+ content: {
113699
+ "application/json": components["schemas"]["Error"];
113700
+ };
113701
+ };
113702
+ /** @description Rate limited */
113703
+ 429: {
113704
+ headers: {
113705
+ [name: string]: unknown;
113706
+ };
113707
+ content: {
113708
+ "application/json": components["schemas"]["Error"];
113709
+ };
113710
+ };
113711
+ };
113712
+ };
113713
+ put?: never;
113714
+ post?: never;
113715
+ delete?: never;
113716
+ options?: never;
113717
+ head?: never;
113718
+ patch?: never;
113719
+ trace?: never;
113720
+ };
113721
+ "/finanzas/tax-tags/non-deductible/documents/{id}": {
113722
+ parameters: {
113723
+ query?: never;
113724
+ header?: never;
113725
+ path?: never;
113726
+ cookie?: never;
113727
+ };
113728
+ get?: never;
113729
+ /**
113730
+ * Mark a document as not deductible
113731
+ * @description Marks the document (whole) as not deductible with its art. 21 outcome: `tax_40` (the company pays the 40 % single tax), `owner` (taxed on the owner named by `owner_id`, one of the workspace's owners) or `left_out` (only left out of the base). `deductible` overrides a default (a fine, an income-tax payment). Replaces a previous mark. The regime field does not exist yet (#8087): the outcome is stored as chosen and the draft applies the regime rule (14 D N°8: only `left_out`). 422 `FINANZAS_OWNER_INVALID` for `owner` without a valid owner. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_admin:write` (owner, admin). Audited.
113732
+ */
113733
+ put: {
113734
+ parameters: {
113735
+ query?: never;
113736
+ header?: never;
113737
+ path: {
113738
+ id: string;
113739
+ };
113740
+ cookie?: never;
113741
+ };
113742
+ requestBody?: {
113743
+ content: {
113744
+ /**
113745
+ * @example {
113746
+ * "outcome": "left_out",
113747
+ * "note": "Multa del banco"
113748
+ * }
113749
+ */
113750
+ "application/json": components["schemas"]["FinanzasNonDeductibleBody"];
113751
+ };
113752
+ };
113753
+ responses: {
113754
+ /** @description The mark */
113755
+ 200: {
113756
+ headers: {
113757
+ [name: string]: unknown;
113758
+ };
113759
+ content: {
113760
+ /**
113761
+ * @example {
113762
+ * "data": {
113763
+ * "target": "document",
113764
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8202",
113765
+ * "non_deductible": {
113766
+ * "outcome": "tax_40",
113767
+ * "outcome_label": "Paga impuesto único de 40 % la empresa",
113768
+ * "owner": null,
113769
+ * "note": null,
113770
+ * "source": "person",
113771
+ * "reason": null,
113772
+ * "reason_label": null
113773
+ * }
113774
+ * }
113775
+ * }
113776
+ */
113777
+ "application/json": {
113778
+ data: components["schemas"]["FinanzasNonDeductibleResult"];
113779
+ };
113780
+ };
113781
+ };
113782
+ /** @description Validation error */
113783
+ 400: {
113784
+ headers: {
113785
+ [name: string]: unknown;
113786
+ };
113787
+ content: {
113788
+ "application/json": components["schemas"]["Error"];
113789
+ };
113790
+ };
113791
+ /** @description Unauthorized */
113792
+ 401: {
113793
+ headers: {
113794
+ [name: string]: unknown;
113795
+ };
113796
+ content: {
113797
+ "application/json": components["schemas"]["Error"];
113798
+ };
113799
+ };
113800
+ /** @description Forbidden */
113801
+ 403: {
113802
+ headers: {
113803
+ [name: string]: unknown;
113804
+ };
113805
+ content: {
113806
+ "application/json": components["schemas"]["Error"];
113807
+ };
113808
+ };
113809
+ /** @description Not found */
113810
+ 404: {
113811
+ headers: {
113812
+ [name: string]: unknown;
113813
+ };
113814
+ content: {
113815
+ "application/json": components["schemas"]["Error"];
113816
+ };
113817
+ };
113818
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
113819
+ 409: {
113820
+ headers: {
113821
+ [name: string]: unknown;
113822
+ };
113823
+ content: {
113824
+ "application/json": components["schemas"]["Error"];
113825
+ };
113826
+ };
113827
+ /** @description Rate limited */
113828
+ 429: {
113829
+ headers: {
113830
+ [name: string]: unknown;
113831
+ };
113832
+ content: {
113833
+ "application/json": components["schemas"]["Error"];
113834
+ };
113835
+ };
113836
+ };
113837
+ };
113838
+ post?: never;
113839
+ /**
113840
+ * Remove the non-deductible mark of a document
113841
+ * @description Removes the person's mark: the document goes back to its default (deductible, unless it is a fine or an income-tax payment). `removed` is false when there was none. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_admin:write` (owner, admin). Audited.
113842
+ */
113843
+ delete: {
113844
+ parameters: {
113845
+ query?: never;
113846
+ header?: never;
113847
+ path: {
113848
+ id: string;
113849
+ };
113850
+ cookie?: never;
113851
+ };
113852
+ requestBody?: never;
113853
+ responses: {
113854
+ /** @description The mark removed */
113855
+ 200: {
113856
+ headers: {
113857
+ [name: string]: unknown;
113858
+ };
113859
+ content: {
113860
+ /**
113861
+ * @example {
113862
+ * "data": {
113863
+ * "target": "document",
113864
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8202",
113865
+ * "non_deductible": null,
113866
+ * "removed": true
113867
+ * }
113868
+ * }
113869
+ */
113870
+ "application/json": {
113871
+ data: components["schemas"]["FinanzasNonDeductibleResult"] & {
113872
+ removed: boolean;
113873
+ };
113874
+ };
113875
+ };
113876
+ };
113877
+ /** @description Validation error */
113878
+ 400: {
113879
+ headers: {
113880
+ [name: string]: unknown;
113881
+ };
113882
+ content: {
113883
+ "application/json": components["schemas"]["Error"];
113884
+ };
113885
+ };
113886
+ /** @description Unauthorized */
113887
+ 401: {
113888
+ headers: {
113889
+ [name: string]: unknown;
113890
+ };
113891
+ content: {
113892
+ "application/json": components["schemas"]["Error"];
113893
+ };
113894
+ };
113895
+ /** @description Forbidden */
113896
+ 403: {
113897
+ headers: {
113898
+ [name: string]: unknown;
113899
+ };
113900
+ content: {
113901
+ "application/json": components["schemas"]["Error"];
113902
+ };
113903
+ };
113904
+ /** @description Not found */
113905
+ 404: {
113906
+ headers: {
113907
+ [name: string]: unknown;
113908
+ };
113909
+ content: {
113910
+ "application/json": components["schemas"]["Error"];
113911
+ };
113912
+ };
113913
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
113914
+ 409: {
113915
+ headers: {
113916
+ [name: string]: unknown;
113917
+ };
113918
+ content: {
113919
+ "application/json": components["schemas"]["Error"];
113920
+ };
113921
+ };
113922
+ /** @description Rate limited */
113923
+ 429: {
113924
+ headers: {
113925
+ [name: string]: unknown;
113926
+ };
113927
+ content: {
113928
+ "application/json": components["schemas"]["Error"];
113929
+ };
113930
+ };
113931
+ };
113932
+ };
113933
+ options?: never;
113934
+ head?: never;
113935
+ patch?: never;
113936
+ trace?: never;
113937
+ };
113938
+ "/finanzas/tax-tags/non-deductible/movements/{id}": {
113939
+ parameters: {
113940
+ query?: never;
113941
+ header?: never;
113942
+ path?: never;
113943
+ cookie?: never;
113944
+ };
113945
+ get?: never;
113946
+ /**
113947
+ * Mark a bank movement as not deductible
113948
+ * @description Marks the bank movement (whole) as not deductible with its art. 21 outcome: `tax_40` (the company pays the 40 % single tax), `owner` (taxed on the owner named by `owner_id`, one of the workspace's owners) or `left_out` (only left out of the base). `deductible` overrides a default (a fine, an income-tax payment). Replaces a previous mark. The regime field does not exist yet (#8087): the outcome is stored as chosen and the draft applies the regime rule (14 D N°8: only `left_out`). 422 `FINANZAS_OWNER_INVALID` for `owner` without a valid owner. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_admin:write` (owner, admin). Audited.
113949
+ */
113950
+ put: {
113951
+ parameters: {
113952
+ query?: never;
113953
+ header?: never;
113954
+ path: {
113955
+ id: string;
113956
+ };
113957
+ cookie?: never;
113958
+ };
113959
+ requestBody?: {
113960
+ content: {
113961
+ /**
113962
+ * @example {
113963
+ * "outcome": "left_out",
113964
+ * "note": "Multa del banco"
113965
+ * }
113966
+ */
113967
+ "application/json": components["schemas"]["FinanzasNonDeductibleBody"];
113968
+ };
113969
+ };
113970
+ responses: {
113971
+ /** @description The mark */
113972
+ 200: {
113973
+ headers: {
113974
+ [name: string]: unknown;
113975
+ };
113976
+ content: {
113977
+ /**
113978
+ * @example {
113979
+ * "data": {
113980
+ * "target": "movement",
113981
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8203",
113982
+ * "non_deductible": {
113983
+ * "outcome": "tax_40",
113984
+ * "outcome_label": "Paga impuesto único de 40 % la empresa",
113985
+ * "owner": null,
113986
+ * "note": null,
113987
+ * "source": "person",
113988
+ * "reason": null,
113989
+ * "reason_label": null
113990
+ * }
113991
+ * }
113992
+ * }
113993
+ */
113994
+ "application/json": {
113995
+ data: components["schemas"]["FinanzasNonDeductibleResult"];
113996
+ };
113997
+ };
113998
+ };
113999
+ /** @description Validation error */
114000
+ 400: {
114001
+ headers: {
114002
+ [name: string]: unknown;
114003
+ };
114004
+ content: {
114005
+ "application/json": components["schemas"]["Error"];
114006
+ };
114007
+ };
114008
+ /** @description Unauthorized */
114009
+ 401: {
114010
+ headers: {
114011
+ [name: string]: unknown;
114012
+ };
114013
+ content: {
114014
+ "application/json": components["schemas"]["Error"];
114015
+ };
114016
+ };
114017
+ /** @description Forbidden */
114018
+ 403: {
114019
+ headers: {
114020
+ [name: string]: unknown;
114021
+ };
114022
+ content: {
114023
+ "application/json": components["schemas"]["Error"];
114024
+ };
114025
+ };
114026
+ /** @description Not found */
114027
+ 404: {
114028
+ headers: {
114029
+ [name: string]: unknown;
114030
+ };
114031
+ content: {
114032
+ "application/json": components["schemas"]["Error"];
114033
+ };
114034
+ };
114035
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
114036
+ 409: {
114037
+ headers: {
114038
+ [name: string]: unknown;
114039
+ };
114040
+ content: {
114041
+ "application/json": components["schemas"]["Error"];
114042
+ };
114043
+ };
114044
+ /** @description Rate limited */
114045
+ 429: {
114046
+ headers: {
114047
+ [name: string]: unknown;
114048
+ };
114049
+ content: {
114050
+ "application/json": components["schemas"]["Error"];
114051
+ };
114052
+ };
114053
+ };
114054
+ };
114055
+ post?: never;
114056
+ /**
114057
+ * Remove the non-deductible mark of a bank movement
114058
+ * @description Removes the person's mark: the bank movement goes back to its default (deductible, unless it is a fine or an income-tax payment). `removed` is false when there was none. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_admin:write` (owner, admin). Audited.
114059
+ */
114060
+ delete: {
114061
+ parameters: {
114062
+ query?: never;
114063
+ header?: never;
114064
+ path: {
114065
+ id: string;
114066
+ };
114067
+ cookie?: never;
114068
+ };
114069
+ requestBody?: never;
114070
+ responses: {
114071
+ /** @description The mark removed */
114072
+ 200: {
114073
+ headers: {
114074
+ [name: string]: unknown;
114075
+ };
114076
+ content: {
114077
+ /**
114078
+ * @example {
114079
+ * "data": {
114080
+ * "target": "movement",
114081
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f8203",
114082
+ * "non_deductible": null,
114083
+ * "removed": true
114084
+ * }
114085
+ * }
114086
+ */
114087
+ "application/json": {
114088
+ data: components["schemas"]["FinanzasNonDeductibleResult"] & {
114089
+ removed: boolean;
114090
+ };
114091
+ };
114092
+ };
114093
+ };
114094
+ /** @description Validation error */
114095
+ 400: {
114096
+ headers: {
114097
+ [name: string]: unknown;
114098
+ };
114099
+ content: {
114100
+ "application/json": components["schemas"]["Error"];
114101
+ };
114102
+ };
114103
+ /** @description Unauthorized */
114104
+ 401: {
114105
+ headers: {
114106
+ [name: string]: unknown;
114107
+ };
114108
+ content: {
114109
+ "application/json": components["schemas"]["Error"];
114110
+ };
114111
+ };
114112
+ /** @description Forbidden */
114113
+ 403: {
114114
+ headers: {
114115
+ [name: string]: unknown;
114116
+ };
114117
+ content: {
114118
+ "application/json": components["schemas"]["Error"];
114119
+ };
114120
+ };
114121
+ /** @description Not found */
114122
+ 404: {
114123
+ headers: {
114124
+ [name: string]: unknown;
114125
+ };
114126
+ content: {
114127
+ "application/json": components["schemas"]["Error"];
114128
+ };
114129
+ };
114130
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
114131
+ 409: {
114132
+ headers: {
114133
+ [name: string]: unknown;
114134
+ };
114135
+ content: {
114136
+ "application/json": components["schemas"]["Error"];
114137
+ };
114138
+ };
114139
+ /** @description Rate limited */
114140
+ 429: {
114141
+ headers: {
114142
+ [name: string]: unknown;
114143
+ };
114144
+ content: {
114145
+ "application/json": components["schemas"]["Error"];
114146
+ };
114147
+ };
114148
+ };
114149
+ };
114150
+ options?: never;
114151
+ head?: never;
114152
+ patch?: never;
114153
+ trace?: never;
114154
+ };
114155
+ "/finanzas/resumen": {
114156
+ parameters: {
114157
+ query?: never;
114158
+ header?: never;
114159
+ path?: never;
114160
+ cookie?: never;
114161
+ };
114162
+ /**
114163
+ * Resumen: the Finanzas home, three answers and the context
114164
+ * @description The Finanzas home in one read, every figure from its detail screen: **cash** («¿cuánto me queda a fin de mes?») = the Flujo de caja projection — today’s balance of the operating accounts, the month-end and 30-day balance, the lowest point and `runs_out` (the first day under zero within 30 days, with its biggest payment); **result** («¿cuánto gasto? / ¿este mes gana plata?») = Costos y equilibrio for the current month at net amounts (ingresos, gastos = variables + fijos, «sin clasificar» apart and counted as variable, resultado operacional) against the punto de equilibrio of the last closed month; **inbox** («Te necesita») = the open «Por resolver» cases and the previous month’s close state; **automatic** = this month’s «Hecho por Vitrina» totals and the newest 3; **accounts** with their balances. `problem` is the one thing shown in red (cash running out, else a bank connection that needs a person). A caller without `finanzas_reports:read` gets `cash`, `result` and every account balance (`balance_clp`, `balance_as_of`) null; account names stay (`reports_visible: false`). A Contador sees patients as initials. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
114165
+ */
114166
+ get: {
114167
+ parameters: {
114168
+ query?: never;
114169
+ header?: never;
114170
+ path?: never;
114171
+ cookie?: never;
114172
+ };
114173
+ requestBody?: never;
114174
+ responses: {
114175
+ /** @description The Resumen */
114176
+ 200: {
114177
+ headers: {
114178
+ [name: string]: unknown;
114179
+ };
114180
+ content: {
114181
+ /**
114182
+ * @example {
114183
+ * "data": {
114184
+ * "as_of": "2026-10-30",
114185
+ * "month": "2026-10",
114186
+ * "month_label": "octubre 2026",
114187
+ * "currency": "CLP",
114188
+ * "reports_visible": true,
114189
+ * "synced_at": "2026-10-30T11:02:00.000Z",
114190
+ * "problem": {
114191
+ * "kind": "cash_runs_out",
114192
+ * "date": "2026-11-06",
114193
+ * "balance_clp": -412000
114194
+ * },
114195
+ * "cash": {
114196
+ * "today_clp": 4917109,
114197
+ * "balance_as_of": "2026-10-30T11:02:00.000Z",
114198
+ * "accounts_count": 3,
114199
+ * "unknown_count": 0,
114200
+ * "savings_clp": 12000000,
114201
+ * "month_end": {
114202
+ * "date": "2026-10-31",
114203
+ * "balance_clp": 5102000,
114204
+ * "band": {
114205
+ * "low_clp": 4980000,
114206
+ * "high_clp": 5260000
114207
+ * }
114208
+ * },
114209
+ * "in_30_days": {
114210
+ * "date": "2026-11-29",
114211
+ * "balance_clp": 3880000,
114212
+ * "band": {
114213
+ * "low_clp": 2100000,
114214
+ * "high_clp": 5400000
114215
+ * }
114216
+ * },
114217
+ * "lowest": {
114218
+ * "date": "2026-11-06",
114219
+ * "balance_clp": -412000,
114220
+ * "negative": true,
114221
+ * "is_today": false,
114222
+ * "cause": {
114223
+ * "key": "document:0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
114224
+ * "source": "payable",
114225
+ * "direction": "outflow",
114226
+ * "label": "Factura 4410 · Laboratorio Andes SpA",
114227
+ * "amount_clp": 5800000,
114228
+ * "date": "2026-11-06",
114229
+ * "due_date": "2026-11-06",
114230
+ * "overdue": false,
114231
+ * "movable": true,
114232
+ * "move": null,
114233
+ * "document": {
114234
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
114235
+ * "kind": "purchase",
114236
+ * "dte_type": 33,
114237
+ * "folio": "4410"
114238
+ * },
114239
+ * "contraparte": {
114240
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6601",
114241
+ * "name": "Laboratorio Andes SpA"
114242
+ * },
114243
+ * "recurring_item_id": null,
114244
+ * "rescue_id": null,
114245
+ * "count": null
114246
+ * }
114247
+ * },
114248
+ * "runs_out": {
114249
+ * "date": "2026-11-06",
114250
+ * "covered_until": "2026-11-05",
114251
+ * "balance_clp": -412000,
114252
+ * "cause": {
114253
+ * "key": "document:0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
114254
+ * "source": "payable",
114255
+ * "direction": "outflow",
114256
+ * "label": "Factura 4410 · Laboratorio Andes SpA",
114257
+ * "amount_clp": 5800000,
114258
+ * "date": "2026-11-06",
114259
+ * "due_date": "2026-11-06",
114260
+ * "overdue": false,
114261
+ * "movable": true,
114262
+ * "move": null,
114263
+ * "document": {
114264
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6501",
114265
+ * "kind": "purchase",
114266
+ * "dte_type": 33,
114267
+ * "folio": "4410"
114268
+ * },
114269
+ * "contraparte": {
114270
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6601",
114271
+ * "name": "Laboratorio Andes SpA"
114272
+ * },
114273
+ * "recurring_item_id": null,
114274
+ * "rescue_id": null,
114275
+ * "count": null
114276
+ * }
114277
+ * },
114278
+ * "overdue": {
114279
+ * "payables_clp": 0,
114280
+ * "payables_count": 0,
114281
+ * "stale_payables_clp": 0,
114282
+ * "stale_payables_count": 0,
114283
+ * "receivables_clp": 380000,
114284
+ * "receivables_count": 2
114285
+ * },
114286
+ * "inherited_overdue": {
114287
+ * "count": 0,
114288
+ * "amount_clp": 0
114289
+ * },
114290
+ * "points": [
114291
+ * {
114292
+ * "date": "2026-10-30",
114293
+ * "balance_clp": 4917109,
114294
+ * "band": {
114295
+ * "low_clp": 4917109,
114296
+ * "high_clp": 4917109
114297
+ * }
114298
+ * },
114299
+ * {
114300
+ * "date": "2026-10-31",
114301
+ * "balance_clp": 5102000,
114302
+ * "band": {
114303
+ * "low_clp": 4980000,
114304
+ * "high_clp": 5260000
114305
+ * }
114306
+ * }
114307
+ * ]
114308
+ * },
114309
+ * "result": {
114310
+ * "month": "2026-10",
114311
+ * "label": "octubre 2026",
114312
+ * "proforma": true,
114313
+ * "ingresos_clp": 41200000,
114314
+ * "gastos_clp": 38900000,
114315
+ * "variables_clp": 17400000,
114316
+ * "fijos_clp": 21500000,
114317
+ * "sin_clasificar_clp": 900000,
114318
+ * "resultado_clp": 2300000,
114319
+ * "equilibrio": {
114320
+ * "month": "2026-09",
114321
+ * "label": "septiembre 2026",
114322
+ * "equilibrio_clp": 44600000,
114323
+ * "sin_calculo": null,
114324
+ * "produccion": null,
114325
+ * "skipped_incompleto": null
114326
+ * },
114327
+ * "target_clp": 44600000,
114328
+ * "cobertura_pct": 92.4,
114329
+ * "brecha_clp": -3400000
114330
+ * },
114331
+ * "inbox": {
114332
+ * "open": 4,
114333
+ * "amount_at_stake_clp": 2860000,
114334
+ * "by_kind": {
114335
+ * "reconcile": 2,
114336
+ * "transfer": 0,
114337
+ * "classify": 1,
114338
+ * "missing_document": 1,
114339
+ * "unknown": 0
114340
+ * },
114341
+ * "close": {
114342
+ * "month": "2026-09",
114343
+ * "label": "septiembre 2026",
114344
+ * "state": "closed",
114345
+ * "open_cases": 0
114346
+ * }
114347
+ * },
114348
+ * "automatic": {
114349
+ * "month": "2026-10",
114350
+ * "count": 240,
114351
+ * "total_clp": 61200000,
114352
+ * "unreviewed_count": 31,
114353
+ * "by_actor": {
114354
+ * "rule": 150,
114355
+ * "match": 72,
114356
+ * "ai": 18
114357
+ * },
114358
+ * "recent": [
114359
+ * {
114360
+ * "kind": "link",
114361
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6701",
114362
+ * "actor": "match",
114363
+ * "label": "Pago de la factura 4388 de Laboratorio Andes SpA",
114364
+ * "day": "2026-10-29",
114365
+ * "amount_clp": 1240000,
114366
+ * "applied_at": "2026-10-29T14:10:00.000Z",
114367
+ * "movement": {
114368
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6801",
114369
+ * "day": "2026-10-29",
114370
+ * "amount_clp": 1240000,
114371
+ * "direction": "outbound",
114372
+ * "description": "Transferencia a Laboratorio Andes"
114373
+ * },
114374
+ * "document": null,
114375
+ * "target": "document",
114376
+ * "reasons": [
114377
+ * "rut",
114378
+ * "amount"
114379
+ * ],
114380
+ * "account": null,
114381
+ * "split": false,
114382
+ * "rule": null,
114383
+ * "reviewed_at": null,
114384
+ * "reviewed_by": null,
114385
+ * "group_name": "Laboratorio Andes SpA",
114386
+ * "group_key": "contraparte:3f6c1d2e-5b7a-4c1e-9d0f-2a8b6c4e1f70",
114387
+ * "group_count": 1,
114388
+ * "group_total_clp": 1240000
114389
+ * }
114390
+ * ]
114391
+ * },
114392
+ * "accounts": [
114393
+ * {
114394
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6401",
114395
+ * "name": "Cuenta corriente",
114396
+ * "institution_name": "Banco de Chile",
114397
+ * "number_masked": "··4821",
114398
+ * "type": "cuenta_corriente",
114399
+ * "currency": "CLP",
114400
+ * "balance_clp": 3719083,
114401
+ * "balance_as_of": "2026-10-30T11:02:00.000Z",
114402
+ * "in_cash": true
114403
+ * },
114404
+ * {
114405
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f6402",
114406
+ * "name": "Ahorro",
114407
+ * "institution_name": "Banco de Chile",
114408
+ * "number_masked": "··0057",
114409
+ * "type": "cuenta_ahorro",
114410
+ * "currency": "CLP",
114411
+ * "balance_clp": 12000000,
114412
+ * "balance_as_of": "2026-10-30T11:02:00.000Z",
114413
+ * "in_cash": false
114414
+ * }
114415
+ * ]
114416
+ * }
114417
+ * }
114418
+ */
114419
+ "application/json": {
114420
+ data: components["schemas"]["FinanzasResumen"];
113382
114421
  };
113383
114422
  };
113384
114423
  };
@@ -113661,13 +114700,14 @@ interface paths {
113661
114700
  cookie?: never;
113662
114701
  };
113663
114702
  /**
113664
- * Download the Contador package for a month (zip)
113665
- * @description One zip, `paquete-contador-<period>.zip`, with seven xlsx: `01-libro-de-compras`, `02-libro-de-ventas`, `03-honorarios`, `04-movimientos-por-cuenta` (one sheet per bank account), `05-clasificaciones-por-cuenta` (net, as the Resultado counts), `06-resultado` and `07-ajustes-posteriores-al-cierre`, each `<name>-<period>.xlsx`, built by the same code as each screen and its export. Read-only. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» with no RUT; the libro de ventas keeps the patient RUT on facturas and on notas de crédito or débito that cite one, and boletas carry neither RUT nor name. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`, `finanzas_reports:read` and `finanzas:export` (the Contador seat, owners and admins).
114703
+ * Download the Contador package for a month or a year (zip)
114704
+ * @description One zip, `paquete-contador-<period>.zip`, with seven xlsx: `01-libro-de-compras`, `02-libro-de-ventas`, `03-honorarios`, `04-movimientos-por-cuenta` (one sheet per bank account), `05-clasificaciones-por-cuenta` (net, as the Resultado counts), `06-resultado` and `07-ajustes-posteriores-al-cierre`, each `<name>-<period>.xlsx`, built by the same code as each screen and its export. With `year=YYYY` (instead of `period`) it is the Paquete anual of that commercial year: `paquete-contador-<year>.zip`, eight xlsx: `00-estado-del-ano` (what makes the year incomplete), `01-resultado-por-cuenta` (a column per month and the total), `02-base-de-caja` (collected and paid by account, `no_operacional` money apart, undated items listed), `03-iva-y-ppm` (each F29, proposal or filed), `04-honorarios-y-retenciones` (with the comparison against F29 code 151), `05-libro-de-compras`, `06-libro-de-ventas` and `07-pagos-de-impuestos`, each `<name>-<year>.xlsx`. The year is never summed silently as complete: the estado file and the manifest name the months not closed, not read by the SII sync, with unclassified movements or documents, F29 periods with no filing, undated collections and payments and money out nothing explains. A future year answers 400, and so does the current year until a month of it has closed; a workspace with more than one sociedad answers 409. Read-only. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» with no RUT; the libro de ventas keeps the patient RUT on facturas and on notas de crédito or débito that cite one, and boletas carry neither RUT nor name. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`, `finanzas_reports:read` and `finanzas:export` (the Contador seat, owners and admins).
113666
114705
  */
113667
114706
  get: {
113668
114707
  parameters: {
113669
114708
  query?: {
113670
114709
  period?: string;
114710
+ year?: number;
113671
114711
  };
113672
114712
  header?: never;
113673
114713
  path?: never;
@@ -113757,7 +114797,7 @@ interface paths {
113757
114797
  };
113758
114798
  /**
113759
114799
  * What the Contador package for a month holds
113760
- * @description The same package as the download, without the bytes: the period, the zip name and each file (key, label, name, rows, size). Over MCP this is the read that generates and checks the package; the zip itself downloads over HTTPS. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» with no RUT; the libro de ventas keeps the patient RUT on facturas and on notas de crédito or débito that cite one, and boletas carry neither RUT nor name. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`, `finanzas_reports:read` and `finanzas:export` (the Contador seat, owners and admins).
114800
+ * @description The same package as the download, without the bytes: the period, the zip name and each file (key, label, name, rows, size). For a year, see `GET /finanzas/contador-export/annual-manifest`. Over MCP this is the read that generates and checks the package; the zip itself downloads over HTTPS. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» with no RUT; the libro de ventas keeps the patient RUT on facturas and on notas de crédito or débito that cite one, and boletas carry neither RUT nor name. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`, `finanzas_reports:read` and `finanzas:export` (the Contador seat, owners and admins).
113761
114801
  */
113762
114802
  get: {
113763
114803
  parameters: {
@@ -113919,6 +114959,376 @@ interface paths {
113919
114959
  patch?: never;
113920
114960
  trace?: never;
113921
114961
  };
114962
+ "/finanzas/contador-export/annual-manifest": {
114963
+ parameters: {
114964
+ query?: never;
114965
+ header?: never;
114966
+ path?: never;
114967
+ cookie?: never;
114968
+ };
114969
+ /**
114970
+ * What the Paquete anual of a year holds and what it is missing
114971
+ * @description The Paquete anual's manifest, without the bytes: the files (key, label, name, rows, size), `complete` (true only when nothing is missing), `incomplete` (the months not closed, not read by the SII sync, with unclassified movements or documents, F29 periods with no filing, undated collections and payments, money out nothing explains: Spanish sentences, ready to show), `warnings` (retention declared versus the boletas) and one row per month. The zip downloads from `GET /finanzas/contador-export?year=`. `00-estado-del-ano` (what makes the year incomplete), `01-resultado-por-cuenta` (a column per month and the total), `02-base-de-caja` (collected and paid by account, `no_operacional` money apart, undated items listed), `03-iva-y-ppm` (each F29, proposal or filed), `04-honorarios-y-retenciones` (with the comparison against F29 code 151), `05-libro-de-compras`, `06-libro-de-ventas` and `07-pagos-de-impuestos`, each `<name>-<year>.xlsx`. A future year answers 400, and so does the current year until a month of it has closed; a workspace with more than one sociedad answers 409. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» with no RUT; the libro de ventas keeps the patient RUT on facturas and on notas de crédito or débito that cite one, and boletas carry neither RUT nor name. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`, `finanzas_reports:read` and `finanzas:export` (the Contador seat, owners and admins).
114972
+ */
114973
+ get: {
114974
+ parameters: {
114975
+ query: {
114976
+ year: number;
114977
+ };
114978
+ header?: never;
114979
+ path?: never;
114980
+ cookie?: never;
114981
+ };
114982
+ requestBody?: never;
114983
+ responses: {
114984
+ /** @description The annual manifest */
114985
+ 200: {
114986
+ headers: {
114987
+ [name: string]: unknown;
114988
+ };
114989
+ content: {
114990
+ /**
114991
+ * @example {
114992
+ * "data": {
114993
+ * "kind": "annual",
114994
+ * "year": 2025,
114995
+ * "filename": "paquete-contador-2025.zip",
114996
+ * "in_progress": false,
114997
+ * "complete": true,
114998
+ * "sociedad": {
114999
+ * "connection_id": "0194f3a0-7c1e-7a52-9d1b-3c5e8f2a6b41",
115000
+ * "rut": "76.123.456-7",
115001
+ * "legal_name": "Clínica Ejemplo SpA"
115002
+ * },
115003
+ * "incomplete": [],
115004
+ * "warnings": [],
115005
+ * "months": [
115006
+ * {
115007
+ * "month": "2025-01",
115008
+ * "label": "Enero 2025",
115009
+ * "state": "closed",
115010
+ * "state_label": "Cerrado",
115011
+ * "in_progress": false,
115012
+ * "open_cases": 0,
115013
+ * "sii_read": true,
115014
+ * "f29": "filed",
115015
+ * "f29_label": "Presentado",
115016
+ * "issues": []
115017
+ * },
115018
+ * {
115019
+ * "month": "2025-02",
115020
+ * "label": "Febrero 2025",
115021
+ * "state": "closed",
115022
+ * "state_label": "Cerrado",
115023
+ * "in_progress": false,
115024
+ * "open_cases": 0,
115025
+ * "sii_read": true,
115026
+ * "f29": "filed",
115027
+ * "f29_label": "Presentado",
115028
+ * "issues": []
115029
+ * },
115030
+ * {
115031
+ * "month": "2025-03",
115032
+ * "label": "Marzo 2025",
115033
+ * "state": "closed",
115034
+ * "state_label": "Cerrado",
115035
+ * "in_progress": false,
115036
+ * "open_cases": 0,
115037
+ * "sii_read": true,
115038
+ * "f29": "filed",
115039
+ * "f29_label": "Presentado",
115040
+ * "issues": []
115041
+ * },
115042
+ * {
115043
+ * "month": "2025-04",
115044
+ * "label": "Abril 2025",
115045
+ * "state": "closed",
115046
+ * "state_label": "Cerrado",
115047
+ * "in_progress": false,
115048
+ * "open_cases": 0,
115049
+ * "sii_read": true,
115050
+ * "f29": "filed",
115051
+ * "f29_label": "Presentado",
115052
+ * "issues": []
115053
+ * },
115054
+ * {
115055
+ * "month": "2025-05",
115056
+ * "label": "Mayo 2025",
115057
+ * "state": "closed",
115058
+ * "state_label": "Cerrado",
115059
+ * "in_progress": false,
115060
+ * "open_cases": 0,
115061
+ * "sii_read": true,
115062
+ * "f29": "filed",
115063
+ * "f29_label": "Presentado",
115064
+ * "issues": []
115065
+ * },
115066
+ * {
115067
+ * "month": "2025-06",
115068
+ * "label": "Junio 2025",
115069
+ * "state": "closed",
115070
+ * "state_label": "Cerrado",
115071
+ * "in_progress": false,
115072
+ * "open_cases": 0,
115073
+ * "sii_read": true,
115074
+ * "f29": "filed",
115075
+ * "f29_label": "Presentado",
115076
+ * "issues": []
115077
+ * },
115078
+ * {
115079
+ * "month": "2025-07",
115080
+ * "label": "Julio 2025",
115081
+ * "state": "closed",
115082
+ * "state_label": "Cerrado",
115083
+ * "in_progress": false,
115084
+ * "open_cases": 0,
115085
+ * "sii_read": true,
115086
+ * "f29": "filed",
115087
+ * "f29_label": "Presentado",
115088
+ * "issues": []
115089
+ * },
115090
+ * {
115091
+ * "month": "2025-08",
115092
+ * "label": "Agosto 2025",
115093
+ * "state": "closed",
115094
+ * "state_label": "Cerrado",
115095
+ * "in_progress": false,
115096
+ * "open_cases": 0,
115097
+ * "sii_read": true,
115098
+ * "f29": "filed",
115099
+ * "f29_label": "Presentado",
115100
+ * "issues": []
115101
+ * },
115102
+ * {
115103
+ * "month": "2025-09",
115104
+ * "label": "Septiembre 2025",
115105
+ * "state": "closed",
115106
+ * "state_label": "Cerrado",
115107
+ * "in_progress": false,
115108
+ * "open_cases": 0,
115109
+ * "sii_read": true,
115110
+ * "f29": "filed",
115111
+ * "f29_label": "Presentado",
115112
+ * "issues": []
115113
+ * },
115114
+ * {
115115
+ * "month": "2025-10",
115116
+ * "label": "Octubre 2025",
115117
+ * "state": "closed",
115118
+ * "state_label": "Cerrado",
115119
+ * "in_progress": false,
115120
+ * "open_cases": 0,
115121
+ * "sii_read": true,
115122
+ * "f29": "filed",
115123
+ * "f29_label": "Presentado",
115124
+ * "issues": []
115125
+ * },
115126
+ * {
115127
+ * "month": "2025-11",
115128
+ * "label": "Noviembre 2025",
115129
+ * "state": "closed",
115130
+ * "state_label": "Cerrado",
115131
+ * "in_progress": false,
115132
+ * "open_cases": 0,
115133
+ * "sii_read": true,
115134
+ * "f29": "filed",
115135
+ * "f29_label": "Presentado",
115136
+ * "issues": []
115137
+ * },
115138
+ * {
115139
+ * "month": "2025-12",
115140
+ * "label": "Diciembre 2025",
115141
+ * "state": "closed",
115142
+ * "state_label": "Cerrado",
115143
+ * "in_progress": false,
115144
+ * "open_cases": 0,
115145
+ * "sii_read": true,
115146
+ * "f29": "filed",
115147
+ * "f29_label": "Presentado",
115148
+ * "issues": []
115149
+ * }
115150
+ * ],
115151
+ * "files": [
115152
+ * {
115153
+ * "key": "estado",
115154
+ * "label": "Estado del año",
115155
+ * "filename": "00-estado-del-ano-2025.xlsx",
115156
+ * "rows": 0,
115157
+ * "size_bytes": 7904
115158
+ * },
115159
+ * {
115160
+ * "key": "resultado",
115161
+ * "label": "Resultado por cuenta",
115162
+ * "filename": "01-resultado-por-cuenta-2025.xlsx",
115163
+ * "rows": 96,
115164
+ * "size_bytes": 21350
115165
+ * },
115166
+ * {
115167
+ * "key": "base_caja",
115168
+ * "label": "Base de caja",
115169
+ * "filename": "02-base-de-caja-2025.xlsx",
115170
+ * "rows": 7412,
115171
+ * "size_bytes": 412880
115172
+ * },
115173
+ * {
115174
+ * "key": "iva_ppm",
115175
+ * "label": "IVA y PPM",
115176
+ * "filename": "03-iva-y-ppm-2025.xlsx",
115177
+ * "rows": 12,
115178
+ * "size_bytes": 8120
115179
+ * },
115180
+ * {
115181
+ * "key": "honorarios",
115182
+ * "label": "Honorarios y retenciones",
115183
+ * "filename": "04-honorarios-y-retenciones-2025.xlsx",
115184
+ * "rows": 148,
115185
+ * "size_bytes": 15660
115186
+ * },
115187
+ * {
115188
+ * "key": "libro_compras",
115189
+ * "label": "Libro de compras",
115190
+ * "filename": "05-libro-de-compras-2025.xlsx",
115191
+ * "rows": 1004,
115192
+ * "size_bytes": 88410
115193
+ * },
115194
+ * {
115195
+ * "key": "libro_ventas",
115196
+ * "label": "Libro de ventas",
115197
+ * "filename": "06-libro-de-ventas-2025.xlsx",
115198
+ * "rows": 14820,
115199
+ * "size_bytes": 702330
115200
+ * },
115201
+ * {
115202
+ * "key": "pagos_impuestos",
115203
+ * "label": "Pagos de impuestos",
115204
+ * "filename": "07-pagos-de-impuestos-2025.xlsx",
115205
+ * "rows": 24,
115206
+ * "size_bytes": 9240
115207
+ * }
115208
+ * ]
115209
+ * }
115210
+ * }
115211
+ */
115212
+ "application/json": {
115213
+ data: {
115214
+ /** @enum {string} */
115215
+ kind: "annual";
115216
+ year: number;
115217
+ /** @description The zip the download serves. */
115218
+ filename: string;
115219
+ /** @description The current year: figures still moving, future months missing. */
115220
+ in_progress: boolean;
115221
+ /** @description True only when `incomplete` is empty. Anything else: the year is NOT complete and nothing in it should be read as final. */
115222
+ complete: boolean;
115223
+ sociedad: {
115224
+ connection_id: string;
115225
+ rut: string;
115226
+ legal_name: string | null;
115227
+ } | null;
115228
+ incomplete: {
115229
+ /** @enum {string} */
115230
+ code: "month_not_closed" | "month_in_progress" | "month_not_started" | "sii_not_connected" | "sii_backfill_pending" | "sii_not_read" | "sii_not_read_previous_year" | "unclassified" | "incomplete_month" | "f29_missing" | "f29_not_filed" | "undated_collections" | "undated_payments" | "unexplained_outflows" | "rows_truncated";
115231
+ /** @description `YYYY-MM`, or null for an item about the whole year. */
115232
+ month: string | null;
115233
+ /** @description Spanish, ready to show. */
115234
+ message: string;
115235
+ }[];
115236
+ warnings: {
115237
+ /** @enum {string} */
115238
+ code: "honorarios_retention_differs" | "honorarios_no_declared_code";
115239
+ month: string | null;
115240
+ message: string;
115241
+ }[];
115242
+ months: {
115243
+ month: string;
115244
+ label: string;
115245
+ /** @enum {string} */
115246
+ state: "open" | "ready_to_close" | "closed" | "closed_imported" | "upcoming";
115247
+ state_label: string;
115248
+ in_progress: boolean;
115249
+ open_cases: number;
115250
+ sii_read: boolean;
115251
+ /** @enum {string} */
115252
+ f29: "filed" | "proposal" | "missing" | "not_due";
115253
+ f29_label: string;
115254
+ issues: ("month_not_closed" | "month_in_progress" | "month_not_started" | "sii_not_connected" | "sii_backfill_pending" | "sii_not_read" | "sii_not_read_previous_year" | "unclassified" | "incomplete_month" | "f29_missing" | "f29_not_filed" | "undated_collections" | "undated_payments" | "unexplained_outflows" | "rows_truncated")[];
115255
+ }[];
115256
+ files: {
115257
+ /** @enum {string} */
115258
+ key: "estado" | "resultado" | "base_caja" | "iva_ppm" | "honorarios" | "libro_compras" | "libro_ventas" | "pagos_impuestos";
115259
+ label: string;
115260
+ filename: string;
115261
+ rows: number;
115262
+ size_bytes: number;
115263
+ }[];
115264
+ };
115265
+ };
115266
+ };
115267
+ };
115268
+ /** @description Validation error */
115269
+ 400: {
115270
+ headers: {
115271
+ [name: string]: unknown;
115272
+ };
115273
+ content: {
115274
+ "application/json": components["schemas"]["Error"];
115275
+ };
115276
+ };
115277
+ /** @description Unauthorized */
115278
+ 401: {
115279
+ headers: {
115280
+ [name: string]: unknown;
115281
+ };
115282
+ content: {
115283
+ "application/json": components["schemas"]["Error"];
115284
+ };
115285
+ };
115286
+ /** @description Forbidden */
115287
+ 403: {
115288
+ headers: {
115289
+ [name: string]: unknown;
115290
+ };
115291
+ content: {
115292
+ "application/json": components["schemas"]["Error"];
115293
+ };
115294
+ };
115295
+ /** @description Not found */
115296
+ 404: {
115297
+ headers: {
115298
+ [name: string]: unknown;
115299
+ };
115300
+ content: {
115301
+ "application/json": components["schemas"]["Error"];
115302
+ };
115303
+ };
115304
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
115305
+ 409: {
115306
+ headers: {
115307
+ [name: string]: unknown;
115308
+ };
115309
+ content: {
115310
+ "application/json": components["schemas"]["Error"];
115311
+ };
115312
+ };
115313
+ /** @description Rate limited */
115314
+ 429: {
115315
+ headers: {
115316
+ [name: string]: unknown;
115317
+ };
115318
+ content: {
115319
+ "application/json": components["schemas"]["Error"];
115320
+ };
115321
+ };
115322
+ };
115323
+ };
115324
+ put?: never;
115325
+ post?: never;
115326
+ delete?: never;
115327
+ options?: never;
115328
+ head?: never;
115329
+ patch?: never;
115330
+ trace?: never;
115331
+ };
113922
115332
  "/finanzas/ads-connections": {
113923
115333
  parameters: {
113924
115334
  query?: never;
@@ -147350,7 +148760,7 @@ interface paths {
147350
148760
  };
147351
148761
  /**
147352
148762
  * Agenda for a window, any engine, by professional and branch
147353
- * @description Mirrored AND native appointments between `from` (inclusive) and `to` (EXCLUSIVE), bare `YYYY-MM-DD` days in the clinic's timezone; the window may not exceed 8 days. Cancelled citas are INCLUDED (the grid draws them muted). Unlike `GET /clinic/agenda`, `professional_id` and `location_id` are VITRINA uuids — `clinic_professional.id` and `location.id` — so one query serves a Medilink, a Reservo and a native clinic. Each row still carries the vendor's own ids under `vendor` for provenance: a row with `vendor.professional_id` set and `professional: null` is a roster gap, never a cita nobody is attending. `video` ({staff_link, join_opens_at, join_closes_at, waiting} or null) marks a videoconsulta: the camera icon, the professional's «Entrar» from join_opens_at, and «Esperando en video». Never calls the clinic API. `cancellation` ({by: patient|clinic|null, reason} or null) is set on a cancelled cita: who called it off and why. `flags` are the clinical alerts the clinic shows on the block: clinical-record content, returned to an API key or personal token only when it also holds `clinic_record:read`. `booking_kind` is the cita's Tipo de agendamiento: `new` (Nuevo: it would be a primera visita and the patient never booked before), `new_rebooked` (Nuevo · reagenda: a primera visita, but the patient had earlier bookings and never came) or `in_treatment` (En tratamiento: every other cita); null on a row that is not a patient's cita. It uses the primera-visita rule Vitrina Ads counts, so a patient back after 12 months without an attended cita is `new`. `origin` is the patient's Origen (`kind` `meta` with the ad, ad set and campaign names, or `organic`) — the attribution Vitrina Ads reports, one definition; null on a row that is not a patient's cita. Filter with `origin=meta|organic|unknown` and, for Meta, `origin_ad_id` (a Meta ad id): rows that are not a patient's cita never match. `is_diagnosis` marks a diagnosis cita — a primera visita (`booking_kind` `new` / `new_rebooked`), an entry prestación the clinic confirmed, or a cita the clinic named as an evaluación / diagnóstico (the prestación, or the vendor's tratamiento label) unless its prestación is confirmed not to be an entry; `diagnosis=true` returns only those. `booked_via` says how the cita was booked: `agent` (Vitrina's AI agent, with the conversation `channel`), `online` (the patient on a booking page), `whatsapp` (a person booked it within 48 h of a WhatsApp exchange with the patient), `staff` (a team member in Vitrina, `by`), `vendor` (keyed straight into the clinic's system) or `calendar`; `booked_at` is the vendor's own creation time when known. `paid_clp` is what THIS cita was paid (allocations to its own abono and performed prestaciones; never the patient's presupuesto cuotas), returned only to a caller holding `clinic_money:read`. `owed_clp` is everything the cita still owes (abono AND performed prestaciones: every open receivable on the cita, net of allocations) and `patient_owed_clp` everything its patient owes, future cuotas included — the same figure as the ficha's «Debe» (`GET /contacts/{id}/ledger` `outstanding_clp`); both null without `clinic_money:read`. `money` stays the abono alone. `unconfirmed` is true on a live cita (`status` `confirmed`) whose clinic status says the patient has not confirmed it yet («No confirmado»): draw it as «Sin confirmar». It is a confirmation flag beside `status`, never a lifecycle state — the cita still counts as booked everywhere `status` `confirmed` does. `visit_state` is THE cita's one status (lane L2, `GET /clinic/cita-statuses`): `key` is `scheduled` (Agendada), `confirmed` (Confirmada), `waiting` (Esperando), `in_room` (En box), `attended` (Atendida), `no_show` (No llegó) or `cancelled` (Anulada) — a call-off first, then an attended visit, then where the patient is (Vitrina's board, else the mirror's own estado), then whether she confirmed; `minutes` is how long she has waited, been in the box or (attended, still owing) been at the counter, and `stale` says that has gone on for 3 h or since an earlier day. `owes` marks an attended visit that still owes its own lines («Cobrar»): money is a mark, never a status. `overbooked` marks a cita staff booked as a sobrecupo. `status_actions` is `{current, offered}` on the same line: `offered` is what `POST /clinic/appointments/{id}/status` accepts from this caller now — never the current one, empty on a cancelled cita, a bloqueo or an own event, and for a caller without `clinic:write`; no visit-day move on a later day, `no_show` only from the cita's hour; a Medilink/Dentalink mirror offers only where the patient is and the cancel. `motivo` ({id, name} or null) is the motivo de atención a cita in Vitrina's own agenda was booked as — what the cita is called on the block, the drawer and the phone; `service` stays the prestación it is charged as. `professional.name` is «Nombre Apellidos».
148763
+ * @description Mirrored AND native appointments between `from` (inclusive) and `to` (EXCLUSIVE), bare `YYYY-MM-DD` days in the clinic's timezone; the window may not exceed 8 days. Cancelled citas are INCLUDED (the grid draws them muted). Unlike `GET /clinic/agenda`, `professional_id` and `location_id` are VITRINA uuids — `clinic_professional.id` and `location.id` — so one query serves a Medilink, a Reservo and a native clinic. Each row still carries the vendor's own ids under `vendor` for provenance: a row with `vendor.professional_id` set and `professional: null` is a roster gap, never a cita nobody is attending. `video` ({staff_link, join_opens_at, join_closes_at, waiting} or null) marks a videoconsulta: the camera icon, the professional's «Entrar» from join_opens_at, and «Esperando en video». Never calls the clinic API. `cancellation` ({by: patient|clinic|null, reason} or null) is set on a cancelled cita: who called it off and why. `flags` are the clinical alerts the clinic shows on the block: clinical-record content, returned to an API key or personal token only when it also holds `clinic_record:read`. `booking_kind` is the cita's Tipo de agendamiento: `new` (Nuevo: it would be a primera visita and the patient never booked before), `new_rebooked` (Nuevo · reagenda: a primera visita, but the patient had earlier bookings and never came) or `in_treatment` (En tratamiento: every other cita); null on a row that is not a patient's cita. It uses the primera-visita rule Vitrina Ads counts, so a patient back after 12 months without an attended cita is `new`. `origin` is the patient's Origen (`kind` `meta` with the ad, ad set and campaign names, or `organic`) — the attribution Vitrina Ads reports, one definition; null on a row that is not a patient's cita. Filter with `origin=meta|organic|unknown` and, for Meta, `origin_ad_id` (a Meta ad id): rows that are not a patient's cita never match. `is_diagnosis` marks a diagnosis cita — a primera visita (`booking_kind` `new` / `new_rebooked`), an entry prestación the clinic confirmed, or a cita the clinic named as an evaluación / diagnóstico (the prestación, or the vendor's tratamiento label) unless its prestación is confirmed not to be an entry; `diagnosis=true` returns only those. `booked_via` says how the cita was booked: `agent` (Vitrina's AI agent, with the conversation `channel`), `online` (the patient on a booking page), `whatsapp` (a person booked it within 48 h of a WhatsApp exchange with the patient), `staff` (a team member in Vitrina, `by`), `vendor` (keyed straight into the clinic's system) or `calendar`; `booked_at` is the vendor's own creation time when known. `paid_clp` is what THIS cita was paid (allocations to its own abono and performed prestaciones; never the patient's presupuesto cuotas), returned only to a caller holding `clinic_money:read`. `owed_clp` is everything the cita still owes (abono AND performed prestaciones: every open receivable on the cita, net of allocations) and `patient_owed_clp` everything its patient owes, future cuotas included — the same figure as the ficha's «Debe» (`GET /contacts/{id}/ledger` `outstanding_clp`); both null without `clinic_money:read`. `money` stays the abono alone. `unconfirmed` is true on a live cita (`status` `confirmed`) whose clinic status says the patient has not confirmed it yet («No confirmado»): draw it as «Sin confirmar». It is a confirmation flag beside `status`, never a lifecycle state — the cita still counts as booked everywhere `status` `confirmed` does. `visit_state` is THE cita's one status (lane L2, `GET /clinic/cita-statuses`): `key` is `scheduled` (Agendada), `confirmed` (Confirmada), `waiting` (Esperando), `in_room` (En box), `attended` (Atendida), `no_show` (No llegó) or `cancelled` (Anulada) — a call-off first, then an attended visit, then where the patient is (Vitrina's board, else the mirror's own estado), then whether she confirmed; `minutes` is how long she has waited, been in the box or (attended, still owing) been at the counter, and `stale` says that has gone on for 3 h or since an earlier day. `owes` marks an attended visit that still owes its own lines («Cobrar»): money is a mark, never a status. `overbooked` marks a cita booked as a sobrecupo and `overbook_reason` says why (the reason staff wrote, or `campaña` for a «Sobrecupo de campaña»; null otherwise). `status_actions` is `{current, offered}` on the same line: `offered` is what `POST /clinic/appointments/{id}/status` accepts from this caller now — never the current one, empty on a cancelled cita, a bloqueo or an own event, and for a caller without `clinic:write`; no visit-day move on a later day, `no_show` only from the cita's hour; a Medilink/Dentalink mirror offers only where the patient is and the cancel. `motivo` ({id, name} or null) is the motivo de atención a cita in Vitrina's own agenda was booked as — what the cita is called on the block, the drawer and the phone; `service` stays the prestación it is charged as. `professional.name` is «Nombre Apellidos».
147354
148764
  *
147355
148765
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
147356
148766
  */
@@ -147411,6 +148821,7 @@ interface paths {
147411
148821
  * },
147412
148822
  * "owes": false,
147413
148823
  * "overbooked": false,
148824
+ * "overbook_reason": null,
147414
148825
  * "clinic_status_id": null,
147415
148826
  * "status_label": null,
147416
148827
  * "status_color": null,
@@ -148190,7 +149601,7 @@ interface paths {
148190
149601
  };
148191
149602
  /**
148192
149603
  * Free slots, from whichever engine owns this diary
148193
- * @description One endpoint, three truths: a Medilink clinic gets its vendor's live answer, a Reservo clinic the local compute over its mirror, and a native clinic the professionals' work patterns minus exceptions, existing citas and room contention. Each slot carries an opaque `slot_ref` that pins the professional, the box and the branch — book it back verbatim. `allow_overbook` is a STAFF flag and defaults to false: an hour that only exists because the clinic permits sobrecupo is a receptionist's decision with a reason, never something a patient-facing read gives away. `professional_id` is the `id` returned by clinic_professionals_list, and each slot's `professional_id` is in that same id space. The window is half-open like every agenda read: `from` inclusive, `to` EXCLUSIVE. `truncated: true` means more free slots exist than were listed — days of the window left unread (see `searched_through`) or the `limit` cap (max 100) reached; narrow by `professional_id` / `especialidad` or shorten the window to see the rest. A ONE-day read with no slot says why in `empty_reason` (Vitrina's own diary; null elsewhere): `nobody_performs`, `nobody_works` (no horario that day), `professional_off` (the one professional asked for is off that day while others work), `closed` (bloqueos, feriados or vacaciones cover it), `past` or `all_taken`. `performed_by` names whose agendas were read when the visit narrowed them (its who-performs or specialty; null = everyone), so an empty day reads «este motivo solo lo atiende …». On a `complete` read of Vitrina's own diary that came back empty, `next_available` is the first later day with a free hour ({date, first_starts_at}); null otherwise.
149604
+ * @description One endpoint, three truths: a Medilink clinic gets its vendor's live answer, a Reservo clinic the local compute over its mirror, and a native clinic the professionals' work patterns minus exceptions, existing citas and room contention. Each slot carries an opaque `slot_ref` that pins the professional, the box and the branch — book it back verbatim. `allow_overbook` is a STAFF flag and defaults to false: an hour that only exists because the clinic permits sobrecupo is a receptionist's decision with a reason, never something a patient-facing read gives away. The one exception is a clinic that set «Sobrecupo de campaña» (`/clinic/agenda/campaign-overbook`): for an entry prestación, a share of the hours held by ad-origin evaluations is offered once more, to every reader, flagged `campaign_overbook: true` here; booked by its `slot_ref` it is stored as a sobrecupo with reason «campaña». `professional_id` is the `id` returned by clinic_professionals_list, and each slot's `professional_id` is in that same id space. The window is half-open like every agenda read: `from` inclusive, `to` EXCLUSIVE. `truncated: true` means more free slots exist than were listed — days of the window left unread (see `searched_through`) or the `limit` cap (max 100) reached; narrow by `professional_id` / `especialidad` or shorten the window to see the rest. A ONE-day read with no slot says why in `empty_reason` (Vitrina's own diary; null elsewhere): `nobody_performs`, `nobody_works` (no horario that day), `professional_off` (the one professional asked for is off that day while others work), `closed` (bloqueos, feriados or vacaciones cover it), `past` or `all_taken`. `performed_by` names whose agendas were read when the visit narrowed them (its who-performs or specialty; null = everyone), so an empty day reads «este motivo solo lo atiende …». On a `complete` read of Vitrina's own diary that came back empty, `next_available` is the first later day with a free hour ({date, first_starts_at}); null otherwise.
148194
149605
  *
148195
149606
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
148196
149607
  */
@@ -148234,7 +149645,8 @@ interface paths {
148234
149645
  * "label": "jueves, 24 de septiembre, 09:00",
148235
149646
  * "slot_ref": "ncl1_eyJwIjoiZmZmZmZmZmYtMDAwMC00MDAwLTgwMDAtMDAwMDAwMDAwMDAxIiwibCI6ImIxYjFiMWIxLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDAwMiIsInMiOiIyMDI2LTA5LTI0VDEyOjAwOjAwLjAwMFoiLCJlIjoiMjAyNi0wOS0yNFQxMjozMDowMC4wMDBaIn0",
148236
149647
  * "professional_id": "ffffffff-0000-4000-8000-000000000001",
148237
- * "professional_name": "Ana Rojas"
149648
+ * "professional_name": "Ana Rojas",
149649
+ * "campaign_overbook": false
148238
149650
  * },
148239
149651
  * {
148240
149652
  * "starts_at": "2026-09-24T12:30:00.000Z",
@@ -148242,7 +149654,8 @@ interface paths {
148242
149654
  * "label": "jueves, 24 de septiembre, 09:30",
148243
149655
  * "slot_ref": "ncl1_eyJwIjoiZmZmZmZmZmYtMDAwMC00MDAwLTgwMDAtMDAwMDAwMDAwMDAxIiwibCI6ImIxYjFiMWIxLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDAwMiIsInMiOiIyMDI2LTA5LTI0VDEyOjMwOjAwLjAwMFoiLCJlIjoiMjAyNi0wOS0yNFQxMzowMDowMC4wMDBaIn0",
148244
149656
  * "professional_id": "ffffffff-0000-4000-8000-000000000001",
148245
- * "professional_name": "Ana Rojas"
149657
+ * "professional_name": "Ana Rojas",
149658
+ * "campaign_overbook": false
148246
149659
  * }
148247
149660
  * ],
148248
149661
  * "searched_through": "2026-09-24",
@@ -148752,8 +150165,317 @@ interface paths {
148752
150165
  * "treatment_plan_id": null,
148753
150166
  * "booking_landing_id": null,
148754
150167
  * "attribution": null,
148755
- * "starts_at": "2026-09-24T14:00:00.000Z",
148756
- * "ends_at": "2026-09-24T14:30:00.000Z",
150168
+ * "starts_at": "2026-09-24T14:00:00.000Z",
150169
+ * "ends_at": "2026-09-24T14:30:00.000Z",
150170
+ * "hold_expires_at": null,
150171
+ * "google_event_id": null,
150172
+ * "google_ical_uid": null,
150173
+ * "google_updated_at": null,
150174
+ * "google_etag": null,
150175
+ * "calendar_mirror_status": null,
150176
+ * "calendar_mirror_op": null,
150177
+ * "calendar_mirror_error": null,
150178
+ * "calendar_mirror_attempts": 0,
150179
+ * "calendar_mirror_attempted_at": null,
150180
+ * "calendar_mirror_next_retry_at": null,
150181
+ * "calendar_mirror_calendar_id": null,
150182
+ * "reminder_at": null,
150183
+ * "reminder_sent_at": null,
150184
+ * "reminder_job_id": null,
150185
+ * "customer_name": "María José Fuentes Lagos",
150186
+ * "notes": "Control mensual",
150187
+ * "metadata": {
150188
+ * "engine": "native-clinic",
150189
+ * "patient_rut": "11.111.111-1",
150190
+ * "clinic_patient_id": "12121212-0000-4000-8000-000000000001"
150191
+ * },
150192
+ * "display_seq": 2,
150193
+ * "display_id": "A-2",
150194
+ * "created_at": "2026-09-22T17:18:58.202Z",
150195
+ * "updated_at": "2026-09-22T17:18:58.202Z"
150196
+ * }
150197
+ * }
150198
+ */
150199
+ "application/json": {
150200
+ data?: unknown;
150201
+ meta?: {
150202
+ [key: string]: unknown;
150203
+ };
150204
+ };
150205
+ };
150206
+ };
150207
+ /** @description Validation error */
150208
+ 400: {
150209
+ headers: {
150210
+ [name: string]: unknown;
150211
+ };
150212
+ content: {
150213
+ "application/json": components["schemas"]["Error"];
150214
+ };
150215
+ };
150216
+ /** @description Unauthorized */
150217
+ 401: {
150218
+ headers: {
150219
+ [name: string]: unknown;
150220
+ };
150221
+ content: {
150222
+ "application/json": components["schemas"]["Error"];
150223
+ };
150224
+ };
150225
+ /** @description Forbidden */
150226
+ 403: {
150227
+ headers: {
150228
+ [name: string]: unknown;
150229
+ };
150230
+ content: {
150231
+ "application/json": components["schemas"]["Error"];
150232
+ };
150233
+ };
150234
+ /** @description Not found */
150235
+ 404: {
150236
+ headers: {
150237
+ [name: string]: unknown;
150238
+ };
150239
+ content: {
150240
+ "application/json": components["schemas"]["Error"];
150241
+ };
150242
+ };
150243
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
150244
+ 409: {
150245
+ headers: {
150246
+ [name: string]: unknown;
150247
+ };
150248
+ content: {
150249
+ "application/json": components["schemas"]["Error"];
150250
+ };
150251
+ };
150252
+ /** @description Rate limited */
150253
+ 429: {
150254
+ headers: {
150255
+ [name: string]: unknown;
150256
+ };
150257
+ content: {
150258
+ "application/json": components["schemas"]["Error"];
150259
+ };
150260
+ };
150261
+ };
150262
+ };
150263
+ delete?: never;
150264
+ options?: never;
150265
+ head?: never;
150266
+ patch?: never;
150267
+ trace?: never;
150268
+ };
150269
+ "/clinic/agenda/appointments/{id}/resend-confirmation": {
150270
+ parameters: {
150271
+ query?: never;
150272
+ header?: never;
150273
+ path?: never;
150274
+ cookie?: never;
150275
+ };
150276
+ get?: never;
150277
+ put?: never;
150278
+ /**
150279
+ * Send the cita confirmation again
150280
+ * @description For a patient who says the confirmation never arrived: the same message, now, through the one reach policy (WhatsApp, else e-mail). It goes even with «Confirmar cada cita al paciente» off (a person asked) and never becomes a «Llamar hoy» item. Answers `{ sent, reason, channel, call }`. Only a live cita still ahead (`cita_not_ahead` otherwise). Requires `clinic:write`.
150281
+ *
150282
+ * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
150283
+ */
150284
+ post: {
150285
+ parameters: {
150286
+ query?: never;
150287
+ header?: {
150288
+ /** @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. */
150289
+ "Idempotency-Key"?: string;
150290
+ };
150291
+ path: {
150292
+ id: string;
150293
+ };
150294
+ cookie?: never;
150295
+ };
150296
+ requestBody?: never;
150297
+ responses: {
150298
+ /** @description Booking confirmation outcome */
150299
+ 200: {
150300
+ headers: {
150301
+ [name: string]: unknown;
150302
+ };
150303
+ content: {
150304
+ /**
150305
+ * @example {
150306
+ * "data": {
150307
+ * "sent": true,
150308
+ * "reason": null,
150309
+ * "channel": "whatsapp"
150310
+ * }
150311
+ * }
150312
+ */
150313
+ "application/json": {
150314
+ data?: unknown;
150315
+ meta?: {
150316
+ [key: string]: unknown;
150317
+ };
150318
+ };
150319
+ };
150320
+ };
150321
+ /** @description Validation error */
150322
+ 400: {
150323
+ headers: {
150324
+ [name: string]: unknown;
150325
+ };
150326
+ content: {
150327
+ "application/json": components["schemas"]["Error"];
150328
+ };
150329
+ };
150330
+ /** @description Unauthorized */
150331
+ 401: {
150332
+ headers: {
150333
+ [name: string]: unknown;
150334
+ };
150335
+ content: {
150336
+ "application/json": components["schemas"]["Error"];
150337
+ };
150338
+ };
150339
+ /** @description Forbidden */
150340
+ 403: {
150341
+ headers: {
150342
+ [name: string]: unknown;
150343
+ };
150344
+ content: {
150345
+ "application/json": components["schemas"]["Error"];
150346
+ };
150347
+ };
150348
+ /** @description Not found */
150349
+ 404: {
150350
+ headers: {
150351
+ [name: string]: unknown;
150352
+ };
150353
+ content: {
150354
+ "application/json": components["schemas"]["Error"];
150355
+ };
150356
+ };
150357
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
150358
+ 409: {
150359
+ headers: {
150360
+ [name: string]: unknown;
150361
+ };
150362
+ content: {
150363
+ "application/json": components["schemas"]["Error"];
150364
+ };
150365
+ };
150366
+ /** @description Rate limited */
150367
+ 429: {
150368
+ headers: {
150369
+ [name: string]: unknown;
150370
+ };
150371
+ content: {
150372
+ "application/json": components["schemas"]["Error"];
150373
+ };
150374
+ };
150375
+ };
150376
+ };
150377
+ delete?: never;
150378
+ options?: never;
150379
+ head?: never;
150380
+ patch?: never;
150381
+ trace?: never;
150382
+ };
150383
+ "/clinic/agenda/appointments/{id}": {
150384
+ parameters: {
150385
+ query?: never;
150386
+ header?: never;
150387
+ path?: never;
150388
+ cookie?: never;
150389
+ };
150390
+ get?: never;
150391
+ put?: never;
150392
+ post?: never;
150393
+ delete?: never;
150394
+ options?: never;
150395
+ head?: never;
150396
+ /**
150397
+ * Move a cita
150398
+ * @description Reschedule through the owning engine — a native cita moves inside one transaction under the same per-professional lock a booking takes, and a mirrored one moves the way its vendor moves citas. The deposit's deadline travels with it: a cita moved a week out with a deadline that stayed put is a "vencido" nobody can date. `professional_id` / `resource_id` move the cita to another agenda or room in the same stroke; omitted, it keeps the ones it has. Requires `clinic:write`.
150399
+ *
150400
+ * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
150401
+ */
150402
+ patch: {
150403
+ parameters: {
150404
+ query?: never;
150405
+ header?: never;
150406
+ path: {
150407
+ id: string;
150408
+ };
150409
+ cookie?: never;
150410
+ };
150411
+ requestBody?: {
150412
+ content: {
150413
+ /**
150414
+ * @example {
150415
+ * "starts_at": "2026-09-24T14:30:00.000Z",
150416
+ * "ends_at": "2026-09-24T15:00:00.000Z"
150417
+ * }
150418
+ */
150419
+ "application/json": {
150420
+ slot_ref?: string;
150421
+ /** Format: uuid */
150422
+ professional_id?: string;
150423
+ /**
150424
+ * Format: uuid
150425
+ * @description The box/sillón (`clinic_resource.id`) the cita moves to. Omitted = it keeps its box; null = «Sin box». The same times with another box is a move between boxes. Refused with `box_taken` when that box holds another cita at that hour, `unknown_box` / `box_other_sucursal` when it is not an active room of the cita's sucursal.
150426
+ */
150427
+ resource_id?: string | null;
150428
+ starts_at: string;
150429
+ ends_at: string;
150430
+ allow_overbook?: boolean;
150431
+ duration_minutes?: number;
150432
+ confirm_past?: boolean;
150433
+ /** @enum {string} */
150434
+ modality?: "presencial" | "video";
150435
+ /** @description Tell the patient the new time (the booking confirmation, with the manage link) through the one reach policy: WhatsApp, else e-mail, else a Call center item; a move less than 24 h before the cita also asks reception to phone. The answer carries `patient_notice: {sent, reason, channel, call}`; a notice that could not go out never fails the move. */
150436
+ notify_patient?: boolean;
150437
+ };
150438
+ };
150439
+ };
150440
+ responses: {
150441
+ /** @description Appointment */
150442
+ 200: {
150443
+ headers: {
150444
+ [name: string]: unknown;
150445
+ };
150446
+ content: {
150447
+ /**
150448
+ * @example {
150449
+ * "data": {
150450
+ * "id": "eeeeeeee-0000-4000-8000-000000000002",
150451
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
150452
+ * "lead_id": null,
150453
+ * "contact_id": null,
150454
+ * "conversation_id": null,
150455
+ * "vehicle_id": null,
150456
+ * "appointment_type_id": null,
150457
+ * "owner_user_id": null,
150458
+ * "location_id": "b1b1b1b1-0000-4000-8000-000000000002",
150459
+ * "professional_id": "ffffffff-0000-4000-8000-000000000001",
150460
+ * "resource_id": null,
150461
+ * "kind": "clinic",
150462
+ * "source": "agent",
150463
+ * "engine": "native",
150464
+ * "external_id": null,
150465
+ * "status": "confirmed",
150466
+ * "status_epoch": 0,
150467
+ * "clinic_status_id": null,
150468
+ * "arrival_state": "scheduled",
150469
+ * "arrived_at": null,
150470
+ * "in_room_at": null,
150471
+ * "done_at": null,
150472
+ * "series_id": null,
150473
+ * "series_index": null,
150474
+ * "treatment_plan_id": null,
150475
+ * "booking_landing_id": null,
150476
+ * "attribution": null,
150477
+ * "starts_at": "2026-09-24T14:30:00.000Z",
150478
+ * "ends_at": "2026-09-24T15:00:00.000Z",
148757
150479
  * "hold_expires_at": null,
148758
150480
  * "google_event_id": null,
148759
150481
  * "google_ical_uid": null,
@@ -148779,7 +150501,7 @@ interface paths {
148779
150501
  * "display_seq": 2,
148780
150502
  * "display_id": "A-2",
148781
150503
  * "created_at": "2026-09-22T17:18:58.202Z",
148782
- * "updated_at": "2026-09-22T17:18:58.202Z"
150504
+ * "updated_at": "2026-09-22T17:19:15.981Z"
148783
150505
  * }
148784
150506
  * }
148785
150507
  */
@@ -148847,34 +150569,25 @@ interface paths {
148847
150569
  };
148848
150570
  };
148849
150571
  };
148850
- delete?: never;
148851
- options?: never;
148852
- head?: never;
148853
- patch?: never;
148854
150572
  trace?: never;
148855
150573
  };
148856
- "/clinic/agenda/appointments/{id}/resend-confirmation": {
150574
+ "/clinic/agenda/appointments/{id}/history": {
148857
150575
  parameters: {
148858
150576
  query?: never;
148859
150577
  header?: never;
148860
150578
  path?: never;
148861
150579
  cookie?: never;
148862
150580
  };
148863
- get?: never;
148864
- put?: never;
148865
150581
  /**
148866
- * Send the cita confirmation again
148867
- * @description For a patient who says the confirmation never arrived: the same message, now, through the one reach policy (WhatsApp, else e-mail). It goes even with «Confirmar cada cita al paciente» off (a person asked) and never becomes a «Llamar hoy» item. Answers `{ sent, reason, channel, call }`. Only a live cita still ahead (`cita_not_ahead` otherwise). Requires `clinic:write`.
150582
+ * A cita's «Historial de cambios»
150583
+ * @description Who created the cita and from which door (`staff` in the agenda, the patient `online`, the AI agent in a conversation, an `import`, the clinic’s system), then every move (from → to), estado, profesional, box, sucursal, modalidad and comment change and the cancellation with its reason — each with who and when. WHAT changed is recorded by the database whatever wrote it; WHO is the request’s own audit row, the patient’s reminder reply, or `unknown` (never guessed). Oldest first. Read-only. Requires `clinic:read`.
148868
150584
  *
148869
150585
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
148870
150586
  */
148871
- post: {
150587
+ get: {
148872
150588
  parameters: {
148873
150589
  query?: never;
148874
- header?: {
148875
- /** @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. */
148876
- "Idempotency-Key"?: string;
148877
- };
150590
+ header?: never;
148878
150591
  path: {
148879
150592
  id: string;
148880
150593
  };
@@ -148882,7 +150595,7 @@ interface paths {
148882
150595
  };
148883
150596
  requestBody?: never;
148884
150597
  responses: {
148885
- /** @description Booking confirmation outcome */
150598
+ /** @description The history */
148886
150599
  200: {
148887
150600
  headers: {
148888
150601
  [name: string]: unknown;
@@ -148891,17 +150604,39 @@ interface paths {
148891
150604
  /**
148892
150605
  * @example {
148893
150606
  * "data": {
148894
- * "sent": true,
148895
- * "reason": null,
148896
- * "channel": "whatsapp"
150607
+ * "entries": [
150608
+ * {
150609
+ * "id": "e1e1e1e1-0000-4000-8000-000000000001",
150610
+ * "at": "2026-11-03T14:02:00.000Z",
150611
+ * "kind": "created",
150612
+ * "from": null,
150613
+ * "to": "2026-11-10T13:00:00.000Z",
150614
+ * "reason": null,
150615
+ * "actor": {
150616
+ * "kind": "patient",
150617
+ * "name": null,
150618
+ * "via": "online"
150619
+ * }
150620
+ * },
150621
+ * {
150622
+ * "id": "e1e1e1e1-0000-4000-8000-000000000002",
150623
+ * "at": "2026-11-05T09:15:00.000Z",
150624
+ * "kind": "rescheduled",
150625
+ * "from": "2026-11-10T13:00:00.000Z",
150626
+ * "to": "2026-11-12T15:00:00.000Z",
150627
+ * "reason": "El paciente pidió cambiarla",
150628
+ * "actor": {
150629
+ * "kind": "staff",
150630
+ * "name": "Recepción",
150631
+ * "via": "agenda"
150632
+ * }
150633
+ * }
150634
+ * ]
148897
150635
  * }
148898
150636
  * }
148899
150637
  */
148900
150638
  "application/json": {
148901
- data?: unknown;
148902
- meta?: {
148903
- [key: string]: unknown;
148904
- };
150639
+ data: components["schemas"]["ClinicCitaHistory"];
148905
150640
  };
148906
150641
  };
148907
150642
  };
@@ -148961,32 +150696,28 @@ interface paths {
148961
150696
  };
148962
150697
  };
148963
150698
  };
150699
+ put?: never;
150700
+ post?: never;
148964
150701
  delete?: never;
148965
150702
  options?: never;
148966
150703
  head?: never;
148967
150704
  patch?: never;
148968
150705
  trace?: never;
148969
150706
  };
148970
- "/clinic/agenda/appointments/{id}": {
150707
+ "/clinic/agenda/appointments/{id}/patient-notice": {
148971
150708
  parameters: {
148972
150709
  query?: never;
148973
150710
  header?: never;
148974
150711
  path?: never;
148975
150712
  cookie?: never;
148976
150713
  };
148977
- get?: never;
148978
- put?: never;
148979
- post?: never;
148980
- delete?: never;
148981
- options?: never;
148982
- head?: never;
148983
150714
  /**
148984
- * Move a cita
148985
- * @description Reschedule through the owning engine — a native cita moves inside one transaction under the same per-professional lock a booking takes, and a mirrored one moves the way its vendor moves citas. The deposit's deadline travels with it: a cita moved a week out with a deadline that stayed put is a "vencido" nobody can date. `professional_id` / `resource_id` move the cita to another agenda or room in the same stroke; omitted, it keeps the ones it has. Requires `clinic:write`.
150715
+ * Can «Avisar al paciente» reach this patient now
150716
+ * @description The one reach policy (`clinic-patient-reach`) in dry run: it walks the same gates the notice send walks (phone, consent, the clinic WhatsApp number, the thread, the 24 h window; then the e-mail) and sends NOTHING. `channel` is how a move or cancel with `notify_patient` would reach the patient: `whatsapp`; `email` when WhatsApp cannot and the owner left «Usar correo si no hay WhatsApp» on; `call` when no message can go and it would land on «Llamar hoy»; null when not even a call is asked for. `can_send` is true for a message channel. `reason` says why WhatsApp cannot (`no_contact`, `no_phone`, `preference_blocked`, `no_whatsapp_account`, `no_thread`, `window_closed`, `billing_paused`). `recipient` names who receives it (a minor's apoderado: `{ name, relation, relation_sex }`; `relation_sex` `f`/`m` when the apoderado's own ficha says it, else null). Requires `clinic:read`.
148986
150717
  *
148987
150718
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
148988
150719
  */
148989
- patch: {
150720
+ get: {
148990
150721
  parameters: {
148991
150722
  query?: never;
148992
150723
  header?: never;
@@ -148995,37 +150726,9 @@ interface paths {
148995
150726
  };
148996
150727
  cookie?: never;
148997
150728
  };
148998
- requestBody?: {
148999
- content: {
149000
- /**
149001
- * @example {
149002
- * "starts_at": "2026-09-24T14:30:00.000Z",
149003
- * "ends_at": "2026-09-24T15:00:00.000Z"
149004
- * }
149005
- */
149006
- "application/json": {
149007
- slot_ref?: string;
149008
- /** Format: uuid */
149009
- professional_id?: string;
149010
- /**
149011
- * Format: uuid
149012
- * @description The box/sillón (`clinic_resource.id`) the cita moves to. Omitted = it keeps its box; null = «Sin box». The same times with another box is a move between boxes. Refused with `box_taken` when that box holds another cita at that hour, `unknown_box` / `box_other_sucursal` when it is not an active room of the cita's sucursal.
149013
- */
149014
- resource_id?: string | null;
149015
- starts_at: string;
149016
- ends_at: string;
149017
- allow_overbook?: boolean;
149018
- duration_minutes?: number;
149019
- confirm_past?: boolean;
149020
- /** @enum {string} */
149021
- modality?: "presencial" | "video";
149022
- /** @description Tell the patient the new time (the booking confirmation, with the manage link) through the one reach policy: WhatsApp, else e-mail, else a Call center item; a move less than 24 h before the cita also asks reception to phone. The answer carries `patient_notice: {sent, reason, channel, call}`; a notice that could not go out never fails the move. */
149023
- notify_patient?: boolean;
149024
- };
149025
- };
149026
- };
150729
+ requestBody?: never;
149027
150730
  responses: {
149028
- /** @description Appointment */
150731
+ /** @description Patient notice readiness */
149029
150732
  200: {
149030
150733
  headers: {
149031
150734
  [name: string]: unknown;
@@ -149034,61 +150737,14 @@ interface paths {
149034
150737
  /**
149035
150738
  * @example {
149036
150739
  * "data": {
149037
- * "id": "eeeeeeee-0000-4000-8000-000000000002",
149038
- * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
149039
- * "lead_id": null,
149040
- * "contact_id": null,
149041
- * "conversation_id": null,
149042
- * "vehicle_id": null,
149043
- * "appointment_type_id": null,
149044
- * "owner_user_id": null,
149045
- * "location_id": "b1b1b1b1-0000-4000-8000-000000000002",
149046
- * "professional_id": "ffffffff-0000-4000-8000-000000000001",
149047
- * "resource_id": null,
149048
- * "kind": "clinic",
149049
- * "source": "agent",
149050
- * "engine": "native",
149051
- * "external_id": null,
149052
- * "status": "confirmed",
149053
- * "status_epoch": 0,
149054
- * "clinic_status_id": null,
149055
- * "arrival_state": "scheduled",
149056
- * "arrived_at": null,
149057
- * "in_room_at": null,
149058
- * "done_at": null,
149059
- * "series_id": null,
149060
- * "series_index": null,
149061
- * "treatment_plan_id": null,
149062
- * "booking_landing_id": null,
149063
- * "attribution": null,
149064
- * "starts_at": "2026-09-24T14:30:00.000Z",
149065
- * "ends_at": "2026-09-24T15:00:00.000Z",
149066
- * "hold_expires_at": null,
149067
- * "google_event_id": null,
149068
- * "google_ical_uid": null,
149069
- * "google_updated_at": null,
149070
- * "google_etag": null,
149071
- * "calendar_mirror_status": null,
149072
- * "calendar_mirror_op": null,
149073
- * "calendar_mirror_error": null,
149074
- * "calendar_mirror_attempts": 0,
149075
- * "calendar_mirror_attempted_at": null,
149076
- * "calendar_mirror_next_retry_at": null,
149077
- * "calendar_mirror_calendar_id": null,
149078
- * "reminder_at": null,
149079
- * "reminder_sent_at": null,
149080
- * "reminder_job_id": null,
149081
- * "customer_name": "María José Fuentes Lagos",
149082
- * "notes": "Control mensual",
149083
- * "metadata": {
149084
- * "engine": "native-clinic",
149085
- * "patient_rut": "11.111.111-1",
149086
- * "clinic_patient_id": "12121212-0000-4000-8000-000000000001"
149087
- * },
149088
- * "display_seq": 2,
149089
- * "display_id": "A-2",
149090
- * "created_at": "2026-09-22T17:18:58.202Z",
149091
- * "updated_at": "2026-09-22T17:19:15.981Z"
150740
+ * "can_send": true,
150741
+ * "reason": null,
150742
+ * "channel": "email",
150743
+ * "recipient": {
150744
+ * "name": "Paula Lagos Riquelme",
150745
+ * "relation": "apoderado",
150746
+ * "relation_sex": "f"
150747
+ * }
149092
150748
  * }
149093
150749
  * }
149094
150750
  */
@@ -149156,9 +150812,15 @@ interface paths {
149156
150812
  };
149157
150813
  };
149158
150814
  };
150815
+ put?: never;
150816
+ post?: never;
150817
+ delete?: never;
150818
+ options?: never;
150819
+ head?: never;
150820
+ patch?: never;
149159
150821
  trace?: never;
149160
150822
  };
149161
- "/clinic/agenda/appointments/{id}/history": {
150823
+ "/clinic/agenda/campaign-overbook": {
149162
150824
  parameters: {
149163
150825
  query?: never;
149164
150826
  header?: never;
@@ -149166,8 +150828,8 @@ interface paths {
149166
150828
  cookie?: never;
149167
150829
  };
149168
150830
  /**
149169
- * A cita's «Historial de cambios»
149170
- * @description Who created the cita and from which door (`staff` in the agenda, the patient `online`, the AI agent in a conversation, an `import`, the clinic’s system), then every move (from → to), estado, profesional, box, sucursal, modalidad and comment change and the cancellation with its reason — each with who and when. WHAT changed is recorded by the database whatever wrote it; WHO is the request’s own audit row, the patient’s reminder reply, or `unknown` (never guessed). Oldest first. Read-only. Requires `clinic:read`.
150831
+ * Sobrecupo de campaña: the setting and the measured no-show rate
150832
+ * @description «Sobrecupo de campaña»: the clinic's own bet against the no-shows of ad patients. `percent` (0–100, 0 = off, the default) is the share of the hours held by an evaluation cita (an entry prestación) of a patient whose Origen is Meta that stays bookable once more, per professional and day — by the AI agent and the online booking page as well as staff — for any patient booking an entry prestación. At most one extra cita per held hour; floor(percent × that day's ad-origin evaluation citas) per professional and day; the earliest held hours first; a box is never double-booked; the horario's staff sobrecupo is neither required nor spent. The extra cita is stored as a sobrecupo with reason «campaña» (`overbooked: true`, `overbook_reason: "campaña"` on the feed). `no_show_guidance` is the clinic's measured no-show rate by Origen over the last 90 days, as the Inasistencias report counts it; Vitrina never sets the percentage. Only a clinic whose agenda runs in Vitrina can use it: on a mirrored agenda (Dentalink / Medilink / Reservo) `supported` is false with `unsupported_reason: "mirrored_agenda"` and nothing is offered.
149171
150833
  *
149172
150834
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
149173
150835
  */
@@ -149175,14 +150837,12 @@ interface paths {
149175
150837
  parameters: {
149176
150838
  query?: never;
149177
150839
  header?: never;
149178
- path: {
149179
- id: string;
149180
- };
150840
+ path?: never;
149181
150841
  cookie?: never;
149182
150842
  };
149183
150843
  requestBody?: never;
149184
150844
  responses: {
149185
- /** @description The history */
150845
+ /** @description Sobrecupo de campaña */
149186
150846
  200: {
149187
150847
  headers: {
149188
150848
  [name: string]: unknown;
@@ -149191,39 +150851,50 @@ interface paths {
149191
150851
  /**
149192
150852
  * @example {
149193
150853
  * "data": {
149194
- * "entries": [
149195
- * {
149196
- * "id": "e1e1e1e1-0000-4000-8000-000000000001",
149197
- * "at": "2026-11-03T14:02:00.000Z",
149198
- * "kind": "created",
149199
- * "from": null,
149200
- * "to": "2026-11-10T13:00:00.000Z",
149201
- * "reason": null,
149202
- * "actor": {
149203
- * "kind": "patient",
149204
- * "name": null,
149205
- * "via": "online"
149206
- * }
149207
- * },
149208
- * {
149209
- * "id": "e1e1e1e1-0000-4000-8000-000000000002",
149210
- * "at": "2026-11-05T09:15:00.000Z",
149211
- * "kind": "rescheduled",
149212
- * "from": "2026-11-10T13:00:00.000Z",
149213
- * "to": "2026-11-12T15:00:00.000Z",
149214
- * "reason": "El paciente pidió cambiarla",
149215
- * "actor": {
149216
- * "kind": "staff",
149217
- * "name": "Recepción",
149218
- * "via": "agenda"
150854
+ * "percent": 50,
150855
+ * "enabled": true,
150856
+ * "supported": true,
150857
+ * "unsupported_reason": null,
150858
+ * "engine": "native-clinic",
150859
+ * "no_show_guidance": {
150860
+ * "from": "2026-06-26",
150861
+ * "to": "2026-09-23",
150862
+ * "by_origin": [
150863
+ * {
150864
+ * "key": "meta",
150865
+ * "label": "Meta",
150866
+ * "attended": 62,
150867
+ * "no_show": 21,
150868
+ * "late_cancel": 4,
150869
+ * "cancelled": 11,
150870
+ * "cancelled_notice_unknown": 1,
150871
+ * "unknown": 0,
150872
+ * "closed": 94,
150873
+ * "no_show_pct": 25,
150874
+ * "late_cancel_pct": 40,
150875
+ * "attendance_pct": 66
150876
+ * },
150877
+ * {
150878
+ * "key": "organic",
150879
+ * "label": "Orgánico",
150880
+ * "attended": 140,
150881
+ * "no_show": 9,
150882
+ * "late_cancel": 3,
150883
+ * "cancelled": 15,
150884
+ * "cancelled_notice_unknown": 0,
150885
+ * "unknown": 0,
150886
+ * "closed": 164,
150887
+ * "no_show_pct": 6,
150888
+ * "late_cancel_pct": 20,
150889
+ * "attendance_pct": 85
149219
150890
  * }
149220
- * }
149221
- * ]
150891
+ * ]
150892
+ * }
149222
150893
  * }
149223
150894
  * }
149224
150895
  */
149225
150896
  "application/json": {
149226
- data: components["schemas"]["ClinicCitaHistory"];
150897
+ data: components["schemas"]["ClinicCampaignOverbookSetting"];
149227
150898
  };
149228
150899
  };
149229
150900
  };
@@ -149283,39 +150954,31 @@ interface paths {
149283
150954
  };
149284
150955
  };
149285
150956
  };
149286
- put?: never;
149287
- post?: never;
149288
- delete?: never;
149289
- options?: never;
149290
- head?: never;
149291
- patch?: never;
149292
- trace?: never;
149293
- };
149294
- "/clinic/agenda/appointments/{id}/patient-notice": {
149295
- parameters: {
149296
- query?: never;
149297
- header?: never;
149298
- path?: never;
149299
- cookie?: never;
149300
- };
149301
150957
  /**
149302
- * Can «Avisar al paciente» reach this patient now
149303
- * @description The one reach policy (`clinic-patient-reach`) in dry run: it walks the same gates the notice send walks (phone, consent, the clinic WhatsApp number, the thread, the 24 h window; then the e-mail) and sends NOTHING. `channel` is how a move or cancel with `notify_patient` would reach the patient: `whatsapp`; `email` when WhatsApp cannot and the owner left «Usar correo si no hay WhatsApp» on; `call` when no message can go and it would land on «Llamar hoy»; null when not even a call is asked for. `can_send` is true for a message channel. `reason` says why WhatsApp cannot (`no_contact`, `no_phone`, `preference_blocked`, `no_whatsapp_account`, `no_thread`, `window_closed`, `billing_paused`). `recipient` names who receives it (a minor's apoderado: `{ name, relation, relation_sex }`; `relation_sex` `f`/`m` when the apoderado's own ficha says it, else null). Requires `clinic:read`.
150958
+ * Set the Sobrecupo de campaña percentage
150959
+ * @description «Sobrecupo de campaña»: the clinic's own bet against the no-shows of ad patients. `percent` (0–100, 0 = off, the default) is the share of the hours held by an evaluation cita (an entry prestación) of a patient whose Origen is Meta that stays bookable once more, per professional and day — by the AI agent and the online booking page as well as staff — for any patient booking an entry prestación. At most one extra cita per held hour; floor(percent × that day's ad-origin evaluation citas) per professional and day; the earliest held hours first; a box is never double-booked; the horario's staff sobrecupo is neither required nor spent. The extra cita is stored as a sobrecupo with reason «campaña» (`overbooked: true`, `overbook_reason: "campaña"` on the feed). `no_show_guidance` is the clinic's measured no-show rate by Origen over the last 90 days, as the Inasistencias report counts it; Vitrina never sets the percentage. Only a clinic whose agenda runs in Vitrina can use it: on a mirrored agenda (Dentalink / Medilink / Reservo) `supported` is false with `unsupported_reason: "mirrored_agenda"` and nothing is offered. Owner or admin (`schedule_config:write`); audited. Turning it on for a mirrored agenda answers 409 `mirrored_agenda`; turning it off always works.
149304
150960
  *
149305
150961
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
149306
150962
  */
149307
- get: {
150963
+ put: {
149308
150964
  parameters: {
149309
150965
  query?: never;
149310
150966
  header?: never;
149311
- path: {
149312
- id: string;
149313
- };
150967
+ path?: never;
149314
150968
  cookie?: never;
149315
150969
  };
149316
- requestBody?: never;
150970
+ requestBody?: {
150971
+ content: {
150972
+ /**
150973
+ * @example {
150974
+ * "percent": 50
150975
+ * }
150976
+ */
150977
+ "application/json": components["schemas"]["ClinicCampaignOverbookBody"];
150978
+ };
150979
+ };
149317
150980
  responses: {
149318
- /** @description Patient notice readiness */
150981
+ /** @description Sobrecupo de campaña */
149319
150982
  200: {
149320
150983
  headers: {
149321
150984
  [name: string]: unknown;
@@ -149324,22 +150987,50 @@ interface paths {
149324
150987
  /**
149325
150988
  * @example {
149326
150989
  * "data": {
149327
- * "can_send": true,
149328
- * "reason": null,
149329
- * "channel": "email",
149330
- * "recipient": {
149331
- * "name": "Paula Lagos Riquelme",
149332
- * "relation": "apoderado",
149333
- * "relation_sex": "f"
150990
+ * "percent": 50,
150991
+ * "enabled": true,
150992
+ * "supported": true,
150993
+ * "unsupported_reason": null,
150994
+ * "engine": "native-clinic",
150995
+ * "no_show_guidance": {
150996
+ * "from": "2026-06-26",
150997
+ * "to": "2026-09-23",
150998
+ * "by_origin": [
150999
+ * {
151000
+ * "key": "meta",
151001
+ * "label": "Meta",
151002
+ * "attended": 62,
151003
+ * "no_show": 21,
151004
+ * "late_cancel": 4,
151005
+ * "cancelled": 11,
151006
+ * "cancelled_notice_unknown": 1,
151007
+ * "unknown": 0,
151008
+ * "closed": 94,
151009
+ * "no_show_pct": 25,
151010
+ * "late_cancel_pct": 40,
151011
+ * "attendance_pct": 66
151012
+ * },
151013
+ * {
151014
+ * "key": "organic",
151015
+ * "label": "Orgánico",
151016
+ * "attended": 140,
151017
+ * "no_show": 9,
151018
+ * "late_cancel": 3,
151019
+ * "cancelled": 15,
151020
+ * "cancelled_notice_unknown": 0,
151021
+ * "unknown": 0,
151022
+ * "closed": 164,
151023
+ * "no_show_pct": 6,
151024
+ * "late_cancel_pct": 20,
151025
+ * "attendance_pct": 85
151026
+ * }
151027
+ * ]
149334
151028
  * }
149335
151029
  * }
149336
151030
  * }
149337
151031
  */
149338
151032
  "application/json": {
149339
- data?: unknown;
149340
- meta?: {
149341
- [key: string]: unknown;
149342
- };
151033
+ data: components["schemas"]["ClinicCampaignOverbookSetting"];
149343
151034
  };
149344
151035
  };
149345
151036
  };
@@ -149399,7 +151090,6 @@ interface paths {
149399
151090
  };
149400
151091
  };
149401
151092
  };
149402
- put?: never;
149403
151093
  post?: never;
149404
151094
  delete?: never;
149405
151095
  options?: never;
@@ -220048,7 +221738,7 @@ interface paths {
220048
221738
  };
220049
221739
  /**
220050
221740
  * What blocks publishing the draft
220051
- * @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`.
221741
+ * @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`, `pick_media` (choose another library file for a «Paso de video»), `review_template` (open the video step’s template review) 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`; for a «Paso de video» (content `media_file`): `media_step_channel_unsupported` (not WhatsApp or same chat), `media_asset_deleted`, `media_asset_expired`, `media_asset_consent_missing`, `media_asset_kind_unsupported` (audio, or not an image, video or PDF), `media_asset_too_large` (over 16 MB), `media_caption_field_unknown`, `media_caption_field_unavailable` (an appointment field without entry `appointment_booked`). Warning codes: `instagram_past_24h`, `whatsapp_past_24h_without_template`, `media_step_past_24h`, `media_step_window_uncertain` (a before-the-appointment wait), `media_asset_scheduled`; and, once the video step’s template is read (vitrina-app#8073, replacing the two window warnings), one per template state that does not send outside the window: `media_template_missing`, `media_template_draft`, `media_template_in_review`, `media_template_rejected` (names Meta’s reason), `media_template_recategorised`, `media_template_paused`, `media_template_disabled` (fix `review_template`: open the template review, `GET /sequences/{id}/media-templates`), `media_template_caption_invalid` (the caption breaks Meta’s template rules), `media_template_file_unsupported` (`pick_media`) and `media_template_name_required`. 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`.
220052
221742
  */
220053
221743
  get: {
220054
221744
  parameters: {
@@ -222784,6 +224474,459 @@ interface paths {
222784
224474
  patch?: never;
222785
224475
  trace?: never;
222786
224476
  };
224477
+ "/sequences/media-templates": {
224478
+ parameters: {
224479
+ query?: never;
224480
+ header?: never;
224481
+ path?: never;
224482
+ cookie?: never;
224483
+ };
224484
+ /**
224485
+ * List the video-step templates of the workspace
224486
+ * @description A «Paso de video» (content `media_file`) goes out OUTSIDE WhatsApp’s 24 h window as an approved template whose header is the step’s library file and whose body is its caption (fields as NAMED variables). Publishing drafts one per step and content (file version + caption + language; republishing the same content creates nothing, a new file or caption supersedes the old draft for the step). Vitrina never submits it: the workspace does, here. Category MARKETING (a sequence send is marketing-basis; the kernel refuses it on a UTILITY template); `review.price_per_send` is Meta’s list rate for Chile. Until Meta approves it the step is skipped outside the window (`media_template_*` reasons); inside the window the plain file goes.
224487
+ *
224488
+ * Every live sequence with a video step, one entry per published video step, with the review data. Requires `followups:read`.
224489
+ */
224490
+ get: {
224491
+ parameters: {
224492
+ query?: never;
224493
+ header?: never;
224494
+ path?: never;
224495
+ cookie?: never;
224496
+ };
224497
+ requestBody?: never;
224498
+ responses: {
224499
+ /** @description The templates */
224500
+ 200: {
224501
+ headers: {
224502
+ [name: string]: unknown;
224503
+ };
224504
+ content: {
224505
+ /**
224506
+ * @example {
224507
+ * "data": [
224508
+ * {
224509
+ * "id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e12",
224510
+ * "sequence_id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
224511
+ * "sequence_name": "Seguimiento de cotización",
224512
+ * "step_key": "step-2",
224513
+ * "state": "draft",
224514
+ * "state_message": "La plantilla de este paso está lista para que la revises y la envíes a Meta. Hasta que Meta la apruebe, fuera de las 24 horas el paso se salta.",
224515
+ * "can_submit": true,
224516
+ * "submit_blocked_reason": null,
224517
+ * "template": null,
224518
+ * "review": {
224519
+ * "language": "es",
224520
+ * "category": "MARKETING",
224521
+ * "category_note": "Marketing. Los mensajes de una secuencia se envían como marketing, así que la plantilla se pide en esa categoría y solo le llega a quien no se haya dado de baja de tus mensajes. Meta puede cambiar la categoría al revisarla; si la aprueba en otra, Vitrina no la envía.",
224522
+ * "price_per_send": {
224523
+ * "market": "CL",
224524
+ * "currency": "USD",
224525
+ * "category": "marketing",
224526
+ * "amount": 0.0889,
224527
+ * "as_of": "2026-11-01",
224528
+ * "label": "Cada envío de esta plantilla cuesta cerca de US$0,0889, la tarifa de Meta para una plantilla de marketing a un número de Chile. Meta lo cobra a tu cuenta de WhatsApp."
224529
+ * },
224530
+ * "header": {
224531
+ * "format": "VIDEO",
224532
+ * "asset_id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e13",
224533
+ * "asset_name": "Presentación del tratamiento",
224534
+ * "mime_type": "video/mp4",
224535
+ * "byte_size": 4200000
224536
+ * },
224537
+ * "body_text": "Hola {{nombre}}, mira cómo es tu primera visita.",
224538
+ * "body_preview": "Hola María, mira cómo es tu primera visita.",
224539
+ * "variables": [
224540
+ * {
224541
+ * "name": "nombre",
224542
+ * "field": "nombre",
224543
+ * "label": "Nombre",
224544
+ * "example": "María"
224545
+ * }
224546
+ * ],
224547
+ * "caption_issues": [],
224548
+ * "problem_message": null,
224549
+ * "name_note": "Fuera de las 24 horas este paso sale como plantilla y una plantilla no puede dejar {{nombre}} vacío: a quien no tenga su nombre guardado no se le envía fuera de las 24 horas."
224550
+ * }
224551
+ * }
224552
+ * ]
224553
+ * }
224554
+ */
224555
+ "application/json": {
224556
+ data: components["schemas"]["SequenceMediaTemplate"][];
224557
+ };
224558
+ };
224559
+ };
224560
+ /** @description Validation error */
224561
+ 400: {
224562
+ headers: {
224563
+ [name: string]: unknown;
224564
+ };
224565
+ content: {
224566
+ "application/json": components["schemas"]["Error"];
224567
+ };
224568
+ };
224569
+ /** @description Unauthorized */
224570
+ 401: {
224571
+ headers: {
224572
+ [name: string]: unknown;
224573
+ };
224574
+ content: {
224575
+ "application/json": components["schemas"]["Error"];
224576
+ };
224577
+ };
224578
+ /** @description Forbidden */
224579
+ 403: {
224580
+ headers: {
224581
+ [name: string]: unknown;
224582
+ };
224583
+ content: {
224584
+ "application/json": components["schemas"]["Error"];
224585
+ };
224586
+ };
224587
+ /** @description Not found */
224588
+ 404: {
224589
+ headers: {
224590
+ [name: string]: unknown;
224591
+ };
224592
+ content: {
224593
+ "application/json": components["schemas"]["Error"];
224594
+ };
224595
+ };
224596
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
224597
+ 409: {
224598
+ headers: {
224599
+ [name: string]: unknown;
224600
+ };
224601
+ content: {
224602
+ "application/json": components["schemas"]["Error"];
224603
+ };
224604
+ };
224605
+ /** @description Rate limited */
224606
+ 429: {
224607
+ headers: {
224608
+ [name: string]: unknown;
224609
+ };
224610
+ content: {
224611
+ "application/json": components["schemas"]["Error"];
224612
+ };
224613
+ };
224614
+ };
224615
+ };
224616
+ put?: never;
224617
+ post?: never;
224618
+ delete?: never;
224619
+ options?: never;
224620
+ head?: never;
224621
+ patch?: never;
224622
+ trace?: never;
224623
+ };
224624
+ "/sequences/{id}/media-templates": {
224625
+ parameters: {
224626
+ query?: never;
224627
+ header?: never;
224628
+ path?: never;
224629
+ cookie?: never;
224630
+ };
224631
+ /**
224632
+ * List a sequence’s video-step templates
224633
+ * @description A «Paso de video» (content `media_file`) goes out OUTSIDE WhatsApp’s 24 h window as an approved template whose header is the step’s library file and whose body is its caption (fields as NAMED variables). Publishing drafts one per step and content (file version + caption + language; republishing the same content creates nothing, a new file or caption supersedes the old draft for the step). Vitrina never submits it: the workspace does, here. Category MARKETING (a sequence send is marketing-basis; the kernel refuses it on a UTILITY template); `review.price_per_send` is Meta’s list rate for Chile. Until Meta approves it the step is skipped outside the window (`media_template_*` reasons); inside the window the plain file goes.
224634
+ *
224635
+ * One entry per video step of the PUBLISHED version (empty when unpublished). Requires `followups:read`.
224636
+ */
224637
+ get: {
224638
+ parameters: {
224639
+ query?: never;
224640
+ header?: never;
224641
+ path: {
224642
+ id: string;
224643
+ };
224644
+ cookie?: never;
224645
+ };
224646
+ requestBody?: never;
224647
+ responses: {
224648
+ /** @description The templates */
224649
+ 200: {
224650
+ headers: {
224651
+ [name: string]: unknown;
224652
+ };
224653
+ content: {
224654
+ /**
224655
+ * @example {
224656
+ * "data": [
224657
+ * {
224658
+ * "id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e12",
224659
+ * "sequence_id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
224660
+ * "sequence_name": "Seguimiento de cotización",
224661
+ * "step_key": "step-2",
224662
+ * "state": "draft",
224663
+ * "state_message": "La plantilla de este paso está lista para que la revises y la envíes a Meta. Hasta que Meta la apruebe, fuera de las 24 horas el paso se salta.",
224664
+ * "can_submit": true,
224665
+ * "submit_blocked_reason": null,
224666
+ * "template": null,
224667
+ * "review": {
224668
+ * "language": "es",
224669
+ * "category": "MARKETING",
224670
+ * "category_note": "Marketing. Los mensajes de una secuencia se envían como marketing, así que la plantilla se pide en esa categoría y solo le llega a quien no se haya dado de baja de tus mensajes. Meta puede cambiar la categoría al revisarla; si la aprueba en otra, Vitrina no la envía.",
224671
+ * "price_per_send": {
224672
+ * "market": "CL",
224673
+ * "currency": "USD",
224674
+ * "category": "marketing",
224675
+ * "amount": 0.0889,
224676
+ * "as_of": "2026-11-01",
224677
+ * "label": "Cada envío de esta plantilla cuesta cerca de US$0,0889, la tarifa de Meta para una plantilla de marketing a un número de Chile. Meta lo cobra a tu cuenta de WhatsApp."
224678
+ * },
224679
+ * "header": {
224680
+ * "format": "VIDEO",
224681
+ * "asset_id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e13",
224682
+ * "asset_name": "Presentación del tratamiento",
224683
+ * "mime_type": "video/mp4",
224684
+ * "byte_size": 4200000
224685
+ * },
224686
+ * "body_text": "Hola {{nombre}}, mira cómo es tu primera visita.",
224687
+ * "body_preview": "Hola María, mira cómo es tu primera visita.",
224688
+ * "variables": [
224689
+ * {
224690
+ * "name": "nombre",
224691
+ * "field": "nombre",
224692
+ * "label": "Nombre",
224693
+ * "example": "María"
224694
+ * }
224695
+ * ],
224696
+ * "caption_issues": [],
224697
+ * "problem_message": null,
224698
+ * "name_note": "Fuera de las 24 horas este paso sale como plantilla y una plantilla no puede dejar {{nombre}} vacío: a quien no tenga su nombre guardado no se le envía fuera de las 24 horas."
224699
+ * }
224700
+ * }
224701
+ * ]
224702
+ * }
224703
+ */
224704
+ "application/json": {
224705
+ data: components["schemas"]["SequenceMediaTemplate"][];
224706
+ };
224707
+ };
224708
+ };
224709
+ /** @description Validation error */
224710
+ 400: {
224711
+ headers: {
224712
+ [name: string]: unknown;
224713
+ };
224714
+ content: {
224715
+ "application/json": components["schemas"]["Error"];
224716
+ };
224717
+ };
224718
+ /** @description Unauthorized */
224719
+ 401: {
224720
+ headers: {
224721
+ [name: string]: unknown;
224722
+ };
224723
+ content: {
224724
+ "application/json": components["schemas"]["Error"];
224725
+ };
224726
+ };
224727
+ /** @description Forbidden */
224728
+ 403: {
224729
+ headers: {
224730
+ [name: string]: unknown;
224731
+ };
224732
+ content: {
224733
+ "application/json": components["schemas"]["Error"];
224734
+ };
224735
+ };
224736
+ /** @description Not found */
224737
+ 404: {
224738
+ headers: {
224739
+ [name: string]: unknown;
224740
+ };
224741
+ content: {
224742
+ "application/json": components["schemas"]["Error"];
224743
+ };
224744
+ };
224745
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
224746
+ 409: {
224747
+ headers: {
224748
+ [name: string]: unknown;
224749
+ };
224750
+ content: {
224751
+ "application/json": components["schemas"]["Error"];
224752
+ };
224753
+ };
224754
+ /** @description Rate limited */
224755
+ 429: {
224756
+ headers: {
224757
+ [name: string]: unknown;
224758
+ };
224759
+ content: {
224760
+ "application/json": components["schemas"]["Error"];
224761
+ };
224762
+ };
224763
+ };
224764
+ };
224765
+ put?: never;
224766
+ post?: never;
224767
+ delete?: never;
224768
+ options?: never;
224769
+ head?: never;
224770
+ patch?: never;
224771
+ trace?: never;
224772
+ };
224773
+ "/sequences/{id}/media-templates/{step_key}/submit": {
224774
+ parameters: {
224775
+ query?: never;
224776
+ header?: never;
224777
+ path?: never;
224778
+ cookie?: never;
224779
+ };
224780
+ get?: never;
224781
+ put?: never;
224782
+ /**
224783
+ * Submit a video step’s template to Meta
224784
+ * @description A «Paso de video» (content `media_file`) goes out OUTSIDE WhatsApp’s 24 h window as an approved template whose header is the step’s library file and whose body is its caption (fields as NAMED variables). Publishing drafts one per step and content (file version + caption + language; republishing the same content creates nothing, a new file or caption supersedes the old draft for the step). Vitrina never submits it: the workspace does, here. Category MARKETING (a sequence send is marketing-basis; the kernel refuses it on a UTILITY template); `review.price_per_send` is Meta’s list rate for Chile. Until Meta approves it the step is skipped outside the window (`media_template_*` reasons); inside the window the plain file goes.
224785
+ *
224786
+ * The workspace’s own act: copies the library file once to a public header link and files the template with Meta (a sandbox captures it). 409 `media_template_not_submittable` (with `details.state`) when it is in review, approved, rejected, paused, disabled, recategorised, when the caption or file cannot be a template, or WhatsApp is not connected. 404 when the published version has no video step with that key. Requires `followups:write`.
224787
+ */
224788
+ post: {
224789
+ parameters: {
224790
+ query?: never;
224791
+ header?: {
224792
+ /** @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. */
224793
+ "Idempotency-Key"?: string;
224794
+ };
224795
+ path: {
224796
+ id: string;
224797
+ step_key: string;
224798
+ };
224799
+ cookie?: never;
224800
+ };
224801
+ requestBody?: never;
224802
+ responses: {
224803
+ /** @description The template after submitting */
224804
+ 200: {
224805
+ headers: {
224806
+ [name: string]: unknown;
224807
+ };
224808
+ content: {
224809
+ /**
224810
+ * @example {
224811
+ * "data": {
224812
+ * "id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e12",
224813
+ * "sequence_id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
224814
+ * "sequence_name": "Seguimiento de cotización",
224815
+ * "step_key": "step-2",
224816
+ * "state": "in_review",
224817
+ * "state_message": "La plantilla de este paso está lista para que la revises y la envíes a Meta. Hasta que Meta la apruebe, fuera de las 24 horas el paso se salta.",
224818
+ * "can_submit": false,
224819
+ * "submit_blocked_reason": null,
224820
+ * "template": {
224821
+ * "id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e14",
224822
+ * "name": "secuencia_video_3f9a1c",
224823
+ * "status": "PENDING",
224824
+ * "category": "MARKETING",
224825
+ * "rejection_reason": null
224826
+ * },
224827
+ * "review": {
224828
+ * "language": "es",
224829
+ * "category": "MARKETING",
224830
+ * "category_note": "Marketing. Los mensajes de una secuencia se envían como marketing, así que la plantilla se pide en esa categoría y solo le llega a quien no se haya dado de baja de tus mensajes. Meta puede cambiar la categoría al revisarla; si la aprueba en otra, Vitrina no la envía.",
224831
+ * "price_per_send": {
224832
+ * "market": "CL",
224833
+ * "currency": "USD",
224834
+ * "category": "marketing",
224835
+ * "amount": 0.0889,
224836
+ * "as_of": "2026-11-01",
224837
+ * "label": "Cada envío de esta plantilla cuesta cerca de US$0,0889, la tarifa de Meta para una plantilla de marketing a un número de Chile. Meta lo cobra a tu cuenta de WhatsApp."
224838
+ * },
224839
+ * "header": {
224840
+ * "format": "VIDEO",
224841
+ * "asset_id": "0192f0b2-1a2b-7c3d-8e4f-5a6b7c8d9e13",
224842
+ * "asset_name": "Presentación del tratamiento",
224843
+ * "mime_type": "video/mp4",
224844
+ * "byte_size": 4200000
224845
+ * },
224846
+ * "body_text": "Hola {{nombre}}, mira cómo es tu primera visita.",
224847
+ * "body_preview": "Hola María, mira cómo es tu primera visita.",
224848
+ * "variables": [
224849
+ * {
224850
+ * "name": "nombre",
224851
+ * "field": "nombre",
224852
+ * "label": "Nombre",
224853
+ * "example": "María"
224854
+ * }
224855
+ * ],
224856
+ * "caption_issues": [],
224857
+ * "problem_message": null,
224858
+ * "name_note": "Fuera de las 24 horas este paso sale como plantilla y una plantilla no puede dejar {{nombre}} vacío: a quien no tenga su nombre guardado no se le envía fuera de las 24 horas."
224859
+ * }
224860
+ * }
224861
+ * }
224862
+ */
224863
+ "application/json": {
224864
+ data: components["schemas"]["SequenceMediaTemplate"];
224865
+ };
224866
+ };
224867
+ };
224868
+ /** @description Validation error */
224869
+ 400: {
224870
+ headers: {
224871
+ [name: string]: unknown;
224872
+ };
224873
+ content: {
224874
+ "application/json": components["schemas"]["Error"];
224875
+ };
224876
+ };
224877
+ /** @description Unauthorized */
224878
+ 401: {
224879
+ headers: {
224880
+ [name: string]: unknown;
224881
+ };
224882
+ content: {
224883
+ "application/json": components["schemas"]["Error"];
224884
+ };
224885
+ };
224886
+ /** @description Forbidden */
224887
+ 403: {
224888
+ headers: {
224889
+ [name: string]: unknown;
224890
+ };
224891
+ content: {
224892
+ "application/json": components["schemas"]["Error"];
224893
+ };
224894
+ };
224895
+ /** @description Not found */
224896
+ 404: {
224897
+ headers: {
224898
+ [name: string]: unknown;
224899
+ };
224900
+ content: {
224901
+ "application/json": components["schemas"]["Error"];
224902
+ };
224903
+ };
224904
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
224905
+ 409: {
224906
+ headers: {
224907
+ [name: string]: unknown;
224908
+ };
224909
+ content: {
224910
+ "application/json": components["schemas"]["Error"];
224911
+ };
224912
+ };
224913
+ /** @description Rate limited */
224914
+ 429: {
224915
+ headers: {
224916
+ [name: string]: unknown;
224917
+ };
224918
+ content: {
224919
+ "application/json": components["schemas"]["Error"];
224920
+ };
224921
+ };
224922
+ };
224923
+ };
224924
+ delete?: never;
224925
+ options?: never;
224926
+ head?: never;
224927
+ patch?: never;
224928
+ trace?: never;
224929
+ };
222787
224930
  "/sequences/templates": {
222788
224931
  parameters: {
222789
224932
  query?: never;
@@ -331806,6 +333949,11 @@ interface components {
331806
333949
  FinanzasAccountKind: "ingreso" | "costo" | "gasto" | "no_operacional";
331807
333950
  /** @enum {string|null} */
331808
333951
  FinanzasAccountBehavior: "fijo" | "variable" | null;
333952
+ /**
333953
+ * @description What the account's money is for the tax return (#8104); null = «sin significado tributario». Set it with `PUT /finanzas/tax-tags/accounts/{accountId}`.
333954
+ * @enum {string|null}
333955
+ */
333956
+ FinanzasTaxRole: "business_income" | "other_income" | "interest_income" | "goods_and_inputs" | "business_services" | "remunerations" | "honorarios" | "rent" | "interest" | "financial_charges" | "donations" | "related_party_expenses" | "income_tax" | "other_deductible" | "withdrawal" | "fixed_asset" | "loan" | "capital" | "own_funds" | "other_non_result" | null;
331809
333957
  /** @description Present only when the list was asked with `usage_month`. */
331810
333958
  FinanzasAccountUsage: {
331811
333959
  /** @example 2026-10 */
@@ -331830,6 +333978,7 @@ interface components {
331830
333978
  behavior: components["schemas"]["FinanzasAccountBehavior"];
331831
333979
  /** @description «No lleva documento»: money out classified here never has a legal document. It opens no «Falta documento» case and is not counted in «Egresos sin documento». */
331832
333980
  no_document: boolean;
333981
+ tax_role: components["schemas"]["FinanzasTaxRole"];
331833
333982
  position: number;
331834
333983
  depth: number;
331835
333984
  path: string;
@@ -334703,6 +336852,8 @@ interface components {
334703
336852
  path: string;
334704
336853
  archived: boolean;
334705
336854
  has_children: boolean;
336855
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
336856
+ tax_role_label: string | null;
334706
336857
  } | null;
334707
336858
  /** @description +1 adds to the operating result, −1 subtracts, 0 = a subtotal or outside the result (Retiros). */
334708
336859
  sign: 1 | -1 | 0;
@@ -334763,6 +336914,20 @@ interface components {
334763
336914
  } | null;
334764
336915
  }[];
334765
336916
  rows: components["schemas"]["FinanzasResultadoRow"][];
336917
+ /** @description The range by tax role (#8104), same sign and basis as the account rows: `total` of the accounts with the role, and the part marked non-deductible by art. 21 outcome (a fine or income-tax payment counts by default). `tax_role` null gathers the accounts without tax meaning, apart. */
336918
+ by_role: {
336919
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
336920
+ tax_role_label: string | null;
336921
+ /** @enum {string|null} */
336922
+ section: "income" | "outlay" | "non_result" | null;
336923
+ total: number;
336924
+ count: number;
336925
+ non_deductible: {
336926
+ tax_40: number;
336927
+ owner: number;
336928
+ left_out: number;
336929
+ };
336930
+ }[];
334766
336931
  summary: {
334767
336932
  resultado_operacional_clp: number;
334768
336933
  ingresos_clp: number;
@@ -334846,6 +337011,30 @@ interface components {
334846
337011
  counterparty_name: string | null;
334847
337012
  contraparte_id: string | null;
334848
337013
  } | null;
337014
+ /**
337015
+ * @description Art. 21 outcome: `tax_40` (the company pays the 40 % single tax), `owner` (taxed on an owner), `left_out` (only left out of the base). 14 D N°8 has no 40 % tax: only `left_out` applies there; the regime field does not exist yet (#8087), so the value a person chose is stored as is and consumers apply the regime rule (`outcomes[].regimes`).
337016
+ * @enum {string}
337017
+ */
337018
+ FinanzasNonDeductibleOutcome: "tax_40" | "owner" | "left_out";
337019
+ /** @description The non-deductible mark of the line's document (document lines) or bank movement (movement lines), a person's or a default (a fine, an income-tax payment); null = deductible. Consumers apply the regime rule (14 D N°8: only `left_out`). */
337020
+ FinanzasNonDeductible: {
337021
+ outcome: components["schemas"]["FinanzasNonDeductibleOutcome"];
337022
+ outcome_label: string;
337023
+ owner: {
337024
+ /** Format: uuid */
337025
+ id: string;
337026
+ name: string;
337027
+ } | null;
337028
+ note: string | null;
337029
+ /**
337030
+ * @description `person`: someone marked it. `default`: a fine or an income-tax payment (`idpc` tax-payment kind), non-deductible until a person says otherwise.
337031
+ * @enum {string}
337032
+ */
337033
+ source: "person" | "default";
337034
+ /** @enum {string|null} */
337035
+ reason: "fine" | "prior_year_income_tax" | null;
337036
+ reason_label: string | null;
337037
+ } | null;
334849
337038
  FinanzasCashLine: {
334850
337039
  /** @description `<payment_id>:<account_id | unclassified>`; a classified movement `<movement_id>:<account_id>`; a processor fee `<movement_id>:fee`. Stable across reads. */
334851
337040
  line_key: string;
@@ -334919,6 +337108,7 @@ interface components {
334919
337108
  kind: string;
334920
337109
  /** @description «No lleva documento»: money out on this account never has a legal document (sueldos, Previred, gastos financieros, retiros). */
334921
337110
  no_document: boolean;
337111
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
334922
337112
  } | null;
334923
337113
  /** @description The document has only a total (e.g. a gasto created from a movement): base = gross, VAT unknown. */
334924
337114
  no_vat_breakdown: boolean;
@@ -334929,6 +337119,10 @@ interface components {
334929
337119
  * @enum {string|null}
334930
337120
  */
334931
337121
  non_result_kind: "withdrawal" | "loan" | "fixed_asset" | "capital" | "own_funds" | "other" | null;
337122
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
337123
+ /** @enum {string|null} */
337124
+ tax_role_source: "account" | "clinic_payment" | null;
337125
+ non_deductible: components["schemas"]["FinanzasNonDeductible"];
334932
337126
  /** @description What this line settles of the document (link amount + rounding), signed: a refund is negative. */
334933
337127
  settled_clp: number;
334934
337128
  /** @description Its share of the document total after credit notes; honorarios: GROSS. */
@@ -335014,6 +337208,7 @@ interface components {
335014
337208
  kind: string;
335015
337209
  /** @description «No lleva documento»: money out on this account never has a legal document (sueldos, Previred, gastos financieros, retiros). */
335016
337210
  no_document: boolean;
337211
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
335017
337212
  }[];
335018
337213
  /** @description What this line settles of the document (link amount + rounding), signed: a refund is negative. */
335019
337214
  settled_clp: number;
@@ -335425,6 +337620,7 @@ interface components {
335425
337620
  kind: string;
335426
337621
  /** @description «No lleva documento»: money out on this account never has a legal document (sueldos, Previred, gastos financieros, retiros). */
335427
337622
  no_document: boolean;
337623
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
335428
337624
  } | null;
335429
337625
  undocumented: boolean;
335430
337626
  /**
@@ -335448,6 +337644,42 @@ interface components {
335448
337644
  /** @description Honorarios: the retención (gross − settled), shown apart; 0 otherwise. */
335449
337645
  retention_clp: number;
335450
337646
  }[];
337647
+ /** @description Always returned: one subtotal per (side, document year, tax role, non-deductible outcome and owner) over `collections`, `payments` and `non_result`, so the F22 draft maps roles to codes (`GET /finanzas/tax-tags/roles`) without re-reading accounts. `tax_role` null = without tax meaning, apart. Lines marked non-deductible are subtotalled apart from the deductible ones. */
337648
+ by_role: {
337649
+ /** @enum {string} */
337650
+ side: "collection" | "payment";
337651
+ /**
337652
+ * @description `current` = issued in the year asked (F22 1400 / 1409…); `earlier` = issued in an earlier year (1817 / 1818…); `later` = issued after the year (paid in advance).
337653
+ * @enum {string}
337654
+ */
337655
+ document_year: "current" | "earlier" | "later";
337656
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
337657
+ tax_role_label: string | null;
337658
+ /** @enum {string|null} */
337659
+ section: "income" | "outlay" | "non_result" | null;
337660
+ non_result: boolean;
337661
+ /** @enum {string|null} */
337662
+ non_deductible: "tax_40" | "owner" | "left_out" | null;
337663
+ owner: {
337664
+ id: string;
337665
+ name: string;
337666
+ } | null;
337667
+ lines: number;
337668
+ /** @description What this line settles of the document (link amount + rounding), signed: a refund is negative. */
337669
+ settled_clp: number;
337670
+ /** @description Its share of the document total after credit notes; honorarios: GROSS. */
337671
+ gross_clp: number;
337672
+ /** @description What counts in the cash base, by the Resultado net rule: a sale without IVA débito and specific taxes; a purchase with crédito fiscal without its recoverable IVA and specific taxes; anything else (boletas, gastos with only a total, honorarios) in full. */
337673
+ base_clp: number;
337674
+ /** @description Its share of the document's neto. */
337675
+ net_clp: number;
337676
+ /** @description Its share of the document's exento. */
337677
+ exempt_clp: number;
337678
+ /** @description `gross_clp − base_clp`: IVA and specific taxes left out. */
337679
+ vat_excluded_clp: number;
337680
+ /** @description Honorarios: the retención (gross − settled), shown apart; 0 otherwise. */
337681
+ retention_clp: number;
337682
+ }[];
335451
337683
  /** @description Always returned: one subtotal per (side, line kind, documented or not), over `collections` and `payments`. */
335452
337684
  by_kind: {
335453
337685
  /** @enum {string} */
@@ -336460,6 +338692,134 @@ interface components {
336460
338692
  /** Format: uuid */
336461
338693
  owner_id: string;
336462
338694
  };
338695
+ FinanzasTaxRoles: {
338696
+ tax_year: number;
338697
+ tax_years: number[];
338698
+ roles: {
338699
+ role: components["schemas"]["FinanzasTaxRole"] & string;
338700
+ label_es: string;
338701
+ /** @enum {string} */
338702
+ section: "income" | "outlay" | "non_result";
338703
+ hint_es: string;
338704
+ /** @description The F22 code this role feeds in each regime for the tax year; null = no code of that regime takes it. */
338705
+ codes: {
338706
+ "14A": {
338707
+ code: number;
338708
+ /** @description The twin code for documents of an earlier year paid in this one (14 D); null when the form has none. */
338709
+ earlier: number | null;
338710
+ } | null;
338711
+ "14D3": {
338712
+ code: number;
338713
+ /** @description The twin code for documents of an earlier year paid in this one (14 D); null when the form has none. */
338714
+ earlier: number | null;
338715
+ } | null;
338716
+ "14D8": {
338717
+ code: number;
338718
+ /** @description The twin code for documents of an earlier year paid in this one (14 D); null when the form has none. */
338719
+ earlier: number | null;
338720
+ } | null;
338721
+ };
338722
+ }[];
338723
+ outcomes: {
338724
+ outcome: components["schemas"]["FinanzasNonDeductibleOutcome"];
338725
+ label_es: string;
338726
+ hint_es: string;
338727
+ regimes: ("14A" | "14D3" | "14D8")[];
338728
+ }[];
338729
+ default_reasons: {
338730
+ /** @enum {string} */
338731
+ reason: "fine" | "prior_year_income_tax";
338732
+ label_es: string;
338733
+ }[];
338734
+ };
338735
+ FinanzasAccountTaxList: {
338736
+ tax_year: number;
338737
+ /** @description Accounts with no role: «sin significado tributario». */
338738
+ without_tax_meaning: number;
338739
+ accounts: {
338740
+ /** Format: uuid */
338741
+ account_id: string;
338742
+ name: string;
338743
+ path: string;
338744
+ /** @enum {string} */
338745
+ kind: "ingreso" | "costo" | "gasto" | "no_operacional";
338746
+ archived: boolean;
338747
+ seeded: boolean;
338748
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
338749
+ tax_role_label: string | null;
338750
+ without_tax_meaning: boolean;
338751
+ /** @description The F22 code this role feeds in each regime for the tax year; null = no code of that regime takes it. */
338752
+ codes: {
338753
+ "14A": {
338754
+ code: number;
338755
+ /** @description The twin code for documents of an earlier year paid in this one (14 D); null when the form has none. */
338756
+ earlier: number | null;
338757
+ } | null;
338758
+ "14D3": {
338759
+ code: number;
338760
+ /** @description The twin code for documents of an earlier year paid in this one (14 D); null when the form has none. */
338761
+ earlier: number | null;
338762
+ } | null;
338763
+ "14D8": {
338764
+ code: number;
338765
+ /** @description The twin code for documents of an earlier year paid in this one (14 D); null when the form has none. */
338766
+ earlier: number | null;
338767
+ } | null;
338768
+ };
338769
+ /** @description For an account with no role: a proposal from its name (nothing is stored until a person sets it). */
338770
+ suggestion: {
338771
+ role: components["schemas"]["FinanzasTaxRole"] & string;
338772
+ label_es: string;
338773
+ /** @enum {string} */
338774
+ section: "income" | "outlay" | "non_result";
338775
+ /** @enum {string} */
338776
+ reason: "name" | "parent" | "kind";
338777
+ } | null;
338778
+ }[];
338779
+ };
338780
+ FinanzasAccountTaxBody: {
338781
+ tax_role: components["schemas"]["FinanzasTaxRole"] & unknown;
338782
+ };
338783
+ FinanzasNonDeductibleList: {
338784
+ year: number;
338785
+ items: {
338786
+ /** @enum {string} */
338787
+ target: "document" | "movement";
338788
+ /** Format: uuid */
338789
+ id: string;
338790
+ date: string;
338791
+ amount_clp: number;
338792
+ label: string | null;
338793
+ non_deductible: components["schemas"]["FinanzasNonDeductible"];
338794
+ /** @description A person said «deductible» over a default. */
338795
+ overrides_default: boolean;
338796
+ }[];
338797
+ defaults: {
338798
+ /** Format: uuid */
338799
+ movement_id: string;
338800
+ non_deductible: components["schemas"]["FinanzasNonDeductible"] & Record<string, never>;
338801
+ }[];
338802
+ };
338803
+ FinanzasNonDeductibleResult: {
338804
+ /** @enum {string} */
338805
+ target: "document" | "movement";
338806
+ /** Format: uuid */
338807
+ id: string;
338808
+ non_deductible: components["schemas"]["FinanzasNonDeductible"] & unknown;
338809
+ };
338810
+ FinanzasNonDeductibleBody: {
338811
+ /**
338812
+ * @description `tax_40`, `owner` (needs `owner_id`), `left_out`, or `deductible` to override a default (a fine or income-tax payment a person says is deductible).
338813
+ * @enum {string}
338814
+ */
338815
+ outcome: "tax_40" | "owner" | "left_out" | "deductible";
338816
+ /**
338817
+ * Format: uuid
338818
+ * @description Required with `owner`, refused otherwise.
338819
+ */
338820
+ owner_id?: string | null;
338821
+ note?: string | null;
338822
+ };
336463
338823
  FinanzasResumenCash: {
336464
338824
  /** @description «Caja hoy»: today’s balance of the operating accounts (savings apart) = the Flujo de caja opening. */
336465
338825
  today_clp: number;
@@ -337717,6 +340077,39 @@ interface components {
337717
340077
  };
337718
340078
  }[];
337719
340079
  };
340080
+ ClinicCampaignOverbookSetting: {
340081
+ percent: number;
340082
+ enabled: boolean;
340083
+ supported: boolean;
340084
+ /** @enum {string|null} */
340085
+ unsupported_reason: "mirrored_agenda" | "engine_unavailable" | null;
340086
+ engine: string | null;
340087
+ no_show_guidance: {
340088
+ from: string;
340089
+ to: string;
340090
+ by_origin: {
340091
+ key: string;
340092
+ label: string | null;
340093
+ attended: number;
340094
+ no_show: number;
340095
+ late_cancel: number;
340096
+ cancelled: number;
340097
+ cancelled_notice_unknown: number;
340098
+ unknown: number;
340099
+ closed: number;
340100
+ no_show_pct: number | null;
340101
+ late_cancel_pct: number | null;
340102
+ attendance_pct: number | null;
340103
+ }[];
340104
+ } | null;
340105
+ };
340106
+ ClinicCampaignOverbookBody: {
340107
+ /**
340108
+ * @description Share of the hours held by Meta-origin evaluation citas that stays bookable once more, per professional and day. 0 = off.
340109
+ * @example 50
340110
+ */
340111
+ percent: number;
340112
+ };
337720
340113
  ClinicWaitlistDemand: {
337721
340114
  window: {
337722
340115
  days: number;
@@ -339842,6 +342235,16 @@ interface components {
339842
342235
  /** Format: uuid */
339843
342236
  followup_id: string;
339844
342237
  trigger_key: string;
342238
+ } | {
342239
+ /** @enum {string} */
342240
+ type: "media_file";
342241
+ /**
342242
+ * Format: uuid
342243
+ * @description The media library file (`GET /media-assets/{id}`).
342244
+ */
342245
+ asset_id: string;
342246
+ /** @description Sent as written. Fields: `{{nombre}}` (first name; dropped when unknown), `{{cita.fecha}}` and `{{cita.hora}}` (only with entry `appointment_booked`). Empty = the file alone. */
342247
+ caption: string;
339845
342248
  };
339846
342249
  config_ref: {
339847
342250
  /** @enum {string} */
@@ -340381,6 +342784,16 @@ interface components {
340381
342784
  /** Format: uuid */
340382
342785
  followup_id: string;
340383
342786
  trigger_key: string;
342787
+ } | {
342788
+ /** @enum {string} */
342789
+ type: "media_file";
342790
+ /**
342791
+ * Format: uuid
342792
+ * @description The media library file (`GET /media-assets/{id}`).
342793
+ */
342794
+ asset_id: string;
342795
+ /** @description Sent as written. Fields: `{{nombre}}` (first name; dropped when unknown), `{{cita.fecha}}` and `{{cita.hora}}` (only with entry `appointment_booked`). Empty = the file alone. */
342796
+ caption: string;
340384
342797
  };
340385
342798
  /** @description Where a built-in step is stored (keep it as read); null for a step added in the draft. */
340386
342799
  config_ref: {
@@ -340695,7 +343108,7 @@ interface components {
340695
343108
  message: string;
340696
343109
  fix: {
340697
343110
  /** @enum {string} */
340698
- kind: "draft_template" | "connect_channel" | "request_review" | "remove_step" | "change_channel" | "pick_agent" | "contact_support";
343111
+ kind: "draft_template" | "connect_channel" | "request_review" | "remove_step" | "change_channel" | "pick_agent" | "pick_media" | "review_template" | "contact_support";
340699
343112
  target?: components["schemas"]["NotificationTarget"];
340700
343113
  };
340701
343114
  };
@@ -340839,6 +343252,72 @@ interface components {
340839
343252
  via?: string | null;
340840
343253
  } | null;
340841
343254
  };
343255
+ SequenceMediaTemplate: {
343256
+ /** @description The draft (null while the step has no draft for its current content: it is made on publish, or on submit). */
343257
+ id: string | null;
343258
+ sequence_id: string;
343259
+ sequence_name: string | null;
343260
+ step_key: string;
343261
+ /**
343262
+ * @description Where the template stands for the step’s CURRENT content (file version + caption + language). Only `approved` sends outside the window; inside it the plain file goes in every state.
343263
+ * @enum {string}
343264
+ */
343265
+ state: "unavailable" | "none" | "draft" | "in_review" | "approved" | "recategorised" | "rejected" | "paused" | "disabled";
343266
+ /** @description One Spanish sentence about the state, for the owner. */
343267
+ state_message: string;
343268
+ can_submit: boolean;
343269
+ submit_blocked_reason: string | null;
343270
+ /** @description The submitted template (the Meta mirror row). */
343271
+ template: {
343272
+ id: string;
343273
+ name: string;
343274
+ status: string;
343275
+ category: string;
343276
+ rejection_reason: string | null;
343277
+ } | null;
343278
+ review: {
343279
+ language: string;
343280
+ /** @enum {string} */
343281
+ category: "MARKETING";
343282
+ category_note: string;
343283
+ price_per_send: {
343284
+ /** @enum {string} */
343285
+ market: "CL";
343286
+ /** @enum {string} */
343287
+ currency: "USD";
343288
+ category: string;
343289
+ amount: number;
343290
+ as_of: string;
343291
+ label: string;
343292
+ };
343293
+ header: {
343294
+ /** @enum {string|null} */
343295
+ format: "VIDEO" | "IMAGE" | "DOCUMENT" | null;
343296
+ asset_id: string;
343297
+ asset_name: string | null;
343298
+ mime_type: string | null;
343299
+ byte_size: number | null;
343300
+ };
343301
+ /** @description The body as submitted: the caption with NAMED variables (`{{nombre}}`, `{{cita_fecha}}`, `{{cita_hora}}`). */
343302
+ body_text: string;
343303
+ body_preview: string;
343304
+ variables: {
343305
+ name: string;
343306
+ /** @enum {string} */
343307
+ field: "nombre" | "cita.fecha" | "cita.hora";
343308
+ label: string;
343309
+ example: string;
343310
+ }[];
343311
+ caption_issues: {
343312
+ /** @enum {string} */
343313
+ code: "empty" | "too_long" | "missing_required" | "unknown_variable" | "numbered_variable" | "repeated_variable" | "starts_with_variable" | "ends_with_variable" | "adjacent_variables" | "stray_brace" | "too_many_variables" | "promotional";
343314
+ message: string;
343315
+ slot?: string;
343316
+ }[];
343317
+ problem_message: string | null;
343318
+ name_note: string | null;
343319
+ };
343320
+ };
340842
343321
  SequenceTemplate: {
340843
343322
  /** @enum {string} */
340844
343323
  key: "blank" | "quote_followup" | "reactivate" | "signup_not_paid" | "installments" | "appointment_reminder";
@@ -340936,6 +343415,16 @@ interface components {
340936
343415
  /** Format: uuid */
340937
343416
  followup_id: string;
340938
343417
  trigger_key: string;
343418
+ } | {
343419
+ /** @enum {string} */
343420
+ type: "media_file";
343421
+ /**
343422
+ * Format: uuid
343423
+ * @description The media library file (`GET /media-assets/{id}`).
343424
+ */
343425
+ asset_id: string;
343426
+ /** @description Sent as written. Fields: `{{nombre}}` (first name; dropped when unknown), `{{cita.fecha}}` and `{{cita.hora}}` (only with entry `appointment_booked`). Empty = the file alone. */
343427
+ caption: string;
340939
343428
  };
340940
343429
  /** @description Where a built-in step is stored (keep it as read); null for a step added in the draft. */
340941
343430
  config_ref: {