@vitrina/api 14.59.0 → 14.60.1

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 +1790 -919
  2. package/dist/index.d.ts +1790 -919
  3. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -21617,7 +21617,7 @@ interface paths {
21617
21617
  put?: never;
21618
21618
  /**
21619
21619
  * Submit a website buyer inquiry (dealer-website write API)
21620
- * @description Creates a CRM lead with `website` origin, attaching the inquired Vehículo when `vehicle_id` is given. Requires the write-only `leads:intake` scope (never `leads:write`). Returns a minimized `{ status }` ack — `received` on create, `duplicate` on dedup — and echoes no internal ids. Rate-limited like every authenticated endpoint; a hidden `hp_website` honeypot field silently drops spam.
21620
+ * @description Creates a CRM lead with `website` origin, attaching the inquired Vehículo when `vehicle_id` is given. A proyecto form (Módulo Proyectos) sends `project_id` and/or `unit_model_id` (a tipología names its proyecto): the lead lands on the proyecto, is routed to its ejecutivos, and `message` becomes optional. `attribution` carries the visitor's `first_touch` and `last_touch` (utm_*, gclid, fbclid, anonymous_id); both are kept on the lead. Requires the write-only `leads:intake` scope (never `leads:write`). Returns a minimized `{ status }` ack — `received` on create, `duplicate` on dedup — and echoes no internal ids. Rate-limited like every authenticated endpoint; a hidden `hp_website` honeypot field silently drops spam.
21621
21621
  */
21622
21622
  post: {
21623
21623
  parameters: {
@@ -21646,9 +21646,37 @@ interface paths {
21646
21646
  /** Format: email */
21647
21647
  email?: string;
21648
21648
  phone?: string;
21649
- message: string;
21649
+ message?: string;
21650
21650
  /** Format: uuid */
21651
21651
  vehicle_id?: string;
21652
+ /** Format: uuid */
21653
+ project_id?: string;
21654
+ /** Format: uuid */
21655
+ unit_model_id?: string;
21656
+ attribution?: {
21657
+ first_touch?: {
21658
+ utm_source?: string | null;
21659
+ utm_medium?: string | null;
21660
+ utm_campaign?: string | null;
21661
+ utm_content?: string | null;
21662
+ utm_term?: string | null;
21663
+ utm_id?: string | null;
21664
+ fbclid?: string | null;
21665
+ gclid?: string | null;
21666
+ anonymous_id?: string | null;
21667
+ };
21668
+ last_touch?: {
21669
+ utm_source?: string | null;
21670
+ utm_medium?: string | null;
21671
+ utm_campaign?: string | null;
21672
+ utm_content?: string | null;
21673
+ utm_term?: string | null;
21674
+ utm_id?: string | null;
21675
+ fbclid?: string | null;
21676
+ gclid?: string | null;
21677
+ anonymous_id?: string | null;
21678
+ };
21679
+ };
21652
21680
  /** @enum {string} */
21653
21681
  intent?: "buy" | "sell" | "financing" | "trade_in";
21654
21682
  hp_website?: string;
@@ -67365,7 +67393,7 @@ interface paths {
67365
67393
  };
67366
67394
  /**
67367
67395
  * How this business charges, and its Mercado Pago connection
67368
- * @description `charging.reservation` (refundable reservations: booking deposits, vehicle reservation deposits) and `charging.final` (balances, budgets, packs, services), each with the effective `mode`, whether it is the workspace's choice or the vertical default (`source`), and the `default_mode`. Defaults: healthcare `mp_first` for both; automotive `transfer_first` for reservations (a Mercado Pago refund does not return the commission) and `mp_first` for final payments; any other vertical `mp_first`. `provider` is which connected provider payment links go through (`preferred`: the business's choice or null; `active`: what a new link would use now or null when none is connected; `connected`: every connected provider, which the buyer chooses among on the link page when there are two or more); `webpay` is the Webpay Plus connection status and `fintoc` the Fintoc one. `mercadopago` is the connection status plus `configured` (the environment can connect at all). `installments.min_clp`: from which amount a final-charge link offers cuotas (`null` = off). `budgets.accept_charge`: what a presupuesto's «aceptar y pagar» charges (`full` | `first_installment`). Requires `tenant_bank_accounts:read` (or `clinic_money:read`).
67396
+ * @description `charging.reservation` (refundable reservations: booking deposits, vehicle reservation deposits) and `charging.final` (balances, budgets, packs, services), each with the effective `mode`, whether it is the workspace's choice or the vertical default (`source`), and the `default_mode`. Defaults: healthcare `mp_first` for both; automotive `transfer_first` for reservations (a Mercado Pago refund does not return the commission) and `mp_first` for final payments; any other vertical `mp_first`. `provider` is which connected provider payment links go through (`preferred`: the business's choice or null; `active`: what a new link would use now or null when none is connected; `connected`: every connected provider, which the buyer chooses among on the link page when there are two or more); `webpay` is the Webpay Plus connection status and `fintoc`, `flow` and `khipu` the Fintoc, Flow and Khipu ones. `mercadopago` is the connection status plus `configured` (the environment can connect at all). `installments.min_clp`: from which amount a final-charge link offers cuotas (`null` = off). `budgets.accept_charge`: what a presupuesto's «aceptar y pagar» charges (`full` | `first_installment`). Requires `tenant_bank_accounts:read` (or `clinic_money:read`).
67369
67397
  */
67370
67398
  get: {
67371
67399
  parameters: {
@@ -67403,7 +67431,9 @@ interface paths {
67403
67431
  * "connected": [
67404
67432
  * "mercadopago",
67405
67433
  * "webpay",
67406
- * "fintoc"
67434
+ * "fintoc",
67435
+ * "flow",
67436
+ * "khipu"
67407
67437
  * ]
67408
67438
  * },
67409
67439
  * "webpay": {
@@ -67419,6 +67449,18 @@ interface paths {
67419
67449
  * "secret_key_preview": "••••Ab12",
67420
67450
  * "connected_at": "2026-10-20T14:00:00.000Z"
67421
67451
  * },
67452
+ * "flow": {
67453
+ * "connected": true,
67454
+ * "environment": "sandbox",
67455
+ * "api_key": "flow-api-key-example",
67456
+ * "secret_key_preview": "4c1a••••9e",
67457
+ * "connected_at": "2026-10-20T14:00:00.000Z"
67458
+ * },
67459
+ * "khipu": {
67460
+ * "connected": true,
67461
+ * "api_key_preview": "9d2f••••a7",
67462
+ * "connected_at": "2026-10-20T14:00:00.000Z"
67463
+ * },
67422
67464
  * "installments": {
67423
67465
  * "min_clp": null
67424
67466
  * },
@@ -68321,7 +68363,7 @@ interface paths {
68321
68363
  get?: never;
68322
68364
  /**
68323
68365
  * Choose which connected provider payment links use
68324
- * @description When the business connected more than one customer payment provider (Mercado Pago, Webpay Plus, Fintoc), payment links go through the one chosen here; `null` clears the choice (the first connected one is used). A choice that is not connected is ignored at link time. Returns the choice and the provider a new link would use now. Requires `tenant_bank_accounts:write` (or `clinic_money:write`).
68366
+ * @description When the business connected more than one customer payment provider (Mercado Pago, Webpay Plus, Fintoc, Flow, Khipu), payment links go through the one chosen here; `null` clears the choice (the first connected one is used). A choice that is not connected is ignored at link time. Returns the choice and the provider a new link would use now. Requires `tenant_bank_accounts:write` (or `clinic_money:write`).
68325
68367
  */
68326
68368
  put: {
68327
68369
  parameters: {
@@ -68343,7 +68385,7 @@ interface paths {
68343
68385
  * @example webpay
68344
68386
  * @enum {string|null}
68345
68387
  */
68346
- provider: "mercadopago" | "webpay" | "fintoc" | null;
68388
+ provider: "mercadopago" | "webpay" | "fintoc" | "flow" | "khipu" | null;
68347
68389
  };
68348
68390
  };
68349
68391
  };
@@ -69098,7 +69140,7 @@ interface paths {
69098
69140
  patch?: never;
69099
69141
  trace?: never;
69100
69142
  };
69101
- "/clinic/bank-feed/sources": {
69143
+ "/payment-settings/flow/status": {
69102
69144
  parameters: {
69103
69145
  query?: never;
69104
69146
  header?: never;
@@ -69106,10 +69148,8 @@ interface paths {
69106
69148
  cookie?: never;
69107
69149
  };
69108
69150
  /**
69109
- * Bank feed sources available to this clinic
69110
- * @description The e-mail rail (free, always on), Fintoc (optional add-on `bank_feed_fintoc`, billed per connected bank per month at the provider's list price — `price_clp_per_bank_month` is null until it is set) and BCI API Market (not configured until the partner approval lands). Requires `clinic_money:read`.
69111
- *
69112
- * **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`.
69151
+ * Flow connection status
69152
+ * @description Connected API key, environment and a masked secret key preview, or `connected: false`. The secret is never returned. Requires `tenant_bank_accounts:read` (or `clinic_money:read`).
69113
69153
  */
69114
69154
  get: {
69115
69155
  parameters: {
@@ -69120,7 +69160,7 @@ interface paths {
69120
69160
  };
69121
69161
  requestBody?: never;
69122
69162
  responses: {
69123
- /** @description The sources */
69163
+ /** @description The connection status */
69124
69164
  200: {
69125
69165
  headers: {
69126
69166
  [name: string]: unknown;
@@ -69129,26 +69169,19 @@ interface paths {
69129
69169
  /**
69130
69170
  * @example {
69131
69171
  * "data": {
69132
- * "email": {
69133
- * "available": true,
69134
- * "billed": false
69135
- * },
69136
- * "fintoc": {
69137
- * "configured": true,
69138
- * "entitled": true,
69139
- * "feature": "bank_feed_fintoc",
69140
- * "price_clp_per_bank_month": null,
69141
- * "connected_banks": 1
69142
- * },
69143
- * "bci_api_market": {
69144
- * "configured": false,
69145
- * "reason": "BCI API Market production access is pending partner approval."
69146
- * }
69172
+ * "connected": true,
69173
+ * "environment": "sandbox",
69174
+ * "api_key": "flow-api-key-example",
69175
+ * "secret_key_preview": "4c1a••••9e",
69176
+ * "connected_at": "2026-10-20T14:00:00.000Z"
69147
69177
  * }
69148
69178
  * }
69149
69179
  */
69150
69180
  "application/json": {
69151
- data: components["schemas"]["BankFeedSources"];
69181
+ data?: unknown;
69182
+ meta?: {
69183
+ [key: string]: unknown;
69184
+ };
69152
69185
  };
69153
69186
  };
69154
69187
  };
@@ -69216,29 +69249,57 @@ interface paths {
69216
69249
  patch?: never;
69217
69250
  trace?: never;
69218
69251
  };
69219
- "/clinic/bank-feed/connections": {
69252
+ "/payment-settings/flow/connect": {
69220
69253
  parameters: {
69221
69254
  query?: never;
69222
69255
  header?: never;
69223
69256
  path?: never;
69224
69257
  cookie?: never;
69225
69258
  };
69259
+ get?: never;
69260
+ put?: never;
69226
69261
  /**
69227
- * Connected bank links
69228
- * @description Every bank link this clinic connected through an API source, enabled or not, with masked account numbers and the last sync result. Requires `clinic_money:read`.
69229
- *
69230
- * **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`.
69262
+ * Connect the business's own Flow commerce
69263
+ * @description Connects the business's OWN Flow commerce (API Key + Secret Key); the money never passes through Vitrina. The pair is verified against Flow for the chosen `environment` before it is stored encrypted: 400 when Flow rejects it. Use `sandbox` (sandbox.flow.cl) to try it without real money. A reconnect replaces the credentials. Requires `tenant_bank_accounts:write` (or `clinic_money:write`).
69231
69264
  */
69232
- get: {
69265
+ post: {
69233
69266
  parameters: {
69234
69267
  query?: never;
69235
- header?: never;
69268
+ header?: {
69269
+ /** @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. */
69270
+ "Idempotency-Key"?: string;
69271
+ };
69236
69272
  path?: never;
69237
69273
  cookie?: never;
69238
69274
  };
69239
- requestBody?: never;
69275
+ requestBody?: {
69276
+ content: {
69277
+ /**
69278
+ * @example {
69279
+ * "api_key": "flow-api-key-example",
69280
+ * "secret_key": "<your commerce Secret Key>",
69281
+ * "environment": "sandbox"
69282
+ * }
69283
+ */
69284
+ "application/json": {
69285
+ /**
69286
+ * @description The commerce API Key («ApiKey») from the Flow panel. Not a secret.
69287
+ * @example flow-api-key-example
69288
+ */
69289
+ api_key: string;
69290
+ /** @description The commerce Secret Key («SecretKey»). Verified against Flow, stored encrypted, never returned. */
69291
+ secret_key: string;
69292
+ /**
69293
+ * @description `sandbox` = sandbox.flow.cl (test payments, no real money); `production` = real charges.
69294
+ * @example sandbox
69295
+ * @enum {string}
69296
+ */
69297
+ environment: "sandbox" | "production";
69298
+ };
69299
+ };
69300
+ };
69240
69301
  responses: {
69241
- /** @description The connections */
69302
+ /** @description The connection status */
69242
69303
  200: {
69243
69304
  headers: {
69244
69305
  [name: string]: unknown;
@@ -69246,31 +69307,20 @@ interface paths {
69246
69307
  content: {
69247
69308
  /**
69248
69309
  * @example {
69249
- * "data": [
69250
- * {
69251
- * "id": "bf0bf0bf-0000-4000-8000-000000000001",
69252
- * "provider": "fintoc",
69253
- * "institution_name": "Banco de Chile",
69254
- * "holder_name": "Clínica Ejemplo SpA",
69255
- * "accounts": [
69256
- * {
69257
- * "id": "acc_9Xz2Lm",
69258
- * "number_masked": "••••4821"
69259
- * }
69260
- * ],
69261
- * "enabled": true,
69262
- * "connected_at": "2026-09-20T14:02:11.000Z",
69263
- * "disconnected_at": null,
69264
- * "last_sync_at": "2026-09-22T09:00:04.000Z",
69265
- * "last_sync_status": "ok",
69266
- * "last_sync_error": null,
69267
- * "sync_cursor": "2026-09-22"
69268
- * }
69269
- * ]
69310
+ * "data": {
69311
+ * "connected": true,
69312
+ * "environment": "sandbox",
69313
+ * "api_key": "flow-api-key-example",
69314
+ * "secret_key_preview": "4c1a••••9e",
69315
+ * "connected_at": "2026-10-20T14:00:00.000Z"
69316
+ * }
69270
69317
  * }
69271
69318
  */
69272
69319
  "application/json": {
69273
- data: components["schemas"]["BankFeedConnection"][];
69320
+ data?: unknown;
69321
+ meta?: {
69322
+ [key: string]: unknown;
69323
+ };
69274
69324
  };
69275
69325
  };
69276
69326
  };
@@ -69330,15 +69380,13 @@ interface paths {
69330
69380
  };
69331
69381
  };
69332
69382
  };
69333
- put?: never;
69334
- post?: never;
69335
69383
  delete?: never;
69336
69384
  options?: never;
69337
69385
  head?: never;
69338
69386
  patch?: never;
69339
69387
  trace?: never;
69340
69388
  };
69341
- "/clinic/bank-feed/fintoc/connect": {
69389
+ "/payment-settings/flow/disconnect": {
69342
69390
  parameters: {
69343
69391
  query?: never;
69344
69392
  header?: never;
@@ -69348,10 +69396,8 @@ interface paths {
69348
69396
  get?: never;
69349
69397
  put?: never;
69350
69398
  /**
69351
- * Connect a bank through Fintoc
69352
- * @description Send the `exchange_token` Fintoc's widget returns (or a `link_token`). The server swaps it for the long-lived link token, stores it encrypted, and queues the first pull. Requires the `bank_feed_fintoc` add-on — without it the answer is `402 ENTITLEMENT_NOT_ACTIVE` (the upsell). Reconnecting the same bank updates its connection. Requires `clinic_money:write`.
69353
- *
69354
- * **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`.
69399
+ * Disconnect Flow
69400
+ * @description Reversible: the connection survives disabled and a later connect re-enables it. Payment links fall back to another connected provider or the transfer. Requires `tenant_bank_accounts:write` (or `clinic_money:write`).
69355
69401
  */
69356
69402
  post: {
69357
69403
  parameters: {
@@ -69363,50 +69409,14 @@ interface paths {
69363
69409
  path?: never;
69364
69410
  cookie?: never;
69365
69411
  };
69366
- requestBody?: {
69367
- content: {
69368
- /**
69369
- * @example {
69370
- * "exchange_token": "exch_7f3a9b2c1d"
69371
- * }
69372
- */
69373
- "application/json": components["schemas"]["BankFeedFintocConnectBody"];
69374
- };
69375
- };
69412
+ requestBody?: never;
69376
69413
  responses: {
69377
- /** @description The connection */
69378
- 201: {
69414
+ /** @description Disconnected */
69415
+ 204: {
69379
69416
  headers: {
69380
69417
  [name: string]: unknown;
69381
69418
  };
69382
- content: {
69383
- /**
69384
- * @example {
69385
- * "data": {
69386
- * "id": "bf0bf0bf-0000-4000-8000-000000000001",
69387
- * "provider": "fintoc",
69388
- * "institution_name": "Banco de Chile",
69389
- * "holder_name": "Clínica Ejemplo SpA",
69390
- * "accounts": [
69391
- * {
69392
- * "id": "acc_9Xz2Lm",
69393
- * "number_masked": "••••4821"
69394
- * }
69395
- * ],
69396
- * "enabled": true,
69397
- * "connected_at": "2026-09-20T14:02:11.000Z",
69398
- * "disconnected_at": null,
69399
- * "last_sync_at": "2026-09-22T09:00:04.000Z",
69400
- * "last_sync_status": "ok",
69401
- * "last_sync_error": null,
69402
- * "sync_cursor": "2026-09-22"
69403
- * }
69404
- * }
69405
- */
69406
- "application/json": {
69407
- data: components["schemas"]["BankFeedConnection"];
69408
- };
69409
- };
69419
+ content?: never;
69410
69420
  };
69411
69421
  /** @description Validation error */
69412
69422
  400: {
@@ -69470,37 +69480,28 @@ interface paths {
69470
69480
  patch?: never;
69471
69481
  trace?: never;
69472
69482
  };
69473
- "/clinic/bank-feed/connections/{id}/sync": {
69483
+ "/payment-settings/khipu/status": {
69474
69484
  parameters: {
69475
69485
  query?: never;
69476
69486
  header?: never;
69477
69487
  path?: never;
69478
69488
  cookie?: never;
69479
69489
  };
69480
- get?: never;
69481
- put?: never;
69482
69490
  /**
69483
- * Sincronizar ahora — enqueue a pull of one bank link
69484
- * @description Enqueues the SAME job the daily tick uses; the stable per-connection jobId dedups with an in-flight sync. Requires `clinic_money:write`.
69485
- *
69486
- * **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`.
69491
+ * Khipu connection status
69492
+ * @description Whether a Khipu collection account is connected, with a masked key preview. The secret is never returned. Requires `tenant_bank_accounts:read` (or `clinic_money:read`).
69487
69493
  */
69488
- post: {
69494
+ get: {
69489
69495
  parameters: {
69490
69496
  query?: never;
69491
- header?: {
69492
- /** @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. */
69493
- "Idempotency-Key"?: string;
69494
- };
69495
- path: {
69496
- id: string;
69497
- };
69497
+ header?: never;
69498
+ path?: never;
69498
69499
  cookie?: never;
69499
69500
  };
69500
69501
  requestBody?: never;
69501
69502
  responses: {
69502
- /** @description Enqueued */
69503
- 202: {
69503
+ /** @description The connection status */
69504
+ 200: {
69504
69505
  headers: {
69505
69506
  [name: string]: unknown;
69506
69507
  };
@@ -69508,13 +69509,16 @@ interface paths {
69508
69509
  /**
69509
69510
  * @example {
69510
69511
  * "data": {
69511
- * "enqueued": true
69512
+ * "connected": true,
69513
+ * "api_key_preview": "9d2f••••a7",
69514
+ * "connected_at": "2026-10-20T14:00:00.000Z"
69512
69515
  * }
69513
69516
  * }
69514
69517
  */
69515
69518
  "application/json": {
69516
- data: {
69517
- enqueued: boolean;
69519
+ data?: unknown;
69520
+ meta?: {
69521
+ [key: string]: unknown;
69518
69522
  };
69519
69523
  };
69520
69524
  };
@@ -69575,13 +69579,15 @@ interface paths {
69575
69579
  };
69576
69580
  };
69577
69581
  };
69582
+ put?: never;
69583
+ post?: never;
69578
69584
  delete?: never;
69579
69585
  options?: never;
69580
69586
  head?: never;
69581
69587
  patch?: never;
69582
69588
  trace?: never;
69583
69589
  };
69584
- "/clinic/bank-feed/connections/{id}/disconnect": {
69590
+ "/payment-settings/khipu/connect": {
69585
69591
  parameters: {
69586
69592
  query?: never;
69587
69593
  header?: never;
@@ -69591,10 +69597,8 @@ interface paths {
69591
69597
  get?: never;
69592
69598
  put?: never;
69593
69599
  /**
69594
- * Disconnect a bank link
69595
- * @description Reversible: the connection survives disabled (its movements stay in the ledger), stops syncing and stops counting as a billed bank from the next period. Requires `clinic_money:write`.
69596
- *
69597
- * **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`.
69600
+ * Connect the business's own Khipu account
69601
+ * @description Connects the business's OWN Khipu collection account with its secret key; the money never passes through Vitrina. The key is verified against Khipu before it is stored encrypted: 400 when Khipu rejects it. Khipu has no separate sandbox: a developer collection account accepts only Khipu's DemoBank test bank, so connect one to try it without real money. A reconnect replaces the key. Requires `tenant_bank_accounts:write` (or `clinic_money:write`).
69598
69602
  */
69599
69603
  post: {
69600
69604
  parameters: {
@@ -69603,19 +69607,45 @@ interface paths {
69603
69607
  /** @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. */
69604
69608
  "Idempotency-Key"?: string;
69605
69609
  };
69606
- path: {
69607
- id: string;
69608
- };
69610
+ path?: never;
69609
69611
  cookie?: never;
69610
69612
  };
69611
- requestBody?: never;
69613
+ requestBody?: {
69614
+ content: {
69615
+ /**
69616
+ * @example {
69617
+ * "api_key": "<your collection account secret key>"
69618
+ * }
69619
+ */
69620
+ "application/json": {
69621
+ /** @description The collection account secret key. It authenticates API calls and signs Khipu notifications. Verified against Khipu, stored encrypted, never returned. A developer collection account accepts only the DemoBank test bank. */
69622
+ api_key: string;
69623
+ };
69624
+ };
69625
+ };
69612
69626
  responses: {
69613
- /** @description Disconnected */
69614
- 204: {
69627
+ /** @description The connection status */
69628
+ 200: {
69615
69629
  headers: {
69616
69630
  [name: string]: unknown;
69617
69631
  };
69618
- content?: never;
69632
+ content: {
69633
+ /**
69634
+ * @example {
69635
+ * "data": {
69636
+ * "connected": true,
69637
+ * "api_key_preview": "9d2f••••a7",
69638
+ * "connected_at": "2026-10-20T14:00:00.000Z"
69639
+ * }
69640
+ * }
69641
+ */
69642
+ "application/json": {
69643
+ data?: unknown;
69644
+ meta?: {
69645
+ [key: string]: unknown;
69646
+ };
69647
+ };
69648
+ };
69619
69649
  };
69620
69650
  /** @description Validation error */
69621
69651
  400: {
@@ -69679,7 +69709,7 @@ interface paths {
69679
69709
  patch?: never;
69680
69710
  trace?: never;
69681
69711
  };
69682
- "/clinic/bank-feed/email/pull": {
69712
+ "/payment-settings/khipu/disconnect": {
69683
69713
  parameters: {
69684
69714
  query?: never;
69685
69715
  header?: never;
@@ -69689,10 +69719,8 @@ interface paths {
69689
69719
  get?: never;
69690
69720
  put?: never;
69691
69721
  /**
69692
- * Re-read bank e-mails still in the inbox for a window
69693
- * @description Runs the e-mail source of the bank feed over `[from, to]` (Santiago days, ≤ 92 days): bank comprobantes that are still conversations in a connected mailbox become `bank_movement` rows (provenance `backfill` — historical, never announced to anyone). Idempotent. Requires `clinic_money:write`.
69694
- *
69695
- * **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`.
69722
+ * Disconnect Khipu
69723
+ * @description Reversible: the connection survives disabled and a later connect re-enables it. Payment links fall back to another connected provider or the transfer. Requires `tenant_bank_accounts:write` (or `clinic_money:write`).
69696
69724
  */
69697
69725
  post: {
69698
69726
  parameters: {
@@ -69704,38 +69732,14 @@ interface paths {
69704
69732
  path?: never;
69705
69733
  cookie?: never;
69706
69734
  };
69707
- requestBody?: {
69708
- content: {
69709
- /**
69710
- * @example {
69711
- * "from": "2026-09-01",
69712
- * "to": "2026-09-22"
69713
- * }
69714
- */
69715
- "application/json": components["schemas"]["BankFeedEmailPullBody"];
69716
- };
69717
- };
69735
+ requestBody?: never;
69718
69736
  responses: {
69719
- /** @description What was ingested */
69720
- 200: {
69737
+ /** @description Disconnected */
69738
+ 204: {
69721
69739
  headers: {
69722
69740
  [name: string]: unknown;
69723
69741
  };
69724
- content: {
69725
- /**
69726
- * @example {
69727
- * "data": {
69728
- * "drafts": 0,
69729
- * "inserted": 3,
69730
- * "deduped": 1,
69731
- * "cross_source_twins": 1
69732
- * }
69733
- * }
69734
- */
69735
- "application/json": {
69736
- data: components["schemas"]["BankFeedIngestResult"];
69737
- };
69738
- };
69742
+ content?: never;
69739
69743
  };
69740
69744
  /** @description Validation error */
69741
69745
  400: {
@@ -69799,7 +69803,7 @@ interface paths {
69799
69803
  patch?: never;
69800
69804
  trace?: never;
69801
69805
  };
69802
- "/clinic/evidence-cards": {
69806
+ "/clinic/bank-feed/sources": {
69803
69807
  parameters: {
69804
69808
  query?: never;
69805
69809
  header?: never;
@@ -69807,8 +69811,8 @@ interface paths {
69807
69811
  cookie?: never;
69808
69812
  };
69809
69813
  /**
69810
- * Evidence cards for the owner's home (at most three)
69811
- * @description Deterministic, no model call. Each card carries `rule`, the proving `number` (`{ value, unit: "clp" | "count" }`), human-ready Spanish `title` / `label` / `detail` / `cta_label`, a workspace-relative `route`, and `money_at_stake_clp`. Ordered by money at stake, biggest first. A rule whose module is already set up, whose number is zero, or that the caller dismissed (and whose number has not grown in 30 days) is absent: an empty array means render nothing. The numbers are the destination modules' own (boletas, comisiones, conciliación, números comerciales, gastos).
69814
+ * Bank feed sources available to this clinic
69815
+ * @description The e-mail rail (free, always on), Fintoc (optional add-on `bank_feed_fintoc`, billed per connected bank per month at the provider's list price — `price_clp_per_bank_month` is null until it is set) and BCI API Market (not configured until the partner approval lands). Requires `clinic_money:read`.
69812
69816
  *
69813
69817
  * **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`.
69814
69818
  */
@@ -69821,7 +69825,7 @@ interface paths {
69821
69825
  };
69822
69826
  requestBody?: never;
69823
69827
  responses: {
69824
- /** @description The cards */
69828
+ /** @description The sources */
69825
69829
  200: {
69826
69830
  headers: {
69827
69831
  [name: string]: unknown;
@@ -69830,29 +69834,26 @@ interface paths {
69830
69834
  /**
69831
69835
  * @example {
69832
69836
  * "data": {
69833
- * "cards": [
69834
- * {
69835
- * "rule": "payments_without_boleta",
69836
- * "number": {
69837
- * "value": 1450000,
69838
- * "unit": "clp"
69839
- * },
69840
- * "label": "en pagos sin boleta este mes",
69841
- * "title": "Este mes registraste $1.450.000 en pagos sin boleta",
69842
- * "detail": "12 pagos sin documento tributario. Conecta la emisión electrónica y emite cada boleta desde el mismo pago.",
69843
- * "cta_label": "Activar boletas",
69844
- * "route": "/clinic/boletas?tab=emision",
69845
- * "money_at_stake_clp": 1450000
69846
- * }
69847
- * ]
69837
+ * "email": {
69838
+ * "available": true,
69839
+ * "billed": false
69840
+ * },
69841
+ * "fintoc": {
69842
+ * "configured": true,
69843
+ * "entitled": true,
69844
+ * "feature": "bank_feed_fintoc",
69845
+ * "price_clp_per_bank_month": null,
69846
+ * "connected_banks": 1
69847
+ * },
69848
+ * "bci_api_market": {
69849
+ * "configured": false,
69850
+ * "reason": "BCI API Market production access is pending partner approval."
69851
+ * }
69848
69852
  * }
69849
69853
  * }
69850
69854
  */
69851
69855
  "application/json": {
69852
- data?: unknown;
69853
- meta?: {
69854
- [key: string]: unknown;
69855
- };
69856
+ data: components["schemas"]["BankFeedSources"];
69856
69857
  };
69857
69858
  };
69858
69859
  };
@@ -69920,36 +69921,29 @@ interface paths {
69920
69921
  patch?: never;
69921
69922
  trace?: never;
69922
69923
  };
69923
- "/clinic/evidence-cards/{rule_id}/dismiss": {
69924
+ "/clinic/bank-feed/connections": {
69924
69925
  parameters: {
69925
69926
  query?: never;
69926
69927
  header?: never;
69927
69928
  path?: never;
69928
69929
  cookie?: never;
69929
69930
  };
69930
- get?: never;
69931
- put?: never;
69932
69931
  /**
69933
- * Dismiss one evidence card for the calling member
69934
- * @description Stored as a per-member preference (no table). The card returns only after 30 days AND only if its number grew since; the number is read server-side at dismissal time, never taken from the caller.
69932
+ * Connected bank links
69933
+ * @description Every bank link this clinic connected through an API source, enabled or not, with masked account numbers and the last sync result. Requires `clinic_money:read`.
69935
69934
  *
69936
69935
  * **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`.
69937
69936
  */
69938
- post: {
69937
+ get: {
69939
69938
  parameters: {
69940
69939
  query?: never;
69941
- header?: {
69942
- /** @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. */
69943
- "Idempotency-Key"?: string;
69944
- };
69945
- path: {
69946
- rule_id: "payments_without_boleta" | "commissions_unsettled" | "payments_unreconciled" | "accepted_budgets_unscheduled" | "advertising_spend";
69947
- };
69940
+ header?: never;
69941
+ path?: never;
69948
69942
  cookie?: never;
69949
69943
  };
69950
69944
  requestBody?: never;
69951
69945
  responses: {
69952
- /** @description The dismissal */
69946
+ /** @description The connections */
69953
69947
  200: {
69954
69948
  headers: {
69955
69949
  [name: string]: unknown;
@@ -69957,18 +69951,31 @@ interface paths {
69957
69951
  content: {
69958
69952
  /**
69959
69953
  * @example {
69960
- * "data": {
69961
- * "rule": "payments_without_boleta",
69962
- * "dismissed_at": "2026-09-30T15:00:00.000Z",
69963
- * "value": 1450000
69964
- * }
69954
+ * "data": [
69955
+ * {
69956
+ * "id": "bf0bf0bf-0000-4000-8000-000000000001",
69957
+ * "provider": "fintoc",
69958
+ * "institution_name": "Banco de Chile",
69959
+ * "holder_name": "Clínica Ejemplo SpA",
69960
+ * "accounts": [
69961
+ * {
69962
+ * "id": "acc_9Xz2Lm",
69963
+ * "number_masked": "••••4821"
69964
+ * }
69965
+ * ],
69966
+ * "enabled": true,
69967
+ * "connected_at": "2026-09-20T14:02:11.000Z",
69968
+ * "disconnected_at": null,
69969
+ * "last_sync_at": "2026-09-22T09:00:04.000Z",
69970
+ * "last_sync_status": "ok",
69971
+ * "last_sync_error": null,
69972
+ * "sync_cursor": "2026-09-22"
69973
+ * }
69974
+ * ]
69965
69975
  * }
69966
69976
  */
69967
69977
  "application/json": {
69968
- data?: unknown;
69969
- meta?: {
69970
- [key: string]: unknown;
69971
- };
69978
+ data: components["schemas"]["BankFeedConnection"][];
69972
69979
  };
69973
69980
  };
69974
69981
  };
@@ -70028,69 +70035,81 @@ interface paths {
70028
70035
  };
70029
70036
  };
70030
70037
  };
70038
+ put?: never;
70039
+ post?: never;
70031
70040
  delete?: never;
70032
70041
  options?: never;
70033
70042
  head?: never;
70034
70043
  patch?: never;
70035
70044
  trace?: never;
70036
70045
  };
70037
- "/clinic/pricing/lists": {
70046
+ "/clinic/bank-feed/fintoc/connect": {
70038
70047
  parameters: {
70039
70048
  query?: never;
70040
70049
  header?: never;
70041
70050
  path?: never;
70042
70051
  cookie?: never;
70043
70052
  };
70053
+ get?: never;
70054
+ put?: never;
70044
70055
  /**
70045
- * List price lists (aranceles)
70046
- * @description Every arancel with its validity window, its sucursal (null = the whole workspace) and how many prestaciones it prices. Retired lists included unless `?active=true` — this screen manages the catalogue.
70056
+ * Connect a bank through Fintoc
70057
+ * @description Send the `exchange_token` Fintoc's widget returns (or a `link_token`). The server swaps it for the long-lived link token, stores it encrypted, and queues the first pull. Requires the `bank_feed_fintoc` add-on — without it the answer is `402 ENTITLEMENT_NOT_ACTIVE` (the upsell). Reconnecting the same bank updates its connection. Requires `clinic_money:write`.
70047
70058
  *
70048
70059
  * **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`.
70049
70060
  */
70050
- get: {
70061
+ post: {
70051
70062
  parameters: {
70052
- query?: {
70053
- active?: "true" | "false";
70063
+ query?: never;
70064
+ header?: {
70065
+ /** @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. */
70066
+ "Idempotency-Key"?: string;
70054
70067
  };
70055
- header?: never;
70056
70068
  path?: never;
70057
70069
  cookie?: never;
70058
70070
  };
70059
- requestBody?: never;
70071
+ requestBody?: {
70072
+ content: {
70073
+ /**
70074
+ * @example {
70075
+ * "exchange_token": "exch_7f3a9b2c1d"
70076
+ * }
70077
+ */
70078
+ "application/json": components["schemas"]["BankFeedFintocConnectBody"];
70079
+ };
70080
+ };
70060
70081
  responses: {
70061
- /** @description Clinic price lists */
70062
- 200: {
70082
+ /** @description The connection */
70083
+ 201: {
70063
70084
  headers: {
70064
70085
  [name: string]: unknown;
70065
70086
  };
70066
70087
  content: {
70067
70088
  /**
70068
70089
  * @example {
70069
- * "data": [
70070
- * {
70071
- * "id": "38b62be4-0000-4000-8000-000000000001",
70072
- * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
70073
- * "source": "native",
70074
- * "external_id": null,
70075
- * "name": "Arancel particular 2026",
70076
- * "currency": "CLP",
70077
- * "valid_from": "2026-09-22",
70078
- * "valid_to": null,
70079
- * "location_id": null,
70080
- * "is_default": true,
70081
- * "active": true,
70082
- * "created_at": "2026-09-22T22:21:14.611Z",
70083
- * "updated_at": "2026-09-22T22:21:14.611Z",
70084
- * "entry_count": 0
70085
- * }
70086
- * ]
70090
+ * "data": {
70091
+ * "id": "bf0bf0bf-0000-4000-8000-000000000001",
70092
+ * "provider": "fintoc",
70093
+ * "institution_name": "Banco de Chile",
70094
+ * "holder_name": "Clínica Ejemplo SpA",
70095
+ * "accounts": [
70096
+ * {
70097
+ * "id": "acc_9Xz2Lm",
70098
+ * "number_masked": "••••4821"
70099
+ * }
70100
+ * ],
70101
+ * "enabled": true,
70102
+ * "connected_at": "2026-09-20T14:02:11.000Z",
70103
+ * "disconnected_at": null,
70104
+ * "last_sync_at": "2026-09-22T09:00:04.000Z",
70105
+ * "last_sync_status": "ok",
70106
+ * "last_sync_error": null,
70107
+ * "sync_cursor": "2026-09-22"
70108
+ * }
70087
70109
  * }
70088
70110
  */
70089
70111
  "application/json": {
70090
- data?: unknown;
70091
- meta?: {
70092
- [key: string]: unknown;
70093
- };
70112
+ data: components["schemas"]["BankFeedConnection"];
70094
70113
  };
70095
70114
  };
70096
70115
  };
@@ -70150,10 +70169,24 @@ interface paths {
70150
70169
  };
70151
70170
  };
70152
70171
  };
70172
+ delete?: never;
70173
+ options?: never;
70174
+ head?: never;
70175
+ patch?: never;
70176
+ trace?: never;
70177
+ };
70178
+ "/clinic/bank-feed/connections/{id}/sync": {
70179
+ parameters: {
70180
+ query?: never;
70181
+ header?: never;
70182
+ path?: never;
70183
+ cookie?: never;
70184
+ };
70185
+ get?: never;
70153
70186
  put?: never;
70154
70187
  /**
70155
- * Create a price list
70156
- * @description A dated arancel. `is_default: true` demotes the previous default in the same scope (tenant-wide, or that sucursal).
70188
+ * Sincronizar ahora — enqueue a pull of one bank link
70189
+ * @description Enqueues the SAME job the daily tick uses; the stable per-connection jobId dedups with an in-flight sync. Requires `clinic_money:write`.
70157
70190
  *
70158
70191
  * **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`.
70159
70192
  */
@@ -70164,33 +70197,15 @@ interface paths {
70164
70197
  /** @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. */
70165
70198
  "Idempotency-Key"?: string;
70166
70199
  };
70167
- path?: never;
70168
- cookie?: never;
70169
- };
70170
- requestBody?: {
70171
- content: {
70172
- /**
70173
- * @example {
70174
- * "name": "Arancel particular 2026",
70175
- * "currency": "CLP",
70176
- * "is_default": true
70177
- * }
70178
- */
70179
- "application/json": {
70180
- name: string;
70181
- currency?: string;
70182
- valid_from?: string;
70183
- valid_to?: string | null;
70184
- /** Format: uuid */
70185
- location_id?: string | null;
70186
- is_default?: boolean;
70187
- active?: boolean;
70188
- };
70200
+ path: {
70201
+ id: string;
70189
70202
  };
70203
+ cookie?: never;
70190
70204
  };
70205
+ requestBody?: never;
70191
70206
  responses: {
70192
- /** @description Clinic price list */
70193
- 201: {
70207
+ /** @description Enqueued */
70208
+ 202: {
70194
70209
  headers: {
70195
70210
  [name: string]: unknown;
70196
70211
  };
@@ -70198,25 +70213,14 @@ interface paths {
70198
70213
  /**
70199
70214
  * @example {
70200
70215
  * "data": {
70201
- * "id": "38b62be4-0000-4000-8000-000000000001",
70202
- * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
70203
- * "source": "native",
70204
- * "external_id": null,
70205
- * "name": "Arancel particular 2026",
70206
- * "currency": "CLP",
70207
- * "valid_from": "2026-09-22",
70208
- * "valid_to": null,
70209
- * "location_id": null,
70210
- * "is_default": true,
70211
- * "active": true,
70212
- * "created_at": "2026-09-22T22:21:14.611Z",
70213
- * "updated_at": "2026-09-22T22:21:14.611Z",
70214
- * "entry_count": 0
70216
+ * "enqueued": true
70215
70217
  * }
70216
70218
  * }
70217
70219
  */
70218
70220
  "application/json": {
70219
- data?: unknown;
70221
+ data: {
70222
+ enqueued: boolean;
70223
+ };
70220
70224
  };
70221
70225
  };
70222
70226
  };
@@ -70282,7 +70286,7 @@ interface paths {
70282
70286
  patch?: never;
70283
70287
  trace?: never;
70284
70288
  };
70285
- "/clinic/pricing/lists/{id}": {
70289
+ "/clinic/bank-feed/connections/{id}/disconnect": {
70286
70290
  parameters: {
70287
70291
  query?: never;
70288
70292
  header?: never;
@@ -70291,23 +70295,27 @@ interface paths {
70291
70295
  };
70292
70296
  get?: never;
70293
70297
  put?: never;
70294
- post?: never;
70295
70298
  /**
70296
- * Delete a price list
70297
- * @description Its entries cascade. A convenio pointing at it keeps its row with a null `price_list_id`.
70299
+ * Disconnect a bank link
70300
+ * @description Reversible: the connection survives disabled (its movements stay in the ledger), stops syncing and stops counting as a billed bank from the next period. Requires `clinic_money:write`.
70298
70301
  *
70299
70302
  * **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`.
70300
70303
  */
70301
- delete: {
70304
+ post: {
70302
70305
  parameters: {
70303
70306
  query?: never;
70304
- header?: never;
70305
- path?: never;
70307
+ header?: {
70308
+ /** @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. */
70309
+ "Idempotency-Key"?: string;
70310
+ };
70311
+ path: {
70312
+ id: string;
70313
+ };
70306
70314
  cookie?: never;
70307
70315
  };
70308
70316
  requestBody?: never;
70309
70317
  responses: {
70310
- /** @description No content */
70318
+ /** @description Disconnected */
70311
70319
  204: {
70312
70320
  headers: {
70313
70321
  [name: string]: unknown;
@@ -70370,18 +70378,34 @@ interface paths {
70370
70378
  };
70371
70379
  };
70372
70380
  };
70381
+ delete?: never;
70373
70382
  options?: never;
70374
70383
  head?: never;
70384
+ patch?: never;
70385
+ trace?: never;
70386
+ };
70387
+ "/clinic/bank-feed/email/pull": {
70388
+ parameters: {
70389
+ query?: never;
70390
+ header?: never;
70391
+ path?: never;
70392
+ cookie?: never;
70393
+ };
70394
+ get?: never;
70395
+ put?: never;
70375
70396
  /**
70376
- * Edit a price list
70377
- * @description Edit a price list
70397
+ * Re-read bank e-mails still in the inbox for a window
70398
+ * @description Runs the e-mail source of the bank feed over `[from, to]` (Santiago days, ≤ 92 days): bank comprobantes that are still conversations in a connected mailbox become `bank_movement` rows (provenance `backfill` — historical, never announced to anyone). Idempotent. Requires `clinic_money:write`.
70378
70399
  *
70379
70400
  * **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`.
70380
70401
  */
70381
- patch: {
70402
+ post: {
70382
70403
  parameters: {
70383
70404
  query?: never;
70384
- header?: never;
70405
+ header?: {
70406
+ /** @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. */
70407
+ "Idempotency-Key"?: string;
70408
+ };
70385
70409
  path?: never;
70386
70410
  cookie?: never;
70387
70411
  };
@@ -70389,23 +70413,15 @@ interface paths {
70389
70413
  content: {
70390
70414
  /**
70391
70415
  * @example {
70392
- * "valid_from": "2026-01-01"
70416
+ * "from": "2026-09-01",
70417
+ * "to": "2026-09-22"
70393
70418
  * }
70394
70419
  */
70395
- "application/json": {
70396
- name?: string;
70397
- currency?: string;
70398
- valid_from?: string;
70399
- valid_to?: string | null;
70400
- /** Format: uuid */
70401
- location_id?: string | null;
70402
- is_default?: boolean;
70403
- active?: boolean;
70404
- };
70420
+ "application/json": components["schemas"]["BankFeedEmailPullBody"];
70405
70421
  };
70406
70422
  };
70407
70423
  responses: {
70408
- /** @description Clinic price list */
70424
+ /** @description What was ingested */
70409
70425
  200: {
70410
70426
  headers: {
70411
70427
  [name: string]: unknown;
@@ -70414,28 +70430,15 @@ interface paths {
70414
70430
  /**
70415
70431
  * @example {
70416
70432
  * "data": {
70417
- * "id": "38b62be4-0000-4000-8000-000000000001",
70418
- * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
70419
- * "source": "native",
70420
- * "external_id": null,
70421
- * "name": "Arancel particular 2026",
70422
- * "currency": "CLP",
70423
- * "valid_from": "2026-01-01",
70424
- * "valid_to": null,
70425
- * "location_id": null,
70426
- * "is_default": true,
70427
- * "active": true,
70428
- * "created_at": "2026-09-22T22:21:14.611Z",
70429
- * "updated_at": "2026-09-22T22:21:14.627Z",
70430
- * "entry_count": 0
70433
+ * "drafts": 0,
70434
+ * "inserted": 3,
70435
+ * "deduped": 1,
70436
+ * "cross_source_twins": 1
70431
70437
  * }
70432
70438
  * }
70433
70439
  */
70434
70440
  "application/json": {
70435
- data?: unknown;
70436
- meta?: {
70437
- [key: string]: unknown;
70438
- };
70441
+ data: components["schemas"]["BankFeedIngestResult"];
70439
70442
  };
70440
70443
  };
70441
70444
  };
@@ -70495,9 +70498,13 @@ interface paths {
70495
70498
  };
70496
70499
  };
70497
70500
  };
70501
+ delete?: never;
70502
+ options?: never;
70503
+ head?: never;
70504
+ patch?: never;
70498
70505
  trace?: never;
70499
70506
  };
70500
- "/clinic/pricing/lists/{id}/entries": {
70507
+ "/clinic/evidence-cards": {
70501
70508
  parameters: {
70502
70509
  query?: never;
70503
70510
  header?: never;
@@ -70505,8 +70512,8 @@ interface paths {
70505
70512
  cookie?: never;
70506
70513
  };
70507
70514
  /**
70508
- * List the prices inside one arancel
70509
- * @description List the prices inside one arancel
70515
+ * Evidence cards for the owner's home (at most three)
70516
+ * @description Deterministic, no model call. Each card carries `rule`, the proving `number` (`{ value, unit: "clp" | "count" }`), human-ready Spanish `title` / `label` / `detail` / `cta_label`, a workspace-relative `route`, and `money_at_stake_clp`. Ordered by money at stake, biggest first. A rule whose module is already set up, whose number is zero, or that the caller dismissed (and whose number has not grown in 30 days) is absent: an empty array means render nothing. The numbers are the destination modules' own (boletas, comisiones, conciliación, números comerciales, gastos).
70510
70517
  *
70511
70518
  * **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`.
70512
70519
  */
@@ -70519,7 +70526,7 @@ interface paths {
70519
70526
  };
70520
70527
  requestBody?: never;
70521
70528
  responses: {
70522
- /** @description Clinic price list entries */
70529
+ /** @description The cards */
70523
70530
  200: {
70524
70531
  headers: {
70525
70532
  [name: string]: unknown;
@@ -70527,26 +70534,23 @@ interface paths {
70527
70534
  content: {
70528
70535
  /**
70529
70536
  * @example {
70530
- * "data": [
70531
- * {
70532
- * "id": "c9f37927-0000-4000-8000-000000000001",
70533
- * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
70534
- * "price_list_id": "38b62be4-0000-4000-8000-000000000001",
70535
- * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000001",
70536
- * "precio_clp": 28000,
70537
- * "created_at": "2026-09-22T22:21:14.637Z",
70538
- * "updated_at": "2026-09-22T22:21:14.637Z"
70539
- * },
70540
- * {
70541
- * "id": "c9f37927-0000-4000-8000-000000000002",
70542
- * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
70543
- * "price_list_id": "38b62be4-0000-4000-8000-000000000001",
70544
- * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000002",
70545
- * "precio_clp": 35000,
70546
- * "created_at": "2026-09-22T22:21:14.637Z",
70547
- * "updated_at": "2026-09-22T22:21:14.637Z"
70548
- * }
70549
- * ]
70537
+ * "data": {
70538
+ * "cards": [
70539
+ * {
70540
+ * "rule": "payments_without_boleta",
70541
+ * "number": {
70542
+ * "value": 1450000,
70543
+ * "unit": "clp"
70544
+ * },
70545
+ * "label": "en pagos sin boleta este mes",
70546
+ * "title": "Este mes registraste $1.450.000 en pagos sin boleta",
70547
+ * "detail": "12 pagos sin documento tributario. Conecta la emisión electrónica y emite cada boleta desde el mismo pago.",
70548
+ * "cta_label": "Activar boletas",
70549
+ * "route": "/clinic/boletas?tab=emision",
70550
+ * "money_at_stake_clp": 1450000
70551
+ * }
70552
+ * ]
70553
+ * }
70550
70554
  * }
70551
70555
  */
70552
70556
  "application/json": {
@@ -70613,46 +70617,44 @@ interface paths {
70613
70617
  };
70614
70618
  };
70615
70619
  };
70620
+ put?: never;
70621
+ post?: never;
70622
+ delete?: never;
70623
+ options?: never;
70624
+ head?: never;
70625
+ patch?: never;
70626
+ trace?: never;
70627
+ };
70628
+ "/clinic/evidence-cards/{rule_id}/dismiss": {
70629
+ parameters: {
70630
+ query?: never;
70631
+ header?: never;
70632
+ path?: never;
70633
+ cookie?: never;
70634
+ };
70635
+ get?: never;
70636
+ put?: never;
70616
70637
  /**
70617
- * Set prices inside one arancel
70618
- * @description Bulk upsert. `precio_clp: null` REMOVES the entry — "this list does not price it" is the absence of a row, and 0 means free (ADR 0058 §2).
70638
+ * Dismiss one evidence card for the calling member
70639
+ * @description Stored as a per-member preference (no table). The card returns only after 30 days AND only if its number grew since; the number is read server-side at dismissal time, never taken from the caller.
70619
70640
  *
70620
70641
  * **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`.
70621
70642
  */
70622
- put: {
70643
+ post: {
70623
70644
  parameters: {
70624
70645
  query?: never;
70625
- header?: never;
70626
- path?: never;
70627
- cookie?: never;
70628
- };
70629
- requestBody?: {
70630
- content: {
70631
- /**
70632
- * @example {
70633
- * "entries": [
70634
- * {
70635
- * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000001",
70636
- * "precio_clp": 28000
70637
- * },
70638
- * {
70639
- * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000002",
70640
- * "precio_clp": 35000
70641
- * }
70642
- * ]
70643
- * }
70644
- */
70645
- "application/json": {
70646
- entries: {
70647
- /** Format: uuid */
70648
- clinic_service_id: string;
70649
- precio_clp: number | null;
70650
- }[];
70651
- };
70646
+ header?: {
70647
+ /** @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. */
70648
+ "Idempotency-Key"?: string;
70652
70649
  };
70650
+ path: {
70651
+ rule_id: "payments_without_boleta" | "commissions_unsettled" | "payments_unreconciled" | "accepted_budgets_unscheduled" | "advertising_spend";
70652
+ };
70653
+ cookie?: never;
70653
70654
  };
70655
+ requestBody?: never;
70654
70656
  responses: {
70655
- /** @description { upserted, removed } */
70657
+ /** @description The dismissal */
70656
70658
  200: {
70657
70659
  headers: {
70658
70660
  [name: string]: unknown;
@@ -70661,8 +70663,9 @@ interface paths {
70661
70663
  /**
70662
70664
  * @example {
70663
70665
  * "data": {
70664
- * "upserted": 2,
70665
- * "removed": 0
70666
+ * "rule": "payments_without_boleta",
70667
+ * "dismissed_at": "2026-09-30T15:00:00.000Z",
70668
+ * "value": 1450000
70666
70669
  * }
70667
70670
  * }
70668
70671
  */
@@ -70730,14 +70733,13 @@ interface paths {
70730
70733
  };
70731
70734
  };
70732
70735
  };
70733
- post?: never;
70734
70736
  delete?: never;
70735
70737
  options?: never;
70736
70738
  head?: never;
70737
70739
  patch?: never;
70738
70740
  trace?: never;
70739
70741
  };
70740
- "/clinic/pricing/rules": {
70742
+ "/clinic/pricing/lists": {
70741
70743
  parameters: {
70742
70744
  query?: never;
70743
70745
  header?: never;
@@ -70745,8 +70747,8 @@ interface paths {
70745
70747
  cookie?: never;
70746
70748
  };
70747
70749
  /**
70748
- * List price rules
70749
- * @description The declarative modifiers, in application order (`priority` ascending). Every real-world discount — a convenio override, a previsión price, a campaign, a loyalty tier — is a row here rather than a code branch.
70750
+ * List price lists (aranceles)
70751
+ * @description Every arancel with its validity window, its sucursal (null = the whole workspace) and how many prestaciones it prices. Retired lists included unless `?active=true` — this screen manages the catalogue.
70750
70752
  *
70751
70753
  * **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`.
70752
70754
  */
@@ -70754,7 +70756,6 @@ interface paths {
70754
70756
  parameters: {
70755
70757
  query?: {
70756
70758
  active?: "true" | "false";
70757
- agreement_id?: string;
70758
70759
  };
70759
70760
  header?: never;
70760
70761
  path?: never;
@@ -70762,7 +70763,7 @@ interface paths {
70762
70763
  };
70763
70764
  requestBody?: never;
70764
70765
  responses: {
70765
- /** @description Clinic price rules */
70766
+ /** @description Clinic price lists */
70766
70767
  200: {
70767
70768
  headers: {
70768
70769
  [name: string]: unknown;
@@ -70772,24 +70773,20 @@ interface paths {
70772
70773
  * @example {
70773
70774
  * "data": [
70774
70775
  * {
70775
- * "id": "0f400122-0000-4000-8000-000000000001",
70776
+ * "id": "38b62be4-0000-4000-8000-000000000001",
70776
70777
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
70777
- * "name": "15% convenio Empresa Andina",
70778
- * "kind": "convenio",
70779
- * "subject_kind": "all",
70780
- * "subject_id": null,
70781
- * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
70782
- * "prevision": null,
70783
- * "loyalty_tier": null,
70784
- * "professional_id": null,
70785
- * "modifier": "percent_off",
70786
- * "value": 15,
70787
- * "priority": 10,
70788
- * "valid_from": null,
70778
+ * "source": "native",
70779
+ * "external_id": null,
70780
+ * "name": "Arancel particular 2026",
70781
+ * "currency": "CLP",
70782
+ * "valid_from": "2026-09-22",
70789
70783
  * "valid_to": null,
70784
+ * "location_id": null,
70785
+ * "is_default": true,
70790
70786
  * "active": true,
70791
- * "created_at": "2026-09-22T22:21:14.689Z",
70792
- * "updated_at": "2026-09-22T22:21:14.689Z"
70787
+ * "created_at": "2026-09-22T22:21:14.611Z",
70788
+ * "updated_at": "2026-09-22T22:21:14.611Z",
70789
+ * "entry_count": 0
70793
70790
  * }
70794
70791
  * ]
70795
70792
  * }
@@ -70860,8 +70857,8 @@ interface paths {
70860
70857
  };
70861
70858
  put?: never;
70862
70859
  /**
70863
- * Create a price rule
70864
- * @description 400 `subject_id_required` for a `service`/`category` rule with no subject, and 400 `subject_kind_specialty_not_supported` until `clinic_service.specialty_id` lands — a rule that can never fire is refused rather than accepted and silently ignored.
70860
+ * Create a price list
70861
+ * @description A dated arancel. `is_default: true` demotes the previous default in the same scope (tenant-wide, or that sucursal).
70865
70862
  *
70866
70863
  * **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`.
70867
70864
  */
@@ -70879,42 +70876,25 @@ interface paths {
70879
70876
  content: {
70880
70877
  /**
70881
70878
  * @example {
70882
- * "name": "15% convenio Empresa Andina",
70883
- * "kind": "convenio",
70884
- * "subject_kind": "all",
70885
- * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
70886
- * "modifier": "percent_off",
70887
- * "value": 15,
70888
- * "priority": 10
70879
+ * "name": "Arancel particular 2026",
70880
+ * "currency": "CLP",
70881
+ * "is_default": true
70889
70882
  * }
70890
70883
  */
70891
70884
  "application/json": {
70892
70885
  name: string;
70893
- /** @enum {string} */
70894
- kind: "convenio" | "prevision" | "campaign" | "pack" | "professional" | "loyalty" | "manual";
70895
- /** @enum {string} */
70896
- subject_kind?: "service" | "category" | "all";
70897
- /** Format: uuid */
70898
- subject_id?: string | null;
70899
- /** Format: uuid */
70900
- agreement_id?: string | null;
70901
- prevision?: string | null;
70902
- /** @enum {string|null} */
70903
- loyalty_tier?: "0_6" | "6_12" | "12_plus" | null;
70904
- /** Format: uuid */
70905
- professional_id?: string | null;
70906
- /** @enum {string} */
70907
- modifier: "percent_off" | "amount_off" | "override";
70908
- value: number;
70909
- priority?: number;
70910
- valid_from?: string | null;
70886
+ currency?: string;
70887
+ valid_from?: string;
70911
70888
  valid_to?: string | null;
70889
+ /** Format: uuid */
70890
+ location_id?: string | null;
70891
+ is_default?: boolean;
70912
70892
  active?: boolean;
70913
70893
  };
70914
70894
  };
70915
70895
  };
70916
70896
  responses: {
70917
- /** @description Clinic price rule */
70897
+ /** @description Clinic price list */
70918
70898
  201: {
70919
70899
  headers: {
70920
70900
  [name: string]: unknown;
@@ -70923,24 +70903,20 @@ interface paths {
70923
70903
  /**
70924
70904
  * @example {
70925
70905
  * "data": {
70926
- * "id": "0f400122-0000-4000-8000-000000000001",
70906
+ * "id": "38b62be4-0000-4000-8000-000000000001",
70927
70907
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
70928
- * "name": "15% convenio Empresa Andina",
70929
- * "kind": "convenio",
70930
- * "subject_kind": "all",
70931
- * "subject_id": null,
70932
- * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
70933
- * "prevision": null,
70934
- * "loyalty_tier": null,
70935
- * "professional_id": null,
70936
- * "modifier": "percent_off",
70937
- * "value": 15,
70938
- * "priority": 10,
70939
- * "valid_from": null,
70908
+ * "source": "native",
70909
+ * "external_id": null,
70910
+ * "name": "Arancel particular 2026",
70911
+ * "currency": "CLP",
70912
+ * "valid_from": "2026-09-22",
70940
70913
  * "valid_to": null,
70914
+ * "location_id": null,
70915
+ * "is_default": true,
70941
70916
  * "active": true,
70942
- * "created_at": "2026-09-22T22:21:14.689Z",
70943
- * "updated_at": "2026-09-22T22:21:14.689Z"
70917
+ * "created_at": "2026-09-22T22:21:14.611Z",
70918
+ * "updated_at": "2026-09-22T22:21:14.611Z",
70919
+ * "entry_count": 0
70944
70920
  * }
70945
70921
  * }
70946
70922
  */
@@ -71011,7 +70987,7 @@ interface paths {
71011
70987
  patch?: never;
71012
70988
  trace?: never;
71013
70989
  };
71014
- "/clinic/pricing/rules/{id}": {
70990
+ "/clinic/pricing/lists/{id}": {
71015
70991
  parameters: {
71016
70992
  query?: never;
71017
70993
  header?: never;
@@ -71022,8 +70998,8 @@ interface paths {
71022
70998
  put?: never;
71023
70999
  post?: never;
71024
71000
  /**
71025
- * Delete a price rule
71026
- * @description Delete a price rule
71001
+ * Delete a price list
71002
+ * @description Its entries cascade. A convenio pointing at it keeps its row with a null `price_list_id`.
71027
71003
  *
71028
71004
  * **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`.
71029
71005
  */
@@ -71102,8 +71078,8 @@ interface paths {
71102
71078
  options?: never;
71103
71079
  head?: never;
71104
71080
  /**
71105
- * Edit a price rule
71106
- * @description Edit a price rule
71081
+ * Edit a price list
71082
+ * @description Edit a price list
71107
71083
  *
71108
71084
  * **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`.
71109
71085
  */
@@ -71118,36 +71094,23 @@ interface paths {
71118
71094
  content: {
71119
71095
  /**
71120
71096
  * @example {
71121
- * "priority": 20
71097
+ * "valid_from": "2026-01-01"
71122
71098
  * }
71123
71099
  */
71124
71100
  "application/json": {
71125
71101
  name?: string;
71126
- /** @enum {string} */
71127
- kind?: "convenio" | "prevision" | "campaign" | "pack" | "professional" | "loyalty" | "manual";
71128
- /** @enum {string} */
71129
- subject_kind?: "service" | "category" | "all";
71130
- /** Format: uuid */
71131
- subject_id?: string | null;
71132
- /** Format: uuid */
71133
- agreement_id?: string | null;
71134
- prevision?: string | null;
71135
- /** @enum {string|null} */
71136
- loyalty_tier?: "0_6" | "6_12" | "12_plus" | null;
71137
- /** Format: uuid */
71138
- professional_id?: string | null;
71139
- /** @enum {string} */
71140
- modifier?: "percent_off" | "amount_off" | "override";
71141
- value?: number;
71142
- priority?: number;
71143
- valid_from?: string | null;
71102
+ currency?: string;
71103
+ valid_from?: string;
71144
71104
  valid_to?: string | null;
71105
+ /** Format: uuid */
71106
+ location_id?: string | null;
71107
+ is_default?: boolean;
71145
71108
  active?: boolean;
71146
71109
  };
71147
71110
  };
71148
71111
  };
71149
71112
  responses: {
71150
- /** @description Clinic price rule */
71113
+ /** @description Clinic price list */
71151
71114
  200: {
71152
71115
  headers: {
71153
71116
  [name: string]: unknown;
@@ -71156,24 +71119,20 @@ interface paths {
71156
71119
  /**
71157
71120
  * @example {
71158
71121
  * "data": {
71159
- * "id": "0f400122-0000-4000-8000-000000000001",
71122
+ * "id": "38b62be4-0000-4000-8000-000000000001",
71160
71123
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
71161
- * "name": "15% convenio Empresa Andina",
71162
- * "kind": "convenio",
71163
- * "subject_kind": "all",
71164
- * "subject_id": null,
71165
- * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
71166
- * "prevision": null,
71167
- * "loyalty_tier": null,
71168
- * "professional_id": null,
71169
- * "modifier": "percent_off",
71170
- * "value": 15,
71171
- * "priority": 20,
71172
- * "valid_from": null,
71124
+ * "source": "native",
71125
+ * "external_id": null,
71126
+ * "name": "Arancel particular 2026",
71127
+ * "currency": "CLP",
71128
+ * "valid_from": "2026-01-01",
71173
71129
  * "valid_to": null,
71130
+ * "location_id": null,
71131
+ * "is_default": true,
71174
71132
  * "active": true,
71175
- * "created_at": "2026-09-22T22:21:14.689Z",
71176
- * "updated_at": "2026-09-22T22:21:14.701Z"
71133
+ * "created_at": "2026-09-22T22:21:14.611Z",
71134
+ * "updated_at": "2026-09-22T22:21:14.627Z",
71135
+ * "entry_count": 0
71177
71136
  * }
71178
71137
  * }
71179
71138
  */
@@ -71243,7 +71202,7 @@ interface paths {
71243
71202
  };
71244
71203
  trace?: never;
71245
71204
  };
71246
- "/clinic/labs": {
71205
+ "/clinic/pricing/lists/{id}/entries": {
71247
71206
  parameters: {
71248
71207
  query?: never;
71249
71208
  header?: never;
@@ -71251,23 +71210,21 @@ interface paths {
71251
71210
  cookie?: never;
71252
71211
  };
71253
71212
  /**
71254
- * List laboratorios
71255
- * @description The dental labs the clinic sends work to — imported from Dentalink (`/laboratorios`) by the migration importer, or native. Each row carries the lab's `contact` (address, phone) as the clinic recorded it. Disabled labs included unless `?active=true`.
71213
+ * List the prices inside one arancel
71214
+ * @description List the prices inside one arancel
71256
71215
  *
71257
71216
  * **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`.
71258
71217
  */
71259
71218
  get: {
71260
71219
  parameters: {
71261
- query?: {
71262
- active?: "true" | "false";
71263
- };
71220
+ query?: never;
71264
71221
  header?: never;
71265
71222
  path?: never;
71266
71223
  cookie?: never;
71267
71224
  };
71268
71225
  requestBody?: never;
71269
71226
  responses: {
71270
- /** @description Clinic labs */
71227
+ /** @description Clinic price list entries */
71271
71228
  200: {
71272
71229
  headers: {
71273
71230
  [name: string]: unknown;
@@ -71277,18 +71234,22 @@ interface paths {
71277
71234
  * @example {
71278
71235
  * "data": [
71279
71236
  * {
71280
- * "id": "c0e57121-0000-4000-8000-0000000001ab",
71237
+ * "id": "c9f37927-0000-4000-8000-000000000001",
71281
71238
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
71282
- * "source": "healthatom",
71283
- * "external_id": "9",
71284
- * "name": "Laboratorio Ejemplo",
71285
- * "contact": {
71286
- * "direccion": "Avenida Ejemplo 456",
71287
- * "telefono": "+56 9 0000 0200"
71288
- * },
71289
- * "active": true,
71290
- * "created_at": "2026-09-23T18:00:00.000Z",
71291
- * "updated_at": "2026-09-23T18:00:00.000Z"
71239
+ * "price_list_id": "38b62be4-0000-4000-8000-000000000001",
71240
+ * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000001",
71241
+ * "precio_clp": 28000,
71242
+ * "created_at": "2026-09-22T22:21:14.637Z",
71243
+ * "updated_at": "2026-09-22T22:21:14.637Z"
71244
+ * },
71245
+ * {
71246
+ * "id": "c9f37927-0000-4000-8000-000000000002",
71247
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
71248
+ * "price_list_id": "38b62be4-0000-4000-8000-000000000001",
71249
+ * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000002",
71250
+ * "precio_clp": 35000,
71251
+ * "created_at": "2026-09-22T22:21:14.637Z",
71252
+ * "updated_at": "2026-09-22T22:21:14.637Z"
71292
71253
  * }
71293
71254
  * ]
71294
71255
  * }
@@ -71357,20 +71318,16 @@ interface paths {
71357
71318
  };
71358
71319
  };
71359
71320
  };
71360
- put?: never;
71361
71321
  /**
71362
- * Add a laboratorio
71363
- * @description A lab the clinic works with that did not arrive from the Dentalink import (`source: "native"`). `contact` is the lab's address and phone. Requires `clinic_admin:write`.
71322
+ * Set prices inside one arancel
71323
+ * @description Bulk upsert. `precio_clp: null` REMOVES the entry — "this list does not price it" is the absence of a row, and 0 means free (ADR 0058 §2).
71364
71324
  *
71365
71325
  * **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`.
71366
71326
  */
71367
- post: {
71327
+ put: {
71368
71328
  parameters: {
71369
71329
  query?: never;
71370
- header?: {
71371
- /** @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. */
71372
- "Idempotency-Key"?: string;
71373
- };
71330
+ header?: never;
71374
71331
  path?: never;
71375
71332
  cookie?: never;
71376
71333
  };
@@ -71378,25 +71335,30 @@ interface paths {
71378
71335
  content: {
71379
71336
  /**
71380
71337
  * @example {
71381
- * "name": "Laboratorio Ejemplo",
71382
- * "contact": {
71383
- * "direccion": "Avenida Ejemplo 456",
71384
- * "telefono": "+56 9 0000 0200"
71385
- * }
71338
+ * "entries": [
71339
+ * {
71340
+ * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000001",
71341
+ * "precio_clp": 28000
71342
+ * },
71343
+ * {
71344
+ * "clinic_service_id": "4cf5bc59-0000-4000-8000-000000000002",
71345
+ * "precio_clp": 35000
71346
+ * }
71347
+ * ]
71386
71348
  * }
71387
71349
  */
71388
71350
  "application/json": {
71389
- name: string;
71390
- contact?: {
71391
- direccion?: string | null;
71392
- telefono?: string | null;
71393
- };
71351
+ entries: {
71352
+ /** Format: uuid */
71353
+ clinic_service_id: string;
71354
+ precio_clp: number | null;
71355
+ }[];
71394
71356
  };
71395
71357
  };
71396
71358
  };
71397
71359
  responses: {
71398
- /** @description Clinic lab */
71399
- 201: {
71360
+ /** @description { upserted, removed } */
71361
+ 200: {
71400
71362
  headers: {
71401
71363
  [name: string]: unknown;
71402
71364
  };
@@ -71404,23 +71366,16 @@ interface paths {
71404
71366
  /**
71405
71367
  * @example {
71406
71368
  * "data": {
71407
- * "id": "c0e57121-0000-4000-8000-0000000001ab",
71408
- * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
71409
- * "source": "native",
71410
- * "external_id": null,
71411
- * "name": "Laboratorio Ejemplo",
71412
- * "contact": {
71413
- * "direccion": "Avenida Ejemplo 456",
71414
- * "telefono": "+56 9 0000 0200"
71415
- * },
71416
- * "active": true,
71417
- * "created_at": "2026-09-29T13:00:00.000Z",
71418
- * "updated_at": "2026-09-29T13:00:00.000Z"
71369
+ * "upserted": 2,
71370
+ * "removed": 0
71419
71371
  * }
71420
71372
  * }
71421
71373
  */
71422
71374
  "application/json": {
71423
71375
  data?: unknown;
71376
+ meta?: {
71377
+ [key: string]: unknown;
71378
+ };
71424
71379
  };
71425
71380
  };
71426
71381
  };
@@ -71480,13 +71435,14 @@ interface paths {
71480
71435
  };
71481
71436
  };
71482
71437
  };
71438
+ post?: never;
71483
71439
  delete?: never;
71484
71440
  options?: never;
71485
71441
  head?: never;
71486
71442
  patch?: never;
71487
71443
  trace?: never;
71488
71444
  };
71489
- "/clinic/pricing/agreements": {
71445
+ "/clinic/pricing/rules": {
71490
71446
  parameters: {
71491
71447
  query?: never;
71492
71448
  header?: never;
@@ -71494,8 +71450,8 @@ interface paths {
71494
71450
  cookie?: never;
71495
71451
  };
71496
71452
  /**
71497
- * List convenios
71498
- * @description Empresas, colegios and cajas with their validity, their own arancel (if any), who is billed, and how many members they have.
71453
+ * List price rules
71454
+ * @description The declarative modifiers, in application order (`priority` ascending). Every real-world discount — a convenio override, a previsión price, a campaign, a loyalty tier — is a row here rather than a code branch.
71499
71455
  *
71500
71456
  * **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`.
71501
71457
  */
@@ -71503,6 +71459,7 @@ interface paths {
71503
71459
  parameters: {
71504
71460
  query?: {
71505
71461
  active?: "true" | "false";
71462
+ agreement_id?: string;
71506
71463
  };
71507
71464
  header?: never;
71508
71465
  path?: never;
@@ -71510,7 +71467,7 @@ interface paths {
71510
71467
  };
71511
71468
  requestBody?: never;
71512
71469
  responses: {
71513
- /** @description Clinic agreements */
71470
+ /** @description Clinic price rules */
71514
71471
  200: {
71515
71472
  headers: {
71516
71473
  [name: string]: unknown;
@@ -71520,22 +71477,24 @@ interface paths {
71520
71477
  * @example {
71521
71478
  * "data": [
71522
71479
  * {
71523
- * "id": "c0e57121-0000-4000-8000-000000000001",
71480
+ * "id": "0f400122-0000-4000-8000-000000000001",
71524
71481
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
71525
- * "source": "native",
71526
- * "external_id": null,
71527
- * "name": "Convenio Empresa Andina",
71528
- * "organization_name": "Empresa Andina SpA",
71529
- * "organization_rut": "76.543.210-3",
71530
- * "price_list_id": null,
71531
- * "billing_mode": "patient",
71532
- * "valid_from": "2026-01-01",
71482
+ * "name": "15% convenio Empresa Andina",
71483
+ * "kind": "convenio",
71484
+ * "subject_kind": "all",
71485
+ * "subject_id": null,
71486
+ * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
71487
+ * "prevision": null,
71488
+ * "loyalty_tier": null,
71489
+ * "professional_id": null,
71490
+ * "modifier": "percent_off",
71491
+ * "value": 15,
71492
+ * "priority": 10,
71493
+ * "valid_from": null,
71533
71494
  * "valid_to": null,
71534
71495
  * "active": true,
71535
- * "notes": null,
71536
- * "created_at": "2026-09-22T22:21:14.651Z",
71537
- * "updated_at": "2026-09-22T22:21:14.651Z",
71538
- * "member_count": 0
71496
+ * "created_at": "2026-09-22T22:21:14.689Z",
71497
+ * "updated_at": "2026-09-22T22:21:14.689Z"
71539
71498
  * }
71540
71499
  * ]
71541
71500
  * }
@@ -71606,8 +71565,8 @@ interface paths {
71606
71565
  };
71607
71566
  put?: never;
71608
71567
  /**
71609
- * Create a convenio
71610
- * @description Create a convenio
71568
+ * Create a price rule
71569
+ * @description 400 `subject_id_required` for a `service`/`category` rule with no subject, and 400 `subject_kind_specialty_not_supported` until `clinic_service.specialty_id` lands — a rule that can never fire is refused rather than accepted and silently ignored.
71611
71570
  *
71612
71571
  * **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`.
71613
71572
  */
@@ -71625,30 +71584,42 @@ interface paths {
71625
71584
  content: {
71626
71585
  /**
71627
71586
  * @example {
71628
- * "name": "Convenio Empresa Andina",
71629
- * "organization_name": "Empresa Andina SpA",
71630
- * "organization_rut": "76.543.210-3",
71631
- * "billing_mode": "patient",
71632
- * "valid_from": "2026-01-01"
71587
+ * "name": "15% convenio Empresa Andina",
71588
+ * "kind": "convenio",
71589
+ * "subject_kind": "all",
71590
+ * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
71591
+ * "modifier": "percent_off",
71592
+ * "value": 15,
71593
+ * "priority": 10
71633
71594
  * }
71634
71595
  */
71635
71596
  "application/json": {
71636
71597
  name: string;
71637
- organization_name?: string | null;
71638
- organization_rut?: string | null;
71598
+ /** @enum {string} */
71599
+ kind: "convenio" | "prevision" | "campaign" | "pack" | "professional" | "loyalty" | "manual";
71600
+ /** @enum {string} */
71601
+ subject_kind?: "service" | "category" | "all";
71639
71602
  /** Format: uuid */
71640
- price_list_id?: string | null;
71603
+ subject_id?: string | null;
71604
+ /** Format: uuid */
71605
+ agreement_id?: string | null;
71606
+ prevision?: string | null;
71607
+ /** @enum {string|null} */
71608
+ loyalty_tier?: "0_6" | "6_12" | "12_plus" | null;
71609
+ /** Format: uuid */
71610
+ professional_id?: string | null;
71641
71611
  /** @enum {string} */
71642
- billing_mode?: "patient" | "organization" | "split";
71612
+ modifier: "percent_off" | "amount_off" | "override";
71613
+ value: number;
71614
+ priority?: number;
71643
71615
  valid_from?: string | null;
71644
71616
  valid_to?: string | null;
71645
71617
  active?: boolean;
71646
- notes?: string | null;
71647
71618
  };
71648
71619
  };
71649
71620
  };
71650
71621
  responses: {
71651
- /** @description Clinic agreement */
71622
+ /** @description Clinic price rule */
71652
71623
  201: {
71653
71624
  headers: {
71654
71625
  [name: string]: unknown;
@@ -71657,22 +71628,24 @@ interface paths {
71657
71628
  /**
71658
71629
  * @example {
71659
71630
  * "data": {
71660
- * "id": "c0e57121-0000-4000-8000-000000000001",
71631
+ * "id": "0f400122-0000-4000-8000-000000000001",
71661
71632
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
71662
- * "source": "native",
71663
- * "external_id": null,
71664
- * "name": "Convenio Empresa Andina",
71665
- * "organization_name": "Empresa Andina SpA",
71666
- * "organization_rut": "76.543.210-3",
71667
- * "price_list_id": null,
71668
- * "billing_mode": "patient",
71669
- * "valid_from": "2026-01-01",
71633
+ * "name": "15% convenio Empresa Andina",
71634
+ * "kind": "convenio",
71635
+ * "subject_kind": "all",
71636
+ * "subject_id": null,
71637
+ * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
71638
+ * "prevision": null,
71639
+ * "loyalty_tier": null,
71640
+ * "professional_id": null,
71641
+ * "modifier": "percent_off",
71642
+ * "value": 15,
71643
+ * "priority": 10,
71644
+ * "valid_from": null,
71670
71645
  * "valid_to": null,
71671
71646
  * "active": true,
71672
- * "notes": null,
71673
- * "created_at": "2026-09-22T22:21:14.651Z",
71674
- * "updated_at": "2026-09-22T22:21:14.651Z",
71675
- * "member_count": 0
71647
+ * "created_at": "2026-09-22T22:21:14.689Z",
71648
+ * "updated_at": "2026-09-22T22:21:14.689Z"
71676
71649
  * }
71677
71650
  * }
71678
71651
  */
@@ -71743,7 +71716,7 @@ interface paths {
71743
71716
  patch?: never;
71744
71717
  trace?: never;
71745
71718
  };
71746
- "/clinic/pricing/agreements/{id}": {
71719
+ "/clinic/pricing/rules/{id}": {
71747
71720
  parameters: {
71748
71721
  query?: never;
71749
71722
  header?: never;
@@ -71754,8 +71727,8 @@ interface paths {
71754
71727
  put?: never;
71755
71728
  post?: never;
71756
71729
  /**
71757
- * Delete a convenio
71758
- * @description Memberships and the rules that name it cascade.
71730
+ * Delete a price rule
71731
+ * @description Delete a price rule
71759
71732
  *
71760
71733
  * **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`.
71761
71734
  */
@@ -71834,8 +71807,8 @@ interface paths {
71834
71807
  options?: never;
71835
71808
  head?: never;
71836
71809
  /**
71837
- * Edit a convenio
71838
- * @description Edit a convenio
71810
+ * Edit a price rule
71811
+ * @description Edit a price rule
71839
71812
  *
71840
71813
  * **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`.
71841
71814
  */
@@ -71850,26 +71823,36 @@ interface paths {
71850
71823
  content: {
71851
71824
  /**
71852
71825
  * @example {
71853
- * "notes": "Presentar credencial de la empresa"
71826
+ * "priority": 20
71854
71827
  * }
71855
71828
  */
71856
71829
  "application/json": {
71857
71830
  name?: string;
71858
- organization_name?: string | null;
71859
- organization_rut?: string | null;
71831
+ /** @enum {string} */
71832
+ kind?: "convenio" | "prevision" | "campaign" | "pack" | "professional" | "loyalty" | "manual";
71833
+ /** @enum {string} */
71834
+ subject_kind?: "service" | "category" | "all";
71860
71835
  /** Format: uuid */
71861
- price_list_id?: string | null;
71836
+ subject_id?: string | null;
71837
+ /** Format: uuid */
71838
+ agreement_id?: string | null;
71839
+ prevision?: string | null;
71840
+ /** @enum {string|null} */
71841
+ loyalty_tier?: "0_6" | "6_12" | "12_plus" | null;
71842
+ /** Format: uuid */
71843
+ professional_id?: string | null;
71862
71844
  /** @enum {string} */
71863
- billing_mode?: "patient" | "organization" | "split";
71845
+ modifier?: "percent_off" | "amount_off" | "override";
71846
+ value?: number;
71847
+ priority?: number;
71864
71848
  valid_from?: string | null;
71865
71849
  valid_to?: string | null;
71866
71850
  active?: boolean;
71867
- notes?: string | null;
71868
71851
  };
71869
71852
  };
71870
71853
  };
71871
71854
  responses: {
71872
- /** @description Clinic agreement */
71855
+ /** @description Clinic price rule */
71873
71856
  200: {
71874
71857
  headers: {
71875
71858
  [name: string]: unknown;
@@ -71878,22 +71861,24 @@ interface paths {
71878
71861
  /**
71879
71862
  * @example {
71880
71863
  * "data": {
71881
- * "id": "c0e57121-0000-4000-8000-000000000001",
71864
+ * "id": "0f400122-0000-4000-8000-000000000001",
71882
71865
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
71883
- * "source": "native",
71884
- * "external_id": null,
71885
- * "name": "Convenio Empresa Andina",
71886
- * "organization_name": "Empresa Andina SpA",
71887
- * "organization_rut": "76.543.210-3",
71888
- * "price_list_id": null,
71889
- * "billing_mode": "patient",
71890
- * "valid_from": "2026-01-01",
71866
+ * "name": "15% convenio Empresa Andina",
71867
+ * "kind": "convenio",
71868
+ * "subject_kind": "all",
71869
+ * "subject_id": null,
71870
+ * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
71871
+ * "prevision": null,
71872
+ * "loyalty_tier": null,
71873
+ * "professional_id": null,
71874
+ * "modifier": "percent_off",
71875
+ * "value": 15,
71876
+ * "priority": 20,
71877
+ * "valid_from": null,
71891
71878
  * "valid_to": null,
71892
71879
  * "active": true,
71893
- * "notes": "Presentar credencial de la empresa",
71894
- * "created_at": "2026-09-22T22:21:14.651Z",
71895
- * "updated_at": "2026-09-22T22:21:14.663Z",
71896
- * "member_count": 0
71880
+ * "created_at": "2026-09-22T22:21:14.689Z",
71881
+ * "updated_at": "2026-09-22T22:21:14.701Z"
71897
71882
  * }
71898
71883
  * }
71899
71884
  */
@@ -71963,7 +71948,7 @@ interface paths {
71963
71948
  };
71964
71949
  trace?: never;
71965
71950
  };
71966
- "/clinic/pricing/agreements/{id}/members": {
71951
+ "/clinic/labs": {
71967
71952
  parameters: {
71968
71953
  query?: never;
71969
71954
  header?: never;
@@ -71971,21 +71956,23 @@ interface paths {
71971
71956
  cookie?: never;
71972
71957
  };
71973
71958
  /**
71974
- * List a convenio’s members
71975
- * @description Each membership with the patient’s name and RUT, its member number and its OWN validity window — the window the loyalty tier is measured from.
71959
+ * List laboratorios
71960
+ * @description The dental labs the clinic sends work to — imported from Dentalink (`/laboratorios`) by the migration importer, or native. Each row carries the lab's `contact` (address, phone) as the clinic recorded it. Disabled labs included unless `?active=true`.
71976
71961
  *
71977
71962
  * **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`.
71978
71963
  */
71979
71964
  get: {
71980
71965
  parameters: {
71981
- query?: never;
71966
+ query?: {
71967
+ active?: "true" | "false";
71968
+ };
71982
71969
  header?: never;
71983
71970
  path?: never;
71984
71971
  cookie?: never;
71985
71972
  };
71986
71973
  requestBody?: never;
71987
71974
  responses: {
71988
- /** @description Clinic agreement members */
71975
+ /** @description Clinic labs */
71989
71976
  200: {
71990
71977
  headers: {
71991
71978
  [name: string]: unknown;
@@ -71995,18 +71982,18 @@ interface paths {
71995
71982
  * @example {
71996
71983
  * "data": [
71997
71984
  * {
71998
- * "id": "6467baa3-0000-4000-8000-000000000001",
71985
+ * "id": "c0e57121-0000-4000-8000-0000000001ab",
71999
71986
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
72000
- * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72001
- * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
72002
- * "member_number": "EA-0042",
72003
- * "valid_from": null,
72004
- * "valid_to": null,
72005
- * "created_at": "2026-09-22T22:21:14.673Z",
72006
- * "updated_at": "2026-09-22T22:21:14.673Z",
72007
- * "patient_nombre": "María José",
72008
- * "patient_apellidos": "Fuentes Lagos",
72009
- * "patient_rut": "11.111.111-1"
71987
+ * "source": "healthatom",
71988
+ * "external_id": "9",
71989
+ * "name": "Laboratorio Ejemplo",
71990
+ * "contact": {
71991
+ * "direccion": "Avenida Ejemplo 456",
71992
+ * "telefono": "+56 9 0000 0200"
71993
+ * },
71994
+ * "active": true,
71995
+ * "created_at": "2026-09-23T18:00:00.000Z",
71996
+ * "updated_at": "2026-09-23T18:00:00.000Z"
72010
71997
  * }
72011
71998
  * ]
72012
71999
  * }
@@ -72077,8 +72064,8 @@ interface paths {
72077
72064
  };
72078
72065
  put?: never;
72079
72066
  /**
72080
- * Add a member to a convenio
72081
- * @description Idempotent per (patient, convenio): re-adding re-opens the window on the existing row rather than stacking a second membership.
72067
+ * Add a laboratorio
72068
+ * @description A lab the clinic works with that did not arrive from the Dentalink import (`source: "native"`). `contact` is the lab's address and phone. Requires `clinic_admin:write`.
72082
72069
  *
72083
72070
  * **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`.
72084
72071
  */
@@ -72096,21 +72083,24 @@ interface paths {
72096
72083
  content: {
72097
72084
  /**
72098
72085
  * @example {
72099
- * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72100
- * "member_number": "EA-0042"
72086
+ * "name": "Laboratorio Ejemplo",
72087
+ * "contact": {
72088
+ * "direccion": "Avenida Ejemplo 456",
72089
+ * "telefono": "+56 9 0000 0200"
72090
+ * }
72101
72091
  * }
72102
72092
  */
72103
72093
  "application/json": {
72104
- /** Format: uuid */
72105
- clinic_patient_id: string;
72106
- member_number?: string | null;
72107
- valid_from?: string | null;
72108
- valid_to?: string | null;
72094
+ name: string;
72095
+ contact?: {
72096
+ direccion?: string | null;
72097
+ telefono?: string | null;
72098
+ };
72109
72099
  };
72110
72100
  };
72111
72101
  };
72112
72102
  responses: {
72113
- /** @description Clinic agreement membership */
72103
+ /** @description Clinic lab */
72114
72104
  201: {
72115
72105
  headers: {
72116
72106
  [name: string]: unknown;
@@ -72119,15 +72109,18 @@ interface paths {
72119
72109
  /**
72120
72110
  * @example {
72121
72111
  * "data": {
72122
- * "id": "6467baa3-0000-4000-8000-000000000001",
72112
+ * "id": "c0e57121-0000-4000-8000-0000000001ab",
72123
72113
  * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
72124
- * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72125
- * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
72126
- * "member_number": "EA-0042",
72127
- * "valid_from": null,
72128
- * "valid_to": null,
72129
- * "created_at": "2026-09-22T22:21:14.673Z",
72130
- * "updated_at": "2026-09-22T22:21:14.673Z"
72114
+ * "source": "native",
72115
+ * "external_id": null,
72116
+ * "name": "Laboratorio Ejemplo",
72117
+ * "contact": {
72118
+ * "direccion": "Avenida Ejemplo 456",
72119
+ * "telefono": "+56 9 0000 0200"
72120
+ * },
72121
+ * "active": true,
72122
+ * "created_at": "2026-09-29T13:00:00.000Z",
72123
+ * "updated_at": "2026-09-29T13:00:00.000Z"
72131
72124
  * }
72132
72125
  * }
72133
72126
  */
@@ -72198,37 +72191,67 @@ interface paths {
72198
72191
  patch?: never;
72199
72192
  trace?: never;
72200
72193
  };
72201
- "/clinic/pricing/members/{id}": {
72194
+ "/clinic/pricing/agreements": {
72202
72195
  parameters: {
72203
72196
  query?: never;
72204
72197
  header?: never;
72205
72198
  path?: never;
72206
72199
  cookie?: never;
72207
72200
  };
72208
- get?: never;
72209
- put?: never;
72210
- post?: never;
72211
72201
  /**
72212
- * Remove a convenio membership
72213
- * @description Remove a convenio membership
72202
+ * List convenios
72203
+ * @description Empresas, colegios and cajas with their validity, their own arancel (if any), who is billed, and how many members they have.
72214
72204
  *
72215
72205
  * **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`.
72216
72206
  */
72217
- delete: {
72207
+ get: {
72218
72208
  parameters: {
72219
- query?: never;
72209
+ query?: {
72210
+ active?: "true" | "false";
72211
+ };
72220
72212
  header?: never;
72221
72213
  path?: never;
72222
72214
  cookie?: never;
72223
72215
  };
72224
72216
  requestBody?: never;
72225
72217
  responses: {
72226
- /** @description No content */
72227
- 204: {
72218
+ /** @description Clinic agreements */
72219
+ 200: {
72228
72220
  headers: {
72229
72221
  [name: string]: unknown;
72230
72222
  };
72231
- content?: never;
72223
+ content: {
72224
+ /**
72225
+ * @example {
72226
+ * "data": [
72227
+ * {
72228
+ * "id": "c0e57121-0000-4000-8000-000000000001",
72229
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
72230
+ * "source": "native",
72231
+ * "external_id": null,
72232
+ * "name": "Convenio Empresa Andina",
72233
+ * "organization_name": "Empresa Andina SpA",
72234
+ * "organization_rut": "76.543.210-3",
72235
+ * "price_list_id": null,
72236
+ * "billing_mode": "patient",
72237
+ * "valid_from": "2026-01-01",
72238
+ * "valid_to": null,
72239
+ * "active": true,
72240
+ * "notes": null,
72241
+ * "created_at": "2026-09-22T22:21:14.651Z",
72242
+ * "updated_at": "2026-09-22T22:21:14.651Z",
72243
+ * "member_count": 0
72244
+ * }
72245
+ * ]
72246
+ * }
72247
+ */
72248
+ "application/json": {
72249
+ data?: unknown;
72250
+ meta?: {
72251
+ [key: string]: unknown;
72252
+ };
72253
+ };
72254
+ };
72232
72255
  };
72233
72256
  /** @description Validation error */
72234
72257
  400: {
@@ -72286,23 +72309,10 @@ interface paths {
72286
72309
  };
72287
72310
  };
72288
72311
  };
72289
- options?: never;
72290
- head?: never;
72291
- patch?: never;
72292
- trace?: never;
72293
- };
72294
- "/clinic/pricing/quote": {
72295
- parameters: {
72296
- query?: never;
72297
- header?: never;
72298
- path?: never;
72299
- cookie?: never;
72300
- };
72301
- get?: never;
72302
72312
  put?: never;
72303
72313
  /**
72304
- * Quote a prestación, with the explanation
72305
- * @description Resolves the price for a prestación on a date, for a patient (through their contact), at a sucursal, with a professional — and returns the ORDERED EXPLANATION: which arancel supplied the base, which professional override replaced it, and every rule that moved it, in the order it was applied. `base_clp: null` with `unpriced_reason: "no_price_anywhere"` means nothing prices it — which is not the same as free. `deposit_policy` is a READ of the payments ledger’s own rule (§3.6); this module never writes deposits. A READ that is a POST because its input is a structured body: `clinic:read`.
72314
+ * Create a convenio
72315
+ * @description Create a convenio
72306
72316
  *
72307
72317
  * **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`.
72308
72318
  */
@@ -72320,37 +72330,31 @@ interface paths {
72320
72330
  content: {
72321
72331
  /**
72322
72332
  * @example {
72323
- * "service_id": "4cf5bc59-0000-4000-8000-000000000001",
72324
- * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72325
- * "professional_id": "18342d1b-0000-4000-8000-000000000001",
72326
- * "location_id": "b1b1b1b1-0000-4000-8000-000000000002"
72333
+ * "name": "Convenio Empresa Andina",
72334
+ * "organization_name": "Empresa Andina SpA",
72335
+ * "organization_rut": "76.543.210-3",
72336
+ * "billing_mode": "patient",
72337
+ * "valid_from": "2026-01-01"
72327
72338
  * }
72328
72339
  */
72329
72340
  "application/json": {
72341
+ name: string;
72342
+ organization_name?: string | null;
72343
+ organization_rut?: string | null;
72330
72344
  /** Format: uuid */
72331
- service_id: string;
72332
- /** Format: uuid */
72333
- contact_id?: string | null;
72334
- /** Format: uuid */
72335
- clinic_patient_id?: string | null;
72336
- /** Format: uuid */
72337
- location_id?: string | null;
72338
- /** Format: uuid */
72339
- professional_id?: string | null;
72340
- on?: string | null;
72341
- /** Format: uuid */
72342
- agreement_id?: string | null;
72343
- prevision?: string | null;
72344
- /** @enum {string|null} */
72345
- loyalty_tier?: "0_6" | "6_12" | "12_plus" | null;
72346
- /** Format: uuid */
72347
- pack_id?: string | null;
72345
+ price_list_id?: string | null;
72346
+ /** @enum {string} */
72347
+ billing_mode?: "patient" | "organization" | "split";
72348
+ valid_from?: string | null;
72349
+ valid_to?: string | null;
72350
+ active?: boolean;
72351
+ notes?: string | null;
72348
72352
  };
72349
72353
  };
72350
72354
  };
72351
72355
  responses: {
72352
- /** @description Resolved price with its explanation */
72353
- 200: {
72356
+ /** @description Clinic agreement */
72357
+ 201: {
72354
72358
  headers: {
72355
72359
  [name: string]: unknown;
72356
72360
  };
@@ -72358,78 +72362,779 @@ interface paths {
72358
72362
  /**
72359
72363
  * @example {
72360
72364
  * "data": {
72361
- * "service": {
72362
- * "id": "4cf5bc59-0000-4000-8000-000000000001",
72363
- * "nombre": "Control de ortodoncia",
72364
- * "codigo": "ORT-CTRL",
72365
- * "categoria": "Ortodoncia"
72366
- * },
72367
- * "currency": "CLP",
72368
- * "on": "2026-09-22",
72369
- * "price_list": {
72370
- * "id": "38b62be4-0000-4000-8000-000000000001",
72371
- * "name": "Arancel particular 2026",
72372
- * "valid_from": "2026-01-01",
72373
- * "valid_to": null
72374
- * },
72375
- * "inputs": {
72376
- * "contact_id": null,
72377
- * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72378
- * "location_id": "b1b1b1b1-0000-4000-8000-000000000002",
72379
- * "professional_id": "18342d1b-0000-4000-8000-000000000001",
72380
- * "agreement_ids": [
72381
- * "c0e57121-0000-4000-8000-000000000001"
72382
- * ],
72383
- * "prevision": "Fonasa",
72384
- * "loyalty_tier": "6_12",
72385
- * "pack_id": null
72386
- * },
72387
- * "base_clp": 28000,
72388
- * "final_clp": 23800,
72389
- * "unpriced_reason": null,
72390
- * "explain": [
72391
- * {
72392
- * "order": 1,
72393
- * "source": "price_list",
72394
- * "label": "Arancel particular 2026",
72395
- * "kind": null,
72396
- * "rule_id": null,
72397
- * "modifier": null,
72398
- * "value": null,
72399
- * "amount_before_clp": null,
72400
- * "amount_after_clp": 28000,
72401
- * "delta_clp": 0
72402
- * },
72403
- * {
72404
- * "order": 2,
72405
- * "source": "price_rule",
72406
- * "label": "15% convenio Empresa Andina",
72407
- * "kind": "convenio",
72408
- * "rule_id": "0f400122-0000-4000-8000-000000000001",
72409
- * "modifier": "percent_off",
72410
- * "value": 15,
72411
- * "amount_before_clp": 28000,
72412
- * "amount_after_clp": 23800,
72413
- * "delta_clp": -4200
72414
- * }
72415
- * ],
72416
- * "applied_rule_ids": [
72417
- * "0f400122-0000-4000-8000-000000000001"
72418
- * ],
72419
- * "deposit_policy": {
72420
- * "amount_clp": null,
72421
- * "due_hours": null,
72422
- * "scope": null,
72423
- * "reason": "no_policy"
72424
- * }
72365
+ * "id": "c0e57121-0000-4000-8000-000000000001",
72366
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
72367
+ * "source": "native",
72368
+ * "external_id": null,
72369
+ * "name": "Convenio Empresa Andina",
72370
+ * "organization_name": "Empresa Andina SpA",
72371
+ * "organization_rut": "76.543.210-3",
72372
+ * "price_list_id": null,
72373
+ * "billing_mode": "patient",
72374
+ * "valid_from": "2026-01-01",
72375
+ * "valid_to": null,
72376
+ * "active": true,
72377
+ * "notes": null,
72378
+ * "created_at": "2026-09-22T22:21:14.651Z",
72379
+ * "updated_at": "2026-09-22T22:21:14.651Z",
72380
+ * "member_count": 0
72425
72381
  * }
72426
72382
  * }
72427
72383
  */
72428
72384
  "application/json": {
72429
72385
  data?: unknown;
72430
- meta?: {
72431
- [key: string]: unknown;
72432
- };
72386
+ };
72387
+ };
72388
+ };
72389
+ /** @description Validation error */
72390
+ 400: {
72391
+ headers: {
72392
+ [name: string]: unknown;
72393
+ };
72394
+ content: {
72395
+ "application/json": components["schemas"]["Error"];
72396
+ };
72397
+ };
72398
+ /** @description Unauthorized */
72399
+ 401: {
72400
+ headers: {
72401
+ [name: string]: unknown;
72402
+ };
72403
+ content: {
72404
+ "application/json": components["schemas"]["Error"];
72405
+ };
72406
+ };
72407
+ /** @description Forbidden */
72408
+ 403: {
72409
+ headers: {
72410
+ [name: string]: unknown;
72411
+ };
72412
+ content: {
72413
+ "application/json": components["schemas"]["Error"];
72414
+ };
72415
+ };
72416
+ /** @description Not found */
72417
+ 404: {
72418
+ headers: {
72419
+ [name: string]: unknown;
72420
+ };
72421
+ content: {
72422
+ "application/json": components["schemas"]["Error"];
72423
+ };
72424
+ };
72425
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
72426
+ 409: {
72427
+ headers: {
72428
+ [name: string]: unknown;
72429
+ };
72430
+ content: {
72431
+ "application/json": components["schemas"]["Error"];
72432
+ };
72433
+ };
72434
+ /** @description Rate limited */
72435
+ 429: {
72436
+ headers: {
72437
+ [name: string]: unknown;
72438
+ };
72439
+ content: {
72440
+ "application/json": components["schemas"]["Error"];
72441
+ };
72442
+ };
72443
+ };
72444
+ };
72445
+ delete?: never;
72446
+ options?: never;
72447
+ head?: never;
72448
+ patch?: never;
72449
+ trace?: never;
72450
+ };
72451
+ "/clinic/pricing/agreements/{id}": {
72452
+ parameters: {
72453
+ query?: never;
72454
+ header?: never;
72455
+ path?: never;
72456
+ cookie?: never;
72457
+ };
72458
+ get?: never;
72459
+ put?: never;
72460
+ post?: never;
72461
+ /**
72462
+ * Delete a convenio
72463
+ * @description Memberships and the rules that name it cascade.
72464
+ *
72465
+ * **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`.
72466
+ */
72467
+ delete: {
72468
+ parameters: {
72469
+ query?: never;
72470
+ header?: never;
72471
+ path?: never;
72472
+ cookie?: never;
72473
+ };
72474
+ requestBody?: never;
72475
+ responses: {
72476
+ /** @description No content */
72477
+ 204: {
72478
+ headers: {
72479
+ [name: string]: unknown;
72480
+ };
72481
+ content?: never;
72482
+ };
72483
+ /** @description Validation error */
72484
+ 400: {
72485
+ headers: {
72486
+ [name: string]: unknown;
72487
+ };
72488
+ content: {
72489
+ "application/json": components["schemas"]["Error"];
72490
+ };
72491
+ };
72492
+ /** @description Unauthorized */
72493
+ 401: {
72494
+ headers: {
72495
+ [name: string]: unknown;
72496
+ };
72497
+ content: {
72498
+ "application/json": components["schemas"]["Error"];
72499
+ };
72500
+ };
72501
+ /** @description Forbidden */
72502
+ 403: {
72503
+ headers: {
72504
+ [name: string]: unknown;
72505
+ };
72506
+ content: {
72507
+ "application/json": components["schemas"]["Error"];
72508
+ };
72509
+ };
72510
+ /** @description Not found */
72511
+ 404: {
72512
+ headers: {
72513
+ [name: string]: unknown;
72514
+ };
72515
+ content: {
72516
+ "application/json": components["schemas"]["Error"];
72517
+ };
72518
+ };
72519
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
72520
+ 409: {
72521
+ headers: {
72522
+ [name: string]: unknown;
72523
+ };
72524
+ content: {
72525
+ "application/json": components["schemas"]["Error"];
72526
+ };
72527
+ };
72528
+ /** @description Rate limited */
72529
+ 429: {
72530
+ headers: {
72531
+ [name: string]: unknown;
72532
+ };
72533
+ content: {
72534
+ "application/json": components["schemas"]["Error"];
72535
+ };
72536
+ };
72537
+ };
72538
+ };
72539
+ options?: never;
72540
+ head?: never;
72541
+ /**
72542
+ * Edit a convenio
72543
+ * @description Edit a convenio
72544
+ *
72545
+ * **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`.
72546
+ */
72547
+ patch: {
72548
+ parameters: {
72549
+ query?: never;
72550
+ header?: never;
72551
+ path?: never;
72552
+ cookie?: never;
72553
+ };
72554
+ requestBody?: {
72555
+ content: {
72556
+ /**
72557
+ * @example {
72558
+ * "notes": "Presentar credencial de la empresa"
72559
+ * }
72560
+ */
72561
+ "application/json": {
72562
+ name?: string;
72563
+ organization_name?: string | null;
72564
+ organization_rut?: string | null;
72565
+ /** Format: uuid */
72566
+ price_list_id?: string | null;
72567
+ /** @enum {string} */
72568
+ billing_mode?: "patient" | "organization" | "split";
72569
+ valid_from?: string | null;
72570
+ valid_to?: string | null;
72571
+ active?: boolean;
72572
+ notes?: string | null;
72573
+ };
72574
+ };
72575
+ };
72576
+ responses: {
72577
+ /** @description Clinic agreement */
72578
+ 200: {
72579
+ headers: {
72580
+ [name: string]: unknown;
72581
+ };
72582
+ content: {
72583
+ /**
72584
+ * @example {
72585
+ * "data": {
72586
+ * "id": "c0e57121-0000-4000-8000-000000000001",
72587
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
72588
+ * "source": "native",
72589
+ * "external_id": null,
72590
+ * "name": "Convenio Empresa Andina",
72591
+ * "organization_name": "Empresa Andina SpA",
72592
+ * "organization_rut": "76.543.210-3",
72593
+ * "price_list_id": null,
72594
+ * "billing_mode": "patient",
72595
+ * "valid_from": "2026-01-01",
72596
+ * "valid_to": null,
72597
+ * "active": true,
72598
+ * "notes": "Presentar credencial de la empresa",
72599
+ * "created_at": "2026-09-22T22:21:14.651Z",
72600
+ * "updated_at": "2026-09-22T22:21:14.663Z",
72601
+ * "member_count": 0
72602
+ * }
72603
+ * }
72604
+ */
72605
+ "application/json": {
72606
+ data?: unknown;
72607
+ meta?: {
72608
+ [key: string]: unknown;
72609
+ };
72610
+ };
72611
+ };
72612
+ };
72613
+ /** @description Validation error */
72614
+ 400: {
72615
+ headers: {
72616
+ [name: string]: unknown;
72617
+ };
72618
+ content: {
72619
+ "application/json": components["schemas"]["Error"];
72620
+ };
72621
+ };
72622
+ /** @description Unauthorized */
72623
+ 401: {
72624
+ headers: {
72625
+ [name: string]: unknown;
72626
+ };
72627
+ content: {
72628
+ "application/json": components["schemas"]["Error"];
72629
+ };
72630
+ };
72631
+ /** @description Forbidden */
72632
+ 403: {
72633
+ headers: {
72634
+ [name: string]: unknown;
72635
+ };
72636
+ content: {
72637
+ "application/json": components["schemas"]["Error"];
72638
+ };
72639
+ };
72640
+ /** @description Not found */
72641
+ 404: {
72642
+ headers: {
72643
+ [name: string]: unknown;
72644
+ };
72645
+ content: {
72646
+ "application/json": components["schemas"]["Error"];
72647
+ };
72648
+ };
72649
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
72650
+ 409: {
72651
+ headers: {
72652
+ [name: string]: unknown;
72653
+ };
72654
+ content: {
72655
+ "application/json": components["schemas"]["Error"];
72656
+ };
72657
+ };
72658
+ /** @description Rate limited */
72659
+ 429: {
72660
+ headers: {
72661
+ [name: string]: unknown;
72662
+ };
72663
+ content: {
72664
+ "application/json": components["schemas"]["Error"];
72665
+ };
72666
+ };
72667
+ };
72668
+ };
72669
+ trace?: never;
72670
+ };
72671
+ "/clinic/pricing/agreements/{id}/members": {
72672
+ parameters: {
72673
+ query?: never;
72674
+ header?: never;
72675
+ path?: never;
72676
+ cookie?: never;
72677
+ };
72678
+ /**
72679
+ * List a convenio’s members
72680
+ * @description Each membership with the patient’s name and RUT, its member number and its OWN validity window — the window the loyalty tier is measured from.
72681
+ *
72682
+ * **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`.
72683
+ */
72684
+ get: {
72685
+ parameters: {
72686
+ query?: never;
72687
+ header?: never;
72688
+ path?: never;
72689
+ cookie?: never;
72690
+ };
72691
+ requestBody?: never;
72692
+ responses: {
72693
+ /** @description Clinic agreement members */
72694
+ 200: {
72695
+ headers: {
72696
+ [name: string]: unknown;
72697
+ };
72698
+ content: {
72699
+ /**
72700
+ * @example {
72701
+ * "data": [
72702
+ * {
72703
+ * "id": "6467baa3-0000-4000-8000-000000000001",
72704
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
72705
+ * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72706
+ * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
72707
+ * "member_number": "EA-0042",
72708
+ * "valid_from": null,
72709
+ * "valid_to": null,
72710
+ * "created_at": "2026-09-22T22:21:14.673Z",
72711
+ * "updated_at": "2026-09-22T22:21:14.673Z",
72712
+ * "patient_nombre": "María José",
72713
+ * "patient_apellidos": "Fuentes Lagos",
72714
+ * "patient_rut": "11.111.111-1"
72715
+ * }
72716
+ * ]
72717
+ * }
72718
+ */
72719
+ "application/json": {
72720
+ data?: unknown;
72721
+ meta?: {
72722
+ [key: string]: unknown;
72723
+ };
72724
+ };
72725
+ };
72726
+ };
72727
+ /** @description Validation error */
72728
+ 400: {
72729
+ headers: {
72730
+ [name: string]: unknown;
72731
+ };
72732
+ content: {
72733
+ "application/json": components["schemas"]["Error"];
72734
+ };
72735
+ };
72736
+ /** @description Unauthorized */
72737
+ 401: {
72738
+ headers: {
72739
+ [name: string]: unknown;
72740
+ };
72741
+ content: {
72742
+ "application/json": components["schemas"]["Error"];
72743
+ };
72744
+ };
72745
+ /** @description Forbidden */
72746
+ 403: {
72747
+ headers: {
72748
+ [name: string]: unknown;
72749
+ };
72750
+ content: {
72751
+ "application/json": components["schemas"]["Error"];
72752
+ };
72753
+ };
72754
+ /** @description Not found */
72755
+ 404: {
72756
+ headers: {
72757
+ [name: string]: unknown;
72758
+ };
72759
+ content: {
72760
+ "application/json": components["schemas"]["Error"];
72761
+ };
72762
+ };
72763
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
72764
+ 409: {
72765
+ headers: {
72766
+ [name: string]: unknown;
72767
+ };
72768
+ content: {
72769
+ "application/json": components["schemas"]["Error"];
72770
+ };
72771
+ };
72772
+ /** @description Rate limited */
72773
+ 429: {
72774
+ headers: {
72775
+ [name: string]: unknown;
72776
+ };
72777
+ content: {
72778
+ "application/json": components["schemas"]["Error"];
72779
+ };
72780
+ };
72781
+ };
72782
+ };
72783
+ put?: never;
72784
+ /**
72785
+ * Add a member to a convenio
72786
+ * @description Idempotent per (patient, convenio): re-adding re-opens the window on the existing row rather than stacking a second membership.
72787
+ *
72788
+ * **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`.
72789
+ */
72790
+ post: {
72791
+ parameters: {
72792
+ query?: never;
72793
+ header?: {
72794
+ /** @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. */
72795
+ "Idempotency-Key"?: string;
72796
+ };
72797
+ path?: never;
72798
+ cookie?: never;
72799
+ };
72800
+ requestBody?: {
72801
+ content: {
72802
+ /**
72803
+ * @example {
72804
+ * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72805
+ * "member_number": "EA-0042"
72806
+ * }
72807
+ */
72808
+ "application/json": {
72809
+ /** Format: uuid */
72810
+ clinic_patient_id: string;
72811
+ member_number?: string | null;
72812
+ valid_from?: string | null;
72813
+ valid_to?: string | null;
72814
+ };
72815
+ };
72816
+ };
72817
+ responses: {
72818
+ /** @description Clinic agreement membership */
72819
+ 201: {
72820
+ headers: {
72821
+ [name: string]: unknown;
72822
+ };
72823
+ content: {
72824
+ /**
72825
+ * @example {
72826
+ * "data": {
72827
+ * "id": "6467baa3-0000-4000-8000-000000000001",
72828
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
72829
+ * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
72830
+ * "agreement_id": "c0e57121-0000-4000-8000-000000000001",
72831
+ * "member_number": "EA-0042",
72832
+ * "valid_from": null,
72833
+ * "valid_to": null,
72834
+ * "created_at": "2026-09-22T22:21:14.673Z",
72835
+ * "updated_at": "2026-09-22T22:21:14.673Z"
72836
+ * }
72837
+ * }
72838
+ */
72839
+ "application/json": {
72840
+ data?: unknown;
72841
+ };
72842
+ };
72843
+ };
72844
+ /** @description Validation error */
72845
+ 400: {
72846
+ headers: {
72847
+ [name: string]: unknown;
72848
+ };
72849
+ content: {
72850
+ "application/json": components["schemas"]["Error"];
72851
+ };
72852
+ };
72853
+ /** @description Unauthorized */
72854
+ 401: {
72855
+ headers: {
72856
+ [name: string]: unknown;
72857
+ };
72858
+ content: {
72859
+ "application/json": components["schemas"]["Error"];
72860
+ };
72861
+ };
72862
+ /** @description Forbidden */
72863
+ 403: {
72864
+ headers: {
72865
+ [name: string]: unknown;
72866
+ };
72867
+ content: {
72868
+ "application/json": components["schemas"]["Error"];
72869
+ };
72870
+ };
72871
+ /** @description Not found */
72872
+ 404: {
72873
+ headers: {
72874
+ [name: string]: unknown;
72875
+ };
72876
+ content: {
72877
+ "application/json": components["schemas"]["Error"];
72878
+ };
72879
+ };
72880
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
72881
+ 409: {
72882
+ headers: {
72883
+ [name: string]: unknown;
72884
+ };
72885
+ content: {
72886
+ "application/json": components["schemas"]["Error"];
72887
+ };
72888
+ };
72889
+ /** @description Rate limited */
72890
+ 429: {
72891
+ headers: {
72892
+ [name: string]: unknown;
72893
+ };
72894
+ content: {
72895
+ "application/json": components["schemas"]["Error"];
72896
+ };
72897
+ };
72898
+ };
72899
+ };
72900
+ delete?: never;
72901
+ options?: never;
72902
+ head?: never;
72903
+ patch?: never;
72904
+ trace?: never;
72905
+ };
72906
+ "/clinic/pricing/members/{id}": {
72907
+ parameters: {
72908
+ query?: never;
72909
+ header?: never;
72910
+ path?: never;
72911
+ cookie?: never;
72912
+ };
72913
+ get?: never;
72914
+ put?: never;
72915
+ post?: never;
72916
+ /**
72917
+ * Remove a convenio membership
72918
+ * @description Remove a convenio membership
72919
+ *
72920
+ * **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`.
72921
+ */
72922
+ delete: {
72923
+ parameters: {
72924
+ query?: never;
72925
+ header?: never;
72926
+ path?: never;
72927
+ cookie?: never;
72928
+ };
72929
+ requestBody?: never;
72930
+ responses: {
72931
+ /** @description No content */
72932
+ 204: {
72933
+ headers: {
72934
+ [name: string]: unknown;
72935
+ };
72936
+ content?: never;
72937
+ };
72938
+ /** @description Validation error */
72939
+ 400: {
72940
+ headers: {
72941
+ [name: string]: unknown;
72942
+ };
72943
+ content: {
72944
+ "application/json": components["schemas"]["Error"];
72945
+ };
72946
+ };
72947
+ /** @description Unauthorized */
72948
+ 401: {
72949
+ headers: {
72950
+ [name: string]: unknown;
72951
+ };
72952
+ content: {
72953
+ "application/json": components["schemas"]["Error"];
72954
+ };
72955
+ };
72956
+ /** @description Forbidden */
72957
+ 403: {
72958
+ headers: {
72959
+ [name: string]: unknown;
72960
+ };
72961
+ content: {
72962
+ "application/json": components["schemas"]["Error"];
72963
+ };
72964
+ };
72965
+ /** @description Not found */
72966
+ 404: {
72967
+ headers: {
72968
+ [name: string]: unknown;
72969
+ };
72970
+ content: {
72971
+ "application/json": components["schemas"]["Error"];
72972
+ };
72973
+ };
72974
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
72975
+ 409: {
72976
+ headers: {
72977
+ [name: string]: unknown;
72978
+ };
72979
+ content: {
72980
+ "application/json": components["schemas"]["Error"];
72981
+ };
72982
+ };
72983
+ /** @description Rate limited */
72984
+ 429: {
72985
+ headers: {
72986
+ [name: string]: unknown;
72987
+ };
72988
+ content: {
72989
+ "application/json": components["schemas"]["Error"];
72990
+ };
72991
+ };
72992
+ };
72993
+ };
72994
+ options?: never;
72995
+ head?: never;
72996
+ patch?: never;
72997
+ trace?: never;
72998
+ };
72999
+ "/clinic/pricing/quote": {
73000
+ parameters: {
73001
+ query?: never;
73002
+ header?: never;
73003
+ path?: never;
73004
+ cookie?: never;
73005
+ };
73006
+ get?: never;
73007
+ put?: never;
73008
+ /**
73009
+ * Quote a prestación, with the explanation
73010
+ * @description Resolves the price for a prestación on a date, for a patient (through their contact), at a sucursal, with a professional — and returns the ORDERED EXPLANATION: which arancel supplied the base, which professional override replaced it, and every rule that moved it, in the order it was applied. `base_clp: null` with `unpriced_reason: "no_price_anywhere"` means nothing prices it — which is not the same as free. `deposit_policy` is a READ of the payments ledger’s own rule (§3.6); this module never writes deposits. A READ that is a POST because its input is a structured body: `clinic:read`.
73011
+ *
73012
+ * **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`.
73013
+ */
73014
+ post: {
73015
+ parameters: {
73016
+ query?: never;
73017
+ header?: {
73018
+ /** @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. */
73019
+ "Idempotency-Key"?: string;
73020
+ };
73021
+ path?: never;
73022
+ cookie?: never;
73023
+ };
73024
+ requestBody?: {
73025
+ content: {
73026
+ /**
73027
+ * @example {
73028
+ * "service_id": "4cf5bc59-0000-4000-8000-000000000001",
73029
+ * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
73030
+ * "professional_id": "18342d1b-0000-4000-8000-000000000001",
73031
+ * "location_id": "b1b1b1b1-0000-4000-8000-000000000002"
73032
+ * }
73033
+ */
73034
+ "application/json": {
73035
+ /** Format: uuid */
73036
+ service_id: string;
73037
+ /** Format: uuid */
73038
+ contact_id?: string | null;
73039
+ /** Format: uuid */
73040
+ clinic_patient_id?: string | null;
73041
+ /** Format: uuid */
73042
+ location_id?: string | null;
73043
+ /** Format: uuid */
73044
+ professional_id?: string | null;
73045
+ on?: string | null;
73046
+ /** Format: uuid */
73047
+ agreement_id?: string | null;
73048
+ prevision?: string | null;
73049
+ /** @enum {string|null} */
73050
+ loyalty_tier?: "0_6" | "6_12" | "12_plus" | null;
73051
+ /** Format: uuid */
73052
+ pack_id?: string | null;
73053
+ };
73054
+ };
73055
+ };
73056
+ responses: {
73057
+ /** @description Resolved price with its explanation */
73058
+ 200: {
73059
+ headers: {
73060
+ [name: string]: unknown;
73061
+ };
73062
+ content: {
73063
+ /**
73064
+ * @example {
73065
+ * "data": {
73066
+ * "service": {
73067
+ * "id": "4cf5bc59-0000-4000-8000-000000000001",
73068
+ * "nombre": "Control de ortodoncia",
73069
+ * "codigo": "ORT-CTRL",
73070
+ * "categoria": "Ortodoncia"
73071
+ * },
73072
+ * "currency": "CLP",
73073
+ * "on": "2026-09-22",
73074
+ * "price_list": {
73075
+ * "id": "38b62be4-0000-4000-8000-000000000001",
73076
+ * "name": "Arancel particular 2026",
73077
+ * "valid_from": "2026-01-01",
73078
+ * "valid_to": null
73079
+ * },
73080
+ * "inputs": {
73081
+ * "contact_id": null,
73082
+ * "clinic_patient_id": "b1b0b8de-0000-4000-8000-000000000001",
73083
+ * "location_id": "b1b1b1b1-0000-4000-8000-000000000002",
73084
+ * "professional_id": "18342d1b-0000-4000-8000-000000000001",
73085
+ * "agreement_ids": [
73086
+ * "c0e57121-0000-4000-8000-000000000001"
73087
+ * ],
73088
+ * "prevision": "Fonasa",
73089
+ * "loyalty_tier": "6_12",
73090
+ * "pack_id": null
73091
+ * },
73092
+ * "base_clp": 28000,
73093
+ * "final_clp": 23800,
73094
+ * "unpriced_reason": null,
73095
+ * "explain": [
73096
+ * {
73097
+ * "order": 1,
73098
+ * "source": "price_list",
73099
+ * "label": "Arancel particular 2026",
73100
+ * "kind": null,
73101
+ * "rule_id": null,
73102
+ * "modifier": null,
73103
+ * "value": null,
73104
+ * "amount_before_clp": null,
73105
+ * "amount_after_clp": 28000,
73106
+ * "delta_clp": 0
73107
+ * },
73108
+ * {
73109
+ * "order": 2,
73110
+ * "source": "price_rule",
73111
+ * "label": "15% convenio Empresa Andina",
73112
+ * "kind": "convenio",
73113
+ * "rule_id": "0f400122-0000-4000-8000-000000000001",
73114
+ * "modifier": "percent_off",
73115
+ * "value": 15,
73116
+ * "amount_before_clp": 28000,
73117
+ * "amount_after_clp": 23800,
73118
+ * "delta_clp": -4200
73119
+ * }
73120
+ * ],
73121
+ * "applied_rule_ids": [
73122
+ * "0f400122-0000-4000-8000-000000000001"
73123
+ * ],
73124
+ * "deposit_policy": {
73125
+ * "amount_clp": null,
73126
+ * "due_hours": null,
73127
+ * "scope": null,
73128
+ * "reason": "no_policy"
73129
+ * }
73130
+ * }
73131
+ * }
73132
+ */
73133
+ "application/json": {
73134
+ data?: unknown;
73135
+ meta?: {
73136
+ [key: string]: unknown;
73137
+ };
72433
73138
  };
72434
73139
  };
72435
73140
  };
@@ -78458,7 +79163,7 @@ interface paths {
78458
79163
  item_ids: string[];
78459
79164
  payment: {
78460
79165
  /** @enum {string} */
78461
- instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc";
79166
+ instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc" | "flow" | "khipu";
78462
79167
  /** @enum {string} */
78463
79168
  source?: "manual" | "card_terminal";
78464
79169
  amount_clp: number;
@@ -80801,7 +81506,7 @@ interface paths {
80801
81506
  contact_id?: string | null;
80802
81507
  payment?: {
80803
81508
  /** @enum {string} */
80804
- instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc";
81509
+ instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc" | "flow" | "khipu";
80805
81510
  /** @enum {string} */
80806
81511
  source?: "manual" | "card_terminal";
80807
81512
  amount_clp: number;
@@ -113879,7 +114584,7 @@ interface paths {
113879
114584
  /** @enum {string} */
113880
114585
  source?: "manual" | "card_terminal" | "credit_note";
113881
114586
  /** @enum {string} */
113882
- instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc";
114587
+ instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc" | "flow" | "khipu";
113883
114588
  amount_clp: number;
113884
114589
  paid_on: string;
113885
114590
  bank?: string | null;
@@ -114148,10 +114853,18 @@ interface paths {
114148
114853
  * {
114149
114854
  * "instrument": "fintoc",
114150
114855
  * "required_fields": []
114856
+ * },
114857
+ * {
114858
+ * "instrument": "flow",
114859
+ * "required_fields": []
114860
+ * },
114861
+ * {
114862
+ * "instrument": "khipu",
114863
+ * "required_fields": []
114151
114864
  * }
114152
114865
  * ],
114153
114866
  * "meta": {
114154
- * "total": 12
114867
+ * "total": 14
114155
114868
  * }
114156
114869
  * }
114157
114870
  */
@@ -168255,6 +168968,10 @@ interface paths {
168255
168968
  * "https://media.example.com/t/other/aromos-1.jpg"
168256
168969
  * ],
168257
168970
  * "brochure_url": "https://media.example.com/t/other/aromos-brochure.pdf",
168971
+ * "meta_ad_ids": [
168972
+ * "120211111111111111"
168973
+ * ],
168974
+ * "whatsapp_code": "RK482",
168258
168975
  * "created_by": null,
168259
168976
  * "created_at": "2026-10-20T12:00:00.000Z",
168260
168977
  * "updated_at": "2026-10-20T12:00:00.000Z",
@@ -168398,157 +169115,165 @@ interface paths {
168398
169115
  * "https://media.example.com/t/other/aromos-1.jpg"
168399
169116
  * ],
168400
169117
  * "brochure_url": "https://media.example.com/t/other/aromos-brochure.pdf",
168401
- * "created_by": null,
168402
- * "created_at": "2026-10-20T12:00:00.000Z",
168403
- * "updated_at": "2026-10-20T12:00:00.000Z",
168404
- * "sales_office": {
168405
- * "id": "0199e3a0-0000-7000-8000-000000000301",
168406
- * "display_id": "B-2",
168407
- * "name": "Sala de ventas La Florida"
168408
- * },
168409
- * "unit_models": [
168410
- * {
168411
- * "id": "0199e3a0-0000-7000-8000-000000000201",
168412
- * "tenant_id": "0199e3a0-0000-7000-8000-0000000000aa",
168413
- * "project_id": "0199e3a0-0000-7000-8000-000000000101",
168414
- * "name": "3D2B 78 m²",
168415
- * "description": "Esquina, con terraza en L.",
168416
- * "bedrooms": 3,
168417
- * "bathrooms": 2,
168418
- * "usable_area_m2": 72.5,
168419
- * "terrace_area_m2": 6,
168420
- * "total_area_m2": 78.5,
168421
- * "floor_plans": [
168422
- * "https://media.example.com/t/other/planta-3d2b.pdf"
168423
- * ],
168424
- * "renders": [
168425
- * "https://media.example.com/t/other/render-3d2b.jpg"
168426
- * ],
168427
- * "tour_360_url": "https://tour.example.com/3d2b",
168428
- * "created_by": null,
168429
- * "created_at": "2026-10-20T12:00:00.000Z",
168430
- * "updated_at": "2026-10-20T12:00:00.000Z"
168431
- * }
168432
- * ]
168433
- * }
168434
- * }
168435
- */
168436
- "application/json": {
168437
- data: components["schemas"]["Project"];
168438
- };
168439
- };
168440
- };
168441
- /** @description Validation error */
168442
- 400: {
168443
- headers: {
168444
- [name: string]: unknown;
168445
- };
168446
- content: {
168447
- "application/json": components["schemas"]["Error"];
168448
- };
168449
- };
168450
- /** @description Unauthorized */
168451
- 401: {
168452
- headers: {
168453
- [name: string]: unknown;
168454
- };
168455
- content: {
168456
- "application/json": components["schemas"]["Error"];
168457
- };
168458
- };
168459
- /** @description Forbidden */
168460
- 403: {
168461
- headers: {
168462
- [name: string]: unknown;
168463
- };
168464
- content: {
168465
- "application/json": components["schemas"]["Error"];
168466
- };
168467
- };
168468
- /** @description Not found */
168469
- 404: {
168470
- headers: {
168471
- [name: string]: unknown;
168472
- };
168473
- content: {
168474
- "application/json": components["schemas"]["Error"];
168475
- };
168476
- };
168477
- /** @description Conflict (incl. Idempotency-Key reuse with different body) */
168478
- 409: {
168479
- headers: {
168480
- [name: string]: unknown;
168481
- };
168482
- content: {
168483
- "application/json": components["schemas"]["Error"];
168484
- };
168485
- };
168486
- /** @description Rate limited */
168487
- 429: {
168488
- headers: {
168489
- [name: string]: unknown;
168490
- };
168491
- content: {
168492
- "application/json": components["schemas"]["Error"];
168493
- };
168494
- };
168495
- };
168496
- };
168497
- delete?: never;
168498
- options?: never;
168499
- head?: never;
168500
- patch?: never;
168501
- trace?: never;
168502
- };
168503
- "/projects/{id}": {
168504
- parameters: {
168505
- query?: never;
168506
- header?: never;
168507
- path?: never;
168508
- cookie?: never;
168509
- };
168510
- /**
168511
- * One proyecto, with its sala de ventas and tipologías
168512
- * @description Requires `marketplace:read`. A caller whose role narrows proyectos (`project_visibility` `assigned` = ejecutivo, `sales_office` = jefe de sala) only sees the proyectos it admits; any other answers 404, as if it did not exist. Only on a workspace that runs the Proyectos module (real-estate vertical, inmobiliaria); any other answers 403 `MODULE_NOT_ENABLED`.
168513
- */
168514
- get: {
168515
- parameters: {
168516
- query?: never;
168517
- header?: never;
168518
- path: {
168519
- /** @description The proyecto id. */
168520
- id: string;
168521
- };
168522
- cookie?: never;
168523
- };
168524
- requestBody?: never;
168525
- responses: {
168526
- /** @description Proyecto */
168527
- 200: {
168528
- headers: {
168529
- [name: string]: unknown;
168530
- };
168531
- content: {
168532
- /**
168533
- * @example {
168534
- * "data": {
168535
- * "id": "0199e3a0-0000-7000-8000-000000000101",
168536
- * "tenant_id": "0199e3a0-0000-7000-8000-0000000000aa",
168537
- * "name": "Parque Los Aromos",
168538
- * "description": "Condominio de departamentos a pasos del metro.",
168539
- * "region": "Metropolitana",
168540
- * "comuna": "La Florida",
168541
- * "address": "Av. Vicuña Mackenna 0000",
168542
- * "stage": "en_verde",
168543
- * "delivery_date": "2027-12-01",
168544
- * "subsidies": [
168545
- * "DS19"
169118
+ * "meta_ad_ids": [
169119
+ * "120211111111111111"
169120
+ * ],
169121
+ * "whatsapp_code": "RK482",
169122
+ * "created_by": null,
169123
+ * "created_at": "2026-10-20T12:00:00.000Z",
169124
+ * "updated_at": "2026-10-20T12:00:00.000Z",
169125
+ * "sales_office": {
169126
+ * "id": "0199e3a0-0000-7000-8000-000000000301",
169127
+ * "display_id": "B-2",
169128
+ * "name": "Sala de ventas La Florida"
169129
+ * },
169130
+ * "unit_models": [
169131
+ * {
169132
+ * "id": "0199e3a0-0000-7000-8000-000000000201",
169133
+ * "tenant_id": "0199e3a0-0000-7000-8000-0000000000aa",
169134
+ * "project_id": "0199e3a0-0000-7000-8000-000000000101",
169135
+ * "name": "3D2B 78 m²",
169136
+ * "description": "Esquina, con terraza en L.",
169137
+ * "bedrooms": 3,
169138
+ * "bathrooms": 2,
169139
+ * "usable_area_m2": 72.5,
169140
+ * "terrace_area_m2": 6,
169141
+ * "total_area_m2": 78.5,
169142
+ * "floor_plans": [
169143
+ * "https://media.example.com/t/other/planta-3d2b.pdf"
169144
+ * ],
169145
+ * "renders": [
169146
+ * "https://media.example.com/t/other/render-3d2b.jpg"
169147
+ * ],
169148
+ * "tour_360_url": "https://tour.example.com/3d2b",
169149
+ * "created_by": null,
169150
+ * "created_at": "2026-10-20T12:00:00.000Z",
169151
+ * "updated_at": "2026-10-20T12:00:00.000Z"
169152
+ * }
169153
+ * ]
169154
+ * }
169155
+ * }
169156
+ */
169157
+ "application/json": {
169158
+ data: components["schemas"]["Project"];
169159
+ };
169160
+ };
169161
+ };
169162
+ /** @description Validation error */
169163
+ 400: {
169164
+ headers: {
169165
+ [name: string]: unknown;
169166
+ };
169167
+ content: {
169168
+ "application/json": components["schemas"]["Error"];
169169
+ };
169170
+ };
169171
+ /** @description Unauthorized */
169172
+ 401: {
169173
+ headers: {
169174
+ [name: string]: unknown;
169175
+ };
169176
+ content: {
169177
+ "application/json": components["schemas"]["Error"];
169178
+ };
169179
+ };
169180
+ /** @description Forbidden */
169181
+ 403: {
169182
+ headers: {
169183
+ [name: string]: unknown;
169184
+ };
169185
+ content: {
169186
+ "application/json": components["schemas"]["Error"];
169187
+ };
169188
+ };
169189
+ /** @description Not found */
169190
+ 404: {
169191
+ headers: {
169192
+ [name: string]: unknown;
169193
+ };
169194
+ content: {
169195
+ "application/json": components["schemas"]["Error"];
169196
+ };
169197
+ };
169198
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
169199
+ 409: {
169200
+ headers: {
169201
+ [name: string]: unknown;
169202
+ };
169203
+ content: {
169204
+ "application/json": components["schemas"]["Error"];
169205
+ };
169206
+ };
169207
+ /** @description Rate limited */
169208
+ 429: {
169209
+ headers: {
169210
+ [name: string]: unknown;
169211
+ };
169212
+ content: {
169213
+ "application/json": components["schemas"]["Error"];
169214
+ };
169215
+ };
169216
+ };
169217
+ };
169218
+ delete?: never;
169219
+ options?: never;
169220
+ head?: never;
169221
+ patch?: never;
169222
+ trace?: never;
169223
+ };
169224
+ "/projects/{id}": {
169225
+ parameters: {
169226
+ query?: never;
169227
+ header?: never;
169228
+ path?: never;
169229
+ cookie?: never;
169230
+ };
169231
+ /**
169232
+ * One proyecto, with its sala de ventas and tipologías
169233
+ * @description Requires `marketplace:read`. A caller whose role narrows proyectos (`project_visibility` `assigned` = ejecutivo, `sales_office` = jefe de sala) only sees the proyectos it admits; any other answers 404, as if it did not exist. Only on a workspace that runs the Proyectos module (real-estate vertical, inmobiliaria); any other answers 403 `MODULE_NOT_ENABLED`.
169234
+ */
169235
+ get: {
169236
+ parameters: {
169237
+ query?: never;
169238
+ header?: never;
169239
+ path: {
169240
+ /** @description The proyecto id. */
169241
+ id: string;
169242
+ };
169243
+ cookie?: never;
169244
+ };
169245
+ requestBody?: never;
169246
+ responses: {
169247
+ /** @description Proyecto */
169248
+ 200: {
169249
+ headers: {
169250
+ [name: string]: unknown;
169251
+ };
169252
+ content: {
169253
+ /**
169254
+ * @example {
169255
+ * "data": {
169256
+ * "id": "0199e3a0-0000-7000-8000-000000000101",
169257
+ * "tenant_id": "0199e3a0-0000-7000-8000-0000000000aa",
169258
+ * "name": "Parque Los Aromos",
169259
+ * "description": "Condominio de departamentos a pasos del metro.",
169260
+ * "region": "Metropolitana",
169261
+ * "comuna": "La Florida",
169262
+ * "address": "Av. Vicuña Mackenna 0000",
169263
+ * "stage": "en_verde",
169264
+ * "delivery_date": "2027-12-01",
169265
+ * "subsidies": [
169266
+ * "DS19"
169267
+ * ],
169268
+ * "sales_office_location_id": "0199e3a0-0000-7000-8000-000000000301",
169269
+ * "photos": [
169270
+ * "https://media.example.com/t/other/aromos-1.jpg"
169271
+ * ],
169272
+ * "brochure_url": "https://media.example.com/t/other/aromos-brochure.pdf",
169273
+ * "meta_ad_ids": [
169274
+ * "120211111111111111"
168546
169275
  * ],
168547
- * "sales_office_location_id": "0199e3a0-0000-7000-8000-000000000301",
168548
- * "photos": [
168549
- * "https://media.example.com/t/other/aromos-1.jpg"
168550
- * ],
168551
- * "brochure_url": "https://media.example.com/t/other/aromos-brochure.pdf",
169276
+ * "whatsapp_code": "RK482",
168552
169277
  * "created_by": null,
168553
169278
  * "created_at": "2026-10-20T12:00:00.000Z",
168554
169279
  * "updated_at": "2026-10-20T12:00:00.000Z",
@@ -168798,6 +169523,10 @@ interface paths {
168798
169523
  * "https://media.example.com/t/other/aromos-1.jpg"
168799
169524
  * ],
168800
169525
  * "brochure_url": "https://media.example.com/t/other/aromos-brochure.pdf",
169526
+ * "meta_ad_ids": [
169527
+ * "120211111111111111"
169528
+ * ],
169529
+ * "whatsapp_code": "RK482",
168801
169530
  * "created_by": null,
168802
169531
  * "created_at": "2026-10-20T12:00:00.000Z",
168803
169532
  * "updated_at": "2026-10-20T12:00:00.000Z",
@@ -169516,6 +170245,121 @@ interface paths {
169516
170245
  };
169517
170246
  trace?: never;
169518
170247
  };
170248
+ "/projects/{id}/whatsapp-links": {
170249
+ parameters: {
170250
+ query?: never;
170251
+ header?: never;
170252
+ path?: never;
170253
+ cookie?: never;
170254
+ };
170255
+ /**
170256
+ * Get the tracked WhatsApp links of a proyecto
170257
+ * @description One `wa.me` link per enabled WhatsApp number of the workspace, each prefilling a message that carries the proyecto’s `whatsapp_code`. A buyer who opens it and sends that message starts a conversation tied to the proyecto: the agent opens on it by name, and the lead is about it (`lead.project_id`, owned by the proyecto’s ejecutivos) with the link in its notes. Requires `marketplace:read`. A caller whose role narrows proyectos (`project_visibility` `assigned` = ejecutivo, `sales_office` = jefe de sala) only sees the proyectos it admits; any other answers 404, as if it did not exist. Only on a workspace that runs the Proyectos module (real-estate vertical, inmobiliaria); any other answers 403 `MODULE_NOT_ENABLED`.
170258
+ */
170259
+ get: {
170260
+ parameters: {
170261
+ query?: never;
170262
+ header?: never;
170263
+ path: {
170264
+ /** @description The proyecto id. */
170265
+ id: string;
170266
+ };
170267
+ cookie?: never;
170268
+ };
170269
+ requestBody?: never;
170270
+ responses: {
170271
+ /** @description Tracked links */
170272
+ 200: {
170273
+ headers: {
170274
+ [name: string]: unknown;
170275
+ };
170276
+ content: {
170277
+ /**
170278
+ * @example {
170279
+ * "data": {
170280
+ * "project_id": "0199e3a0-0000-7000-8000-000000000101",
170281
+ * "whatsapp_code": "RK482",
170282
+ * "prefill_text": "Hola, me interesa el proyecto Parque Los Aromos (código RK482)",
170283
+ * "links": [
170284
+ * {
170285
+ * "messaging_account_id": "0199e3a0-0000-7000-8000-000000000501",
170286
+ * "name": "WhatsApp ventas",
170287
+ * "phone_e164": "+56912345678",
170288
+ * "url": "https://wa.me/56912345678?text=Hola%2C%20me%20interesa%20el%20proyecto%20Parque%20Los%20Aromos%20(c%C3%B3digo%20RK482)"
170289
+ * }
170290
+ * ]
170291
+ * }
170292
+ * }
170293
+ */
170294
+ "application/json": {
170295
+ data: components["schemas"]["ProjectWhatsappLinks"];
170296
+ };
170297
+ };
170298
+ };
170299
+ /** @description Validation error */
170300
+ 400: {
170301
+ headers: {
170302
+ [name: string]: unknown;
170303
+ };
170304
+ content: {
170305
+ "application/json": components["schemas"]["Error"];
170306
+ };
170307
+ };
170308
+ /** @description Unauthorized */
170309
+ 401: {
170310
+ headers: {
170311
+ [name: string]: unknown;
170312
+ };
170313
+ content: {
170314
+ "application/json": components["schemas"]["Error"];
170315
+ };
170316
+ };
170317
+ /** @description Forbidden */
170318
+ 403: {
170319
+ headers: {
170320
+ [name: string]: unknown;
170321
+ };
170322
+ content: {
170323
+ "application/json": components["schemas"]["Error"];
170324
+ };
170325
+ };
170326
+ /** @description Not found */
170327
+ 404: {
170328
+ headers: {
170329
+ [name: string]: unknown;
170330
+ };
170331
+ content: {
170332
+ "application/json": components["schemas"]["Error"];
170333
+ };
170334
+ };
170335
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
170336
+ 409: {
170337
+ headers: {
170338
+ [name: string]: unknown;
170339
+ };
170340
+ content: {
170341
+ "application/json": components["schemas"]["Error"];
170342
+ };
170343
+ };
170344
+ /** @description Rate limited */
170345
+ 429: {
170346
+ headers: {
170347
+ [name: string]: unknown;
170348
+ };
170349
+ content: {
170350
+ "application/json": components["schemas"]["Error"];
170351
+ };
170352
+ };
170353
+ };
170354
+ };
170355
+ put?: never;
170356
+ post?: never;
170357
+ delete?: never;
170358
+ options?: never;
170359
+ head?: never;
170360
+ patch?: never;
170361
+ trace?: never;
170362
+ };
169519
170363
  "/projects/{id}/members": {
169520
170364
  parameters: {
169521
170365
  query?: never;
@@ -195564,12 +196408,12 @@ interface components {
195564
196408
  /** @description A Mercado Pago checkout payment: its payment id, a link to it and its status. Null for every other movement. */
195565
196409
  GatewayPaymentRef: {
195566
196410
  /** @enum {string} */
195567
- provider: "mercadopago" | "webpay" | "fintoc";
195568
- /** @description The provider’s own payment id (Mercado Pago payment id; Webpay transaction token). */
196411
+ provider: "mercadopago" | "webpay" | "fintoc" | "flow" | "khipu";
196412
+ /** @description The provider’s own payment id (Mercado Pago payment id; Webpay transaction token; Flow token; Khipu payment id). */
195569
196413
  payment_id: string;
195570
196414
  /**
195571
196415
  * Format: uri
195572
- * @description Where to look the payment up: the clinic’s Mercado Pago activity search, or Transbank’s site for Webpay (no per-payment page).
196416
+ * @description Where to look the payment up: the clinic’s Mercado Pago activity search, or the provider’s site for Webpay, Flow and Khipu (no per-payment page).
195573
196417
  */
195574
196418
  url: string;
195575
196419
  /**
@@ -198260,7 +199104,7 @@ interface components {
198260
199104
  };
198261
199105
  PaymentInstrumentRequirement: {
198262
199106
  /** @enum {string} */
198263
- instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc";
199107
+ instrument: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "bono" | "otro" | "mercadopago" | "webpay" | "fintoc" | "flow" | "khipu";
198264
199108
  /** @description Fields that must be non-blank for this instrument. Empty = only paid_on and amount_clp. */
198265
199109
  required_fields: ("bank" | "account_number" | "document_number" | "note")[];
198266
199110
  };
@@ -201877,6 +202721,9 @@ interface components {
201877
202721
  sales_office_location_id: string | null;
201878
202722
  photos: string[];
201879
202723
  brochure_url: string | null;
202724
+ meta_ad_ids: string[];
202725
+ /** @description The proyecto’s code in its tracked WhatsApp link (two letters + three digits, generated, never edited). A first message that carries it ties the conversation and its lead to this proyecto before the agent replies. `GET /projects/{id}/whatsapp-links` builds the links. */
202726
+ whatsapp_code: string;
201880
202727
  created_by: string | null;
201881
202728
  created_at: string;
201882
202729
  updated_at: string;
@@ -201931,6 +202778,9 @@ interface components {
201931
202778
  sales_office_location_id: string | null;
201932
202779
  photos: string[];
201933
202780
  brochure_url: string | null;
202781
+ meta_ad_ids: string[];
202782
+ /** @description The proyecto’s code in its tracked WhatsApp link (two letters + three digits, generated, never edited). A first message that carries it ties the conversation and its lead to this proyecto before the agent replies. `GET /projects/{id}/whatsapp-links` builds the links. */
202783
+ whatsapp_code: string;
201934
202784
  created_by: string | null;
201935
202785
  created_at: string;
201936
202786
  updated_at: string;
@@ -201972,6 +202822,8 @@ interface components {
201972
202822
  * @description Brochure URL (usually a PDF uploaded through /tenant/media).
201973
202823
  */
201974
202824
  brochure_url?: string | null;
202825
+ /** @description The Meta ads (Click-to-WhatsApp, or Instagram / Messenger «Enviar mensaje» ads) that sell this proyecto: a conversation one of them opens is tied to the proyecto before the agent replies, and its lead is about it. One ad sells at most one live proyecto (409 `meta_ad_already_mapped`). Optional: an unmapped ad is still recognised by the proyecto’s name in its campaign, ad set or ad names or in its copy. */
202826
+ meta_ad_ids?: string[];
201975
202827
  };
201976
202828
  UpdateProjectBody: {
201977
202829
  name?: string;
@@ -202001,6 +202853,8 @@ interface components {
202001
202853
  * @description Brochure URL (usually a PDF uploaded through /tenant/media).
202002
202854
  */
202003
202855
  brochure_url?: string | null;
202856
+ /** @description The Meta ads (Click-to-WhatsApp, or Instagram / Messenger «Enviar mensaje» ads) that sell this proyecto: a conversation one of them opens is tied to the proyecto before the agent replies, and its lead is about it. One ad sells at most one live proyecto (409 `meta_ad_already_mapped`). Optional: an unmapped ad is still recognised by the proyecto’s name in its campaign, ad set or ad names or in its copy. */
202857
+ meta_ad_ids?: string[];
202004
202858
  };
202005
202859
  UnitModelListItem: components["schemas"]["UnitModel"] & {
202006
202860
  /** @description The proyecto it belongs to. */
@@ -202069,6 +202923,23 @@ interface components {
202069
202923
  */
202070
202924
  tour_360_url?: string | null;
202071
202925
  };
202926
+ ProjectWhatsappLinks: {
202927
+ /** Format: uuid */
202928
+ project_id: string;
202929
+ whatsapp_code: string;
202930
+ /** @description The message the link prefills, carrying the proyecto’s code. The buyer sends it as their first message. */
202931
+ prefill_text: string;
202932
+ /** @description One link per enabled WhatsApp number of the workspace; empty while none is connected. */
202933
+ links: {
202934
+ /** Format: uuid */
202935
+ messaging_account_id: string;
202936
+ /** @description The WhatsApp channel’s name. */
202937
+ name: string;
202938
+ phone_e164: string;
202939
+ /** @description `https://wa.me/<number>?text=<prefill>`, ready to share. */
202940
+ url: string;
202941
+ }[];
202942
+ };
202072
202943
  Unit: components["schemas"]["Property"] & {
202073
202944
  /**
202074
202945
  * @description Estado: disponible | bloqueada | reservada | promesada | vendida | pausada (arrendada never occurs on a unidad).