@vitrina/api 11.40.0 → 11.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +2822 -633
- package/dist/index.d.ts +2822 -633
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -14834,6 +14834,10 @@ interface paths {
|
|
|
14834
14834
|
* ⚠ `tenencia=propio` IS THE COLUMN DEFAULT, not a recorded decision: that cohort includes every unit nobody has classified yet. Do not word it as "comprado".
|
|
14835
14835
|
*
|
|
14836
14836
|
* Phase 2 (tenencia_source): `tenencia_source` COMPOSES with `tenencia` rather than narrowing it — `?tenencia=propio&tenencia_source=decided` is "propio, and a person or a document actually settled that" (`decided` ⇒ `tenencia_source <> 'default'`); `document` / `declared` / `default` match the column exactly. See `POST /vehicles/tenencia` for how a `declared` row is produced.
|
|
14837
|
+
*
|
|
14838
|
+
* SIN COSTO (ADR 0114 §8). A car that entered without a compra (nota de compra), a consignación (contrato) or a parte de pago (nota de venta) has no acquisition, so nothing records what it cost. Every row carries `sin_costo: true` for such a unit (any status), and `view=sin_costo` lists the pile still on the floor — active, not vendido, no acquisition; the SAME predicate as the `sin_costo` count on `GET /vehicles/stats` and the `stock_without_cost` dealer alert. It is never a gate: bulk imports and migrations land cars here on purpose. `sin_costo` is a statement about the cost basis and follows the cost omission above: ABSENT without `dealership_economics:read`.
|
|
14839
|
+
*
|
|
14840
|
+
* MANDATO SIN FIRMAR (ADR 0114 §5). `view=mandato_sin_firmar` lists the cars whose consignación (activa or vendida) has an emitted mandato and no signed copy filed in the expediente — the SAME predicate as the `mandato_sin_firmar` count on `GET /vehicles/stats` and the `mandate_unsigned` dealer alert. Never a gate.
|
|
14837
14841
|
*/
|
|
14838
14842
|
get: {
|
|
14839
14843
|
parameters: {
|
|
@@ -14860,7 +14864,7 @@ interface paths {
|
|
|
14860
14864
|
consignacion_modalidad?: "en_local" | "virtual" | "sin_contrato";
|
|
14861
14865
|
tenencia_source?: "document" | "declared" | "default" | "decided";
|
|
14862
14866
|
without_acquisition?: boolean | string;
|
|
14863
|
-
view?: "published" | "unpublished" | "error" | "stale" | "source_deactivated";
|
|
14867
|
+
view?: "published" | "unpublished" | "error" | "stale" | "source_deactivated" | "sin_costo" | "mandato_sin_firmar";
|
|
14864
14868
|
active?: boolean | string;
|
|
14865
14869
|
sort?: "price_asc" | "price_desc" | "year_desc" | "recent" | "days_desc" | "interest_desc" | "estacionamiento";
|
|
14866
14870
|
limit?: number;
|
|
@@ -14951,6 +14955,7 @@ interface paths {
|
|
|
14951
14955
|
* "updated_at": "2026-09-15T18:34:48.575Z",
|
|
14952
14956
|
* "live_sale_note": null,
|
|
14953
14957
|
* "active_reservation": null,
|
|
14958
|
+
* "sin_costo": true,
|
|
14954
14959
|
* "not_on_lot": false
|
|
14955
14960
|
* }
|
|
14956
14961
|
* ],
|
|
@@ -15212,6 +15217,7 @@ interface paths {
|
|
|
15212
15217
|
* "updated_at": "2026-09-15T18:34:48.575Z",
|
|
15213
15218
|
* "live_sale_note": null,
|
|
15214
15219
|
* "active_reservation": null,
|
|
15220
|
+
* "sin_costo": true,
|
|
15215
15221
|
* "not_on_lot": false,
|
|
15216
15222
|
* "publications": [
|
|
15217
15223
|
* {
|
|
@@ -15353,7 +15359,7 @@ interface paths {
|
|
|
15353
15359
|
query?: {
|
|
15354
15360
|
format?: "xlsx" | "pdf";
|
|
15355
15361
|
q?: string;
|
|
15356
|
-
view?: "published" | "unpublished" | "error" | "stale" | "source_deactivated";
|
|
15362
|
+
view?: "published" | "unpublished" | "error" | "stale" | "source_deactivated" | "sin_costo" | "mandato_sin_firmar";
|
|
15357
15363
|
location_id?: string;
|
|
15358
15364
|
status?: "disponible" | "reservado" | "vendido";
|
|
15359
15365
|
vehicle_type?: "auto" | "camion" | "maquinaria" | "nautico";
|
|
@@ -15562,6 +15568,7 @@ interface paths {
|
|
|
15562
15568
|
* "updated_at": "2026-09-15T18:34:48.575Z",
|
|
15563
15569
|
* "live_sale_note": null,
|
|
15564
15570
|
* "active_reservation": null,
|
|
15571
|
+
* "sin_costo": true,
|
|
15565
15572
|
* "not_on_lot": false
|
|
15566
15573
|
* }
|
|
15567
15574
|
* }
|
|
@@ -15795,6 +15802,7 @@ interface paths {
|
|
|
15795
15802
|
* "updated_at": "2026-09-15T18:34:48.575Z",
|
|
15796
15803
|
* "live_sale_note": null,
|
|
15797
15804
|
* "active_reservation": null,
|
|
15805
|
+
* "sin_costo": true,
|
|
15798
15806
|
* "not_on_lot": false
|
|
15799
15807
|
* }
|
|
15800
15808
|
* }
|
|
@@ -16065,6 +16073,7 @@ interface paths {
|
|
|
16065
16073
|
* "updated_at": "2026-09-15T18:34:48.575Z",
|
|
16066
16074
|
* "live_sale_note": null,
|
|
16067
16075
|
* "active_reservation": null,
|
|
16076
|
+
* "sin_costo": true,
|
|
16068
16077
|
* "not_on_lot": false
|
|
16069
16078
|
* }
|
|
16070
16079
|
* }
|
|
@@ -16257,6 +16266,7 @@ interface paths {
|
|
|
16257
16266
|
* "updated_at": "2026-09-15T18:34:48.575Z",
|
|
16258
16267
|
* "live_sale_note": null,
|
|
16259
16268
|
* "active_reservation": null,
|
|
16269
|
+
* "sin_costo": true,
|
|
16260
16270
|
* "not_on_lot": false
|
|
16261
16271
|
* }
|
|
16262
16272
|
* }
|
|
@@ -19958,6 +19968,28 @@ interface paths {
|
|
|
19958
19968
|
* "lost_reason": null,
|
|
19959
19969
|
* "lost_reason_source": null,
|
|
19960
19970
|
* "lost_reason_at": null,
|
|
19971
|
+
* "payment_method": "financing",
|
|
19972
|
+
* "down_payment_amount": 4000000,
|
|
19973
|
+
* "budget_max_amount": 11500000,
|
|
19974
|
+
* "has_trade_in": false,
|
|
19975
|
+
* "trade_in_description": null,
|
|
19976
|
+
* "offer_amount": null,
|
|
19977
|
+
* "offer_note": null,
|
|
19978
|
+
* "deal_terms_meta": {
|
|
19979
|
+
* "payment_method": {
|
|
19980
|
+
* "source": "ai",
|
|
19981
|
+
* "actor_id": null,
|
|
19982
|
+
* "actor_label": null,
|
|
19983
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
19984
|
+
* },
|
|
19985
|
+
* "down_payment_amount": {
|
|
19986
|
+
* "source": "human",
|
|
19987
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
19988
|
+
* "actor_label": "Camila Rojas",
|
|
19989
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
19990
|
+
* }
|
|
19991
|
+
* },
|
|
19992
|
+
* "deal_terms_suggestions": {},
|
|
19961
19993
|
* "closed_at": null,
|
|
19962
19994
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
19963
19995
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
@@ -20015,6 +20047,28 @@ interface paths {
|
|
|
20015
20047
|
* "lost_reason": null,
|
|
20016
20048
|
* "lost_reason_source": null,
|
|
20017
20049
|
* "lost_reason_at": null,
|
|
20050
|
+
* "payment_method": "financing",
|
|
20051
|
+
* "down_payment_amount": 4000000,
|
|
20052
|
+
* "budget_max_amount": 11500000,
|
|
20053
|
+
* "has_trade_in": false,
|
|
20054
|
+
* "trade_in_description": null,
|
|
20055
|
+
* "offer_amount": null,
|
|
20056
|
+
* "offer_note": null,
|
|
20057
|
+
* "deal_terms_meta": {
|
|
20058
|
+
* "payment_method": {
|
|
20059
|
+
* "source": "ai",
|
|
20060
|
+
* "actor_id": null,
|
|
20061
|
+
* "actor_label": null,
|
|
20062
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
20063
|
+
* },
|
|
20064
|
+
* "down_payment_amount": {
|
|
20065
|
+
* "source": "human",
|
|
20066
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
20067
|
+
* "actor_label": "Camila Rojas",
|
|
20068
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
20069
|
+
* }
|
|
20070
|
+
* },
|
|
20071
|
+
* "deal_terms_suggestions": {},
|
|
20018
20072
|
* "closed_at": null,
|
|
20019
20073
|
* "created_by": null,
|
|
20020
20074
|
* "created_at": "2026-09-19T09:12:44.000Z",
|
|
@@ -20212,6 +20266,28 @@ interface paths {
|
|
|
20212
20266
|
* "lost_reason": null,
|
|
20213
20267
|
* "lost_reason_source": null,
|
|
20214
20268
|
* "lost_reason_at": null,
|
|
20269
|
+
* "payment_method": "financing",
|
|
20270
|
+
* "down_payment_amount": 4000000,
|
|
20271
|
+
* "budget_max_amount": 11500000,
|
|
20272
|
+
* "has_trade_in": false,
|
|
20273
|
+
* "trade_in_description": null,
|
|
20274
|
+
* "offer_amount": null,
|
|
20275
|
+
* "offer_note": null,
|
|
20276
|
+
* "deal_terms_meta": {
|
|
20277
|
+
* "payment_method": {
|
|
20278
|
+
* "source": "ai",
|
|
20279
|
+
* "actor_id": null,
|
|
20280
|
+
* "actor_label": null,
|
|
20281
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
20282
|
+
* },
|
|
20283
|
+
* "down_payment_amount": {
|
|
20284
|
+
* "source": "human",
|
|
20285
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
20286
|
+
* "actor_label": "Camila Rojas",
|
|
20287
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
20288
|
+
* }
|
|
20289
|
+
* },
|
|
20290
|
+
* "deal_terms_suggestions": {},
|
|
20215
20291
|
* "closed_at": null,
|
|
20216
20292
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
20217
20293
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
@@ -20395,6 +20471,28 @@ interface paths {
|
|
|
20395
20471
|
* "lost_reason": null,
|
|
20396
20472
|
* "lost_reason_source": null,
|
|
20397
20473
|
* "lost_reason_at": null,
|
|
20474
|
+
* "payment_method": "financing",
|
|
20475
|
+
* "down_payment_amount": 4000000,
|
|
20476
|
+
* "budget_max_amount": 11500000,
|
|
20477
|
+
* "has_trade_in": false,
|
|
20478
|
+
* "trade_in_description": null,
|
|
20479
|
+
* "offer_amount": null,
|
|
20480
|
+
* "offer_note": null,
|
|
20481
|
+
* "deal_terms_meta": {
|
|
20482
|
+
* "payment_method": {
|
|
20483
|
+
* "source": "ai",
|
|
20484
|
+
* "actor_id": null,
|
|
20485
|
+
* "actor_label": null,
|
|
20486
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
20487
|
+
* },
|
|
20488
|
+
* "down_payment_amount": {
|
|
20489
|
+
* "source": "human",
|
|
20490
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
20491
|
+
* "actor_label": "Camila Rojas",
|
|
20492
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
20493
|
+
* }
|
|
20494
|
+
* },
|
|
20495
|
+
* "deal_terms_suggestions": {},
|
|
20398
20496
|
* "closed_at": null,
|
|
20399
20497
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
20400
20498
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
@@ -21088,6 +21186,28 @@ interface paths {
|
|
|
21088
21186
|
* "lost_reason": null,
|
|
21089
21187
|
* "lost_reason_source": null,
|
|
21090
21188
|
* "lost_reason_at": null,
|
|
21189
|
+
* "payment_method": "financing",
|
|
21190
|
+
* "down_payment_amount": 4000000,
|
|
21191
|
+
* "budget_max_amount": 11500000,
|
|
21192
|
+
* "has_trade_in": false,
|
|
21193
|
+
* "trade_in_description": null,
|
|
21194
|
+
* "offer_amount": null,
|
|
21195
|
+
* "offer_note": null,
|
|
21196
|
+
* "deal_terms_meta": {
|
|
21197
|
+
* "payment_method": {
|
|
21198
|
+
* "source": "ai",
|
|
21199
|
+
* "actor_id": null,
|
|
21200
|
+
* "actor_label": null,
|
|
21201
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
21202
|
+
* },
|
|
21203
|
+
* "down_payment_amount": {
|
|
21204
|
+
* "source": "human",
|
|
21205
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
21206
|
+
* "actor_label": "Camila Rojas",
|
|
21207
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
21208
|
+
* }
|
|
21209
|
+
* },
|
|
21210
|
+
* "deal_terms_suggestions": {},
|
|
21091
21211
|
* "closed_at": null,
|
|
21092
21212
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
21093
21213
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
@@ -21155,6 +21275,28 @@ interface paths {
|
|
|
21155
21275
|
* "lost_reason": null,
|
|
21156
21276
|
* "lost_reason_source": null,
|
|
21157
21277
|
* "lost_reason_at": null,
|
|
21278
|
+
* "payment_method": "financing",
|
|
21279
|
+
* "down_payment_amount": 4000000,
|
|
21280
|
+
* "budget_max_amount": 11500000,
|
|
21281
|
+
* "has_trade_in": false,
|
|
21282
|
+
* "trade_in_description": null,
|
|
21283
|
+
* "offer_amount": null,
|
|
21284
|
+
* "offer_note": null,
|
|
21285
|
+
* "deal_terms_meta": {
|
|
21286
|
+
* "payment_method": {
|
|
21287
|
+
* "source": "ai",
|
|
21288
|
+
* "actor_id": null,
|
|
21289
|
+
* "actor_label": null,
|
|
21290
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
21291
|
+
* },
|
|
21292
|
+
* "down_payment_amount": {
|
|
21293
|
+
* "source": "human",
|
|
21294
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
21295
|
+
* "actor_label": "Camila Rojas",
|
|
21296
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
21297
|
+
* }
|
|
21298
|
+
* },
|
|
21299
|
+
* "deal_terms_suggestions": {},
|
|
21158
21300
|
* "closed_at": null,
|
|
21159
21301
|
* "created_by": null,
|
|
21160
21302
|
* "created_at": "2026-09-19T09:12:44.000Z",
|
|
@@ -21435,6 +21577,28 @@ interface paths {
|
|
|
21435
21577
|
* "lost_reason": null,
|
|
21436
21578
|
* "lost_reason_source": null,
|
|
21437
21579
|
* "lost_reason_at": null,
|
|
21580
|
+
* "payment_method": "financing",
|
|
21581
|
+
* "down_payment_amount": 4000000,
|
|
21582
|
+
* "budget_max_amount": 11500000,
|
|
21583
|
+
* "has_trade_in": false,
|
|
21584
|
+
* "trade_in_description": null,
|
|
21585
|
+
* "offer_amount": null,
|
|
21586
|
+
* "offer_note": null,
|
|
21587
|
+
* "deal_terms_meta": {
|
|
21588
|
+
* "payment_method": {
|
|
21589
|
+
* "source": "ai",
|
|
21590
|
+
* "actor_id": null,
|
|
21591
|
+
* "actor_label": null,
|
|
21592
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
21593
|
+
* },
|
|
21594
|
+
* "down_payment_amount": {
|
|
21595
|
+
* "source": "human",
|
|
21596
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
21597
|
+
* "actor_label": "Camila Rojas",
|
|
21598
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
21599
|
+
* }
|
|
21600
|
+
* },
|
|
21601
|
+
* "deal_terms_suggestions": {},
|
|
21438
21602
|
* "closed_at": null,
|
|
21439
21603
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
21440
21604
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
@@ -21610,6 +21774,28 @@ interface paths {
|
|
|
21610
21774
|
* "lost_reason": null,
|
|
21611
21775
|
* "lost_reason_source": null,
|
|
21612
21776
|
* "lost_reason_at": null,
|
|
21777
|
+
* "payment_method": "financing",
|
|
21778
|
+
* "down_payment_amount": 4000000,
|
|
21779
|
+
* "budget_max_amount": 11500000,
|
|
21780
|
+
* "has_trade_in": false,
|
|
21781
|
+
* "trade_in_description": null,
|
|
21782
|
+
* "offer_amount": null,
|
|
21783
|
+
* "offer_note": null,
|
|
21784
|
+
* "deal_terms_meta": {
|
|
21785
|
+
* "payment_method": {
|
|
21786
|
+
* "source": "ai",
|
|
21787
|
+
* "actor_id": null,
|
|
21788
|
+
* "actor_label": null,
|
|
21789
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
21790
|
+
* },
|
|
21791
|
+
* "down_payment_amount": {
|
|
21792
|
+
* "source": "human",
|
|
21793
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
21794
|
+
* "actor_label": "Camila Rojas",
|
|
21795
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
21796
|
+
* }
|
|
21797
|
+
* },
|
|
21798
|
+
* "deal_terms_suggestions": {},
|
|
21613
21799
|
* "closed_at": null,
|
|
21614
21800
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
21615
21801
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
@@ -21952,7 +22138,7 @@ interface paths {
|
|
|
21952
22138
|
patch?: never;
|
|
21953
22139
|
trace?: never;
|
|
21954
22140
|
};
|
|
21955
|
-
"/leads/{id}/
|
|
22141
|
+
"/leads/{id}/deal-terms": {
|
|
21956
22142
|
parameters: {
|
|
21957
22143
|
query?: never;
|
|
21958
22144
|
header?: never;
|
|
@@ -21961,8 +22147,8 @@ interface paths {
|
|
|
21961
22147
|
};
|
|
21962
22148
|
get?: never;
|
|
21963
22149
|
/**
|
|
21964
|
-
*
|
|
21965
|
-
* @description
|
|
22150
|
+
* Set a lead's deal terms (human)
|
|
22151
|
+
* @description Deal terms are seven nullable, vertical-neutral facts: `payment_method` (`cash` | `financing` | `credit_card` | `debit_card` | `mixed`), `down_payment_amount`, `budget_max_amount`, `offer_amount` (in the lead's `value_currency`), `has_trade_in` (null = unknown, false = none), `trade_in_description`, `offer_note`. Each carries provenance in `deal_terms_meta` (`ai` | `human`); an AI writer never overwrites a human-owned field — a disagreeing AI reading is kept in `deal_terms_suggestions` instead. Every field in the body becomes human-owned (`source: human`, the caller as actor) and its pending suggestion is removed; `null` clears a value but keeps it human-owned, so the next AI read proposes instead of re-filling it. Accepting a suggestion is this call with the suggested value. Changes land on the lead's timeline as `deal_terms_changed`. Returns the Oportunidad `lead` object. `{id}` accepts the lead uuid or its ID visible (`L-89`) — the label is a lookup shortcut on the path only, never a value to store.
|
|
21966
22152
|
*/
|
|
21967
22153
|
put: {
|
|
21968
22154
|
parameters: {
|
|
@@ -21977,21 +22163,24 @@ interface paths {
|
|
|
21977
22163
|
content: {
|
|
21978
22164
|
/**
|
|
21979
22165
|
* @example {
|
|
21980
|
-
* "
|
|
21981
|
-
* "
|
|
22166
|
+
* "payment_method": "cash",
|
|
22167
|
+
* "offer_amount": 10800000
|
|
21982
22168
|
* }
|
|
21983
22169
|
*/
|
|
21984
22170
|
"application/json": {
|
|
21985
|
-
/**
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
22171
|
+
/** @enum {string|null} */
|
|
22172
|
+
payment_method?: "cash" | "financing" | "credit_card" | "debit_card" | "mixed" | null;
|
|
22173
|
+
down_payment_amount?: number | null;
|
|
22174
|
+
budget_max_amount?: number | null;
|
|
22175
|
+
has_trade_in?: boolean | null;
|
|
22176
|
+
trade_in_description?: string | null;
|
|
22177
|
+
offer_amount?: number | null;
|
|
22178
|
+
offer_note?: string | null;
|
|
21990
22179
|
};
|
|
21991
22180
|
};
|
|
21992
22181
|
};
|
|
21993
22182
|
responses: {
|
|
21994
|
-
/** @description
|
|
22183
|
+
/** @description Oportunidad lead */
|
|
21995
22184
|
200: {
|
|
21996
22185
|
headers: {
|
|
21997
22186
|
[name: string]: unknown;
|
|
@@ -21999,236 +22188,52 @@ interface paths {
|
|
|
21999
22188
|
content: {
|
|
22000
22189
|
/**
|
|
22001
22190
|
* @example {
|
|
22002
|
-
* "
|
|
22003
|
-
*
|
|
22004
|
-
*
|
|
22005
|
-
*
|
|
22006
|
-
*
|
|
22007
|
-
*
|
|
22008
|
-
* "
|
|
22009
|
-
* "
|
|
22010
|
-
*
|
|
22011
|
-
*
|
|
22012
|
-
* "
|
|
22013
|
-
* "
|
|
22014
|
-
*
|
|
22015
|
-
*
|
|
22016
|
-
*
|
|
22017
|
-
*
|
|
22018
|
-
*
|
|
22019
|
-
*
|
|
22020
|
-
*
|
|
22021
|
-
* "
|
|
22022
|
-
* "
|
|
22023
|
-
* "
|
|
22024
|
-
* "
|
|
22025
|
-
* "
|
|
22026
|
-
* "
|
|
22027
|
-
* "
|
|
22028
|
-
*
|
|
22029
|
-
*
|
|
22030
|
-
* "
|
|
22031
|
-
*
|
|
22032
|
-
*
|
|
22033
|
-
*
|
|
22034
|
-
*
|
|
22035
|
-
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
22036
|
-
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
22037
|
-
* "updated_at": "2026-09-22T08:39:25.338Z",
|
|
22038
|
-
* "last_activity_at": "2026-09-22T08:39:25.338Z",
|
|
22039
|
-
* "contact": {
|
|
22040
|
-
* "id": "22222222-0000-4000-8000-000000000001",
|
|
22041
|
-
* "name": "María González",
|
|
22042
|
-
* "email": "maria.gonzalez@example.cl",
|
|
22043
|
-
* "phone": "+56912345001"
|
|
22044
|
-
* },
|
|
22045
|
-
* "stage": {
|
|
22046
|
-
* "id": "55555555-0000-4000-8000-000000000002",
|
|
22047
|
-
* "name": "Contactado",
|
|
22048
|
-
* "slug": "contacted",
|
|
22049
|
-
* "position": 1,
|
|
22050
|
-
* "won_state": null,
|
|
22051
|
-
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
22191
|
+
* "id": "99999999-0000-4000-8000-000000000001",
|
|
22192
|
+
* "display_id": "L-89",
|
|
22193
|
+
* "title": "María — prueba de manejo Corolla 2022",
|
|
22194
|
+
* "status": "open",
|
|
22195
|
+
* "source": "mercadolibre",
|
|
22196
|
+
* "stage": {
|
|
22197
|
+
* "id": "55555555-0000-4000-8000-000000000001",
|
|
22198
|
+
* "name": "Contactado"
|
|
22199
|
+
* },
|
|
22200
|
+
* "pipeline": {
|
|
22201
|
+
* "id": "44444444-0000-4000-8000-000000000001",
|
|
22202
|
+
* "name": "Venta de vehículos"
|
|
22203
|
+
* },
|
|
22204
|
+
* "score": 72,
|
|
22205
|
+
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
22206
|
+
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
22207
|
+
* "temperature": "warm",
|
|
22208
|
+
* "value_currency": "CLP",
|
|
22209
|
+
* "deal_terms": {
|
|
22210
|
+
* "payment_method": "financing",
|
|
22211
|
+
* "down_payment_amount": 4000000,
|
|
22212
|
+
* "budget_max_amount": 11500000,
|
|
22213
|
+
* "has_trade_in": true,
|
|
22214
|
+
* "trade_in_description": "Chery Tiggo 2 Pro 2023, 32.000 km",
|
|
22215
|
+
* "offer_amount": 10500000,
|
|
22216
|
+
* "offer_note": "Financiado · pendiente de aprobación"
|
|
22217
|
+
* },
|
|
22218
|
+
* "deal_terms_meta": {
|
|
22219
|
+
* "payment_method": {
|
|
22220
|
+
* "source": "ai",
|
|
22221
|
+
* "actor_id": null,
|
|
22222
|
+
* "actor_label": null,
|
|
22223
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
22052
22224
|
* },
|
|
22053
|
-
* "
|
|
22054
|
-
* "
|
|
22055
|
-
* "
|
|
22056
|
-
* "
|
|
22225
|
+
* "offer_amount": {
|
|
22226
|
+
* "source": "human",
|
|
22227
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
22228
|
+
* "actor_label": "Camila Rojas",
|
|
22229
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
22057
22230
|
* }
|
|
22058
|
-
* }
|
|
22059
|
-
*
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
[key: string]: unknown;
|
|
22065
|
-
};
|
|
22066
|
-
};
|
|
22067
|
-
};
|
|
22068
|
-
};
|
|
22069
|
-
/** @description Validation error */
|
|
22070
|
-
400: {
|
|
22071
|
-
headers: {
|
|
22072
|
-
[name: string]: unknown;
|
|
22073
|
-
};
|
|
22074
|
-
content: {
|
|
22075
|
-
"application/json": components["schemas"]["Error"];
|
|
22076
|
-
};
|
|
22077
|
-
};
|
|
22078
|
-
/** @description Unauthorized */
|
|
22079
|
-
401: {
|
|
22080
|
-
headers: {
|
|
22081
|
-
[name: string]: unknown;
|
|
22082
|
-
};
|
|
22083
|
-
content: {
|
|
22084
|
-
"application/json": components["schemas"]["Error"];
|
|
22085
|
-
};
|
|
22086
|
-
};
|
|
22087
|
-
/** @description Forbidden */
|
|
22088
|
-
403: {
|
|
22089
|
-
headers: {
|
|
22090
|
-
[name: string]: unknown;
|
|
22091
|
-
};
|
|
22092
|
-
content: {
|
|
22093
|
-
"application/json": components["schemas"]["Error"];
|
|
22094
|
-
};
|
|
22095
|
-
};
|
|
22096
|
-
/** @description Not found */
|
|
22097
|
-
404: {
|
|
22098
|
-
headers: {
|
|
22099
|
-
[name: string]: unknown;
|
|
22100
|
-
};
|
|
22101
|
-
content: {
|
|
22102
|
-
"application/json": components["schemas"]["Error"];
|
|
22103
|
-
};
|
|
22104
|
-
};
|
|
22105
|
-
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
22106
|
-
409: {
|
|
22107
|
-
headers: {
|
|
22108
|
-
[name: string]: unknown;
|
|
22109
|
-
};
|
|
22110
|
-
content: {
|
|
22111
|
-
"application/json": components["schemas"]["Error"];
|
|
22112
|
-
};
|
|
22113
|
-
};
|
|
22114
|
-
/** @description Rate limited */
|
|
22115
|
-
429: {
|
|
22116
|
-
headers: {
|
|
22117
|
-
[name: string]: unknown;
|
|
22118
|
-
};
|
|
22119
|
-
content: {
|
|
22120
|
-
"application/json": components["schemas"]["Error"];
|
|
22121
|
-
};
|
|
22122
|
-
};
|
|
22123
|
-
};
|
|
22124
|
-
};
|
|
22125
|
-
post?: never;
|
|
22126
|
-
delete?: never;
|
|
22127
|
-
options?: never;
|
|
22128
|
-
head?: never;
|
|
22129
|
-
patch?: never;
|
|
22130
|
-
trace?: never;
|
|
22131
|
-
};
|
|
22132
|
-
"/leads/{id}/pipeline": {
|
|
22133
|
-
parameters: {
|
|
22134
|
-
query?: never;
|
|
22135
|
-
header?: never;
|
|
22136
|
-
path?: never;
|
|
22137
|
-
cookie?: never;
|
|
22138
|
-
};
|
|
22139
|
-
get?: never;
|
|
22140
|
-
/**
|
|
22141
|
-
* Move a lead to another board
|
|
22142
|
-
* @description Reclassifies the opportunity onto a different SALES board (400 for a ticket or vehicle board) and lands it on that board's first stage, re-deriving the lifecycle from the landing stage rather than leaving a closed lead parked in an open column. Emits `lead.pipeline_changed`, whose `changes` carries BOTH the board and the stage that moved with it; no separate `lead.stage_changed` fires, so a receiver never sees one board change twice.
|
|
22143
|
-
*/
|
|
22144
|
-
put: {
|
|
22145
|
-
parameters: {
|
|
22146
|
-
query?: never;
|
|
22147
|
-
header?: never;
|
|
22148
|
-
path: {
|
|
22149
|
-
id: string;
|
|
22150
|
-
};
|
|
22151
|
-
cookie?: never;
|
|
22152
|
-
};
|
|
22153
|
-
requestBody?: {
|
|
22154
|
-
content: {
|
|
22155
|
-
/**
|
|
22156
|
-
* @example {
|
|
22157
|
-
* "pipeline_id": "44444444-0000-4000-8000-000000000002",
|
|
22158
|
-
* "reason": "es una venta mayorista"
|
|
22159
|
-
* }
|
|
22160
|
-
*/
|
|
22161
|
-
"application/json": {
|
|
22162
|
-
/** Format: uuid */
|
|
22163
|
-
pipeline_id: string;
|
|
22164
|
-
reason?: string | null;
|
|
22165
|
-
};
|
|
22166
|
-
};
|
|
22167
|
-
};
|
|
22168
|
-
responses: {
|
|
22169
|
-
/** @description Lead */
|
|
22170
|
-
200: {
|
|
22171
|
-
headers: {
|
|
22172
|
-
[name: string]: unknown;
|
|
22173
|
-
};
|
|
22174
|
-
content: {
|
|
22175
|
-
/**
|
|
22176
|
-
* @example {
|
|
22177
|
-
* "data": {
|
|
22178
|
-
* "id": "99999999-0000-4000-8000-000000000001",
|
|
22179
|
-
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
22180
|
-
* "display_id": "L-89",
|
|
22181
|
-
* "display_seq": 89,
|
|
22182
|
-
* "title": "María — prueba de manejo Corolla 2022",
|
|
22183
|
-
* "notes": null,
|
|
22184
|
-
* "status": "open",
|
|
22185
|
-
* "source": "conversation",
|
|
22186
|
-
* "source_ref": null,
|
|
22187
|
-
* "intent": "buy",
|
|
22188
|
-
* "contact_id": "22222222-0000-4000-8000-000000000001",
|
|
22189
|
-
* "pipeline_id": "44444444-0000-4000-8000-000000000002",
|
|
22190
|
-
* "stage_id": "55555555-0000-4000-8000-000000000003",
|
|
22191
|
-
* "conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
22192
|
-
* "origin_conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
22193
|
-
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
22194
|
-
* "team_id": null,
|
|
22195
|
-
* "value_amount": 8990000,
|
|
22196
|
-
* "value_currency": "CLP",
|
|
22197
|
-
* "value_amount_close_confirmed_at": null,
|
|
22198
|
-
* "expected_close_at": "2026-10-15T00:00:00.000Z",
|
|
22199
|
-
* "score": 72,
|
|
22200
|
-
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
22201
|
-
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
22202
|
-
* "temperature": "warm",
|
|
22203
|
-
* "temperature_reason": "respondió pidiendo confirmar la hora y no ha vuelto a escribir",
|
|
22204
|
-
* "temperature_at": "2026-09-21T14:02:11.000Z",
|
|
22205
|
-
* "won_lost_reason": null,
|
|
22206
|
-
* "lost_reason": null,
|
|
22207
|
-
* "lost_reason_source": null,
|
|
22208
|
-
* "lost_reason_at": null,
|
|
22209
|
-
* "closed_at": null,
|
|
22210
|
-
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
22211
|
-
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
22212
|
-
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
22213
|
-
* "last_activity_at": "2026-09-21T14:02:11.000Z",
|
|
22214
|
-
* "contact": {
|
|
22215
|
-
* "id": "22222222-0000-4000-8000-000000000001",
|
|
22216
|
-
* "name": "María González",
|
|
22217
|
-
* "email": "maria.gonzalez@example.cl",
|
|
22218
|
-
* "phone": "+56912345001"
|
|
22219
|
-
* },
|
|
22220
|
-
* "stage": {
|
|
22221
|
-
* "id": "55555555-0000-4000-8000-000000000003",
|
|
22222
|
-
* "name": "Nuevo",
|
|
22223
|
-
* "slug": "new",
|
|
22224
|
-
* "position": 0,
|
|
22225
|
-
* "won_state": null,
|
|
22226
|
-
* "pipeline_id": "44444444-0000-4000-8000-000000000002"
|
|
22227
|
-
* },
|
|
22228
|
-
* "pipeline": {
|
|
22229
|
-
* "id": "44444444-0000-4000-8000-000000000002",
|
|
22230
|
-
* "kind": "sales",
|
|
22231
|
-
* "name": "Ventas mayoristas"
|
|
22231
|
+
* },
|
|
22232
|
+
* "deal_terms_suggestions": {
|
|
22233
|
+
* "offer_amount": {
|
|
22234
|
+
* "value": 10800000,
|
|
22235
|
+
* "reason": "subió la oferta a 10,8 millones",
|
|
22236
|
+
* "at": "2026-09-22T10:00:00.000Z"
|
|
22232
22237
|
* }
|
|
22233
22238
|
* }
|
|
22234
22239
|
* }
|
|
@@ -22304,7 +22309,7 @@ interface paths {
|
|
|
22304
22309
|
patch?: never;
|
|
22305
22310
|
trace?: never;
|
|
22306
22311
|
};
|
|
22307
|
-
"/leads/{id}/
|
|
22312
|
+
"/leads/{id}/deal-terms/suggestions/{field}": {
|
|
22308
22313
|
parameters: {
|
|
22309
22314
|
query?: never;
|
|
22310
22315
|
header?: never;
|
|
@@ -22312,37 +22317,25 @@ interface paths {
|
|
|
22312
22317
|
cookie?: never;
|
|
22313
22318
|
};
|
|
22314
22319
|
get?: never;
|
|
22320
|
+
put?: never;
|
|
22321
|
+
post?: never;
|
|
22315
22322
|
/**
|
|
22316
|
-
*
|
|
22317
|
-
* @description
|
|
22323
|
+
* Dismiss an AI deal-term suggestion (keep the human value)
|
|
22324
|
+
* @description «Mantener la mía»: removes the pending AI suggestion for one field and leaves the human value as it is. Idempotent — no suggestion is a no-op. Returns the Oportunidad `lead` object. `{id}` accepts the lead uuid or its ID visible (`L-89`) — the label is a lookup shortcut on the path only, never a value to store.
|
|
22318
22325
|
*/
|
|
22319
|
-
|
|
22326
|
+
delete: {
|
|
22320
22327
|
parameters: {
|
|
22321
22328
|
query?: never;
|
|
22322
22329
|
header?: never;
|
|
22323
22330
|
path: {
|
|
22324
22331
|
id: string;
|
|
22332
|
+
field: "payment_method" | "down_payment_amount" | "budget_max_amount" | "has_trade_in" | "trade_in_description" | "offer_amount" | "offer_note";
|
|
22325
22333
|
};
|
|
22326
22334
|
cookie?: never;
|
|
22327
22335
|
};
|
|
22328
|
-
requestBody?:
|
|
22329
|
-
content: {
|
|
22330
|
-
/**
|
|
22331
|
-
* @example {
|
|
22332
|
-
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
22333
|
-
* "team_id": "cccccccc-0000-4000-8000-000000000001"
|
|
22334
|
-
* }
|
|
22335
|
-
*/
|
|
22336
|
-
"application/json": {
|
|
22337
|
-
/** Format: uuid */
|
|
22338
|
-
owner_user_id?: string | null;
|
|
22339
|
-
/** Format: uuid */
|
|
22340
|
-
team_id?: string | null;
|
|
22341
|
-
};
|
|
22342
|
-
};
|
|
22343
|
-
};
|
|
22336
|
+
requestBody?: never;
|
|
22344
22337
|
responses: {
|
|
22345
|
-
/** @description
|
|
22338
|
+
/** @description Oportunidad lead */
|
|
22346
22339
|
200: {
|
|
22347
22340
|
headers: {
|
|
22348
22341
|
[name: string]: unknown;
|
|
@@ -22350,61 +22343,52 @@ interface paths {
|
|
|
22350
22343
|
content: {
|
|
22351
22344
|
/**
|
|
22352
22345
|
* @example {
|
|
22353
|
-
* "
|
|
22354
|
-
*
|
|
22355
|
-
*
|
|
22356
|
-
*
|
|
22357
|
-
*
|
|
22358
|
-
*
|
|
22359
|
-
* "
|
|
22360
|
-
* "
|
|
22361
|
-
*
|
|
22362
|
-
*
|
|
22363
|
-
* "
|
|
22364
|
-
* "
|
|
22365
|
-
*
|
|
22366
|
-
*
|
|
22367
|
-
*
|
|
22368
|
-
*
|
|
22369
|
-
*
|
|
22370
|
-
*
|
|
22371
|
-
*
|
|
22372
|
-
* "
|
|
22373
|
-
* "
|
|
22374
|
-
* "
|
|
22375
|
-
* "
|
|
22376
|
-
* "
|
|
22377
|
-
* "
|
|
22378
|
-
* "
|
|
22379
|
-
*
|
|
22380
|
-
*
|
|
22381
|
-
* "
|
|
22382
|
-
*
|
|
22383
|
-
*
|
|
22384
|
-
*
|
|
22385
|
-
*
|
|
22386
|
-
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
22387
|
-
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
22388
|
-
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
22389
|
-
* "last_activity_at": "2026-09-21T14:02:11.000Z",
|
|
22390
|
-
* "contact": {
|
|
22391
|
-
* "id": "22222222-0000-4000-8000-000000000001",
|
|
22392
|
-
* "name": "María González",
|
|
22393
|
-
* "email": "maria.gonzalez@example.cl",
|
|
22394
|
-
* "phone": "+56912345001"
|
|
22395
|
-
* },
|
|
22396
|
-
* "stage": {
|
|
22397
|
-
* "id": "55555555-0000-4000-8000-000000000001",
|
|
22398
|
-
* "name": "Nuevo",
|
|
22399
|
-
* "slug": "new",
|
|
22400
|
-
* "position": 0,
|
|
22401
|
-
* "won_state": null,
|
|
22402
|
-
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
22346
|
+
* "id": "99999999-0000-4000-8000-000000000001",
|
|
22347
|
+
* "display_id": "L-89",
|
|
22348
|
+
* "title": "María — prueba de manejo Corolla 2022",
|
|
22349
|
+
* "status": "open",
|
|
22350
|
+
* "source": "mercadolibre",
|
|
22351
|
+
* "stage": {
|
|
22352
|
+
* "id": "55555555-0000-4000-8000-000000000001",
|
|
22353
|
+
* "name": "Contactado"
|
|
22354
|
+
* },
|
|
22355
|
+
* "pipeline": {
|
|
22356
|
+
* "id": "44444444-0000-4000-8000-000000000001",
|
|
22357
|
+
* "name": "Venta de vehículos"
|
|
22358
|
+
* },
|
|
22359
|
+
* "score": 72,
|
|
22360
|
+
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
22361
|
+
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
22362
|
+
* "temperature": "warm",
|
|
22363
|
+
* "value_currency": "CLP",
|
|
22364
|
+
* "deal_terms": {
|
|
22365
|
+
* "payment_method": "financing",
|
|
22366
|
+
* "down_payment_amount": 4000000,
|
|
22367
|
+
* "budget_max_amount": 11500000,
|
|
22368
|
+
* "has_trade_in": true,
|
|
22369
|
+
* "trade_in_description": "Chery Tiggo 2 Pro 2023, 32.000 km",
|
|
22370
|
+
* "offer_amount": 10500000,
|
|
22371
|
+
* "offer_note": "Financiado · pendiente de aprobación"
|
|
22372
|
+
* },
|
|
22373
|
+
* "deal_terms_meta": {
|
|
22374
|
+
* "payment_method": {
|
|
22375
|
+
* "source": "ai",
|
|
22376
|
+
* "actor_id": null,
|
|
22377
|
+
* "actor_label": null,
|
|
22378
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
22403
22379
|
* },
|
|
22404
|
-
* "
|
|
22405
|
-
* "
|
|
22406
|
-
* "
|
|
22407
|
-
* "
|
|
22380
|
+
* "offer_amount": {
|
|
22381
|
+
* "source": "human",
|
|
22382
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
22383
|
+
* "actor_label": "Camila Rojas",
|
|
22384
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
22385
|
+
* }
|
|
22386
|
+
* },
|
|
22387
|
+
* "deal_terms_suggestions": {
|
|
22388
|
+
* "offer_amount": {
|
|
22389
|
+
* "value": 10800000,
|
|
22390
|
+
* "reason": "subió la oferta a 10,8 millones",
|
|
22391
|
+
* "at": "2026-09-22T10:00:00.000Z"
|
|
22408
22392
|
* }
|
|
22409
22393
|
* }
|
|
22410
22394
|
* }
|
|
@@ -22473,14 +22457,12 @@ interface paths {
|
|
|
22473
22457
|
};
|
|
22474
22458
|
};
|
|
22475
22459
|
};
|
|
22476
|
-
post?: never;
|
|
22477
|
-
delete?: never;
|
|
22478
22460
|
options?: never;
|
|
22479
22461
|
head?: never;
|
|
22480
22462
|
patch?: never;
|
|
22481
22463
|
trace?: never;
|
|
22482
22464
|
};
|
|
22483
|
-
"/leads/{id}/
|
|
22465
|
+
"/leads/{id}/review": {
|
|
22484
22466
|
parameters: {
|
|
22485
22467
|
query?: never;
|
|
22486
22468
|
header?: never;
|
|
@@ -22488,39 +22470,26 @@ interface paths {
|
|
|
22488
22470
|
cookie?: never;
|
|
22489
22471
|
};
|
|
22490
22472
|
get?: never;
|
|
22473
|
+
put?: never;
|
|
22491
22474
|
/**
|
|
22492
|
-
*
|
|
22493
|
-
* @description
|
|
22475
|
+
* Run the lead reviewer on this lead now
|
|
22476
|
+
* @description Synchronous (typically 5–20 s): the same lead-reviewer pass the background worker runs — score, temperature, the stage ladder (auto move or suggestion) and the deal terms the conversation states. Returns the Oportunidad `lead` object. At most once per lead per 60 s: a repeat answers 429 with `error.retry_after_seconds` (and a `Retry-After` header). 409 when lead review is off for the workspace or the lead is closed; 502 when the review could not complete. `{id}` accepts the lead uuid or its ID visible (`L-89`) — the label is a lookup shortcut on the path only, never a value to store.
|
|
22494
22477
|
*/
|
|
22495
|
-
|
|
22478
|
+
post: {
|
|
22496
22479
|
parameters: {
|
|
22497
22480
|
query?: never;
|
|
22498
|
-
header?:
|
|
22481
|
+
header?: {
|
|
22482
|
+
/** @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. */
|
|
22483
|
+
"Idempotency-Key"?: string;
|
|
22484
|
+
};
|
|
22499
22485
|
path: {
|
|
22500
22486
|
id: string;
|
|
22501
22487
|
};
|
|
22502
22488
|
cookie?: never;
|
|
22503
22489
|
};
|
|
22504
|
-
requestBody?:
|
|
22505
|
-
content: {
|
|
22506
|
-
/**
|
|
22507
|
-
* @example {
|
|
22508
|
-
* "reason": "cerró con financiamiento propio",
|
|
22509
|
-
* "value_amount": 8750000,
|
|
22510
|
-
* "value_currency": "CLP"
|
|
22511
|
-
* }
|
|
22512
|
-
*/
|
|
22513
|
-
"application/json": {
|
|
22514
|
-
/** @enum {string} */
|
|
22515
|
-
status?: "won" | "lost" | "unqualified" | "open";
|
|
22516
|
-
reason?: string | null;
|
|
22517
|
-
value_amount?: number | null;
|
|
22518
|
-
value_currency?: string | null;
|
|
22519
|
-
};
|
|
22520
|
-
};
|
|
22521
|
-
};
|
|
22490
|
+
requestBody?: never;
|
|
22522
22491
|
responses: {
|
|
22523
|
-
/** @description
|
|
22492
|
+
/** @description Oportunidad lead */
|
|
22524
22493
|
200: {
|
|
22525
22494
|
headers: {
|
|
22526
22495
|
[name: string]: unknown;
|
|
@@ -22528,61 +22497,52 @@ interface paths {
|
|
|
22528
22497
|
content: {
|
|
22529
22498
|
/**
|
|
22530
22499
|
* @example {
|
|
22531
|
-
* "
|
|
22532
|
-
*
|
|
22533
|
-
*
|
|
22534
|
-
*
|
|
22535
|
-
*
|
|
22536
|
-
*
|
|
22537
|
-
* "
|
|
22538
|
-
* "
|
|
22539
|
-
*
|
|
22540
|
-
*
|
|
22541
|
-
* "
|
|
22542
|
-
* "
|
|
22543
|
-
*
|
|
22544
|
-
*
|
|
22545
|
-
*
|
|
22546
|
-
*
|
|
22547
|
-
*
|
|
22548
|
-
*
|
|
22549
|
-
*
|
|
22550
|
-
* "
|
|
22551
|
-
* "
|
|
22552
|
-
* "
|
|
22553
|
-
* "
|
|
22554
|
-
* "
|
|
22555
|
-
* "
|
|
22556
|
-
* "
|
|
22557
|
-
*
|
|
22558
|
-
*
|
|
22559
|
-
* "
|
|
22560
|
-
*
|
|
22561
|
-
*
|
|
22562
|
-
*
|
|
22563
|
-
*
|
|
22564
|
-
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
22565
|
-
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
22566
|
-
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
22567
|
-
* "last_activity_at": "2026-09-21T14:02:11.000Z",
|
|
22568
|
-
* "contact": {
|
|
22569
|
-
* "id": "22222222-0000-4000-8000-000000000001",
|
|
22570
|
-
* "name": "María González",
|
|
22571
|
-
* "email": "maria.gonzalez@example.cl",
|
|
22572
|
-
* "phone": "+56912345001"
|
|
22573
|
-
* },
|
|
22574
|
-
* "stage": {
|
|
22575
|
-
* "id": "55555555-0000-4000-8000-000000000006",
|
|
22576
|
-
* "name": "Ganado",
|
|
22577
|
-
* "slug": "won",
|
|
22578
|
-
* "position": 6,
|
|
22579
|
-
* "won_state": "won",
|
|
22580
|
-
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
22500
|
+
* "id": "99999999-0000-4000-8000-000000000001",
|
|
22501
|
+
* "display_id": "L-89",
|
|
22502
|
+
* "title": "María — prueba de manejo Corolla 2022",
|
|
22503
|
+
* "status": "open",
|
|
22504
|
+
* "source": "mercadolibre",
|
|
22505
|
+
* "stage": {
|
|
22506
|
+
* "id": "55555555-0000-4000-8000-000000000001",
|
|
22507
|
+
* "name": "Contactado"
|
|
22508
|
+
* },
|
|
22509
|
+
* "pipeline": {
|
|
22510
|
+
* "id": "44444444-0000-4000-8000-000000000001",
|
|
22511
|
+
* "name": "Venta de vehículos"
|
|
22512
|
+
* },
|
|
22513
|
+
* "score": 72,
|
|
22514
|
+
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
22515
|
+
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
22516
|
+
* "temperature": "warm",
|
|
22517
|
+
* "value_currency": "CLP",
|
|
22518
|
+
* "deal_terms": {
|
|
22519
|
+
* "payment_method": "financing",
|
|
22520
|
+
* "down_payment_amount": 4000000,
|
|
22521
|
+
* "budget_max_amount": 11500000,
|
|
22522
|
+
* "has_trade_in": true,
|
|
22523
|
+
* "trade_in_description": "Chery Tiggo 2 Pro 2023, 32.000 km",
|
|
22524
|
+
* "offer_amount": 10500000,
|
|
22525
|
+
* "offer_note": "Financiado · pendiente de aprobación"
|
|
22526
|
+
* },
|
|
22527
|
+
* "deal_terms_meta": {
|
|
22528
|
+
* "payment_method": {
|
|
22529
|
+
* "source": "ai",
|
|
22530
|
+
* "actor_id": null,
|
|
22531
|
+
* "actor_label": null,
|
|
22532
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
22581
22533
|
* },
|
|
22582
|
-
* "
|
|
22583
|
-
* "
|
|
22584
|
-
* "
|
|
22585
|
-
* "
|
|
22534
|
+
* "offer_amount": {
|
|
22535
|
+
* "source": "human",
|
|
22536
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
22537
|
+
* "actor_label": "Camila Rojas",
|
|
22538
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
22539
|
+
* }
|
|
22540
|
+
* },
|
|
22541
|
+
* "deal_terms_suggestions": {
|
|
22542
|
+
* "offer_amount": {
|
|
22543
|
+
* "value": 10800000,
|
|
22544
|
+
* "reason": "subió la oferta a 10,8 millones",
|
|
22545
|
+
* "at": "2026-09-22T10:00:00.000Z"
|
|
22586
22546
|
* }
|
|
22587
22547
|
* }
|
|
22588
22548
|
* }
|
|
@@ -22651,14 +22611,13 @@ interface paths {
|
|
|
22651
22611
|
};
|
|
22652
22612
|
};
|
|
22653
22613
|
};
|
|
22654
|
-
post?: never;
|
|
22655
22614
|
delete?: never;
|
|
22656
22615
|
options?: never;
|
|
22657
22616
|
head?: never;
|
|
22658
22617
|
patch?: never;
|
|
22659
22618
|
trace?: never;
|
|
22660
22619
|
};
|
|
22661
|
-
"/leads/{id}/
|
|
22620
|
+
"/leads/{id}/stage": {
|
|
22662
22621
|
parameters: {
|
|
22663
22622
|
query?: never;
|
|
22664
22623
|
header?: never;
|
|
@@ -22667,8 +22626,8 @@ interface paths {
|
|
|
22667
22626
|
};
|
|
22668
22627
|
get?: never;
|
|
22669
22628
|
/**
|
|
22670
|
-
*
|
|
22671
|
-
* @description The
|
|
22629
|
+
* Move a lead to another stage
|
|
22630
|
+
* @description THE move. The target must be a stage of the lead's own board and must be reachable from the current one — a stage graph that forbids the hop is a 400. Landing on a terminal column re-derives the lifecycle from that stage's category, so dragging a card to «Ganado» closes the lead exactly as `PUT /leads/{id}/won` does. Emits `lead.stage_changed` with `changes.stage = { from, to }` and the author, plus the outcome Evento when the status actually flipped. A no-op move (already on that stage) emits nothing.
|
|
22672
22631
|
*/
|
|
22673
22632
|
put: {
|
|
22674
22633
|
parameters: {
|
|
@@ -22683,15 +22642,16 @@ interface paths {
|
|
|
22683
22642
|
content: {
|
|
22684
22643
|
/**
|
|
22685
22644
|
* @example {
|
|
22686
|
-
* "
|
|
22645
|
+
* "stage_id": "55555555-0000-4000-8000-000000000002",
|
|
22646
|
+
* "reason": "la llamamos y confirmó la hora"
|
|
22687
22647
|
* }
|
|
22688
22648
|
*/
|
|
22689
22649
|
"application/json": {
|
|
22690
|
-
/**
|
|
22691
|
-
|
|
22650
|
+
/** Format: uuid */
|
|
22651
|
+
stage_id: string;
|
|
22692
22652
|
reason?: string | null;
|
|
22693
|
-
|
|
22694
|
-
|
|
22653
|
+
/** Format: uuid */
|
|
22654
|
+
suggestion_id?: string;
|
|
22695
22655
|
};
|
|
22696
22656
|
};
|
|
22697
22657
|
};
|
|
@@ -22711,13 +22671,13 @@ interface paths {
|
|
|
22711
22671
|
* "display_seq": 89,
|
|
22712
22672
|
* "title": "María — prueba de manejo Corolla 2022",
|
|
22713
22673
|
* "notes": null,
|
|
22714
|
-
* "status": "
|
|
22674
|
+
* "status": "open",
|
|
22715
22675
|
* "source": "conversation",
|
|
22716
22676
|
* "source_ref": null,
|
|
22717
22677
|
* "intent": "buy",
|
|
22718
22678
|
* "contact_id": "22222222-0000-4000-8000-000000000001",
|
|
22719
22679
|
* "pipeline_id": "44444444-0000-4000-8000-000000000001",
|
|
22720
|
-
* "stage_id": "55555555-0000-4000-8000-
|
|
22680
|
+
* "stage_id": "55555555-0000-4000-8000-000000000002",
|
|
22721
22681
|
* "conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
22722
22682
|
* "origin_conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
22723
22683
|
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
@@ -22732,15 +22692,37 @@ interface paths {
|
|
|
22732
22692
|
* "temperature": "warm",
|
|
22733
22693
|
* "temperature_reason": "respondió pidiendo confirmar la hora y no ha vuelto a escribir",
|
|
22734
22694
|
* "temperature_at": "2026-09-21T14:02:11.000Z",
|
|
22735
|
-
* "won_lost_reason":
|
|
22736
|
-
* "lost_reason":
|
|
22737
|
-
* "lost_reason_source":
|
|
22738
|
-
* "lost_reason_at":
|
|
22739
|
-
* "
|
|
22695
|
+
* "won_lost_reason": null,
|
|
22696
|
+
* "lost_reason": null,
|
|
22697
|
+
* "lost_reason_source": null,
|
|
22698
|
+
* "lost_reason_at": null,
|
|
22699
|
+
* "payment_method": "financing",
|
|
22700
|
+
* "down_payment_amount": 4000000,
|
|
22701
|
+
* "budget_max_amount": 11500000,
|
|
22702
|
+
* "has_trade_in": false,
|
|
22703
|
+
* "trade_in_description": null,
|
|
22704
|
+
* "offer_amount": null,
|
|
22705
|
+
* "offer_note": null,
|
|
22706
|
+
* "deal_terms_meta": {
|
|
22707
|
+
* "payment_method": {
|
|
22708
|
+
* "source": "ai",
|
|
22709
|
+
* "actor_id": null,
|
|
22710
|
+
* "actor_label": null,
|
|
22711
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
22712
|
+
* },
|
|
22713
|
+
* "down_payment_amount": {
|
|
22714
|
+
* "source": "human",
|
|
22715
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
22716
|
+
* "actor_label": "Camila Rojas",
|
|
22717
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
22718
|
+
* }
|
|
22719
|
+
* },
|
|
22720
|
+
* "deal_terms_suggestions": {},
|
|
22721
|
+
* "closed_at": null,
|
|
22740
22722
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
22741
22723
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
22742
|
-
* "updated_at": "2026-09-
|
|
22743
|
-
* "last_activity_at": "2026-09-
|
|
22724
|
+
* "updated_at": "2026-09-22T08:39:25.338Z",
|
|
22725
|
+
* "last_activity_at": "2026-09-22T08:39:25.338Z",
|
|
22744
22726
|
* "contact": {
|
|
22745
22727
|
* "id": "22222222-0000-4000-8000-000000000001",
|
|
22746
22728
|
* "name": "María González",
|
|
@@ -22748,11 +22730,11 @@ interface paths {
|
|
|
22748
22730
|
* "phone": "+56912345001"
|
|
22749
22731
|
* },
|
|
22750
22732
|
* "stage": {
|
|
22751
|
-
* "id": "55555555-0000-4000-8000-
|
|
22752
|
-
* "name": "
|
|
22753
|
-
* "slug": "
|
|
22754
|
-
* "position":
|
|
22755
|
-
* "won_state":
|
|
22733
|
+
* "id": "55555555-0000-4000-8000-000000000002",
|
|
22734
|
+
* "name": "Contactado",
|
|
22735
|
+
* "slug": "contacted",
|
|
22736
|
+
* "position": 1,
|
|
22737
|
+
* "won_state": null,
|
|
22756
22738
|
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
22757
22739
|
* },
|
|
22758
22740
|
* "pipeline": {
|
|
@@ -22834,7 +22816,7 @@ interface paths {
|
|
|
22834
22816
|
patch?: never;
|
|
22835
22817
|
trace?: never;
|
|
22836
22818
|
};
|
|
22837
|
-
"/leads/{id}/
|
|
22819
|
+
"/leads/{id}/pipeline": {
|
|
22838
22820
|
parameters: {
|
|
22839
22821
|
query?: never;
|
|
22840
22822
|
header?: never;
|
|
@@ -22843,8 +22825,8 @@ interface paths {
|
|
|
22843
22825
|
};
|
|
22844
22826
|
get?: never;
|
|
22845
22827
|
/**
|
|
22846
|
-
*
|
|
22847
|
-
* @description
|
|
22828
|
+
* Move a lead to another board
|
|
22829
|
+
* @description Reclassifies the opportunity onto a different SALES board (400 for a ticket or vehicle board) and lands it on that board's first stage, re-deriving the lifecycle from the landing stage rather than leaving a closed lead parked in an open column. Emits `lead.pipeline_changed`, whose `changes` carries BOTH the board and the stage that moved with it; no separate `lead.stage_changed` fires, so a receiver never sees one board change twice.
|
|
22848
22830
|
*/
|
|
22849
22831
|
put: {
|
|
22850
22832
|
parameters: {
|
|
@@ -22859,15 +22841,14 @@ interface paths {
|
|
|
22859
22841
|
content: {
|
|
22860
22842
|
/**
|
|
22861
22843
|
* @example {
|
|
22862
|
-
* "
|
|
22844
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000002",
|
|
22845
|
+
* "reason": "es una venta mayorista"
|
|
22863
22846
|
* }
|
|
22864
22847
|
*/
|
|
22865
22848
|
"application/json": {
|
|
22866
|
-
/**
|
|
22867
|
-
|
|
22849
|
+
/** Format: uuid */
|
|
22850
|
+
pipeline_id: string;
|
|
22868
22851
|
reason?: string | null;
|
|
22869
|
-
value_amount?: number | null;
|
|
22870
|
-
value_currency?: string | null;
|
|
22871
22852
|
};
|
|
22872
22853
|
};
|
|
22873
22854
|
};
|
|
@@ -22887,12 +22868,12 @@ interface paths {
|
|
|
22887
22868
|
* "display_seq": 89,
|
|
22888
22869
|
* "title": "María — prueba de manejo Corolla 2022",
|
|
22889
22870
|
* "notes": null,
|
|
22890
|
-
* "status": "
|
|
22871
|
+
* "status": "open",
|
|
22891
22872
|
* "source": "conversation",
|
|
22892
22873
|
* "source_ref": null,
|
|
22893
22874
|
* "intent": "buy",
|
|
22894
22875
|
* "contact_id": "22222222-0000-4000-8000-000000000001",
|
|
22895
|
-
* "pipeline_id": "44444444-0000-4000-8000-
|
|
22876
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000002",
|
|
22896
22877
|
* "stage_id": "55555555-0000-4000-8000-000000000003",
|
|
22897
22878
|
* "conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
22898
22879
|
* "origin_conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
@@ -22908,11 +22889,33 @@ interface paths {
|
|
|
22908
22889
|
* "temperature": "warm",
|
|
22909
22890
|
* "temperature_reason": "respondió pidiendo confirmar la hora y no ha vuelto a escribir",
|
|
22910
22891
|
* "temperature_at": "2026-09-21T14:02:11.000Z",
|
|
22911
|
-
* "won_lost_reason":
|
|
22892
|
+
* "won_lost_reason": null,
|
|
22912
22893
|
* "lost_reason": null,
|
|
22913
22894
|
* "lost_reason_source": null,
|
|
22914
22895
|
* "lost_reason_at": null,
|
|
22915
|
-
* "
|
|
22896
|
+
* "payment_method": "financing",
|
|
22897
|
+
* "down_payment_amount": 4000000,
|
|
22898
|
+
* "budget_max_amount": 11500000,
|
|
22899
|
+
* "has_trade_in": false,
|
|
22900
|
+
* "trade_in_description": null,
|
|
22901
|
+
* "offer_amount": null,
|
|
22902
|
+
* "offer_note": null,
|
|
22903
|
+
* "deal_terms_meta": {
|
|
22904
|
+
* "payment_method": {
|
|
22905
|
+
* "source": "ai",
|
|
22906
|
+
* "actor_id": null,
|
|
22907
|
+
* "actor_label": null,
|
|
22908
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
22909
|
+
* },
|
|
22910
|
+
* "down_payment_amount": {
|
|
22911
|
+
* "source": "human",
|
|
22912
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
22913
|
+
* "actor_label": "Camila Rojas",
|
|
22914
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
22915
|
+
* }
|
|
22916
|
+
* },
|
|
22917
|
+
* "deal_terms_suggestions": {},
|
|
22918
|
+
* "closed_at": null,
|
|
22916
22919
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
22917
22920
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
22918
22921
|
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
@@ -22925,16 +22928,810 @@ interface paths {
|
|
|
22925
22928
|
* },
|
|
22926
22929
|
* "stage": {
|
|
22927
22930
|
* "id": "55555555-0000-4000-8000-000000000003",
|
|
22928
|
-
* "name": "
|
|
22929
|
-
* "slug": "
|
|
22930
|
-
* "position":
|
|
22931
|
+
* "name": "Nuevo",
|
|
22932
|
+
* "slug": "new",
|
|
22933
|
+
* "position": 0,
|
|
22931
22934
|
* "won_state": null,
|
|
22932
|
-
* "pipeline_id": "44444444-0000-4000-8000-
|
|
22935
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000002"
|
|
22933
22936
|
* },
|
|
22934
22937
|
* "pipeline": {
|
|
22935
|
-
* "id": "44444444-0000-4000-8000-
|
|
22938
|
+
* "id": "44444444-0000-4000-8000-000000000002",
|
|
22936
22939
|
* "kind": "sales",
|
|
22937
|
-
* "name": "Ventas"
|
|
22940
|
+
* "name": "Ventas mayoristas"
|
|
22941
|
+
* }
|
|
22942
|
+
* }
|
|
22943
|
+
* }
|
|
22944
|
+
*/
|
|
22945
|
+
"application/json": {
|
|
22946
|
+
data?: unknown;
|
|
22947
|
+
meta?: {
|
|
22948
|
+
[key: string]: unknown;
|
|
22949
|
+
};
|
|
22950
|
+
};
|
|
22951
|
+
};
|
|
22952
|
+
};
|
|
22953
|
+
/** @description Validation error */
|
|
22954
|
+
400: {
|
|
22955
|
+
headers: {
|
|
22956
|
+
[name: string]: unknown;
|
|
22957
|
+
};
|
|
22958
|
+
content: {
|
|
22959
|
+
"application/json": components["schemas"]["Error"];
|
|
22960
|
+
};
|
|
22961
|
+
};
|
|
22962
|
+
/** @description Unauthorized */
|
|
22963
|
+
401: {
|
|
22964
|
+
headers: {
|
|
22965
|
+
[name: string]: unknown;
|
|
22966
|
+
};
|
|
22967
|
+
content: {
|
|
22968
|
+
"application/json": components["schemas"]["Error"];
|
|
22969
|
+
};
|
|
22970
|
+
};
|
|
22971
|
+
/** @description Forbidden */
|
|
22972
|
+
403: {
|
|
22973
|
+
headers: {
|
|
22974
|
+
[name: string]: unknown;
|
|
22975
|
+
};
|
|
22976
|
+
content: {
|
|
22977
|
+
"application/json": components["schemas"]["Error"];
|
|
22978
|
+
};
|
|
22979
|
+
};
|
|
22980
|
+
/** @description Not found */
|
|
22981
|
+
404: {
|
|
22982
|
+
headers: {
|
|
22983
|
+
[name: string]: unknown;
|
|
22984
|
+
};
|
|
22985
|
+
content: {
|
|
22986
|
+
"application/json": components["schemas"]["Error"];
|
|
22987
|
+
};
|
|
22988
|
+
};
|
|
22989
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
22990
|
+
409: {
|
|
22991
|
+
headers: {
|
|
22992
|
+
[name: string]: unknown;
|
|
22993
|
+
};
|
|
22994
|
+
content: {
|
|
22995
|
+
"application/json": components["schemas"]["Error"];
|
|
22996
|
+
};
|
|
22997
|
+
};
|
|
22998
|
+
/** @description Rate limited */
|
|
22999
|
+
429: {
|
|
23000
|
+
headers: {
|
|
23001
|
+
[name: string]: unknown;
|
|
23002
|
+
};
|
|
23003
|
+
content: {
|
|
23004
|
+
"application/json": components["schemas"]["Error"];
|
|
23005
|
+
};
|
|
23006
|
+
};
|
|
23007
|
+
};
|
|
23008
|
+
};
|
|
23009
|
+
post?: never;
|
|
23010
|
+
delete?: never;
|
|
23011
|
+
options?: never;
|
|
23012
|
+
head?: never;
|
|
23013
|
+
patch?: never;
|
|
23014
|
+
trace?: never;
|
|
23015
|
+
};
|
|
23016
|
+
"/leads/{id}/assign": {
|
|
23017
|
+
parameters: {
|
|
23018
|
+
query?: never;
|
|
23019
|
+
header?: never;
|
|
23020
|
+
path?: never;
|
|
23021
|
+
cookie?: never;
|
|
23022
|
+
};
|
|
23023
|
+
get?: never;
|
|
23024
|
+
/**
|
|
23025
|
+
* Assign a lead to an owner or team
|
|
23026
|
+
* @description ONE ASSIGNEE OWNS THE WHOLE RELATIONSHIP: reassigning a lead moves every conversation linked to it, and their tickets, to the same person. Send `owner_user_id`, `team_id` or both; an omitted key leaves that side alone, and `null` clears it. A team with no owner draws from the team's rotation. Emits `lead.assigned`.
|
|
23027
|
+
*/
|
|
23028
|
+
put: {
|
|
23029
|
+
parameters: {
|
|
23030
|
+
query?: never;
|
|
23031
|
+
header?: never;
|
|
23032
|
+
path: {
|
|
23033
|
+
id: string;
|
|
23034
|
+
};
|
|
23035
|
+
cookie?: never;
|
|
23036
|
+
};
|
|
23037
|
+
requestBody?: {
|
|
23038
|
+
content: {
|
|
23039
|
+
/**
|
|
23040
|
+
* @example {
|
|
23041
|
+
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
23042
|
+
* "team_id": "cccccccc-0000-4000-8000-000000000001"
|
|
23043
|
+
* }
|
|
23044
|
+
*/
|
|
23045
|
+
"application/json": {
|
|
23046
|
+
/** Format: uuid */
|
|
23047
|
+
owner_user_id?: string | null;
|
|
23048
|
+
/** Format: uuid */
|
|
23049
|
+
team_id?: string | null;
|
|
23050
|
+
};
|
|
23051
|
+
};
|
|
23052
|
+
};
|
|
23053
|
+
responses: {
|
|
23054
|
+
/** @description Lead */
|
|
23055
|
+
200: {
|
|
23056
|
+
headers: {
|
|
23057
|
+
[name: string]: unknown;
|
|
23058
|
+
};
|
|
23059
|
+
content: {
|
|
23060
|
+
/**
|
|
23061
|
+
* @example {
|
|
23062
|
+
* "data": {
|
|
23063
|
+
* "id": "99999999-0000-4000-8000-000000000001",
|
|
23064
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
23065
|
+
* "display_id": "L-89",
|
|
23066
|
+
* "display_seq": 89,
|
|
23067
|
+
* "title": "María — prueba de manejo Corolla 2022",
|
|
23068
|
+
* "notes": null,
|
|
23069
|
+
* "status": "open",
|
|
23070
|
+
* "source": "conversation",
|
|
23071
|
+
* "source_ref": null,
|
|
23072
|
+
* "intent": "buy",
|
|
23073
|
+
* "contact_id": "22222222-0000-4000-8000-000000000001",
|
|
23074
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001",
|
|
23075
|
+
* "stage_id": "55555555-0000-4000-8000-000000000001",
|
|
23076
|
+
* "conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23077
|
+
* "origin_conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23078
|
+
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
23079
|
+
* "team_id": "cccccccc-0000-4000-8000-000000000001",
|
|
23080
|
+
* "value_amount": 8990000,
|
|
23081
|
+
* "value_currency": "CLP",
|
|
23082
|
+
* "value_amount_close_confirmed_at": null,
|
|
23083
|
+
* "expected_close_at": "2026-10-15T00:00:00.000Z",
|
|
23084
|
+
* "score": 72,
|
|
23085
|
+
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
23086
|
+
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
23087
|
+
* "temperature": "warm",
|
|
23088
|
+
* "temperature_reason": "respondió pidiendo confirmar la hora y no ha vuelto a escribir",
|
|
23089
|
+
* "temperature_at": "2026-09-21T14:02:11.000Z",
|
|
23090
|
+
* "won_lost_reason": null,
|
|
23091
|
+
* "lost_reason": null,
|
|
23092
|
+
* "lost_reason_source": null,
|
|
23093
|
+
* "lost_reason_at": null,
|
|
23094
|
+
* "payment_method": "financing",
|
|
23095
|
+
* "down_payment_amount": 4000000,
|
|
23096
|
+
* "budget_max_amount": 11500000,
|
|
23097
|
+
* "has_trade_in": false,
|
|
23098
|
+
* "trade_in_description": null,
|
|
23099
|
+
* "offer_amount": null,
|
|
23100
|
+
* "offer_note": null,
|
|
23101
|
+
* "deal_terms_meta": {
|
|
23102
|
+
* "payment_method": {
|
|
23103
|
+
* "source": "ai",
|
|
23104
|
+
* "actor_id": null,
|
|
23105
|
+
* "actor_label": null,
|
|
23106
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
23107
|
+
* },
|
|
23108
|
+
* "down_payment_amount": {
|
|
23109
|
+
* "source": "human",
|
|
23110
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
23111
|
+
* "actor_label": "Camila Rojas",
|
|
23112
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
23113
|
+
* }
|
|
23114
|
+
* },
|
|
23115
|
+
* "deal_terms_suggestions": {},
|
|
23116
|
+
* "closed_at": null,
|
|
23117
|
+
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
23118
|
+
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
23119
|
+
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
23120
|
+
* "last_activity_at": "2026-09-21T14:02:11.000Z",
|
|
23121
|
+
* "contact": {
|
|
23122
|
+
* "id": "22222222-0000-4000-8000-000000000001",
|
|
23123
|
+
* "name": "María González",
|
|
23124
|
+
* "email": "maria.gonzalez@example.cl",
|
|
23125
|
+
* "phone": "+56912345001"
|
|
23126
|
+
* },
|
|
23127
|
+
* "stage": {
|
|
23128
|
+
* "id": "55555555-0000-4000-8000-000000000001",
|
|
23129
|
+
* "name": "Nuevo",
|
|
23130
|
+
* "slug": "new",
|
|
23131
|
+
* "position": 0,
|
|
23132
|
+
* "won_state": null,
|
|
23133
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
23134
|
+
* },
|
|
23135
|
+
* "pipeline": {
|
|
23136
|
+
* "id": "44444444-0000-4000-8000-000000000001",
|
|
23137
|
+
* "kind": "sales",
|
|
23138
|
+
* "name": "Ventas"
|
|
23139
|
+
* }
|
|
23140
|
+
* }
|
|
23141
|
+
* }
|
|
23142
|
+
*/
|
|
23143
|
+
"application/json": {
|
|
23144
|
+
data?: unknown;
|
|
23145
|
+
meta?: {
|
|
23146
|
+
[key: string]: unknown;
|
|
23147
|
+
};
|
|
23148
|
+
};
|
|
23149
|
+
};
|
|
23150
|
+
};
|
|
23151
|
+
/** @description Validation error */
|
|
23152
|
+
400: {
|
|
23153
|
+
headers: {
|
|
23154
|
+
[name: string]: unknown;
|
|
23155
|
+
};
|
|
23156
|
+
content: {
|
|
23157
|
+
"application/json": components["schemas"]["Error"];
|
|
23158
|
+
};
|
|
23159
|
+
};
|
|
23160
|
+
/** @description Unauthorized */
|
|
23161
|
+
401: {
|
|
23162
|
+
headers: {
|
|
23163
|
+
[name: string]: unknown;
|
|
23164
|
+
};
|
|
23165
|
+
content: {
|
|
23166
|
+
"application/json": components["schemas"]["Error"];
|
|
23167
|
+
};
|
|
23168
|
+
};
|
|
23169
|
+
/** @description Forbidden */
|
|
23170
|
+
403: {
|
|
23171
|
+
headers: {
|
|
23172
|
+
[name: string]: unknown;
|
|
23173
|
+
};
|
|
23174
|
+
content: {
|
|
23175
|
+
"application/json": components["schemas"]["Error"];
|
|
23176
|
+
};
|
|
23177
|
+
};
|
|
23178
|
+
/** @description Not found */
|
|
23179
|
+
404: {
|
|
23180
|
+
headers: {
|
|
23181
|
+
[name: string]: unknown;
|
|
23182
|
+
};
|
|
23183
|
+
content: {
|
|
23184
|
+
"application/json": components["schemas"]["Error"];
|
|
23185
|
+
};
|
|
23186
|
+
};
|
|
23187
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
23188
|
+
409: {
|
|
23189
|
+
headers: {
|
|
23190
|
+
[name: string]: unknown;
|
|
23191
|
+
};
|
|
23192
|
+
content: {
|
|
23193
|
+
"application/json": components["schemas"]["Error"];
|
|
23194
|
+
};
|
|
23195
|
+
};
|
|
23196
|
+
/** @description Rate limited */
|
|
23197
|
+
429: {
|
|
23198
|
+
headers: {
|
|
23199
|
+
[name: string]: unknown;
|
|
23200
|
+
};
|
|
23201
|
+
content: {
|
|
23202
|
+
"application/json": components["schemas"]["Error"];
|
|
23203
|
+
};
|
|
23204
|
+
};
|
|
23205
|
+
};
|
|
23206
|
+
};
|
|
23207
|
+
post?: never;
|
|
23208
|
+
delete?: never;
|
|
23209
|
+
options?: never;
|
|
23210
|
+
head?: never;
|
|
23211
|
+
patch?: never;
|
|
23212
|
+
trace?: never;
|
|
23213
|
+
};
|
|
23214
|
+
"/leads/{id}/won": {
|
|
23215
|
+
parameters: {
|
|
23216
|
+
query?: never;
|
|
23217
|
+
header?: never;
|
|
23218
|
+
path?: never;
|
|
23219
|
+
cookie?: never;
|
|
23220
|
+
};
|
|
23221
|
+
get?: never;
|
|
23222
|
+
/**
|
|
23223
|
+
* Mark a lead as won
|
|
23224
|
+
* @description The opportunity closed in the workspace's favour. The lead MOVES to the lowest-position stage of that category on its board, so the outcome and the column can never disagree — 400 when the board has no stage of that category, which is a board a person has to fix rather than a request to retry. `status`, `closed_at` and `won_lost_reason` are derived from the landing stage, and a `lead.stage_changed` Evento fires alongside the outcome one. `value_amount` here is the REAL closing figure — distinct from any earlier estimate on the lead — and is the only status endpoint that acts on it: it overwrites the value and stamps `value_amount_close_confirmed_at`. Omit it to leave the estimate untouched. Emits `lead.won`.
|
|
23225
|
+
*/
|
|
23226
|
+
put: {
|
|
23227
|
+
parameters: {
|
|
23228
|
+
query?: never;
|
|
23229
|
+
header?: never;
|
|
23230
|
+
path: {
|
|
23231
|
+
id: string;
|
|
23232
|
+
};
|
|
23233
|
+
cookie?: never;
|
|
23234
|
+
};
|
|
23235
|
+
requestBody?: {
|
|
23236
|
+
content: {
|
|
23237
|
+
/**
|
|
23238
|
+
* @example {
|
|
23239
|
+
* "reason": "cerró con financiamiento propio",
|
|
23240
|
+
* "value_amount": 8750000,
|
|
23241
|
+
* "value_currency": "CLP"
|
|
23242
|
+
* }
|
|
23243
|
+
*/
|
|
23244
|
+
"application/json": {
|
|
23245
|
+
/** @enum {string} */
|
|
23246
|
+
status?: "won" | "lost" | "unqualified" | "open";
|
|
23247
|
+
reason?: string | null;
|
|
23248
|
+
value_amount?: number | null;
|
|
23249
|
+
value_currency?: string | null;
|
|
23250
|
+
};
|
|
23251
|
+
};
|
|
23252
|
+
};
|
|
23253
|
+
responses: {
|
|
23254
|
+
/** @description Lead */
|
|
23255
|
+
200: {
|
|
23256
|
+
headers: {
|
|
23257
|
+
[name: string]: unknown;
|
|
23258
|
+
};
|
|
23259
|
+
content: {
|
|
23260
|
+
/**
|
|
23261
|
+
* @example {
|
|
23262
|
+
* "data": {
|
|
23263
|
+
* "id": "99999999-0000-4000-8000-000000000001",
|
|
23264
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
23265
|
+
* "display_id": "L-89",
|
|
23266
|
+
* "display_seq": 89,
|
|
23267
|
+
* "title": "María — prueba de manejo Corolla 2022",
|
|
23268
|
+
* "notes": null,
|
|
23269
|
+
* "status": "won",
|
|
23270
|
+
* "source": "conversation",
|
|
23271
|
+
* "source_ref": null,
|
|
23272
|
+
* "intent": "buy",
|
|
23273
|
+
* "contact_id": "22222222-0000-4000-8000-000000000001",
|
|
23274
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001",
|
|
23275
|
+
* "stage_id": "55555555-0000-4000-8000-000000000006",
|
|
23276
|
+
* "conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23277
|
+
* "origin_conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23278
|
+
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
23279
|
+
* "team_id": null,
|
|
23280
|
+
* "value_amount": 8750000,
|
|
23281
|
+
* "value_currency": "CLP",
|
|
23282
|
+
* "value_amount_close_confirmed_at": "2026-09-22T08:41:32.967Z",
|
|
23283
|
+
* "expected_close_at": "2026-10-15T00:00:00.000Z",
|
|
23284
|
+
* "score": 72,
|
|
23285
|
+
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
23286
|
+
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
23287
|
+
* "temperature": "warm",
|
|
23288
|
+
* "temperature_reason": "respondió pidiendo confirmar la hora y no ha vuelto a escribir",
|
|
23289
|
+
* "temperature_at": "2026-09-21T14:02:11.000Z",
|
|
23290
|
+
* "won_lost_reason": "cerró con financiamiento propio",
|
|
23291
|
+
* "lost_reason": null,
|
|
23292
|
+
* "lost_reason_source": null,
|
|
23293
|
+
* "lost_reason_at": null,
|
|
23294
|
+
* "payment_method": "financing",
|
|
23295
|
+
* "down_payment_amount": 4000000,
|
|
23296
|
+
* "budget_max_amount": 11500000,
|
|
23297
|
+
* "has_trade_in": false,
|
|
23298
|
+
* "trade_in_description": null,
|
|
23299
|
+
* "offer_amount": null,
|
|
23300
|
+
* "offer_note": null,
|
|
23301
|
+
* "deal_terms_meta": {
|
|
23302
|
+
* "payment_method": {
|
|
23303
|
+
* "source": "ai",
|
|
23304
|
+
* "actor_id": null,
|
|
23305
|
+
* "actor_label": null,
|
|
23306
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
23307
|
+
* },
|
|
23308
|
+
* "down_payment_amount": {
|
|
23309
|
+
* "source": "human",
|
|
23310
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
23311
|
+
* "actor_label": "Camila Rojas",
|
|
23312
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
23313
|
+
* }
|
|
23314
|
+
* },
|
|
23315
|
+
* "deal_terms_suggestions": {},
|
|
23316
|
+
* "closed_at": "2026-09-22T08:41:32.977Z",
|
|
23317
|
+
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
23318
|
+
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
23319
|
+
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
23320
|
+
* "last_activity_at": "2026-09-21T14:02:11.000Z",
|
|
23321
|
+
* "contact": {
|
|
23322
|
+
* "id": "22222222-0000-4000-8000-000000000001",
|
|
23323
|
+
* "name": "María González",
|
|
23324
|
+
* "email": "maria.gonzalez@example.cl",
|
|
23325
|
+
* "phone": "+56912345001"
|
|
23326
|
+
* },
|
|
23327
|
+
* "stage": {
|
|
23328
|
+
* "id": "55555555-0000-4000-8000-000000000006",
|
|
23329
|
+
* "name": "Ganado",
|
|
23330
|
+
* "slug": "won",
|
|
23331
|
+
* "position": 6,
|
|
23332
|
+
* "won_state": "won",
|
|
23333
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
23334
|
+
* },
|
|
23335
|
+
* "pipeline": {
|
|
23336
|
+
* "id": "44444444-0000-4000-8000-000000000001",
|
|
23337
|
+
* "kind": "sales",
|
|
23338
|
+
* "name": "Ventas"
|
|
23339
|
+
* }
|
|
23340
|
+
* }
|
|
23341
|
+
* }
|
|
23342
|
+
*/
|
|
23343
|
+
"application/json": {
|
|
23344
|
+
data?: unknown;
|
|
23345
|
+
meta?: {
|
|
23346
|
+
[key: string]: unknown;
|
|
23347
|
+
};
|
|
23348
|
+
};
|
|
23349
|
+
};
|
|
23350
|
+
};
|
|
23351
|
+
/** @description Validation error */
|
|
23352
|
+
400: {
|
|
23353
|
+
headers: {
|
|
23354
|
+
[name: string]: unknown;
|
|
23355
|
+
};
|
|
23356
|
+
content: {
|
|
23357
|
+
"application/json": components["schemas"]["Error"];
|
|
23358
|
+
};
|
|
23359
|
+
};
|
|
23360
|
+
/** @description Unauthorized */
|
|
23361
|
+
401: {
|
|
23362
|
+
headers: {
|
|
23363
|
+
[name: string]: unknown;
|
|
23364
|
+
};
|
|
23365
|
+
content: {
|
|
23366
|
+
"application/json": components["schemas"]["Error"];
|
|
23367
|
+
};
|
|
23368
|
+
};
|
|
23369
|
+
/** @description Forbidden */
|
|
23370
|
+
403: {
|
|
23371
|
+
headers: {
|
|
23372
|
+
[name: string]: unknown;
|
|
23373
|
+
};
|
|
23374
|
+
content: {
|
|
23375
|
+
"application/json": components["schemas"]["Error"];
|
|
23376
|
+
};
|
|
23377
|
+
};
|
|
23378
|
+
/** @description Not found */
|
|
23379
|
+
404: {
|
|
23380
|
+
headers: {
|
|
23381
|
+
[name: string]: unknown;
|
|
23382
|
+
};
|
|
23383
|
+
content: {
|
|
23384
|
+
"application/json": components["schemas"]["Error"];
|
|
23385
|
+
};
|
|
23386
|
+
};
|
|
23387
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
23388
|
+
409: {
|
|
23389
|
+
headers: {
|
|
23390
|
+
[name: string]: unknown;
|
|
23391
|
+
};
|
|
23392
|
+
content: {
|
|
23393
|
+
"application/json": components["schemas"]["Error"];
|
|
23394
|
+
};
|
|
23395
|
+
};
|
|
23396
|
+
/** @description Rate limited */
|
|
23397
|
+
429: {
|
|
23398
|
+
headers: {
|
|
23399
|
+
[name: string]: unknown;
|
|
23400
|
+
};
|
|
23401
|
+
content: {
|
|
23402
|
+
"application/json": components["schemas"]["Error"];
|
|
23403
|
+
};
|
|
23404
|
+
};
|
|
23405
|
+
};
|
|
23406
|
+
};
|
|
23407
|
+
post?: never;
|
|
23408
|
+
delete?: never;
|
|
23409
|
+
options?: never;
|
|
23410
|
+
head?: never;
|
|
23411
|
+
patch?: never;
|
|
23412
|
+
trace?: never;
|
|
23413
|
+
};
|
|
23414
|
+
"/leads/{id}/lost": {
|
|
23415
|
+
parameters: {
|
|
23416
|
+
query?: never;
|
|
23417
|
+
header?: never;
|
|
23418
|
+
path?: never;
|
|
23419
|
+
cookie?: never;
|
|
23420
|
+
};
|
|
23421
|
+
get?: never;
|
|
23422
|
+
/**
|
|
23423
|
+
* Mark a lead as lost
|
|
23424
|
+
* @description The opportunity was real and did not close. The lead MOVES to the lowest-position stage of that category on its board, so the outcome and the column can never disagree — 400 when the board has no stage of that category, which is a board a person has to fix rather than a request to retry. `status`, `closed_at` and `won_lost_reason` are derived from the landing stage, and a `lead.stage_changed` Evento fires alongside the outcome one. `reason` is the one field worth filling: it is what the win-rate and funnel reads are read against. Emits `lead.lost`.
|
|
23425
|
+
*/
|
|
23426
|
+
put: {
|
|
23427
|
+
parameters: {
|
|
23428
|
+
query?: never;
|
|
23429
|
+
header?: never;
|
|
23430
|
+
path: {
|
|
23431
|
+
id: string;
|
|
23432
|
+
};
|
|
23433
|
+
cookie?: never;
|
|
23434
|
+
};
|
|
23435
|
+
requestBody?: {
|
|
23436
|
+
content: {
|
|
23437
|
+
/**
|
|
23438
|
+
* @example {
|
|
23439
|
+
* "reason": "compró en otra parte"
|
|
23440
|
+
* }
|
|
23441
|
+
*/
|
|
23442
|
+
"application/json": {
|
|
23443
|
+
/** @enum {string} */
|
|
23444
|
+
status?: "won" | "lost" | "unqualified" | "open";
|
|
23445
|
+
reason?: string | null;
|
|
23446
|
+
value_amount?: number | null;
|
|
23447
|
+
value_currency?: string | null;
|
|
23448
|
+
};
|
|
23449
|
+
};
|
|
23450
|
+
};
|
|
23451
|
+
responses: {
|
|
23452
|
+
/** @description Lead */
|
|
23453
|
+
200: {
|
|
23454
|
+
headers: {
|
|
23455
|
+
[name: string]: unknown;
|
|
23456
|
+
};
|
|
23457
|
+
content: {
|
|
23458
|
+
/**
|
|
23459
|
+
* @example {
|
|
23460
|
+
* "data": {
|
|
23461
|
+
* "id": "99999999-0000-4000-8000-000000000001",
|
|
23462
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
23463
|
+
* "display_id": "L-89",
|
|
23464
|
+
* "display_seq": 89,
|
|
23465
|
+
* "title": "María — prueba de manejo Corolla 2022",
|
|
23466
|
+
* "notes": null,
|
|
23467
|
+
* "status": "lost",
|
|
23468
|
+
* "source": "conversation",
|
|
23469
|
+
* "source_ref": null,
|
|
23470
|
+
* "intent": "buy",
|
|
23471
|
+
* "contact_id": "22222222-0000-4000-8000-000000000001",
|
|
23472
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001",
|
|
23473
|
+
* "stage_id": "55555555-0000-4000-8000-000000000007",
|
|
23474
|
+
* "conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23475
|
+
* "origin_conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23476
|
+
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
23477
|
+
* "team_id": null,
|
|
23478
|
+
* "value_amount": 8990000,
|
|
23479
|
+
* "value_currency": "CLP",
|
|
23480
|
+
* "value_amount_close_confirmed_at": null,
|
|
23481
|
+
* "expected_close_at": "2026-10-15T00:00:00.000Z",
|
|
23482
|
+
* "score": 72,
|
|
23483
|
+
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
23484
|
+
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
23485
|
+
* "temperature": "warm",
|
|
23486
|
+
* "temperature_reason": "respondió pidiendo confirmar la hora y no ha vuelto a escribir",
|
|
23487
|
+
* "temperature_at": "2026-09-21T14:02:11.000Z",
|
|
23488
|
+
* "won_lost_reason": "compró en otra parte",
|
|
23489
|
+
* "lost_reason": "bought_elsewhere",
|
|
23490
|
+
* "lost_reason_source": "jev",
|
|
23491
|
+
* "lost_reason_at": "2026-09-22T08:44:12.501Z",
|
|
23492
|
+
* "payment_method": "financing",
|
|
23493
|
+
* "down_payment_amount": 4000000,
|
|
23494
|
+
* "budget_max_amount": 11500000,
|
|
23495
|
+
* "has_trade_in": false,
|
|
23496
|
+
* "trade_in_description": null,
|
|
23497
|
+
* "offer_amount": null,
|
|
23498
|
+
* "offer_note": null,
|
|
23499
|
+
* "deal_terms_meta": {
|
|
23500
|
+
* "payment_method": {
|
|
23501
|
+
* "source": "ai",
|
|
23502
|
+
* "actor_id": null,
|
|
23503
|
+
* "actor_label": null,
|
|
23504
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
23505
|
+
* },
|
|
23506
|
+
* "down_payment_amount": {
|
|
23507
|
+
* "source": "human",
|
|
23508
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
23509
|
+
* "actor_label": "Camila Rojas",
|
|
23510
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
23511
|
+
* }
|
|
23512
|
+
* },
|
|
23513
|
+
* "deal_terms_suggestions": {},
|
|
23514
|
+
* "closed_at": "2026-09-22T08:44:10.331Z",
|
|
23515
|
+
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
23516
|
+
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
23517
|
+
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
23518
|
+
* "last_activity_at": "2026-09-21T14:02:11.000Z",
|
|
23519
|
+
* "contact": {
|
|
23520
|
+
* "id": "22222222-0000-4000-8000-000000000001",
|
|
23521
|
+
* "name": "María González",
|
|
23522
|
+
* "email": "maria.gonzalez@example.cl",
|
|
23523
|
+
* "phone": "+56912345001"
|
|
23524
|
+
* },
|
|
23525
|
+
* "stage": {
|
|
23526
|
+
* "id": "55555555-0000-4000-8000-000000000007",
|
|
23527
|
+
* "name": "Perdido",
|
|
23528
|
+
* "slug": "lost",
|
|
23529
|
+
* "position": 7,
|
|
23530
|
+
* "won_state": "lost",
|
|
23531
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
23532
|
+
* },
|
|
23533
|
+
* "pipeline": {
|
|
23534
|
+
* "id": "44444444-0000-4000-8000-000000000001",
|
|
23535
|
+
* "kind": "sales",
|
|
23536
|
+
* "name": "Ventas"
|
|
23537
|
+
* }
|
|
23538
|
+
* }
|
|
23539
|
+
* }
|
|
23540
|
+
*/
|
|
23541
|
+
"application/json": {
|
|
23542
|
+
data?: unknown;
|
|
23543
|
+
meta?: {
|
|
23544
|
+
[key: string]: unknown;
|
|
23545
|
+
};
|
|
23546
|
+
};
|
|
23547
|
+
};
|
|
23548
|
+
};
|
|
23549
|
+
/** @description Validation error */
|
|
23550
|
+
400: {
|
|
23551
|
+
headers: {
|
|
23552
|
+
[name: string]: unknown;
|
|
23553
|
+
};
|
|
23554
|
+
content: {
|
|
23555
|
+
"application/json": components["schemas"]["Error"];
|
|
23556
|
+
};
|
|
23557
|
+
};
|
|
23558
|
+
/** @description Unauthorized */
|
|
23559
|
+
401: {
|
|
23560
|
+
headers: {
|
|
23561
|
+
[name: string]: unknown;
|
|
23562
|
+
};
|
|
23563
|
+
content: {
|
|
23564
|
+
"application/json": components["schemas"]["Error"];
|
|
23565
|
+
};
|
|
23566
|
+
};
|
|
23567
|
+
/** @description Forbidden */
|
|
23568
|
+
403: {
|
|
23569
|
+
headers: {
|
|
23570
|
+
[name: string]: unknown;
|
|
23571
|
+
};
|
|
23572
|
+
content: {
|
|
23573
|
+
"application/json": components["schemas"]["Error"];
|
|
23574
|
+
};
|
|
23575
|
+
};
|
|
23576
|
+
/** @description Not found */
|
|
23577
|
+
404: {
|
|
23578
|
+
headers: {
|
|
23579
|
+
[name: string]: unknown;
|
|
23580
|
+
};
|
|
23581
|
+
content: {
|
|
23582
|
+
"application/json": components["schemas"]["Error"];
|
|
23583
|
+
};
|
|
23584
|
+
};
|
|
23585
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
23586
|
+
409: {
|
|
23587
|
+
headers: {
|
|
23588
|
+
[name: string]: unknown;
|
|
23589
|
+
};
|
|
23590
|
+
content: {
|
|
23591
|
+
"application/json": components["schemas"]["Error"];
|
|
23592
|
+
};
|
|
23593
|
+
};
|
|
23594
|
+
/** @description Rate limited */
|
|
23595
|
+
429: {
|
|
23596
|
+
headers: {
|
|
23597
|
+
[name: string]: unknown;
|
|
23598
|
+
};
|
|
23599
|
+
content: {
|
|
23600
|
+
"application/json": components["schemas"]["Error"];
|
|
23601
|
+
};
|
|
23602
|
+
};
|
|
23603
|
+
};
|
|
23604
|
+
};
|
|
23605
|
+
post?: never;
|
|
23606
|
+
delete?: never;
|
|
23607
|
+
options?: never;
|
|
23608
|
+
head?: never;
|
|
23609
|
+
patch?: never;
|
|
23610
|
+
trace?: never;
|
|
23611
|
+
};
|
|
23612
|
+
"/leads/{id}/unqualify": {
|
|
23613
|
+
parameters: {
|
|
23614
|
+
query?: never;
|
|
23615
|
+
header?: never;
|
|
23616
|
+
path?: never;
|
|
23617
|
+
cookie?: never;
|
|
23618
|
+
};
|
|
23619
|
+
get?: never;
|
|
23620
|
+
/**
|
|
23621
|
+
* Mark a lead as unqualified
|
|
23622
|
+
* @description There was never an opportunity here — the wrong product, the wrong workspace, a duplicate, a test. A DISTINCT outcome from `lost`, and the distinction is the point: unqualified leads are excluded from win rate on both sides, so qualifying early never looks like losing. The lead MOVES to the lowest-position stage of that category on its board, so the outcome and the column can never disagree — 400 when the board has no stage of that category, which is a board a person has to fix rather than a request to retry. `status`, `closed_at` and `won_lost_reason` are derived from the landing stage, and a `lead.stage_changed` Evento fires alongside the outcome one. Emits `lead.unqualified`.
|
|
23623
|
+
*/
|
|
23624
|
+
put: {
|
|
23625
|
+
parameters: {
|
|
23626
|
+
query?: never;
|
|
23627
|
+
header?: never;
|
|
23628
|
+
path: {
|
|
23629
|
+
id: string;
|
|
23630
|
+
};
|
|
23631
|
+
cookie?: never;
|
|
23632
|
+
};
|
|
23633
|
+
requestBody?: {
|
|
23634
|
+
content: {
|
|
23635
|
+
/**
|
|
23636
|
+
* @example {
|
|
23637
|
+
* "reason": "buscaba un servicio que no ofrecemos"
|
|
23638
|
+
* }
|
|
23639
|
+
*/
|
|
23640
|
+
"application/json": {
|
|
23641
|
+
/** @enum {string} */
|
|
23642
|
+
status?: "won" | "lost" | "unqualified" | "open";
|
|
23643
|
+
reason?: string | null;
|
|
23644
|
+
value_amount?: number | null;
|
|
23645
|
+
value_currency?: string | null;
|
|
23646
|
+
};
|
|
23647
|
+
};
|
|
23648
|
+
};
|
|
23649
|
+
responses: {
|
|
23650
|
+
/** @description Lead */
|
|
23651
|
+
200: {
|
|
23652
|
+
headers: {
|
|
23653
|
+
[name: string]: unknown;
|
|
23654
|
+
};
|
|
23655
|
+
content: {
|
|
23656
|
+
/**
|
|
23657
|
+
* @example {
|
|
23658
|
+
* "data": {
|
|
23659
|
+
* "id": "99999999-0000-4000-8000-000000000001",
|
|
23660
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
23661
|
+
* "display_id": "L-89",
|
|
23662
|
+
* "display_seq": 89,
|
|
23663
|
+
* "title": "María — prueba de manejo Corolla 2022",
|
|
23664
|
+
* "notes": null,
|
|
23665
|
+
* "status": "unqualified",
|
|
23666
|
+
* "source": "conversation",
|
|
23667
|
+
* "source_ref": null,
|
|
23668
|
+
* "intent": "buy",
|
|
23669
|
+
* "contact_id": "22222222-0000-4000-8000-000000000001",
|
|
23670
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001",
|
|
23671
|
+
* "stage_id": "55555555-0000-4000-8000-000000000003",
|
|
23672
|
+
* "conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23673
|
+
* "origin_conversation_id": "bbbbbbbb-0000-4000-8000-000000000001",
|
|
23674
|
+
* "owner_user_id": "11111111-0000-4000-8000-000000000001",
|
|
23675
|
+
* "team_id": null,
|
|
23676
|
+
* "value_amount": 8990000,
|
|
23677
|
+
* "value_currency": "CLP",
|
|
23678
|
+
* "value_amount_close_confirmed_at": null,
|
|
23679
|
+
* "expected_close_at": "2026-10-15T00:00:00.000Z",
|
|
23680
|
+
* "score": 72,
|
|
23681
|
+
* "score_reason": "pidió hora para probar el auto y confirmó día",
|
|
23682
|
+
* "scored_at": "2026-09-21T14:02:11.000Z",
|
|
23683
|
+
* "temperature": "warm",
|
|
23684
|
+
* "temperature_reason": "respondió pidiendo confirmar la hora y no ha vuelto a escribir",
|
|
23685
|
+
* "temperature_at": "2026-09-21T14:02:11.000Z",
|
|
23686
|
+
* "won_lost_reason": "buscaba un servicio que no ofrecemos",
|
|
23687
|
+
* "lost_reason": null,
|
|
23688
|
+
* "lost_reason_source": null,
|
|
23689
|
+
* "lost_reason_at": null,
|
|
23690
|
+
* "payment_method": "financing",
|
|
23691
|
+
* "down_payment_amount": 4000000,
|
|
23692
|
+
* "budget_max_amount": 11500000,
|
|
23693
|
+
* "has_trade_in": false,
|
|
23694
|
+
* "trade_in_description": null,
|
|
23695
|
+
* "offer_amount": null,
|
|
23696
|
+
* "offer_note": null,
|
|
23697
|
+
* "deal_terms_meta": {
|
|
23698
|
+
* "payment_method": {
|
|
23699
|
+
* "source": "ai",
|
|
23700
|
+
* "actor_id": null,
|
|
23701
|
+
* "actor_label": null,
|
|
23702
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
23703
|
+
* },
|
|
23704
|
+
* "down_payment_amount": {
|
|
23705
|
+
* "source": "human",
|
|
23706
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
23707
|
+
* "actor_label": "Camila Rojas",
|
|
23708
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
23709
|
+
* }
|
|
23710
|
+
* },
|
|
23711
|
+
* "deal_terms_suggestions": {},
|
|
23712
|
+
* "closed_at": "2026-09-22T08:44:10.331Z",
|
|
23713
|
+
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
23714
|
+
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
23715
|
+
* "updated_at": "2026-09-21T14:02:11.000Z",
|
|
23716
|
+
* "last_activity_at": "2026-09-21T14:02:11.000Z",
|
|
23717
|
+
* "contact": {
|
|
23718
|
+
* "id": "22222222-0000-4000-8000-000000000001",
|
|
23719
|
+
* "name": "María González",
|
|
23720
|
+
* "email": "maria.gonzalez@example.cl",
|
|
23721
|
+
* "phone": "+56912345001"
|
|
23722
|
+
* },
|
|
23723
|
+
* "stage": {
|
|
23724
|
+
* "id": "55555555-0000-4000-8000-000000000003",
|
|
23725
|
+
* "name": "No calificado",
|
|
23726
|
+
* "slug": "unqualified",
|
|
23727
|
+
* "position": 8,
|
|
23728
|
+
* "won_state": null,
|
|
23729
|
+
* "pipeline_id": "44444444-0000-4000-8000-000000000001"
|
|
23730
|
+
* },
|
|
23731
|
+
* "pipeline": {
|
|
23732
|
+
* "id": "44444444-0000-4000-8000-000000000001",
|
|
23733
|
+
* "kind": "sales",
|
|
23734
|
+
* "name": "Ventas"
|
|
22938
23735
|
* }
|
|
22939
23736
|
* }
|
|
22940
23737
|
* }
|
|
@@ -23073,6 +23870,28 @@ interface paths {
|
|
|
23073
23870
|
* "lost_reason": null,
|
|
23074
23871
|
* "lost_reason_source": null,
|
|
23075
23872
|
* "lost_reason_at": null,
|
|
23873
|
+
* "payment_method": "financing",
|
|
23874
|
+
* "down_payment_amount": 4000000,
|
|
23875
|
+
* "budget_max_amount": 11500000,
|
|
23876
|
+
* "has_trade_in": false,
|
|
23877
|
+
* "trade_in_description": null,
|
|
23878
|
+
* "offer_amount": null,
|
|
23879
|
+
* "offer_note": null,
|
|
23880
|
+
* "deal_terms_meta": {
|
|
23881
|
+
* "payment_method": {
|
|
23882
|
+
* "source": "ai",
|
|
23883
|
+
* "actor_id": null,
|
|
23884
|
+
* "actor_label": null,
|
|
23885
|
+
* "at": "2026-09-21T14:02:11.000Z"
|
|
23886
|
+
* },
|
|
23887
|
+
* "down_payment_amount": {
|
|
23888
|
+
* "source": "human",
|
|
23889
|
+
* "actor_id": "11111111-0000-4000-8000-000000000001",
|
|
23890
|
+
* "actor_label": "Camila Rojas",
|
|
23891
|
+
* "at": "2026-09-21T15:10:00.000Z"
|
|
23892
|
+
* }
|
|
23893
|
+
* },
|
|
23894
|
+
* "deal_terms_suggestions": {},
|
|
23076
23895
|
* "closed_at": null,
|
|
23077
23896
|
* "created_by": "11111111-0000-4000-8000-000000000001",
|
|
23078
23897
|
* "created_at": "2026-09-18T13:44:02.115Z",
|
|
@@ -28286,7 +29105,9 @@ interface paths {
|
|
|
28286
29105
|
put?: never;
|
|
28287
29106
|
/**
|
|
28288
29107
|
* Record an outbound preference (consent or DNC) for a contact
|
|
28289
|
-
* @description Appends one fact. **Revoking is a POST with the opposite `status`** — the superseded row stays readable as evidence, which is why there is no PATCH or DELETE here.
|
|
29108
|
+
* @description Appends one fact. **Revoking a block your team set is a POST with the opposite `status`** — the superseded row stays readable as evidence, which is why there is no PATCH or DELETE here.
|
|
29109
|
+
*
|
|
29110
|
+
* An opt-out the **customer** asked for (their message, an unsubscribe link, their own «BAJA») cannot be revoked here: any `status` other than `blocked` that would end it answers 409 with `details.code` `customer_opt_out_lift_required`. Lifting it takes a team member in the Vitrina app, from the contact's card, after confirming.
|
|
28290
29111
|
*
|
|
28291
29112
|
* `recorded_at` is stamped by the server and is deliberately not settable: a caller who could backdate a consent fact could manufacture evidence. `legal_basis` is free text recorded verbatim («consentimiento explícito, Ley 21.719») and `evidence_message_id` points at the customer message that proves it, when there is one.
|
|
28292
29113
|
*
|
|
@@ -30275,6 +31096,10 @@ interface paths {
|
|
|
30275
31096
|
*
|
|
30276
31097
|
* **Every row carries `totals`** — the SAME object `GET /sale-notes/{id}` embeds, computed by the same roll-up: `total_a_pagar_clp` (price + IVA + Σ statutory add-ons), `total_pagos_clp`, `saldo_clp`, `payment_count`, `complete` and `gaps`. ⚠ **A POSITIVE `saldo_clp` means the customer has OVERPAID; a NEGATIVE one is what they still owe** (BR-245 — it is the sign the printed document uses). `total_a_pagar_clp` and `saldo_clp` are both **`null`** when `tax_clp` was never recorded, with `gaps` naming it: that is "not computable", never zero, and a client must render it as such rather than treating the unrecorded IVA as 0. Voided rows are totalled like any other — the money against them was really taken, and `status` is what says the document is dead. Do not sum the payments client-side; there is one definition of this balance and this is it.
|
|
30277
31098
|
*
|
|
31099
|
+
* **`economics` — only for callers holding `dealership_economics:read`** (absent, not null, for everyone else): `margen_bruto_clp` (Margen bruto), `margen_neto_clp` (Utilidad del negocio), `comisiones_vendedores_clp` (Comisión) and `canal` (where the buyer came from), each the SAME figure `GET /margin` serves — one definition, computed in batch for the page. A figure that is not computable is `null`, never zero, and `gaps` names the missing input (`cost_rollup` = Sin costo, `seller_commission` = Sin comisión, `liquidacion` = Sin liquidación). A voided row has `economics: null`.
|
|
31100
|
+
*
|
|
31101
|
+
* **`status`** narrows to one derived status; `status=issued` is the «Por aprobar» list (emitted, waiting for its approval — ADR 0114 §4).
|
|
31102
|
+
*
|
|
30278
31103
|
* Unknown query parameters are a **400**, not a silent drop: a filter the caller believes is being applied, returning a full unfiltered list with a 200, is a worse answer than a refusal.
|
|
30279
31104
|
*/
|
|
30280
31105
|
get: {
|
|
@@ -30283,6 +31108,7 @@ interface paths {
|
|
|
30283
31108
|
exclude_voided?: boolean | null;
|
|
30284
31109
|
vehicle_id?: string;
|
|
30285
31110
|
lead_id?: string;
|
|
31111
|
+
status?: "issued" | "approved" | "voided";
|
|
30286
31112
|
limit?: number;
|
|
30287
31113
|
};
|
|
30288
31114
|
header?: never;
|
|
@@ -30318,6 +31144,7 @@ interface paths {
|
|
|
30318
31144
|
* "tax_treatment": "afecto",
|
|
30319
31145
|
* "status": "issued",
|
|
30320
31146
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
31147
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
30321
31148
|
* "approved_by": null,
|
|
30322
31149
|
* "approved_at": null,
|
|
30323
31150
|
* "voided_at": null,
|
|
@@ -30401,6 +31228,8 @@ interface paths {
|
|
|
30401
31228
|
* Issue a nota de venta
|
|
30402
31229
|
* @description Issues the document and allocates its folio (`V-1`, `V-2`, …) inside the inserting transaction, so a failed issue RELEASES the number rather than burning it out of a legally accountable series.
|
|
30403
31230
|
*
|
|
31231
|
+
* **`emitted_by` is the caller** (ADR 0114 §4): the member (also behind a personal token) or the API key that issued it, stamped from the credential — there is no body field for it.
|
|
31232
|
+
*
|
|
30404
31233
|
* **Money is whole CLP pesos** (`bigint`, never minor units, never decimals) and the triple is `net_clp` + `tax_clp` + `tax_treatment`. Omit `tax_clp` to record "not recorded"; pass `0` to record "no tax" — ADR 0058 §2 makes those two different claims and nothing collapses them. `tax_treatment` is REQUIRED and has no default: the same peso falls inside or outside the IVA base depending on how the deal is structured, so a default would be a guess stored as a determination.
|
|
30405
31234
|
*
|
|
30406
31235
|
* `vehicle_id`, `buyer_contact_id` and `lead_id` must belong to the calling workspace — no foreign key carries a tenant, so this is checked before the insert. A foreign id and a nonexistent one answer identically (404), deliberately: a difference between them is an existence oracle. A soft-deleted or merged vehicle is also refused.
|
|
@@ -30533,6 +31362,7 @@ interface paths {
|
|
|
30533
31362
|
* "tax_treatment": "afecto",
|
|
30534
31363
|
* "status": "issued",
|
|
30535
31364
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
31365
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
30536
31366
|
* "approved_by": null,
|
|
30537
31367
|
* "approved_at": null,
|
|
30538
31368
|
* "voided_at": null,
|
|
@@ -30627,6 +31457,8 @@ interface paths {
|
|
|
30627
31457
|
*
|
|
30628
31458
|
* Nothing here is stored: the standing is DERIVED from the rows on every read, there is no `funding_standing` column, and there is nothing to write. A document issued without a funding plan reads `short`, which is the honest state and not an error.
|
|
30629
31459
|
*
|
|
31460
|
+
* **`timeline` says who did what, by name** (ADR 0114 §4): one entry per step that happened, in the order the document lives them — `emitted` (`issued_at`, `emitted_by`), `approved`, `printed` (the compraventa in force) and `voided` — each with its instant and its `actor` (`{ id, name, kind }`, `kind` = `member` or `api_key`). `actor` is `null` when the document does not record who did it (a note emitted before `emitted_by` existed); `actor.name` is `null` when that person has no name on file. Show either in words — never as an anonymous teammate. Approval is a separate step under `sale_notes:write`, so the emitter and the approver are often different people.
|
|
31461
|
+
*
|
|
30630
31462
|
* **`trade_ins` names the cars taken in part-exchange** (ERP S9-6) — one entry per car with the line’s own id (never the vehicle’s: BR-457), the `vehicle_id`, the `precio_toma_clp` allowed for it, and the `acquisition_id` of the `vehicle_acquisition` that arrival created. That is the SALE → UNIT direction; the UNIT → SALE direction needs no surface here, because `vehicle_acquisition.sale_note_id` is projected on every read of `GET /vehicle-acquisitions?vehicle_id=`. `acquisition_id` is `null` once the document has been VOIDED — a void retracts the arrival and keeps the line, so the null says exactly what happened: this credit was agreed, and the arrival it caused has been withdrawn.
|
|
30631
31463
|
*
|
|
30632
31464
|
* **`credit` is the LIVE brokered credit, or `null`** (ERP S9-7) — the `institution` that is lending (BR-464 makes the financiera the credit’s identity on the document), the `amount_clp`, and its OWN `state`: `committed` (the bank has promised) or `disbursed` (the money has arrived, with `disbursed_at` / `disbursed_by` beside it). ⚠ **Both count the same in `funding`** (BR-463), so never read `funded` as "the cash is in" — read `credit.state` for that. The committed-vs-collected gap is exactly this pair of fields read side by side. ⚠ **The credit’s state is INDEPENDENT of the document’s `status`**: a voided nota de venta keeps its credit row untouched, and a disbursed credit does not make the document anything. Credits that were REPLACED or REMOVED are tombstoned and are deliberately not served here — they are history, not funding, and listing them beside the live one would invite a client to add them up.
|
|
@@ -30668,6 +31500,7 @@ interface paths {
|
|
|
30668
31500
|
* "tax_treatment": "afecto",
|
|
30669
31501
|
* "status": "issued",
|
|
30670
31502
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
31503
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
30671
31504
|
* "approved_by": null,
|
|
30672
31505
|
* "approved_at": null,
|
|
30673
31506
|
* "voided_at": null,
|
|
@@ -30725,7 +31558,18 @@ interface paths {
|
|
|
30725
31558
|
* "gaps": []
|
|
30726
31559
|
* },
|
|
30727
31560
|
* "trade_ins": [],
|
|
30728
|
-
* "credit": null
|
|
31561
|
+
* "credit": null,
|
|
31562
|
+
* "timeline": [
|
|
31563
|
+
* {
|
|
31564
|
+
* "step": "emitted",
|
|
31565
|
+
* "at": "2026-09-19T13:00:00.000Z",
|
|
31566
|
+
* "actor": {
|
|
31567
|
+
* "id": "11111111-0000-4000-8000-000000000001",
|
|
31568
|
+
* "name": "Martina Reyes",
|
|
31569
|
+
* "kind": "member"
|
|
31570
|
+
* }
|
|
31571
|
+
* }
|
|
31572
|
+
* ]
|
|
30729
31573
|
* }
|
|
30730
31574
|
* }
|
|
30731
31575
|
*/
|
|
@@ -30869,6 +31713,7 @@ interface paths {
|
|
|
30869
31713
|
* "tax_treatment": "afecto",
|
|
30870
31714
|
* "status": "issued",
|
|
30871
31715
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
31716
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
30872
31717
|
* "approved_by": null,
|
|
30873
31718
|
* "approved_at": null,
|
|
30874
31719
|
* "voided_at": null,
|
|
@@ -30926,7 +31771,18 @@ interface paths {
|
|
|
30926
31771
|
* "gaps": []
|
|
30927
31772
|
* },
|
|
30928
31773
|
* "trade_ins": [],
|
|
30929
|
-
* "credit": null
|
|
31774
|
+
* "credit": null,
|
|
31775
|
+
* "timeline": [
|
|
31776
|
+
* {
|
|
31777
|
+
* "step": "emitted",
|
|
31778
|
+
* "at": "2026-09-19T13:00:00.000Z",
|
|
31779
|
+
* "actor": {
|
|
31780
|
+
* "id": "11111111-0000-4000-8000-000000000001",
|
|
31781
|
+
* "name": "Martina Reyes",
|
|
31782
|
+
* "kind": "member"
|
|
31783
|
+
* }
|
|
31784
|
+
* }
|
|
31785
|
+
* ]
|
|
30930
31786
|
* }
|
|
30931
31787
|
* }
|
|
30932
31788
|
*/
|
|
@@ -31156,6 +32012,7 @@ interface paths {
|
|
|
31156
32012
|
*
|
|
31157
32013
|
* * **409** when the sale’s price is below the level this organisation requires an authorisation for and no APPROVED `price_approval` names this document (BR-433/BR-434 — a sale cannot authorise its own discount). Raise one with `POST /price-approvals` and have somebody else decide it. The refusal deliberately states no figure: the shortfall and the reference are cost disclosures gated on `dealership_economics:read`.
|
|
31158
32014
|
* * **409** when the unit has already been sold by another document.
|
|
32015
|
+
* * **409** when the car is consigned (active contrato de consignación) and its mandato was never emitted — «Emite el mandato antes de aprobar» (`details.reason: mandate_not_emitted`). Emit it with `POST /consignments/{id}/contract`.
|
|
31159
32016
|
* * **409** when the document is already approved, or is voided — an approval names a person and a moment and cannot be restated.
|
|
31160
32017
|
* * **400** when the deal’s board has no Won column, or forbids the move onto it.
|
|
31161
32018
|
*
|
|
@@ -31208,6 +32065,7 @@ interface paths {
|
|
|
31208
32065
|
* "tax_treatment": "afecto",
|
|
31209
32066
|
* "status": "approved",
|
|
31210
32067
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
32068
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
31211
32069
|
* "approved_by": "11111111-0000-4000-8000-000000000001",
|
|
31212
32070
|
* "approved_at": "2026-09-19T14:10:00.000Z",
|
|
31213
32071
|
* "voided_at": null,
|
|
@@ -31358,6 +32216,7 @@ interface paths {
|
|
|
31358
32216
|
* "tax_treatment": "afecto",
|
|
31359
32217
|
* "status": "voided",
|
|
31360
32218
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
32219
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
31361
32220
|
* "approved_by": null,
|
|
31362
32221
|
* "approved_at": null,
|
|
31363
32222
|
* "voided_at": "2026-09-20T09:00:00.000Z",
|
|
@@ -32702,6 +33561,8 @@ interface paths {
|
|
|
32702
33561
|
*
|
|
32703
33562
|
* Returns the document WITH its line items in document order. `corrected_at` / `corrected_by` say whether it has been changed since it was issued, and by whom.
|
|
32704
33563
|
*
|
|
33564
|
+
* It also carries the unit it bought, the same as each row of the list: `vehicle` is `{ id, make, model, year, registration_number }` or `null`, and `vehicle_count` says how many units the document acquired (`vehicle` is the FIRST of them when there are several, and `null` exactly when the count is `0`).
|
|
33565
|
+
*
|
|
32705
33566
|
* A document belonging to another workspace is a 404, indistinguishable from one that does not exist.
|
|
32706
33567
|
*/
|
|
32707
33568
|
get: {
|
|
@@ -32740,6 +33601,394 @@ interface paths {
|
|
|
32740
33601
|
* "void_reason": null,
|
|
32741
33602
|
* "voided_by": null,
|
|
32742
33603
|
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
33604
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
33605
|
+
* "vehicle": {
|
|
33606
|
+
* "id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
33607
|
+
* "make": "Mazda",
|
|
33608
|
+
* "model": "CX-5",
|
|
33609
|
+
* "year": 2020,
|
|
33610
|
+
* "registration_number": "KXPT21"
|
|
33611
|
+
* },
|
|
33612
|
+
* "vehicle_count": 1
|
|
33613
|
+
* }
|
|
33614
|
+
* }
|
|
33615
|
+
*/
|
|
33616
|
+
"application/json": {
|
|
33617
|
+
data?: unknown;
|
|
33618
|
+
meta?: {
|
|
33619
|
+
[key: string]: unknown;
|
|
33620
|
+
};
|
|
33621
|
+
};
|
|
33622
|
+
};
|
|
33623
|
+
};
|
|
33624
|
+
/** @description Validation error */
|
|
33625
|
+
400: {
|
|
33626
|
+
headers: {
|
|
33627
|
+
[name: string]: unknown;
|
|
33628
|
+
};
|
|
33629
|
+
content: {
|
|
33630
|
+
"application/json": components["schemas"]["Error"];
|
|
33631
|
+
};
|
|
33632
|
+
};
|
|
33633
|
+
/** @description Unauthorized */
|
|
33634
|
+
401: {
|
|
33635
|
+
headers: {
|
|
33636
|
+
[name: string]: unknown;
|
|
33637
|
+
};
|
|
33638
|
+
content: {
|
|
33639
|
+
"application/json": components["schemas"]["Error"];
|
|
33640
|
+
};
|
|
33641
|
+
};
|
|
33642
|
+
/** @description Forbidden */
|
|
33643
|
+
403: {
|
|
33644
|
+
headers: {
|
|
33645
|
+
[name: string]: unknown;
|
|
33646
|
+
};
|
|
33647
|
+
content: {
|
|
33648
|
+
"application/json": components["schemas"]["Error"];
|
|
33649
|
+
};
|
|
33650
|
+
};
|
|
33651
|
+
/** @description Not found */
|
|
33652
|
+
404: {
|
|
33653
|
+
headers: {
|
|
33654
|
+
[name: string]: unknown;
|
|
33655
|
+
};
|
|
33656
|
+
content: {
|
|
33657
|
+
"application/json": components["schemas"]["Error"];
|
|
33658
|
+
};
|
|
33659
|
+
};
|
|
33660
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
33661
|
+
409: {
|
|
33662
|
+
headers: {
|
|
33663
|
+
[name: string]: unknown;
|
|
33664
|
+
};
|
|
33665
|
+
content: {
|
|
33666
|
+
"application/json": components["schemas"]["Error"];
|
|
33667
|
+
};
|
|
33668
|
+
};
|
|
33669
|
+
/** @description Rate limited */
|
|
33670
|
+
429: {
|
|
33671
|
+
headers: {
|
|
33672
|
+
[name: string]: unknown;
|
|
33673
|
+
};
|
|
33674
|
+
content: {
|
|
33675
|
+
"application/json": components["schemas"]["Error"];
|
|
33676
|
+
};
|
|
33677
|
+
};
|
|
33678
|
+
};
|
|
33679
|
+
};
|
|
33680
|
+
put?: never;
|
|
33681
|
+
post?: never;
|
|
33682
|
+
delete?: never;
|
|
33683
|
+
options?: never;
|
|
33684
|
+
head?: never;
|
|
33685
|
+
/**
|
|
33686
|
+
* Correct a nota de compra
|
|
33687
|
+
* @description Corrects a LIVE document and **stamps it**: `corrected_at` and the acting principal are written onto the row, so a reader of the document can tell it has been changed since it was issued without joining an audit table. The folio and the status are never touched.
|
|
33688
|
+
*
|
|
33689
|
+
* **An ABSENT field is left alone; an explicit `null` CLEARS it.** On `tax_clp` that is the difference between "not recorded" and "no tax", which ADR 0058 §2 keeps apart — so correcting away an amount entered by mistake is expressible without being confused with zero.
|
|
33690
|
+
*
|
|
33691
|
+
* `lines` REPLACES the whole breakdown, in order: pass the complete list, or omit the field to leave the existing lines untouched. `[]` clears them, which is a legitimate correction of a breakdown entered against the wrong note. The replacement is delete-all-then-reinsert inside one transaction, because the per-document ordering key is not deferrable.
|
|
33692
|
+
*
|
|
33693
|
+
* A **voided** document cannot be corrected — that is a **409**, because voiding withdraws the instrument and correcting a withdrawn accountable record would rewrite something a third party may already have been shown. Issue a replacement instead; the voided one keeps its folio and stays listable.
|
|
33694
|
+
*
|
|
33695
|
+
* A correction must state at least one field — an empty body is a **400**, not a no-op stamp. `PATCH` and not `PUT`: the body is a partial and `absent` vs `null` are different instructions, which replace-the-representation semantics cannot express. Requires `purchase_notes:write`, the same authority as issuing.
|
|
33696
|
+
*/
|
|
33697
|
+
patch: {
|
|
33698
|
+
parameters: {
|
|
33699
|
+
query?: never;
|
|
33700
|
+
header?: never;
|
|
33701
|
+
path: {
|
|
33702
|
+
id: string;
|
|
33703
|
+
};
|
|
33704
|
+
cookie?: never;
|
|
33705
|
+
};
|
|
33706
|
+
requestBody?: {
|
|
33707
|
+
content: {
|
|
33708
|
+
/**
|
|
33709
|
+
* @example {
|
|
33710
|
+
* "net_clp": 6150000
|
|
33711
|
+
* }
|
|
33712
|
+
*/
|
|
33713
|
+
"application/json": {
|
|
33714
|
+
/** Format: uuid */
|
|
33715
|
+
seller_contact_id?: string | null;
|
|
33716
|
+
net_clp?: number;
|
|
33717
|
+
tax_clp?: number | null;
|
|
33718
|
+
/** @enum {string} */
|
|
33719
|
+
tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
33720
|
+
/** Format: date-time */
|
|
33721
|
+
issued_at?: string;
|
|
33722
|
+
lines?: {
|
|
33723
|
+
description: string;
|
|
33724
|
+
net_clp: number;
|
|
33725
|
+
tax_clp?: number | null;
|
|
33726
|
+
/** @enum {string} */
|
|
33727
|
+
tax_treatment: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
33728
|
+
}[];
|
|
33729
|
+
};
|
|
33730
|
+
};
|
|
33731
|
+
};
|
|
33732
|
+
responses: {
|
|
33733
|
+
/** @description The corrected nota de compra, with its lines */
|
|
33734
|
+
200: {
|
|
33735
|
+
headers: {
|
|
33736
|
+
[name: string]: unknown;
|
|
33737
|
+
};
|
|
33738
|
+
content: {
|
|
33739
|
+
/**
|
|
33740
|
+
* @example {
|
|
33741
|
+
* "data": {
|
|
33742
|
+
* "id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
33743
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
33744
|
+
* "display_id": "P-9",
|
|
33745
|
+
* "display_seq": 9,
|
|
33746
|
+
* "seller_contact_id": "22222222-0000-4000-8000-000000000003",
|
|
33747
|
+
* "net_clp": 6150000,
|
|
33748
|
+
* "tax_clp": null,
|
|
33749
|
+
* "tax_treatment": "no_gravado",
|
|
33750
|
+
* "status": "issued",
|
|
33751
|
+
* "issued_at": "2026-09-12T10:15:00.000Z",
|
|
33752
|
+
* "corrected_at": "2026-09-13T09:00:00.000Z",
|
|
33753
|
+
* "corrected_by": "11111111-0000-4000-8000-000000000001",
|
|
33754
|
+
* "voided_at": null,
|
|
33755
|
+
* "void_reason": null,
|
|
33756
|
+
* "voided_by": null,
|
|
33757
|
+
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
33758
|
+
* "updated_at": "2026-09-12T10:15:00.000Z"
|
|
33759
|
+
* }
|
|
33760
|
+
* }
|
|
33761
|
+
*/
|
|
33762
|
+
"application/json": {
|
|
33763
|
+
data?: unknown;
|
|
33764
|
+
meta?: {
|
|
33765
|
+
[key: string]: unknown;
|
|
33766
|
+
};
|
|
33767
|
+
};
|
|
33768
|
+
};
|
|
33769
|
+
};
|
|
33770
|
+
/** @description Validation error */
|
|
33771
|
+
400: {
|
|
33772
|
+
headers: {
|
|
33773
|
+
[name: string]: unknown;
|
|
33774
|
+
};
|
|
33775
|
+
content: {
|
|
33776
|
+
"application/json": components["schemas"]["Error"];
|
|
33777
|
+
};
|
|
33778
|
+
};
|
|
33779
|
+
/** @description Unauthorized */
|
|
33780
|
+
401: {
|
|
33781
|
+
headers: {
|
|
33782
|
+
[name: string]: unknown;
|
|
33783
|
+
};
|
|
33784
|
+
content: {
|
|
33785
|
+
"application/json": components["schemas"]["Error"];
|
|
33786
|
+
};
|
|
33787
|
+
};
|
|
33788
|
+
/** @description Forbidden */
|
|
33789
|
+
403: {
|
|
33790
|
+
headers: {
|
|
33791
|
+
[name: string]: unknown;
|
|
33792
|
+
};
|
|
33793
|
+
content: {
|
|
33794
|
+
"application/json": components["schemas"]["Error"];
|
|
33795
|
+
};
|
|
33796
|
+
};
|
|
33797
|
+
/** @description Not found */
|
|
33798
|
+
404: {
|
|
33799
|
+
headers: {
|
|
33800
|
+
[name: string]: unknown;
|
|
33801
|
+
};
|
|
33802
|
+
content: {
|
|
33803
|
+
"application/json": components["schemas"]["Error"];
|
|
33804
|
+
};
|
|
33805
|
+
};
|
|
33806
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
33807
|
+
409: {
|
|
33808
|
+
headers: {
|
|
33809
|
+
[name: string]: unknown;
|
|
33810
|
+
};
|
|
33811
|
+
content: {
|
|
33812
|
+
"application/json": components["schemas"]["Error"];
|
|
33813
|
+
};
|
|
33814
|
+
};
|
|
33815
|
+
/** @description Rate limited */
|
|
33816
|
+
429: {
|
|
33817
|
+
headers: {
|
|
33818
|
+
[name: string]: unknown;
|
|
33819
|
+
};
|
|
33820
|
+
content: {
|
|
33821
|
+
"application/json": components["schemas"]["Error"];
|
|
33822
|
+
};
|
|
33823
|
+
};
|
|
33824
|
+
};
|
|
33825
|
+
};
|
|
33826
|
+
trace?: never;
|
|
33827
|
+
};
|
|
33828
|
+
"/purchase-notes/{id}/pdf": {
|
|
33829
|
+
parameters: {
|
|
33830
|
+
query?: never;
|
|
33831
|
+
header?: never;
|
|
33832
|
+
path?: never;
|
|
33833
|
+
cookie?: never;
|
|
33834
|
+
};
|
|
33835
|
+
/**
|
|
33836
|
+
* Print the nota de compra
|
|
33837
|
+
* @description The nota de compra as a printable PDF (`application/pdf`, served `inline`) on the dealership’s paper: folio, seller, vehicle, lines and totals. Rendered on demand and not stored. Any status prints; a voided note says «Anulada». Accepts the UUID or the folio (`P-47`). Requires `purchase_notes:read`.
|
|
33838
|
+
*/
|
|
33839
|
+
get: {
|
|
33840
|
+
parameters: {
|
|
33841
|
+
query?: never;
|
|
33842
|
+
header?: never;
|
|
33843
|
+
path: {
|
|
33844
|
+
id: string;
|
|
33845
|
+
};
|
|
33846
|
+
cookie?: never;
|
|
33847
|
+
};
|
|
33848
|
+
requestBody?: never;
|
|
33849
|
+
responses: {
|
|
33850
|
+
/** @description The printable nota de compra */
|
|
33851
|
+
200: {
|
|
33852
|
+
headers: {
|
|
33853
|
+
[name: string]: unknown;
|
|
33854
|
+
};
|
|
33855
|
+
content: {
|
|
33856
|
+
"application/pdf": string;
|
|
33857
|
+
};
|
|
33858
|
+
};
|
|
33859
|
+
/** @description Validation error */
|
|
33860
|
+
400: {
|
|
33861
|
+
headers: {
|
|
33862
|
+
[name: string]: unknown;
|
|
33863
|
+
};
|
|
33864
|
+
content: {
|
|
33865
|
+
"application/json": components["schemas"]["Error"];
|
|
33866
|
+
};
|
|
33867
|
+
};
|
|
33868
|
+
/** @description Unauthorized */
|
|
33869
|
+
401: {
|
|
33870
|
+
headers: {
|
|
33871
|
+
[name: string]: unknown;
|
|
33872
|
+
};
|
|
33873
|
+
content: {
|
|
33874
|
+
"application/json": components["schemas"]["Error"];
|
|
33875
|
+
};
|
|
33876
|
+
};
|
|
33877
|
+
/** @description Forbidden */
|
|
33878
|
+
403: {
|
|
33879
|
+
headers: {
|
|
33880
|
+
[name: string]: unknown;
|
|
33881
|
+
};
|
|
33882
|
+
content: {
|
|
33883
|
+
"application/json": components["schemas"]["Error"];
|
|
33884
|
+
};
|
|
33885
|
+
};
|
|
33886
|
+
/** @description Not found */
|
|
33887
|
+
404: {
|
|
33888
|
+
headers: {
|
|
33889
|
+
[name: string]: unknown;
|
|
33890
|
+
};
|
|
33891
|
+
content: {
|
|
33892
|
+
"application/json": components["schemas"]["Error"];
|
|
33893
|
+
};
|
|
33894
|
+
};
|
|
33895
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
33896
|
+
409: {
|
|
33897
|
+
headers: {
|
|
33898
|
+
[name: string]: unknown;
|
|
33899
|
+
};
|
|
33900
|
+
content: {
|
|
33901
|
+
"application/json": components["schemas"]["Error"];
|
|
33902
|
+
};
|
|
33903
|
+
};
|
|
33904
|
+
/** @description Rate limited */
|
|
33905
|
+
429: {
|
|
33906
|
+
headers: {
|
|
33907
|
+
[name: string]: unknown;
|
|
33908
|
+
};
|
|
33909
|
+
content: {
|
|
33910
|
+
"application/json": components["schemas"]["Error"];
|
|
33911
|
+
};
|
|
33912
|
+
};
|
|
33913
|
+
};
|
|
33914
|
+
};
|
|
33915
|
+
put?: never;
|
|
33916
|
+
post?: never;
|
|
33917
|
+
delete?: never;
|
|
33918
|
+
options?: never;
|
|
33919
|
+
head?: never;
|
|
33920
|
+
patch?: never;
|
|
33921
|
+
trace?: never;
|
|
33922
|
+
};
|
|
33923
|
+
"/purchase-notes/{id}/void": {
|
|
33924
|
+
parameters: {
|
|
33925
|
+
query?: never;
|
|
33926
|
+
header?: never;
|
|
33927
|
+
path?: never;
|
|
33928
|
+
cookie?: never;
|
|
33929
|
+
};
|
|
33930
|
+
get?: never;
|
|
33931
|
+
put?: never;
|
|
33932
|
+
/**
|
|
33933
|
+
* Void a nota de compra
|
|
33934
|
+
* @description Voids the document. It is **never deleted and it KEEPS ITS FOLIO** (ADR 0058 §10, BR-650–655): the row records the time, the reason and the acting principal, keeps its line items and its correction mark, and remains listable. There is deliberately no `DELETE` verb on this resource.
|
|
33935
|
+
*
|
|
33936
|
+
* `void_reason` is mandatory and must contain at least one **letter or digit** — a reason made only of whitespace, punctuation, symbols or invisible characters states nothing and is refused, at the edge and by a table CHECK.
|
|
33937
|
+
*
|
|
33938
|
+
* The actor comes from the authenticated principal; a `voided_by` in the body is IGNORED rather than rejected — a self-declared actor is not an attestation. Voiding twice is a **409**: the first actor and reason stand.
|
|
33939
|
+
*
|
|
33940
|
+
* Requires `purchase_notes:void`, which is a DIFFERENT authority from `purchase_notes:write` — holding the write scope does not permit a void.
|
|
33941
|
+
*/
|
|
33942
|
+
post: {
|
|
33943
|
+
parameters: {
|
|
33944
|
+
query?: never;
|
|
33945
|
+
header?: {
|
|
33946
|
+
/** @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. */
|
|
33947
|
+
"Idempotency-Key"?: string;
|
|
33948
|
+
};
|
|
33949
|
+
path: {
|
|
33950
|
+
id: string;
|
|
33951
|
+
};
|
|
33952
|
+
cookie?: never;
|
|
33953
|
+
};
|
|
33954
|
+
requestBody?: {
|
|
33955
|
+
content: {
|
|
33956
|
+
/**
|
|
33957
|
+
* @example {
|
|
33958
|
+
* "void_reason": "se anuló la compra: el vendedor desistió antes de firmar"
|
|
33959
|
+
* }
|
|
33960
|
+
*/
|
|
33961
|
+
"application/json": {
|
|
33962
|
+
void_reason: string;
|
|
33963
|
+
};
|
|
33964
|
+
};
|
|
33965
|
+
};
|
|
33966
|
+
responses: {
|
|
33967
|
+
/** @description The voided nota de compra */
|
|
33968
|
+
200: {
|
|
33969
|
+
headers: {
|
|
33970
|
+
[name: string]: unknown;
|
|
33971
|
+
};
|
|
33972
|
+
content: {
|
|
33973
|
+
/**
|
|
33974
|
+
* @example {
|
|
33975
|
+
* "data": {
|
|
33976
|
+
* "id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
33977
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
33978
|
+
* "display_id": "P-9",
|
|
33979
|
+
* "display_seq": 9,
|
|
33980
|
+
* "seller_contact_id": "22222222-0000-4000-8000-000000000003",
|
|
33981
|
+
* "net_clp": 6200000,
|
|
33982
|
+
* "tax_clp": null,
|
|
33983
|
+
* "tax_treatment": "no_gravado",
|
|
33984
|
+
* "status": "voided",
|
|
33985
|
+
* "issued_at": "2026-09-12T10:15:00.000Z",
|
|
33986
|
+
* "corrected_at": null,
|
|
33987
|
+
* "corrected_by": null,
|
|
33988
|
+
* "voided_at": "2026-09-14T11:30:00.000Z",
|
|
33989
|
+
* "void_reason": "se anuló la compra: el vendedor desistió antes de firmar",
|
|
33990
|
+
* "voided_by": "11111111-0000-4000-8000-000000000001",
|
|
33991
|
+
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
32743
33992
|
* "updated_at": "2026-09-12T10:15:00.000Z"
|
|
32744
33993
|
* }
|
|
32745
33994
|
* }
|
|
@@ -32808,60 +34057,35 @@ interface paths {
|
|
|
32808
34057
|
};
|
|
32809
34058
|
};
|
|
32810
34059
|
};
|
|
32811
|
-
put?: never;
|
|
32812
|
-
post?: never;
|
|
32813
34060
|
delete?: never;
|
|
32814
34061
|
options?: never;
|
|
32815
34062
|
head?: never;
|
|
34063
|
+
patch?: never;
|
|
34064
|
+
trace?: never;
|
|
34065
|
+
};
|
|
34066
|
+
"/document-templates/starters": {
|
|
34067
|
+
parameters: {
|
|
34068
|
+
query?: never;
|
|
34069
|
+
header?: never;
|
|
34070
|
+
path?: never;
|
|
34071
|
+
cookie?: never;
|
|
34072
|
+
};
|
|
32816
34073
|
/**
|
|
32817
|
-
*
|
|
32818
|
-
* @description
|
|
32819
|
-
*
|
|
32820
|
-
* **An ABSENT field is left alone; an explicit `null` CLEARS it.** On `tax_clp` that is the difference between "not recorded" and "no tax", which ADR 0058 §2 keeps apart — so correcting away an amount entered by mistake is expressible without being confused with zero.
|
|
32821
|
-
*
|
|
32822
|
-
* `lines` REPLACES the whole breakdown, in order: pass the complete list, or omit the field to leave the existing lines untouched. `[]` clears them, which is a legitimate correction of a breakdown entered against the wrong note. The replacement is delete-all-then-reinsert inside one transaction, because the per-document ordering key is not deferrable.
|
|
32823
|
-
*
|
|
32824
|
-
* A **voided** document cannot be corrected — that is a **409**, because voiding withdraws the instrument and correcting a withdrawn accountable record would rewrite something a third party may already have been shown. Issue a replacement instead; the voided one keeps its folio and stays listable.
|
|
32825
|
-
*
|
|
32826
|
-
* A correction must state at least one field — an empty body is a **400**, not a no-op stamp. `PATCH` and not `PUT`: the body is a partial and `absent` vs `null` are different instructions, which replace-the-representation semantics cannot express. Requires `purchase_notes:write`, the same authority as issuing.
|
|
34074
|
+
* The standard text of each document family
|
|
34075
|
+
* @description The starter Spanish body of every document family (nota de venta, comprobante de reserva, cotización, mandato de consignación, nota de compra, ficha técnica) — the text an authoring screen opens with when the dealer starts a template, and what «volver al texto estándar» appends as a new version (`PUT /document-templates/{id}`). Every body uses only variables the family’s vocabulary registers, so it saves as-is. Every automotive workspace is seeded with these as its default templates (one per family it had none for). `kind` narrows to one family; `placeholders` lists the `{{NAMES}}` the body uses. Requires `document_templates:read`.
|
|
32827
34076
|
*/
|
|
32828
|
-
|
|
34077
|
+
get: {
|
|
32829
34078
|
parameters: {
|
|
32830
|
-
query?:
|
|
32831
|
-
|
|
32832
|
-
path: {
|
|
32833
|
-
id: string;
|
|
34079
|
+
query?: {
|
|
34080
|
+
kind?: string;
|
|
32834
34081
|
};
|
|
34082
|
+
header?: never;
|
|
34083
|
+
path?: never;
|
|
32835
34084
|
cookie?: never;
|
|
32836
34085
|
};
|
|
32837
|
-
requestBody?:
|
|
32838
|
-
content: {
|
|
32839
|
-
/**
|
|
32840
|
-
* @example {
|
|
32841
|
-
* "net_clp": 6150000
|
|
32842
|
-
* }
|
|
32843
|
-
*/
|
|
32844
|
-
"application/json": {
|
|
32845
|
-
/** Format: uuid */
|
|
32846
|
-
seller_contact_id?: string | null;
|
|
32847
|
-
net_clp?: number;
|
|
32848
|
-
tax_clp?: number | null;
|
|
32849
|
-
/** @enum {string} */
|
|
32850
|
-
tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
32851
|
-
/** Format: date-time */
|
|
32852
|
-
issued_at?: string;
|
|
32853
|
-
lines?: {
|
|
32854
|
-
description: string;
|
|
32855
|
-
net_clp: number;
|
|
32856
|
-
tax_clp?: number | null;
|
|
32857
|
-
/** @enum {string} */
|
|
32858
|
-
tax_treatment: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
32859
|
-
}[];
|
|
32860
|
-
};
|
|
32861
|
-
};
|
|
32862
|
-
};
|
|
34086
|
+
requestBody?: never;
|
|
32863
34087
|
responses: {
|
|
32864
|
-
/** @description
|
|
34088
|
+
/** @description Starter templates */
|
|
32865
34089
|
200: {
|
|
32866
34090
|
headers: {
|
|
32867
34091
|
[name: string]: unknown;
|
|
@@ -32869,24 +34093,25 @@ interface paths {
|
|
|
32869
34093
|
content: {
|
|
32870
34094
|
/**
|
|
32871
34095
|
* @example {
|
|
32872
|
-
* "data":
|
|
32873
|
-
*
|
|
32874
|
-
*
|
|
32875
|
-
*
|
|
32876
|
-
*
|
|
32877
|
-
*
|
|
32878
|
-
*
|
|
32879
|
-
*
|
|
32880
|
-
*
|
|
32881
|
-
*
|
|
32882
|
-
*
|
|
32883
|
-
*
|
|
32884
|
-
*
|
|
32885
|
-
*
|
|
32886
|
-
*
|
|
32887
|
-
*
|
|
32888
|
-
*
|
|
32889
|
-
*
|
|
34096
|
+
* "data": [
|
|
34097
|
+
* {
|
|
34098
|
+
* "document_kind": "quote",
|
|
34099
|
+
* "label": "Cotización",
|
|
34100
|
+
* "key": "cotizacion",
|
|
34101
|
+
* "name": "Cotización",
|
|
34102
|
+
* "body": "COTIZACIÓN N° {{FOLIO}}\n\n{{MANDATARIA_RAZON_SOCIAL}}\nRUT {{MANDATARIA_RUT}}\n\nCLIENTE\n{{CLIENTE_NOMBRE}}, RUT {{CLIENTE_RUT}}.\n\nPRECIO\nPrecio ofrecido: {{PRECIO_OFERTADO}}",
|
|
34103
|
+
* "placeholders": [
|
|
34104
|
+
* "FOLIO",
|
|
34105
|
+
* "MANDATARIA_RAZON_SOCIAL",
|
|
34106
|
+
* "MANDATARIA_RUT",
|
|
34107
|
+
* "CLIENTE_NOMBRE",
|
|
34108
|
+
* "CLIENTE_RUT",
|
|
34109
|
+
* "PRECIO_OFERTADO"
|
|
34110
|
+
* ]
|
|
34111
|
+
* }
|
|
34112
|
+
* ],
|
|
34113
|
+
* "meta": {
|
|
34114
|
+
* "total": 1
|
|
32890
34115
|
* }
|
|
32891
34116
|
* }
|
|
32892
34117
|
*/
|
|
@@ -32954,9 +34179,15 @@ interface paths {
|
|
|
32954
34179
|
};
|
|
32955
34180
|
};
|
|
32956
34181
|
};
|
|
34182
|
+
put?: never;
|
|
34183
|
+
post?: never;
|
|
34184
|
+
delete?: never;
|
|
34185
|
+
options?: never;
|
|
34186
|
+
head?: never;
|
|
34187
|
+
patch?: never;
|
|
32957
34188
|
trace?: never;
|
|
32958
34189
|
};
|
|
32959
|
-
"/
|
|
34190
|
+
"/document-templates/clauses/check": {
|
|
32960
34191
|
parameters: {
|
|
32961
34192
|
query?: never;
|
|
32962
34193
|
header?: never;
|
|
@@ -32966,14 +34197,8 @@ interface paths {
|
|
|
32966
34197
|
get?: never;
|
|
32967
34198
|
put?: never;
|
|
32968
34199
|
/**
|
|
32969
|
-
*
|
|
32970
|
-
* @description
|
|
32971
|
-
*
|
|
32972
|
-
* `void_reason` is mandatory and must contain at least one **letter or digit** — a reason made only of whitespace, punctuation, symbols or invisible characters states nothing and is refused, at the edge and by a table CHECK.
|
|
32973
|
-
*
|
|
32974
|
-
* The actor comes from the authenticated principal; a `voided_by` in the body is IGNORED rather than rejected — a self-declared actor is not an attestation. Voiding twice is a **409**: the first actor and reason stand.
|
|
32975
|
-
*
|
|
32976
|
-
* Requires `purchase_notes:void`, which is a DIFFERENT authority from `purchase_notes:write` — holding the write scope does not permit a void.
|
|
34200
|
+
* Check a body against its cláusulas esenciales and recomendadas
|
|
34201
|
+
* @description The editor's checklist («Esenciales 5/5 · Recomendadas 5/6», ADR 0114 §6.1), computed by the same function the publish gate uses. Send the body being written plus `template_id` (it is that template's next version: its current version is the baseline for "removed") or `document_kind` (a new template: the standard text is the baseline). Returns each clause with `present`, a `summary` of counts, `missing_esenciales` (publishing is refused while non-empty) and `removed_recomendadas` (each needs a reason in `recommended_clause_removals` when publishing). A clause is detected by structural markers — the `{{VARIABLES}}` it needs (designed blocks count, through their text twins), a section heading, or a signature block — never by free-text search. Writes nothing. Requires `document_templates:read`.
|
|
32977
34202
|
*/
|
|
32978
34203
|
post: {
|
|
32979
34204
|
parameters: {
|
|
@@ -32982,25 +34207,27 @@ interface paths {
|
|
|
32982
34207
|
/** @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. */
|
|
32983
34208
|
"Idempotency-Key"?: string;
|
|
32984
34209
|
};
|
|
32985
|
-
path
|
|
32986
|
-
id: string;
|
|
32987
|
-
};
|
|
34210
|
+
path?: never;
|
|
32988
34211
|
cookie?: never;
|
|
32989
34212
|
};
|
|
32990
34213
|
requestBody?: {
|
|
32991
34214
|
content: {
|
|
32992
34215
|
/**
|
|
32993
34216
|
* @example {
|
|
32994
|
-
* "
|
|
34217
|
+
* "template_id": "3b1f8a52-9d34-4a7e-8f2c-1a2b3c4d5e6f",
|
|
34218
|
+
* "body": "# Nota de venta N° {{FOLIO}}\n\n{{BLOQUE_PARTES}}\n\n{{BLOQUE_VEHICULO}}\n\n{{BLOQUE_PRECIO}}\n\n{{BLOQUE_FIRMAS}}"
|
|
32995
34219
|
* }
|
|
32996
34220
|
*/
|
|
32997
34221
|
"application/json": {
|
|
32998
|
-
|
|
34222
|
+
body: string;
|
|
34223
|
+
/** Format: uuid */
|
|
34224
|
+
template_id?: string;
|
|
34225
|
+
document_kind?: string;
|
|
32999
34226
|
};
|
|
33000
34227
|
};
|
|
33001
34228
|
};
|
|
33002
34229
|
responses: {
|
|
33003
|
-
/** @description The
|
|
34230
|
+
/** @description The clause checklist */
|
|
33004
34231
|
200: {
|
|
33005
34232
|
headers: {
|
|
33006
34233
|
[name: string]: unknown;
|
|
@@ -33009,23 +34236,108 @@ interface paths {
|
|
|
33009
34236
|
/**
|
|
33010
34237
|
* @example {
|
|
33011
34238
|
* "data": {
|
|
33012
|
-
* "
|
|
33013
|
-
* "
|
|
33014
|
-
*
|
|
33015
|
-
*
|
|
33016
|
-
*
|
|
33017
|
-
*
|
|
33018
|
-
*
|
|
33019
|
-
*
|
|
33020
|
-
*
|
|
33021
|
-
*
|
|
33022
|
-
*
|
|
33023
|
-
*
|
|
33024
|
-
*
|
|
33025
|
-
*
|
|
33026
|
-
*
|
|
33027
|
-
*
|
|
33028
|
-
*
|
|
34239
|
+
* "document_kind": "sale_note",
|
|
34240
|
+
* "esenciales": [
|
|
34241
|
+
* {
|
|
34242
|
+
* "key": "partes",
|
|
34243
|
+
* "label": "Partes con RUT y domicilio",
|
|
34244
|
+
* "tier": "esencial",
|
|
34245
|
+
* "present": true,
|
|
34246
|
+
* "description": "Partes con RUT y domicilio."
|
|
34247
|
+
* },
|
|
34248
|
+
* {
|
|
34249
|
+
* "key": "vehiculo",
|
|
34250
|
+
* "label": "Identidad del vehículo",
|
|
34251
|
+
* "tier": "esencial",
|
|
34252
|
+
* "present": true,
|
|
34253
|
+
* "description": "Identidad del vehículo."
|
|
34254
|
+
* },
|
|
34255
|
+
* {
|
|
34256
|
+
* "key": "precio",
|
|
34257
|
+
* "label": "Precio en cifras y palabras",
|
|
34258
|
+
* "tier": "esencial",
|
|
34259
|
+
* "present": true,
|
|
34260
|
+
* "description": "Precio en cifras y palabras."
|
|
34261
|
+
* },
|
|
34262
|
+
* {
|
|
34263
|
+
* "key": "pago",
|
|
34264
|
+
* "label": "Forma de pago",
|
|
34265
|
+
* "tier": "esencial",
|
|
34266
|
+
* "present": true,
|
|
34267
|
+
* "description": "Forma de pago."
|
|
34268
|
+
* },
|
|
34269
|
+
* {
|
|
34270
|
+
* "key": "firmas",
|
|
34271
|
+
* "label": "Firmas",
|
|
34272
|
+
* "tier": "esencial",
|
|
34273
|
+
* "present": true,
|
|
34274
|
+
* "description": "Firmas."
|
|
34275
|
+
* }
|
|
34276
|
+
* ],
|
|
34277
|
+
* "recomendadas": [
|
|
34278
|
+
* {
|
|
34279
|
+
* "key": "folio",
|
|
34280
|
+
* "label": "Número de folio",
|
|
34281
|
+
* "tier": "recomendada",
|
|
34282
|
+
* "present": true,
|
|
34283
|
+
* "description": "Número de folio."
|
|
34284
|
+
* },
|
|
34285
|
+
* {
|
|
34286
|
+
* "key": "vendedor",
|
|
34287
|
+
* "label": "Vendedor de la automotora",
|
|
34288
|
+
* "tier": "recomendada",
|
|
34289
|
+
* "present": true,
|
|
34290
|
+
* "description": "Vendedor de la automotora."
|
|
34291
|
+
* },
|
|
34292
|
+
* {
|
|
34293
|
+
* "key": "chasis",
|
|
34294
|
+
* "label": "N° de chasis (VIN)",
|
|
34295
|
+
* "tier": "recomendada",
|
|
34296
|
+
* "present": true,
|
|
34297
|
+
* "description": "N° de chasis (VIN)."
|
|
34298
|
+
* },
|
|
34299
|
+
* {
|
|
34300
|
+
* "key": "kilometraje",
|
|
34301
|
+
* "label": "Kilometraje",
|
|
34302
|
+
* "tier": "recomendada",
|
|
34303
|
+
* "present": true,
|
|
34304
|
+
* "description": "Kilometraje."
|
|
34305
|
+
* },
|
|
34306
|
+
* {
|
|
34307
|
+
* "key": "impuesto_transferencia",
|
|
34308
|
+
* "label": "Impuesto a la transferencia",
|
|
34309
|
+
* "tier": "recomendada",
|
|
34310
|
+
* "present": true,
|
|
34311
|
+
* "description": "Impuesto a la transferencia."
|
|
34312
|
+
* },
|
|
34313
|
+
* {
|
|
34314
|
+
* "key": "condiciones",
|
|
34315
|
+
* "label": "Condiciones",
|
|
34316
|
+
* "tier": "recomendada",
|
|
34317
|
+
* "present": false,
|
|
34318
|
+
* "description": "Condiciones."
|
|
34319
|
+
* }
|
|
34320
|
+
* ],
|
|
34321
|
+
* "summary": {
|
|
34322
|
+
* "esenciales": {
|
|
34323
|
+
* "present": 5,
|
|
34324
|
+
* "total": 5
|
|
34325
|
+
* },
|
|
34326
|
+
* "recomendadas": {
|
|
34327
|
+
* "present": 5,
|
|
34328
|
+
* "total": 6
|
|
34329
|
+
* }
|
|
34330
|
+
* },
|
|
34331
|
+
* "missing_esenciales": [],
|
|
34332
|
+
* "removed_recomendadas": [
|
|
34333
|
+
* {
|
|
34334
|
+
* "key": "condiciones",
|
|
34335
|
+
* "label": "Condiciones",
|
|
34336
|
+
* "description": "La sección «Condiciones» con los términos del documento.",
|
|
34337
|
+
* "tier": "recomendada",
|
|
34338
|
+
* "present": false
|
|
34339
|
+
* }
|
|
34340
|
+
* ]
|
|
33029
34341
|
* }
|
|
33030
34342
|
* }
|
|
33031
34343
|
*/
|
|
@@ -33099,7 +34411,7 @@ interface paths {
|
|
|
33099
34411
|
patch?: never;
|
|
33100
34412
|
trace?: never;
|
|
33101
34413
|
};
|
|
33102
|
-
"/document-templates/
|
|
34414
|
+
"/document-templates/{id}/preview-values": {
|
|
33103
34415
|
parameters: {
|
|
33104
34416
|
query?: never;
|
|
33105
34417
|
header?: never;
|
|
@@ -33107,21 +34419,21 @@ interface paths {
|
|
|
33107
34419
|
cookie?: never;
|
|
33108
34420
|
};
|
|
33109
34421
|
/**
|
|
33110
|
-
*
|
|
33111
|
-
* @description
|
|
34422
|
+
* Placeholder values of the latest issued document of a template's type
|
|
34423
|
+
* @description What the template preview renders against: the `{{NAME}}` values of the most recent documento emitido of the template's document type, built by the SAME code that prints that document, so the preview cannot drift from the print. Covers `sale_note`, `compraventa`, `deal_settlement` (Resumen del negocio), `consignment` (mandato) and `consignment_settlement` (liquidación); nota de compra, reserva, cotización and ficha técnica print fixed layouts and have no values source. `source` names the document (`display_id`: the folio such as `V-12`, or the patente for a consignment, and when it was issued); it is `null` — with an empty `values` — when none exists or the type has no values source; the caller then falls back to the vocabulary examples. A fact the document lacks is absent from `values`, never blank. The values carry buyer/owner identity and money, so this requires `document_templates:read` AND the read scope of that document (`sale_notes:read` for nota de venta and compraventa, `consignments:read` for the two consignment families, `dealership_economics:read` for the Resumen del negocio). Writes and issues nothing.
|
|
33112
34424
|
*/
|
|
33113
34425
|
get: {
|
|
33114
34426
|
parameters: {
|
|
33115
|
-
query?:
|
|
33116
|
-
kind?: string;
|
|
33117
|
-
};
|
|
34427
|
+
query?: never;
|
|
33118
34428
|
header?: never;
|
|
33119
|
-
path
|
|
34429
|
+
path: {
|
|
34430
|
+
id: string;
|
|
34431
|
+
};
|
|
33120
34432
|
cookie?: never;
|
|
33121
34433
|
};
|
|
33122
34434
|
requestBody?: never;
|
|
33123
34435
|
responses: {
|
|
33124
|
-
/** @description
|
|
34436
|
+
/** @description The source document and its placeholder values */
|
|
33125
34437
|
200: {
|
|
33126
34438
|
headers: {
|
|
33127
34439
|
[name: string]: unknown;
|
|
@@ -33129,25 +34441,20 @@ interface paths {
|
|
|
33129
34441
|
content: {
|
|
33130
34442
|
/**
|
|
33131
34443
|
* @example {
|
|
33132
|
-
* "data":
|
|
33133
|
-
*
|
|
33134
|
-
*
|
|
33135
|
-
* "
|
|
33136
|
-
* "
|
|
33137
|
-
* "
|
|
33138
|
-
* "
|
|
33139
|
-
*
|
|
33140
|
-
*
|
|
33141
|
-
*
|
|
33142
|
-
*
|
|
33143
|
-
*
|
|
33144
|
-
*
|
|
33145
|
-
* "PRECIO_OFERTADO"
|
|
33146
|
-
* ]
|
|
34444
|
+
* "data": {
|
|
34445
|
+
* "document_kind": "sale_note",
|
|
34446
|
+
* "source": {
|
|
34447
|
+
* "document_kind": "sale_note",
|
|
34448
|
+
* "id": "5c1a3f0e-8b7d-4e2a-9c61-2d4f6a8b0c13",
|
|
34449
|
+
* "display_id": "V-12",
|
|
34450
|
+
* "issued_at": "2026-09-29T15:20:00.000Z"
|
|
34451
|
+
* },
|
|
34452
|
+
* "values": {
|
|
34453
|
+
* "FOLIO": "V-12",
|
|
34454
|
+
* "FECHA": "29 de septiembre de 2026",
|
|
34455
|
+
* "COMPRADOR_NOMBRE": "Persona Ejemplo",
|
|
34456
|
+
* "VEHICULO_PATENTE": "AB-CD-12"
|
|
33147
34457
|
* }
|
|
33148
|
-
* ],
|
|
33149
|
-
* "meta": {
|
|
33150
|
-
* "total": 1
|
|
33151
34458
|
* }
|
|
33152
34459
|
* }
|
|
33153
34460
|
*/
|
|
@@ -35088,29 +36395,176 @@ interface paths {
|
|
|
35088
36395
|
};
|
|
35089
36396
|
trace?: never;
|
|
35090
36397
|
};
|
|
35091
|
-
"/organization-legal/{organizationLegalId}/powers-of-attorney": {
|
|
36398
|
+
"/organization-legal/{organizationLegalId}/powers-of-attorney": {
|
|
36399
|
+
parameters: {
|
|
36400
|
+
query?: never;
|
|
36401
|
+
header?: never;
|
|
36402
|
+
path?: never;
|
|
36403
|
+
cookie?: never;
|
|
36404
|
+
};
|
|
36405
|
+
/**
|
|
36406
|
+
* List the poderes granted for this legal entity
|
|
36407
|
+
* @description The powers of attorney (poderes) on file for one of this workspace’s legal entities, revoked and expired ones included. When a poder is in force on the signing date, printing names its delegate as the representative, so the entity’s own representante RUT and escritura are no longer required. Requires `organization_legal:read`.
|
|
36408
|
+
*/
|
|
36409
|
+
get: {
|
|
36410
|
+
parameters: {
|
|
36411
|
+
query?: never;
|
|
36412
|
+
header?: never;
|
|
36413
|
+
path: {
|
|
36414
|
+
organizationLegalId: string;
|
|
36415
|
+
};
|
|
36416
|
+
cookie?: never;
|
|
36417
|
+
};
|
|
36418
|
+
requestBody?: never;
|
|
36419
|
+
responses: {
|
|
36420
|
+
/** @description Powers of attorney */
|
|
36421
|
+
200: {
|
|
36422
|
+
headers: {
|
|
36423
|
+
[name: string]: unknown;
|
|
36424
|
+
};
|
|
36425
|
+
content: {
|
|
36426
|
+
/**
|
|
36427
|
+
* @example {
|
|
36428
|
+
* "data": [
|
|
36429
|
+
* {
|
|
36430
|
+
* "id": "9b1d4c7e-2f3a-4e5b-8c6d-7a8b9c0d1e2f",
|
|
36431
|
+
* "tenant_id": "6c3f1a2b-9d8e-4b7a-8c5d-1e2f3a4b5c6d",
|
|
36432
|
+
* "organization_legal_id": "4e2a9c71-8b3d-4f5e-a1c6-2d7b9e0f3a58",
|
|
36433
|
+
* "delegate_name": "Andrea Soto Reyes",
|
|
36434
|
+
* "delegate_tax_id": "12345678-5",
|
|
36435
|
+
* "delegate_tax_id_kind": "rut",
|
|
36436
|
+
* "escritura_date": "2024-03-12",
|
|
36437
|
+
* "escritura_notary": "Notaría de ejemplo",
|
|
36438
|
+
* "escritura_comuna_code": "13132",
|
|
36439
|
+
* "escritura_comuna_name": "Vitacura",
|
|
36440
|
+
* "valid_from": "2024-03-12",
|
|
36441
|
+
* "valid_until": null,
|
|
36442
|
+
* "revoked_at": null,
|
|
36443
|
+
* "revoked_by": null,
|
|
36444
|
+
* "revoked_reason": null,
|
|
36445
|
+
* "created_at": "2024-03-14T15:02:11.000Z",
|
|
36446
|
+
* "updated_at": "2024-03-14T15:02:11.000Z"
|
|
36447
|
+
* }
|
|
36448
|
+
* ],
|
|
36449
|
+
* "meta": {
|
|
36450
|
+
* "total": 1
|
|
36451
|
+
* }
|
|
36452
|
+
* }
|
|
36453
|
+
*/
|
|
36454
|
+
"application/json": {
|
|
36455
|
+
data?: unknown;
|
|
36456
|
+
meta?: {
|
|
36457
|
+
[key: string]: unknown;
|
|
36458
|
+
};
|
|
36459
|
+
};
|
|
36460
|
+
};
|
|
36461
|
+
};
|
|
36462
|
+
/** @description Validation error */
|
|
36463
|
+
400: {
|
|
36464
|
+
headers: {
|
|
36465
|
+
[name: string]: unknown;
|
|
36466
|
+
};
|
|
36467
|
+
content: {
|
|
36468
|
+
"application/json": components["schemas"]["Error"];
|
|
36469
|
+
};
|
|
36470
|
+
};
|
|
36471
|
+
/** @description Unauthorized */
|
|
36472
|
+
401: {
|
|
36473
|
+
headers: {
|
|
36474
|
+
[name: string]: unknown;
|
|
36475
|
+
};
|
|
36476
|
+
content: {
|
|
36477
|
+
"application/json": components["schemas"]["Error"];
|
|
36478
|
+
};
|
|
36479
|
+
};
|
|
36480
|
+
/** @description Forbidden */
|
|
36481
|
+
403: {
|
|
36482
|
+
headers: {
|
|
36483
|
+
[name: string]: unknown;
|
|
36484
|
+
};
|
|
36485
|
+
content: {
|
|
36486
|
+
"application/json": components["schemas"]["Error"];
|
|
36487
|
+
};
|
|
36488
|
+
};
|
|
36489
|
+
/** @description Not found */
|
|
36490
|
+
404: {
|
|
36491
|
+
headers: {
|
|
36492
|
+
[name: string]: unknown;
|
|
36493
|
+
};
|
|
36494
|
+
content: {
|
|
36495
|
+
"application/json": components["schemas"]["Error"];
|
|
36496
|
+
};
|
|
36497
|
+
};
|
|
36498
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
36499
|
+
409: {
|
|
36500
|
+
headers: {
|
|
36501
|
+
[name: string]: unknown;
|
|
36502
|
+
};
|
|
36503
|
+
content: {
|
|
36504
|
+
"application/json": components["schemas"]["Error"];
|
|
36505
|
+
};
|
|
36506
|
+
};
|
|
36507
|
+
/** @description Rate limited */
|
|
36508
|
+
429: {
|
|
36509
|
+
headers: {
|
|
36510
|
+
[name: string]: unknown;
|
|
36511
|
+
};
|
|
36512
|
+
content: {
|
|
36513
|
+
"application/json": components["schemas"]["Error"];
|
|
36514
|
+
};
|
|
36515
|
+
};
|
|
36516
|
+
};
|
|
36517
|
+
};
|
|
36518
|
+
put?: never;
|
|
36519
|
+
post?: never;
|
|
36520
|
+
delete?: never;
|
|
36521
|
+
options?: never;
|
|
36522
|
+
head?: never;
|
|
36523
|
+
patch?: never;
|
|
36524
|
+
trace?: never;
|
|
36525
|
+
};
|
|
36526
|
+
"/sale-notes/{id}/participations/{participationId}": {
|
|
35092
36527
|
parameters: {
|
|
35093
36528
|
query?: never;
|
|
35094
36529
|
header?: never;
|
|
35095
36530
|
path?: never;
|
|
35096
36531
|
cookie?: never;
|
|
35097
36532
|
};
|
|
36533
|
+
get?: never;
|
|
36534
|
+
put?: never;
|
|
36535
|
+
post?: never;
|
|
36536
|
+
delete?: never;
|
|
36537
|
+
options?: never;
|
|
36538
|
+
head?: never;
|
|
35098
36539
|
/**
|
|
35099
|
-
*
|
|
35100
|
-
* @description
|
|
36540
|
+
* Record the missing commission on a participation
|
|
36541
|
+
* @description Fixes a «Sin comisión» sale: a participation written with no commission — its Vendedor had no compensation scheme when the nota de venta was emitted, or the car had no recorded cost (no computable Margen bruto to apply a rate to) — gets one. `commission_rate_bp` defaults to the member’s scheme as of the SALE’s day; `commission_basis_clp` defaults to the sale’s Margen bruto as it stands now (so: record the cost, then the commission). **409** when the participation already has a commission — a recorded commission is frozen and never restated — when the Margen bruto is still not computable and no basis is stated, or on a voided nota de venta. **400** when no rate is stated and the member had no scheme on that day. Once every participation has its commission, the sale’s Utilidad del negocio is computable and it enters Margen y rentabilidad’s totals.
|
|
35101
36542
|
*/
|
|
35102
|
-
|
|
36543
|
+
patch: {
|
|
35103
36544
|
parameters: {
|
|
35104
36545
|
query?: never;
|
|
35105
36546
|
header?: never;
|
|
35106
36547
|
path: {
|
|
35107
|
-
|
|
36548
|
+
id: string;
|
|
36549
|
+
participationId: string;
|
|
35108
36550
|
};
|
|
35109
36551
|
cookie?: never;
|
|
35110
36552
|
};
|
|
35111
|
-
requestBody?:
|
|
36553
|
+
requestBody?: {
|
|
36554
|
+
content: {
|
|
36555
|
+
/**
|
|
36556
|
+
* @example {
|
|
36557
|
+
* "commission_rate_bp": 250
|
|
36558
|
+
* }
|
|
36559
|
+
*/
|
|
36560
|
+
"application/json": {
|
|
36561
|
+
commission_rate_bp?: number;
|
|
36562
|
+
commission_basis_clp?: number;
|
|
36563
|
+
};
|
|
36564
|
+
};
|
|
36565
|
+
};
|
|
35112
36566
|
responses: {
|
|
35113
|
-
/** @description
|
|
36567
|
+
/** @description The participation, with its commission recorded */
|
|
35114
36568
|
200: {
|
|
35115
36569
|
headers: {
|
|
35116
36570
|
[name: string]: unknown;
|
|
@@ -35118,29 +36572,17 @@ interface paths {
|
|
|
35118
36572
|
content: {
|
|
35119
36573
|
/**
|
|
35120
36574
|
* @example {
|
|
35121
|
-
* "data":
|
|
35122
|
-
*
|
|
35123
|
-
*
|
|
35124
|
-
*
|
|
35125
|
-
*
|
|
35126
|
-
*
|
|
35127
|
-
*
|
|
35128
|
-
*
|
|
35129
|
-
*
|
|
35130
|
-
*
|
|
35131
|
-
*
|
|
35132
|
-
* "escritura_comuna_name": "Vitacura",
|
|
35133
|
-
* "valid_from": "2024-03-12",
|
|
35134
|
-
* "valid_until": null,
|
|
35135
|
-
* "revoked_at": null,
|
|
35136
|
-
* "revoked_by": null,
|
|
35137
|
-
* "revoked_reason": null,
|
|
35138
|
-
* "created_at": "2024-03-14T15:02:11.000Z",
|
|
35139
|
-
* "updated_at": "2024-03-14T15:02:11.000Z"
|
|
35140
|
-
* }
|
|
35141
|
-
* ],
|
|
35142
|
-
* "meta": {
|
|
35143
|
-
* "total": 1
|
|
36575
|
+
* "data": {
|
|
36576
|
+
* "id": "5d1c2b3a-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
|
|
36577
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
36578
|
+
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
36579
|
+
* "user_id": "11111111-0000-4000-8000-000000000001",
|
|
36580
|
+
* "role": "closer",
|
|
36581
|
+
* "commission_rate_bp": 250,
|
|
36582
|
+
* "commission_basis_clp": 1800000,
|
|
36583
|
+
* "commission_clp": 45000,
|
|
36584
|
+
* "created_at": "2026-09-14T11:30:00.000Z",
|
|
36585
|
+
* "updated_at": "2026-09-29T10:05:00.000Z"
|
|
35144
36586
|
* }
|
|
35145
36587
|
* }
|
|
35146
36588
|
*/
|
|
@@ -35208,12 +36650,6 @@ interface paths {
|
|
|
35208
36650
|
};
|
|
35209
36651
|
};
|
|
35210
36652
|
};
|
|
35211
|
-
put?: never;
|
|
35212
|
-
post?: never;
|
|
35213
|
-
delete?: never;
|
|
35214
|
-
options?: never;
|
|
35215
|
-
head?: never;
|
|
35216
|
-
patch?: never;
|
|
35217
36653
|
trace?: never;
|
|
35218
36654
|
};
|
|
35219
36655
|
"/reservations": {
|
|
@@ -36049,6 +37485,7 @@ interface paths {
|
|
|
36049
37485
|
* "tax_treatment": "afecto",
|
|
36050
37486
|
* "status": "issued",
|
|
36051
37487
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
37488
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
36052
37489
|
* "approved_by": null,
|
|
36053
37490
|
* "approved_at": null,
|
|
36054
37491
|
* "voided_at": null,
|
|
@@ -36550,7 +37987,7 @@ interface paths {
|
|
|
36550
37987
|
put?: never;
|
|
36551
37988
|
/**
|
|
36552
37989
|
* Request approval for a below-reference price
|
|
36553
|
-
* @description Names exactly one of `quote_id` / `reservation_id` / `sale_note_id`. The requester is the authenticated principal, never a body field.
|
|
37990
|
+
* @description Names exactly one of `quote_id` / `reservation_id` / `sale_note_id`. `requested_price_clp` is the price the buyer pays for the car — IVA included on an afecto sale — the same terms as the published price and the precio piso it is measured against (ADR 0114 §2.2). A sale note is approved when what its buyer pays is at or above an approved request. The requester is the authenticated principal, never a body field.
|
|
36554
37991
|
*/
|
|
36555
37992
|
post: {
|
|
36556
37993
|
parameters: {
|
|
@@ -36682,7 +38119,7 @@ interface paths {
|
|
|
36682
38119
|
};
|
|
36683
38120
|
/**
|
|
36684
38121
|
* Would this price need approval?
|
|
36685
|
-
* @description Evaluates `price_clp` against the unit named by exactly one of `vehicle_id` / `quote_id` / `reservation_id` / `sale_note_id` (UUID or folio), with the same policy `POST /price-approvals` enforces — so a screen that hides «Pedir aprobación» on `needs_approval: false` hides exactly the request the POST would refuse. `reason` is the stable code (`below_reference` | `within_tolerance` | `at_or_above_reference` | `no_reference`); `message` is a ready-to-show Spanish sentence. When the reference is the unit floor, `reference_clp` and `shortfall_clp` are ABSENT unless the caller holds `dealership_economics:read`. Requires `price_approval:read` or `price_approval:request`.
|
|
38122
|
+
* @description Evaluates `price_clp` — what the buyer pays for the car, IVA included on an afecto sale, the same terms as the published price and the precio piso (ADR 0114 §2.2) — against the unit named by exactly one of `vehicle_id` / `quote_id` / `reservation_id` / `sale_note_id` (UUID or folio), with the same policy `POST /price-approvals` enforces — so a screen that hides «Pedir aprobación» on `needs_approval: false` hides exactly the request the POST would refuse. `reason` is the stable code (`below_reference` | `within_tolerance` | `at_or_above_reference` | `no_reference`); `message` is a ready-to-show Spanish sentence. When the reference is the unit floor, `reference_clp` and `shortfall_clp` are ABSENT unless the caller holds `dealership_economics:read`. Requires `price_approval:read` or `price_approval:request`.
|
|
36686
38123
|
*/
|
|
36687
38124
|
get: {
|
|
36688
38125
|
parameters: {
|
|
@@ -37771,7 +39208,9 @@ interface paths {
|
|
|
37771
39208
|
* "subject_contact_id": null,
|
|
37772
39209
|
* "uploaded_by": "11111111-0000-4000-8000-000000000001",
|
|
37773
39210
|
* "uploaded_at": "2026-09-15T18:47:01.784Z",
|
|
37774
|
-
* "created_at": "2026-09-15T18:47:01.784Z"
|
|
39211
|
+
* "created_at": "2026-09-15T18:47:01.784Z",
|
|
39212
|
+
* "signed_document_type": null,
|
|
39213
|
+
* "signed_document_id": null
|
|
37775
39214
|
* },
|
|
37776
39215
|
* {
|
|
37777
39216
|
* "id": "f1f1f1f1-0000-4000-8000-000000000002",
|
|
@@ -37786,7 +39225,26 @@ interface paths {
|
|
|
37786
39225
|
* "subject_contact_id": "22222222-0000-4000-8000-000000000001",
|
|
37787
39226
|
* "uploaded_by": "11111111-0000-4000-8000-000000000001",
|
|
37788
39227
|
* "uploaded_at": "2026-09-15T18:47:01.784Z",
|
|
37789
|
-
* "created_at": "2026-09-15T18:47:01.784Z"
|
|
39228
|
+
* "created_at": "2026-09-15T18:47:01.784Z",
|
|
39229
|
+
* "signed_document_type": null,
|
|
39230
|
+
* "signed_document_id": null
|
|
39231
|
+
* },
|
|
39232
|
+
* {
|
|
39233
|
+
* "id": "f1f1f1f1-0000-4000-8000-000000000003",
|
|
39234
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
39235
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
39236
|
+
* "kind": "contrato",
|
|
39237
|
+
* "storage_bucket": "vitrina-registry",
|
|
39238
|
+
* "storage_path": "a1a1a1a1-0000-4000-8000-000000000001/e1e1e1e1-0000-4000-8000-000000000001/compraventa-firmada.pdf",
|
|
39239
|
+
* "filename": "compraventa-firmada.pdf",
|
|
39240
|
+
* "mime_type": "application/pdf",
|
|
39241
|
+
* "byte_size": 812004,
|
|
39242
|
+
* "subject_contact_id": null,
|
|
39243
|
+
* "uploaded_by": "11111111-0000-4000-8000-000000000001",
|
|
39244
|
+
* "uploaded_at": "2026-09-15T18:47:01.784Z",
|
|
39245
|
+
* "created_at": "2026-09-15T18:47:01.784Z",
|
|
39246
|
+
* "signed_document_type": "compraventa",
|
|
39247
|
+
* "signed_document_id": "d4d4d4d4-0000-4000-8000-000000000001"
|
|
37790
39248
|
* }
|
|
37791
39249
|
* ]
|
|
37792
39250
|
* }
|
|
@@ -37859,6 +39317,8 @@ interface paths {
|
|
|
37859
39317
|
/**
|
|
37860
39318
|
* Upload a registry document for a vehicle (multipart/form-data)
|
|
37861
39319
|
* @description Capped at the configured max size; the file part is required.
|
|
39320
|
+
*
|
|
39321
|
+
* A SIGNED COPY of one of the car’s documents (ADR 0114 §7) is filed with `signed_document_type` (`purchase_note`, `sale_note`, `compraventa`, `consignment_contract`, `liquidacion`) and `signed_document_id` (the nota de venta’s id for a compraventa, the consignación’s id for a liquidación). The document must be this car’s, and a compraventa must have been printed; `kind` may then be omitted — it is `contrato` for the compraventa and the mandato, `otro` for the rest — and a contradicting `kind` is refused (400). `GET /vehicles/{id}/documents` shows the copy on its document.
|
|
37862
39322
|
*/
|
|
37863
39323
|
post: {
|
|
37864
39324
|
parameters: {
|
|
@@ -37883,9 +39343,13 @@ interface paths {
|
|
|
37883
39343
|
/** Format: uuid */
|
|
37884
39344
|
vehicle_id: string;
|
|
37885
39345
|
/** @enum {string} */
|
|
37886
|
-
kind
|
|
39346
|
+
kind?: "padron" | "cedula" | "contrato" | "certificado_anotaciones" | "factura" | "otro";
|
|
37887
39347
|
/** Format: uuid */
|
|
37888
39348
|
subject_contact_id?: string;
|
|
39349
|
+
/** @enum {string} */
|
|
39350
|
+
signed_document_type?: "purchase_note" | "sale_note" | "compraventa" | "consignment_contract" | "liquidacion";
|
|
39351
|
+
/** Format: uuid */
|
|
39352
|
+
signed_document_id?: string;
|
|
37889
39353
|
file?: unknown;
|
|
37890
39354
|
};
|
|
37891
39355
|
};
|
|
@@ -37912,7 +39376,9 @@ interface paths {
|
|
|
37912
39376
|
* "subject_contact_id": null,
|
|
37913
39377
|
* "uploaded_by": "11111111-0000-4000-8000-000000000001",
|
|
37914
39378
|
* "uploaded_at": "2026-09-15T18:47:01.784Z",
|
|
37915
|
-
* "created_at": "2026-09-15T18:47:01.784Z"
|
|
39379
|
+
* "created_at": "2026-09-15T18:47:01.784Z",
|
|
39380
|
+
* "signed_document_type": null,
|
|
39381
|
+
* "signed_document_id": null
|
|
37916
39382
|
* }
|
|
37917
39383
|
* }
|
|
37918
39384
|
*/
|
|
@@ -38180,7 +39646,7 @@ interface paths {
|
|
|
38180
39646
|
};
|
|
38181
39647
|
/**
|
|
38182
39648
|
* Export the deals and their margins (xlsx / csv)
|
|
38183
|
-
* @description One row per live nota de venta in the window, with every settlement column: folio, date, status, patente, vehicle, regime, seller, buyer, buyer origin channel, leads, days in stock
|
|
39649
|
+
* @description One row per live nota de venta in the window, with every settlement column: folio, date, status, patente, vehicle, regime, seller, buyer, buyer origin channel, leads, days in stock; then the cifras del negocio, NET of IVA (sale price, Adicionales con margen, revenue, purchase cost, Margen bruto, additional costs, commissions, Utilidad del negocio), the Cobros por cuenta del comprador (cobrado / rendido, neutral); then the cifras del comprador, GROSS and labelled so (sale price con IVA, IVA, published price, discount amount and %); and `Completo` / `Pendiente` (what an incomplete sale lacks: «Sin costo», «Sin comisión», «Sin liquidación»). Every sale is a row. A figure that is not recorded or not computable is an EMPTY cell, never 0.
|
|
38184
39650
|
*
|
|
38185
39651
|
* Pass `period` (`YYYY-MM`, the Margen screen’s month) OR `from`/`to` (`YYYY-MM-DD`, inclusive, on the dealership’s calendar) — one of the two is required (400 otherwise), never both. `format` is `xlsx` (default) or `csv`. **413** over 2000 deals. Requires `dealership_economics:read`.
|
|
38186
39652
|
*/
|
|
@@ -38190,7 +39656,7 @@ interface paths {
|
|
|
38190
39656
|
period?: components["schemas"]["OverheadPeriod"];
|
|
38191
39657
|
from?: string;
|
|
38192
39658
|
to?: string;
|
|
38193
|
-
/** @description `xlsx` (a workbook, typed cells) or `csv` (UTF-8,
|
|
39659
|
+
/** @description `xlsx` (a workbook, typed cells) or `csv` (`;`-separated, UTF-8 with BOM, dd-mm-aaaa dates, decimal comma; the first sheet only). Date-times are on the America/Santiago clock in both formats. */
|
|
38194
39660
|
format?: "xlsx" | "csv";
|
|
38195
39661
|
};
|
|
38196
39662
|
header?: never;
|
|
@@ -38284,6 +39750,12 @@ interface paths {
|
|
|
38284
39750
|
* The Resumen del negocio of one unit
|
|
38285
39751
|
* @description Everything about one car’s deal on one read: the published price, the discount (amount and %), the sale price, the purchase or consignment basis, the cost lines grouped by category with who absorbs each (`automotora` / `dueno` / `cliente`), the margin (the platform’s one margin definition, embedded whole with `complete` and `gaps`), the commission of each salesperson, the seller, the buyer and the buyer’s origin channel (the sale note’s lead first, then the buyer’s first conversation, then the contact’s recorded origin), how many people asked about the unit, days in stock (entry → approval) and days to sell (first publication → sale).
|
|
38286
39752
|
*
|
|
39753
|
+
* Cifras del negocio are NET of IVA (ADR 0114 §2.2): `pricing.sale_price_clp` and every `margin` figure. Cifras del comprador are GROSS: `pricing.total_clp` (what the buyer paid, net + IVA), `pricing.list_price_clp` and `pricing.discount_clp` (measured against the published price, which includes IVA). Where both appear together an afecto sale reads «Precio de venta $5.806.723 neto · $6.910.000 con IVA» under a «Cifras sin IVA» heading.
|
|
39754
|
+
*
|
|
39755
|
+
* The car’s lifecycle facts ride along: `ingreso` (how the car entered stock — `compra`, `consignacion` or `retoma` — the day, and the backing document with its folio; `null` = «Sin costo»), `sale_note.emitted_by` and `sale_note.approved_by` (who emitted and who approved the sale, by name; `null` = not recorded), `basis.consignment.contract_id` (where the Liquidación lives) and `post_sale` (the trámites the approved sale opened: total, pending, overdue on the dealership day and the next deadline; `null` until the sale is approved).
|
|
39756
|
+
*
|
|
39757
|
+
* Cobros por cuenta del comprador (the transfer tax, registry fees, notary — charged at exact cost) are in no margin figure; `pricing.pass_through_clp` (cobrado) and `pricing.pass_through_paid_out_clp` (rendido) carry the memo line «Cobrado por cuenta del comprador $X · rendido $Y».
|
|
39758
|
+
*
|
|
38287
39759
|
* `state` is `sold` (the newest live nota de venta is approved), `pending_approval` (issued, not yet approved) or `preview` (no live nota de venta: the settlement at the published price, with no discount, add-ons or commissions, flagged by a `preview` gap). A figure that is not recorded is `null`, never 0. Requires `dealership_economics:read`.
|
|
38288
39760
|
*/
|
|
38289
39761
|
get: {
|
|
@@ -38329,8 +39801,21 @@ interface paths {
|
|
|
38329
39801
|
* "status": "approved",
|
|
38330
39802
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
38331
39803
|
* "approved_at": "2026-09-20T10:30:00.000Z",
|
|
39804
|
+
* "approved_by": {
|
|
39805
|
+
* "user_id": "a1a1a1a1-0000-4000-8000-000000000003",
|
|
39806
|
+
* "name": "Paz Ortiz"
|
|
39807
|
+
* },
|
|
38332
39808
|
* "seller_of_record": "automotora"
|
|
38333
39809
|
* },
|
|
39810
|
+
* "ingreso": {
|
|
39811
|
+
* "kind": "compra",
|
|
39812
|
+
* "acquired_on": "2026-07-24",
|
|
39813
|
+
* "document": {
|
|
39814
|
+
* "type": "purchase_note",
|
|
39815
|
+
* "id": "e5e5e5e5-0000-4000-8000-000000000001",
|
|
39816
|
+
* "folio": "P-34"
|
|
39817
|
+
* }
|
|
39818
|
+
* },
|
|
38334
39819
|
* "pricing": {
|
|
38335
39820
|
* "list_price_clp": 12490000,
|
|
38336
39821
|
* "sale_price_clp": 11900000,
|
|
@@ -38339,7 +39824,8 @@ interface paths {
|
|
|
38339
39824
|
* "discount_clp": 590000,
|
|
38340
39825
|
* "discount_pct": 4.7,
|
|
38341
39826
|
* "add_on_charges_clp": 100000,
|
|
38342
|
-
* "pass_through_clp": 89900
|
|
39827
|
+
* "pass_through_clp": 89900,
|
|
39828
|
+
* "pass_through_paid_out_clp": 89900
|
|
38343
39829
|
* },
|
|
38344
39830
|
* "basis": {
|
|
38345
39831
|
* "regime": "propia",
|
|
@@ -38421,6 +39907,7 @@ interface paths {
|
|
|
38421
39907
|
* "precio_venta_clp": 11900000,
|
|
38422
39908
|
* "add_on_charges_clp": 100000,
|
|
38423
39909
|
* "pass_through_clp": 89900,
|
|
39910
|
+
* "pass_through_paid_out_clp": 89900,
|
|
38424
39911
|
* "dealer_take_clp": null
|
|
38425
39912
|
* },
|
|
38426
39913
|
* "costo_venta_clp": 9800000,
|
|
@@ -38509,6 +39996,13 @@ interface paths {
|
|
|
38509
39996
|
* "first_contact_at": "2026-08-02T14:10:00.000Z",
|
|
38510
39997
|
* "last_contact_at": "2026-09-18T21:45:00.000Z"
|
|
38511
39998
|
* },
|
|
39999
|
+
* "post_sale": {
|
|
40000
|
+
* "total": 3,
|
|
40001
|
+
* "pending": 1,
|
|
40002
|
+
* "overdue": 0,
|
|
40003
|
+
* "next_due_on": "2026-10-20",
|
|
40004
|
+
* "completed_at": null
|
|
40005
|
+
* },
|
|
38512
40006
|
* "timeline": {
|
|
38513
40007
|
* "entered_stock_at": "2026-07-24T12:00:00.000Z",
|
|
38514
40008
|
* "first_published_at": "2026-07-26T15:00:00.000Z",
|
|
@@ -38594,6 +40088,185 @@ interface paths {
|
|
|
38594
40088
|
patch?: never;
|
|
38595
40089
|
trace?: never;
|
|
38596
40090
|
};
|
|
40091
|
+
"/vehicles/{id}/documents": {
|
|
40092
|
+
parameters: {
|
|
40093
|
+
query?: never;
|
|
40094
|
+
header?: never;
|
|
40095
|
+
path?: never;
|
|
40096
|
+
cookie?: never;
|
|
40097
|
+
};
|
|
40098
|
+
/**
|
|
40099
|
+
* Every document of one car
|
|
40100
|
+
* @description The car’s papers in one read (ADR 0114 §7), in the dealership’s order: how it entered (`purchase_note`, nota de compra — or the `sale_note` with `role: parte_de_pago` that took it as a trade-in), the `consignment_contract` (contrato de consignación, the mandato), each `sale_note` (nota de venta, voided ones included) followed by its `compraventa` (contrato de compraventa), the `deal_settlement` (Resumen del negocio; `preview` while the car is in stock) and the `liquidacion` (liquidación al consignante).
|
|
40101
|
+
*
|
|
40102
|
+
* A paper the car is expected to have and does not is listed with `status: missing` (a nota de venta before the sale, a compraventa before approval, a liquidación before the consignor is paid). Other statuses: `issued`, `approved`, `voided` (notas), `printed` / `unprinted` (compraventa, mandato — frozen instruments), `preview` / `final` (Resumen del negocio), `paid` / `withdrawal` (liquidación).
|
|
40103
|
+
*
|
|
40104
|
+
* `pdf` is where the PDF is read (`method` + `path` under `/api/v1`); `print` is the call that issues an unprinted instrument (needs the write scope). `signable` says whether a signed copy belongs on the document; `signed_copy` is that copy in the expediente (upload it with `POST /vehicle-attachments` and `signed_document_type` + `signed_document_id`), `null` when missing and ABSENT for a caller without `vehicle_registry:read`.
|
|
40105
|
+
*
|
|
40106
|
+
* Requires `marketplace:read`. Each document type is listed only for a caller holding its read scope (`purchase_notes:read`, `consignments:read`, `sale_notes:read`, `dealership_economics:read`). No amounts.
|
|
40107
|
+
*/
|
|
40108
|
+
get: {
|
|
40109
|
+
parameters: {
|
|
40110
|
+
query?: never;
|
|
40111
|
+
header?: never;
|
|
40112
|
+
path: {
|
|
40113
|
+
id: string;
|
|
40114
|
+
};
|
|
40115
|
+
cookie?: never;
|
|
40116
|
+
};
|
|
40117
|
+
requestBody?: never;
|
|
40118
|
+
responses: {
|
|
40119
|
+
/** @description The car’s documents */
|
|
40120
|
+
200: {
|
|
40121
|
+
headers: {
|
|
40122
|
+
[name: string]: unknown;
|
|
40123
|
+
};
|
|
40124
|
+
content: {
|
|
40125
|
+
/**
|
|
40126
|
+
* @example {
|
|
40127
|
+
* "data": {
|
|
40128
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
40129
|
+
* "documents": [
|
|
40130
|
+
* {
|
|
40131
|
+
* "type": "purchase_note",
|
|
40132
|
+
* "id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
40133
|
+
* "folio": "P-34",
|
|
40134
|
+
* "issued_at": "2026-08-02T14:10:00.000Z",
|
|
40135
|
+
* "printed_at": null,
|
|
40136
|
+
* "status": "issued",
|
|
40137
|
+
* "pdf": {
|
|
40138
|
+
* "method": "GET",
|
|
40139
|
+
* "path": "/purchase-notes/d5d5d5d5-0000-4000-8000-000000000001/pdf"
|
|
40140
|
+
* },
|
|
40141
|
+
* "print": null,
|
|
40142
|
+
* "signable": true,
|
|
40143
|
+
* "signed_copy": null
|
|
40144
|
+
* },
|
|
40145
|
+
* {
|
|
40146
|
+
* "type": "sale_note",
|
|
40147
|
+
* "id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
40148
|
+
* "folio": "V-12",
|
|
40149
|
+
* "issued_at": "2026-09-20T15:02:00.000Z",
|
|
40150
|
+
* "printed_at": null,
|
|
40151
|
+
* "status": "approved",
|
|
40152
|
+
* "pdf": {
|
|
40153
|
+
* "method": "GET",
|
|
40154
|
+
* "path": "/sale-notes/d4d4d4d4-0000-4000-8000-000000000001/pdf"
|
|
40155
|
+
* },
|
|
40156
|
+
* "print": null,
|
|
40157
|
+
* "signable": true,
|
|
40158
|
+
* "signed_copy": null
|
|
40159
|
+
* },
|
|
40160
|
+
* {
|
|
40161
|
+
* "type": "compraventa",
|
|
40162
|
+
* "id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
40163
|
+
* "folio": "V-12",
|
|
40164
|
+
* "issued_at": "2026-09-20T16:40:00.000Z",
|
|
40165
|
+
* "printed_at": "2026-09-20T16:40:00.000Z",
|
|
40166
|
+
* "status": "printed",
|
|
40167
|
+
* "pdf": {
|
|
40168
|
+
* "method": "GET",
|
|
40169
|
+
* "path": "/sale-notes/d4d4d4d4-0000-4000-8000-000000000001/compraventa/pdf"
|
|
40170
|
+
* },
|
|
40171
|
+
* "print": null,
|
|
40172
|
+
* "signable": true,
|
|
40173
|
+
* "signed_copy": {
|
|
40174
|
+
* "attachment_id": "f1f1f1f1-0000-4000-8000-000000000003",
|
|
40175
|
+
* "filename": "compraventa-firmada.pdf",
|
|
40176
|
+
* "mime_type": "application/pdf",
|
|
40177
|
+
* "uploaded_at": "2026-09-21T10:05:00.000Z"
|
|
40178
|
+
* }
|
|
40179
|
+
* },
|
|
40180
|
+
* {
|
|
40181
|
+
* "type": "deal_settlement",
|
|
40182
|
+
* "id": null,
|
|
40183
|
+
* "folio": null,
|
|
40184
|
+
* "issued_at": "2026-09-20T15:30:00.000Z",
|
|
40185
|
+
* "printed_at": null,
|
|
40186
|
+
* "status": "final",
|
|
40187
|
+
* "pdf": {
|
|
40188
|
+
* "method": "GET",
|
|
40189
|
+
* "path": "/vehicles/e1e1e1e1-0000-4000-8000-000000000001/deal-settlement/pdf"
|
|
40190
|
+
* },
|
|
40191
|
+
* "print": null,
|
|
40192
|
+
* "signable": false
|
|
40193
|
+
* }
|
|
40194
|
+
* ]
|
|
40195
|
+
* }
|
|
40196
|
+
* }
|
|
40197
|
+
*/
|
|
40198
|
+
"application/json": {
|
|
40199
|
+
data?: unknown;
|
|
40200
|
+
meta?: {
|
|
40201
|
+
[key: string]: unknown;
|
|
40202
|
+
};
|
|
40203
|
+
};
|
|
40204
|
+
};
|
|
40205
|
+
};
|
|
40206
|
+
/** @description Validation error */
|
|
40207
|
+
400: {
|
|
40208
|
+
headers: {
|
|
40209
|
+
[name: string]: unknown;
|
|
40210
|
+
};
|
|
40211
|
+
content: {
|
|
40212
|
+
"application/json": components["schemas"]["Error"];
|
|
40213
|
+
};
|
|
40214
|
+
};
|
|
40215
|
+
/** @description Unauthorized */
|
|
40216
|
+
401: {
|
|
40217
|
+
headers: {
|
|
40218
|
+
[name: string]: unknown;
|
|
40219
|
+
};
|
|
40220
|
+
content: {
|
|
40221
|
+
"application/json": components["schemas"]["Error"];
|
|
40222
|
+
};
|
|
40223
|
+
};
|
|
40224
|
+
/** @description Forbidden */
|
|
40225
|
+
403: {
|
|
40226
|
+
headers: {
|
|
40227
|
+
[name: string]: unknown;
|
|
40228
|
+
};
|
|
40229
|
+
content: {
|
|
40230
|
+
"application/json": components["schemas"]["Error"];
|
|
40231
|
+
};
|
|
40232
|
+
};
|
|
40233
|
+
/** @description Not found */
|
|
40234
|
+
404: {
|
|
40235
|
+
headers: {
|
|
40236
|
+
[name: string]: unknown;
|
|
40237
|
+
};
|
|
40238
|
+
content: {
|
|
40239
|
+
"application/json": components["schemas"]["Error"];
|
|
40240
|
+
};
|
|
40241
|
+
};
|
|
40242
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
40243
|
+
409: {
|
|
40244
|
+
headers: {
|
|
40245
|
+
[name: string]: unknown;
|
|
40246
|
+
};
|
|
40247
|
+
content: {
|
|
40248
|
+
"application/json": components["schemas"]["Error"];
|
|
40249
|
+
};
|
|
40250
|
+
};
|
|
40251
|
+
/** @description Rate limited */
|
|
40252
|
+
429: {
|
|
40253
|
+
headers: {
|
|
40254
|
+
[name: string]: unknown;
|
|
40255
|
+
};
|
|
40256
|
+
content: {
|
|
40257
|
+
"application/json": components["schemas"]["Error"];
|
|
40258
|
+
};
|
|
40259
|
+
};
|
|
40260
|
+
};
|
|
40261
|
+
};
|
|
40262
|
+
put?: never;
|
|
40263
|
+
post?: never;
|
|
40264
|
+
delete?: never;
|
|
40265
|
+
options?: never;
|
|
40266
|
+
head?: never;
|
|
40267
|
+
patch?: never;
|
|
40268
|
+
trace?: never;
|
|
40269
|
+
};
|
|
38597
40270
|
"/vehicles/{id}/deal-settlement/pdf": {
|
|
38598
40271
|
parameters: {
|
|
38599
40272
|
query?: never;
|
|
@@ -38603,7 +40276,7 @@ interface paths {
|
|
|
38603
40276
|
};
|
|
38604
40277
|
/**
|
|
38605
40278
|
* Print the Resumen del negocio (PDF)
|
|
38606
|
-
* @description The Resumen del negocio as a PDF (`application/pdf`, served `inline`): the workspace’s default `deal_settlement` template — or `template_id` — filled with the deal’s facts, followed by a fixed table of the result walk
|
|
40279
|
+
* @description The Resumen del negocio as a PDF (`application/pdf`, served `inline`): the workspace’s default `deal_settlement` template — or `template_id` — filled with the deal’s facts, followed by a fixed table of the result walk headed «Cifras sin IVA», the costs by category and who absorbs them, and the commissions. Every figure of the walk is net of IVA (ADR 0114 §2.2); an afecto sale’s price reads «$5.806.723 neto · $6.910.000 con IVA», and no gross figure is a step of the walk. With no live template it prints the standard text. A missing fact prints «no registrado»; nothing is refused. A preview carries a «VISTA PREVIA» banner. `X-Template-Version` names the prose used. Requires `dealership_economics:read`.
|
|
38607
40280
|
*/
|
|
38608
40281
|
get: {
|
|
38609
40282
|
parameters: {
|
|
@@ -38700,12 +40373,12 @@ interface paths {
|
|
|
38700
40373
|
};
|
|
38701
40374
|
/**
|
|
38702
40375
|
* Export the Resumen del negocio (xlsx / csv)
|
|
38703
|
-
* @description The same Resumen del negocio as a planilla. `xlsx` (default) carries three sheets — **Resumen** (the result walk and the deal’s facts), **Costos** (by category and party) and **Comisiones** (per salesperson); `csv` carries the Resumen. Requires `dealership_economics:read`.
|
|
40376
|
+
* @description The same Resumen del negocio as a planilla. `xlsx` (default) carries three sheets — **Resumen** (the result walk, net of IVA — its `Monto sin IVA` column sums to the Utilidad; an afecto sale’s gross price, the published price and the discount are stated as facts, never in that column — and the deal’s facts), **Costos** (by category and party) and **Comisiones** (per salesperson); `csv` carries the Resumen. Requires `dealership_economics:read`.
|
|
38704
40377
|
*/
|
|
38705
40378
|
get: {
|
|
38706
40379
|
parameters: {
|
|
38707
40380
|
query?: {
|
|
38708
|
-
/** @description `xlsx` (a workbook, typed cells) or `csv` (UTF-8,
|
|
40381
|
+
/** @description `xlsx` (a workbook, typed cells) or `csv` (`;`-separated, UTF-8 with BOM, dd-mm-aaaa dates, decimal comma; the first sheet only). Date-times are on the America/Santiago clock in both formats. */
|
|
38709
40382
|
format?: "xlsx" | "csv";
|
|
38710
40383
|
};
|
|
38711
40384
|
header?: never;
|
|
@@ -38807,7 +40480,7 @@ interface paths {
|
|
|
38807
40480
|
from?: string;
|
|
38808
40481
|
to?: string;
|
|
38809
40482
|
status?: "issued" | "approved" | "voided";
|
|
38810
|
-
/** @description `xlsx` (a workbook, typed cells) or `csv` (UTF-8,
|
|
40483
|
+
/** @description `xlsx` (a workbook, typed cells) or `csv` (`;`-separated, UTF-8 with BOM, dd-mm-aaaa dates, decimal comma; the first sheet only). Date-times are on the America/Santiago clock in both formats. */
|
|
38811
40484
|
format?: "xlsx" | "csv";
|
|
38812
40485
|
};
|
|
38813
40486
|
header?: never;
|
|
@@ -38890,6 +40563,115 @@ interface paths {
|
|
|
38890
40563
|
patch?: never;
|
|
38891
40564
|
trace?: never;
|
|
38892
40565
|
};
|
|
40566
|
+
"/insights/seller-performance/export": {
|
|
40567
|
+
parameters: {
|
|
40568
|
+
query?: never;
|
|
40569
|
+
header?: never;
|
|
40570
|
+
path?: never;
|
|
40571
|
+
cookie?: never;
|
|
40572
|
+
};
|
|
40573
|
+
/**
|
|
40574
|
+
* Exportar comisiones — the month-end payroll file (Excel or CSV)
|
|
40575
|
+
* @description The same figures as the report above, rendered as an .xlsx workbook (default) or, with `?format=csv`, a `;`-separated UTF-8 CSV of the ledger, on the same export rail as `GET /vehicles/export`: sheet "Comisiones" is one row per seller per deal with the commission arithmetic visible (base × «Tasa %» → comisión; rates are percentages, never basis points; dates are dd-mm-aaaa hh:mm on the America/Santiago clock), sheet "Resumen" is what to pay each person. Same `?window=` parameter and the same `dealership_economics:read` gate as the report — a file must not be pullable for a period or by a principal the screen refuses. `Content-Disposition` carries the generated filename (`comisiones-<periodo>-<YYYY-MM-DD>.xlsx`). Audited.
|
|
40576
|
+
*/
|
|
40577
|
+
get: {
|
|
40578
|
+
parameters: {
|
|
40579
|
+
query?: {
|
|
40580
|
+
/** @description Which window. Omit it (with `from`/`to`) for an explicit range — the shape every ranged Insights report has always accepted. `calendar_month` is the one payroll wants: commission is paid monthly, and the month is the DEALERSHIP’s (America/Santiago), the same boundary the commission itself was resolved under. */
|
|
40581
|
+
window?: "24h" | "7d" | "30d" | "90d" | "calendar_month" | "calendar_year" | "custom";
|
|
40582
|
+
/** @description `window=calendar_month` only. ISO month, `YYYY-MM`. Defaults to the month in progress. */
|
|
40583
|
+
month?: string;
|
|
40584
|
+
/** @description `window=calendar_year` only. `YYYY`. Defaults to the year in progress. */
|
|
40585
|
+
year?: string;
|
|
40586
|
+
/** @description Explicit range only. ISO instant, INCLUSIVE. */
|
|
40587
|
+
from?: string;
|
|
40588
|
+
/** @description Explicit range only. ISO instant, EXCLUSIVE. */
|
|
40589
|
+
to?: string;
|
|
40590
|
+
/** @description `xlsx` (default; sheets "Comisiones" + "Resumen") or `csv` (the ledger: `;`-separated, UTF-8 with BOM, dd-mm-aaaa dates). */
|
|
40591
|
+
format?: "xlsx" | "csv";
|
|
40592
|
+
};
|
|
40593
|
+
header?: never;
|
|
40594
|
+
path?: never;
|
|
40595
|
+
cookie?: never;
|
|
40596
|
+
};
|
|
40597
|
+
requestBody?: never;
|
|
40598
|
+
responses: {
|
|
40599
|
+
/** @description The comisiones workbook (xlsx) */
|
|
40600
|
+
200: {
|
|
40601
|
+
headers: {
|
|
40602
|
+
/** @description attachment; filename="comisiones-….xlsx" */
|
|
40603
|
+
"Content-Disposition"?: string;
|
|
40604
|
+
[name: string]: unknown;
|
|
40605
|
+
};
|
|
40606
|
+
content: {
|
|
40607
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": string;
|
|
40608
|
+
"text/csv": string;
|
|
40609
|
+
};
|
|
40610
|
+
};
|
|
40611
|
+
/** @description Validation error */
|
|
40612
|
+
400: {
|
|
40613
|
+
headers: {
|
|
40614
|
+
[name: string]: unknown;
|
|
40615
|
+
};
|
|
40616
|
+
content: {
|
|
40617
|
+
"application/json": components["schemas"]["Error"];
|
|
40618
|
+
};
|
|
40619
|
+
};
|
|
40620
|
+
/** @description Unauthorized */
|
|
40621
|
+
401: {
|
|
40622
|
+
headers: {
|
|
40623
|
+
[name: string]: unknown;
|
|
40624
|
+
};
|
|
40625
|
+
content: {
|
|
40626
|
+
"application/json": components["schemas"]["Error"];
|
|
40627
|
+
};
|
|
40628
|
+
};
|
|
40629
|
+
/** @description Forbidden */
|
|
40630
|
+
403: {
|
|
40631
|
+
headers: {
|
|
40632
|
+
[name: string]: unknown;
|
|
40633
|
+
};
|
|
40634
|
+
content: {
|
|
40635
|
+
"application/json": components["schemas"]["Error"];
|
|
40636
|
+
};
|
|
40637
|
+
};
|
|
40638
|
+
/** @description Not found */
|
|
40639
|
+
404: {
|
|
40640
|
+
headers: {
|
|
40641
|
+
[name: string]: unknown;
|
|
40642
|
+
};
|
|
40643
|
+
content: {
|
|
40644
|
+
"application/json": components["schemas"]["Error"];
|
|
40645
|
+
};
|
|
40646
|
+
};
|
|
40647
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
40648
|
+
409: {
|
|
40649
|
+
headers: {
|
|
40650
|
+
[name: string]: unknown;
|
|
40651
|
+
};
|
|
40652
|
+
content: {
|
|
40653
|
+
"application/json": components["schemas"]["Error"];
|
|
40654
|
+
};
|
|
40655
|
+
};
|
|
40656
|
+
/** @description Rate limited */
|
|
40657
|
+
429: {
|
|
40658
|
+
headers: {
|
|
40659
|
+
[name: string]: unknown;
|
|
40660
|
+
};
|
|
40661
|
+
content: {
|
|
40662
|
+
"application/json": components["schemas"]["Error"];
|
|
40663
|
+
};
|
|
40664
|
+
};
|
|
40665
|
+
};
|
|
40666
|
+
};
|
|
40667
|
+
put?: never;
|
|
40668
|
+
post?: never;
|
|
40669
|
+
delete?: never;
|
|
40670
|
+
options?: never;
|
|
40671
|
+
head?: never;
|
|
40672
|
+
patch?: never;
|
|
40673
|
+
trace?: never;
|
|
40674
|
+
};
|
|
38893
40675
|
"/ai-agent-graphs": {
|
|
38894
40676
|
parameters: {
|
|
38895
40677
|
query?: never;
|
|
@@ -40761,7 +42543,7 @@ interface paths {
|
|
|
40761
42543
|
};
|
|
40762
42544
|
requestBody?: never;
|
|
40763
42545
|
responses: {
|
|
40764
|
-
/** @description The workspace’s rules, evaluation order —
|
|
42546
|
+
/** @description The workspace’s rules, evaluation order — responsable del auto, then a consignación intent rule, then an ordinary portal-scoped rule */
|
|
40765
42547
|
200: {
|
|
40766
42548
|
headers: {
|
|
40767
42549
|
[name: string]: unknown;
|
|
@@ -40773,7 +42555,7 @@ interface paths {
|
|
|
40773
42555
|
* {
|
|
40774
42556
|
* "id": "5c6f2a10-9b2e-4f7a-8b8b-1a2b3c4d5e6f",
|
|
40775
42557
|
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
40776
|
-
* "name": "
|
|
42558
|
+
* "name": "Responsable del auto",
|
|
40777
42559
|
* "enabled": true,
|
|
40778
42560
|
* "priority": 0,
|
|
40779
42561
|
* "match_sources": [],
|
|
@@ -59561,6 +61343,301 @@ interface paths {
|
|
|
59561
61343
|
};
|
|
59562
61344
|
trace?: never;
|
|
59563
61345
|
};
|
|
61346
|
+
"/clinic/migration/runs": {
|
|
61347
|
+
parameters: {
|
|
61348
|
+
query?: never;
|
|
61349
|
+
header?: never;
|
|
61350
|
+
path?: never;
|
|
61351
|
+
cookie?: never;
|
|
61352
|
+
};
|
|
61353
|
+
/**
|
|
61354
|
+
* The clinic’s migration runs, newest first
|
|
61355
|
+
* @description The clinic’s migration runs, newest first
|
|
61356
|
+
*
|
|
61357
|
+
* **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`.
|
|
61358
|
+
*/
|
|
61359
|
+
get: {
|
|
61360
|
+
parameters: {
|
|
61361
|
+
query?: {
|
|
61362
|
+
limit?: number;
|
|
61363
|
+
};
|
|
61364
|
+
header?: never;
|
|
61365
|
+
path?: never;
|
|
61366
|
+
cookie?: never;
|
|
61367
|
+
};
|
|
61368
|
+
requestBody?: never;
|
|
61369
|
+
responses: {
|
|
61370
|
+
/** @description MigrationRuns */
|
|
61371
|
+
200: {
|
|
61372
|
+
headers: {
|
|
61373
|
+
[name: string]: unknown;
|
|
61374
|
+
};
|
|
61375
|
+
content: {
|
|
61376
|
+
/**
|
|
61377
|
+
* @example {
|
|
61378
|
+
* "data": {
|
|
61379
|
+
* "items": [
|
|
61380
|
+
* {
|
|
61381
|
+
* "id": "01929a5e-7c10-7d3e-9a41-5b8f2c6d1e07",
|
|
61382
|
+
* "mode": "apply",
|
|
61383
|
+
* "status": "completed",
|
|
61384
|
+
* "status_label": "Completada",
|
|
61385
|
+
* "families": [
|
|
61386
|
+
* "patients",
|
|
61387
|
+
* "appointments"
|
|
61388
|
+
* ],
|
|
61389
|
+
* "started_at": "2026-10-30T23:05:00.000Z",
|
|
61390
|
+
* "finished_at": "2026-10-31T01:42:10.000Z",
|
|
61391
|
+
* "totals": {
|
|
61392
|
+
* "examined": 4213,
|
|
61393
|
+
* "created": 3980,
|
|
61394
|
+
* "unchanged": 190,
|
|
61395
|
+
* "gaps": 43
|
|
61396
|
+
* }
|
|
61397
|
+
* }
|
|
61398
|
+
* ]
|
|
61399
|
+
* }
|
|
61400
|
+
* }
|
|
61401
|
+
*/
|
|
61402
|
+
"application/json": {
|
|
61403
|
+
data?: unknown;
|
|
61404
|
+
meta?: {
|
|
61405
|
+
[key: string]: unknown;
|
|
61406
|
+
};
|
|
61407
|
+
};
|
|
61408
|
+
};
|
|
61409
|
+
};
|
|
61410
|
+
/** @description Validation error */
|
|
61411
|
+
400: {
|
|
61412
|
+
headers: {
|
|
61413
|
+
[name: string]: unknown;
|
|
61414
|
+
};
|
|
61415
|
+
content: {
|
|
61416
|
+
"application/json": components["schemas"]["Error"];
|
|
61417
|
+
};
|
|
61418
|
+
};
|
|
61419
|
+
/** @description Unauthorized */
|
|
61420
|
+
401: {
|
|
61421
|
+
headers: {
|
|
61422
|
+
[name: string]: unknown;
|
|
61423
|
+
};
|
|
61424
|
+
content: {
|
|
61425
|
+
"application/json": components["schemas"]["Error"];
|
|
61426
|
+
};
|
|
61427
|
+
};
|
|
61428
|
+
/** @description Forbidden */
|
|
61429
|
+
403: {
|
|
61430
|
+
headers: {
|
|
61431
|
+
[name: string]: unknown;
|
|
61432
|
+
};
|
|
61433
|
+
content: {
|
|
61434
|
+
"application/json": components["schemas"]["Error"];
|
|
61435
|
+
};
|
|
61436
|
+
};
|
|
61437
|
+
/** @description Not found */
|
|
61438
|
+
404: {
|
|
61439
|
+
headers: {
|
|
61440
|
+
[name: string]: unknown;
|
|
61441
|
+
};
|
|
61442
|
+
content: {
|
|
61443
|
+
"application/json": components["schemas"]["Error"];
|
|
61444
|
+
};
|
|
61445
|
+
};
|
|
61446
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
61447
|
+
409: {
|
|
61448
|
+
headers: {
|
|
61449
|
+
[name: string]: unknown;
|
|
61450
|
+
};
|
|
61451
|
+
content: {
|
|
61452
|
+
"application/json": components["schemas"]["Error"];
|
|
61453
|
+
};
|
|
61454
|
+
};
|
|
61455
|
+
/** @description Rate limited */
|
|
61456
|
+
429: {
|
|
61457
|
+
headers: {
|
|
61458
|
+
[name: string]: unknown;
|
|
61459
|
+
};
|
|
61460
|
+
content: {
|
|
61461
|
+
"application/json": components["schemas"]["Error"];
|
|
61462
|
+
};
|
|
61463
|
+
};
|
|
61464
|
+
};
|
|
61465
|
+
};
|
|
61466
|
+
put?: never;
|
|
61467
|
+
post?: never;
|
|
61468
|
+
delete?: never;
|
|
61469
|
+
options?: never;
|
|
61470
|
+
head?: never;
|
|
61471
|
+
patch?: never;
|
|
61472
|
+
trace?: never;
|
|
61473
|
+
};
|
|
61474
|
+
"/clinic/migration/runs/{id}": {
|
|
61475
|
+
parameters: {
|
|
61476
|
+
query?: never;
|
|
61477
|
+
header?: never;
|
|
61478
|
+
path?: never;
|
|
61479
|
+
cookie?: never;
|
|
61480
|
+
};
|
|
61481
|
+
/**
|
|
61482
|
+
* One migration run: progress per family, gaps by reason
|
|
61483
|
+
* @description Per family: status, phase, counts (examined / created / converted / updated / unchanged / kept_native / collapsed / skipped / gaps), progress against the latest dry-run, vendor requests. The gap summary counts what could not come across by reason, with Spanish labels. Counts and reason codes only — never a patient.
|
|
61484
|
+
*
|
|
61485
|
+
* **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`.
|
|
61486
|
+
*/
|
|
61487
|
+
get: {
|
|
61488
|
+
parameters: {
|
|
61489
|
+
query?: never;
|
|
61490
|
+
header?: never;
|
|
61491
|
+
path: {
|
|
61492
|
+
id: string;
|
|
61493
|
+
};
|
|
61494
|
+
cookie?: never;
|
|
61495
|
+
};
|
|
61496
|
+
requestBody?: never;
|
|
61497
|
+
responses: {
|
|
61498
|
+
/** @description MigrationRun */
|
|
61499
|
+
200: {
|
|
61500
|
+
headers: {
|
|
61501
|
+
[name: string]: unknown;
|
|
61502
|
+
};
|
|
61503
|
+
content: {
|
|
61504
|
+
/**
|
|
61505
|
+
* @example {
|
|
61506
|
+
* "data": {
|
|
61507
|
+
* "id": "01929a5e-7c10-7d3e-9a41-5b8f2c6d1e07",
|
|
61508
|
+
* "mode": "apply",
|
|
61509
|
+
* "status": "completed",
|
|
61510
|
+
* "status_label": "Completada",
|
|
61511
|
+
* "families": [
|
|
61512
|
+
* {
|
|
61513
|
+
* "family": "patients",
|
|
61514
|
+
* "label": "Fichas administrativas de pacientes (con cargas)",
|
|
61515
|
+
* "status": "done",
|
|
61516
|
+
* "status_label": "Lista",
|
|
61517
|
+
* "reason": null,
|
|
61518
|
+
* "reason_label": null,
|
|
61519
|
+
* "phase": null,
|
|
61520
|
+
* "phase_label": null,
|
|
61521
|
+
* "counts": {
|
|
61522
|
+
* "examined": 1480,
|
|
61523
|
+
* "created": 1402,
|
|
61524
|
+
* "unchanged": 60,
|
|
61525
|
+
* "gaps": 18
|
|
61526
|
+
* },
|
|
61527
|
+
* "progress": {
|
|
61528
|
+
* "examined": 1480,
|
|
61529
|
+
* "expected": 1480
|
|
61530
|
+
* },
|
|
61531
|
+
* "vendor_requests": 31,
|
|
61532
|
+
* "failures": 0,
|
|
61533
|
+
* "started_at": "2026-10-30T23:05:02.000Z",
|
|
61534
|
+
* "finished_at": "2026-10-30T23:31:40.000Z"
|
|
61535
|
+
* }
|
|
61536
|
+
* ],
|
|
61537
|
+
* "totals": {
|
|
61538
|
+
* "examined": 1480,
|
|
61539
|
+
* "created": 1402,
|
|
61540
|
+
* "unchanged": 60,
|
|
61541
|
+
* "gaps": 18
|
|
61542
|
+
* },
|
|
61543
|
+
* "gaps": [
|
|
61544
|
+
* {
|
|
61545
|
+
* "family": "patients",
|
|
61546
|
+
* "reason": "native_rut_match",
|
|
61547
|
+
* "reason_label": "Ya existe en Vitrina una ficha creada aquí con el mismo RUT: no se duplicó ni se fusionó.",
|
|
61548
|
+
* "count": 18
|
|
61549
|
+
* }
|
|
61550
|
+
* ],
|
|
61551
|
+
* "history_from": "2021-01-01",
|
|
61552
|
+
* "window_ends_at": "2026-11-01T21:00:00.000Z",
|
|
61553
|
+
* "started_at": "2026-10-30T23:05:00.000Z",
|
|
61554
|
+
* "finished_at": "2026-10-30T23:31:40.000Z",
|
|
61555
|
+
* "last_progress_at": "2026-10-30T23:31:40.000Z",
|
|
61556
|
+
* "job_deleted_at": "2026-10-30T23:31:41.000Z",
|
|
61557
|
+
* "instruction": {
|
|
61558
|
+
* "version": "clinic-migration-instruction/2026-09-28",
|
|
61559
|
+
* "sha256": "b1946ac92492d2347c6235b4d2611184b1946ac92492d2347c6235b4d2611184",
|
|
61560
|
+
* "text": "Instruyo a Vitrina copiar desde Dentalink las fichas administrativas de pacientes …",
|
|
61561
|
+
* "instructed_by_user_id": "20000000-0000-4000-8000-000000000001",
|
|
61562
|
+
* "instructed_at": "2026-10-30T23:04:40.000Z",
|
|
61563
|
+
* "document_reference": null
|
|
61564
|
+
* },
|
|
61565
|
+
* "error": null
|
|
61566
|
+
* }
|
|
61567
|
+
* }
|
|
61568
|
+
*/
|
|
61569
|
+
"application/json": {
|
|
61570
|
+
data?: unknown;
|
|
61571
|
+
meta?: {
|
|
61572
|
+
[key: string]: unknown;
|
|
61573
|
+
};
|
|
61574
|
+
};
|
|
61575
|
+
};
|
|
61576
|
+
};
|
|
61577
|
+
/** @description Validation error */
|
|
61578
|
+
400: {
|
|
61579
|
+
headers: {
|
|
61580
|
+
[name: string]: unknown;
|
|
61581
|
+
};
|
|
61582
|
+
content: {
|
|
61583
|
+
"application/json": components["schemas"]["Error"];
|
|
61584
|
+
};
|
|
61585
|
+
};
|
|
61586
|
+
/** @description Unauthorized */
|
|
61587
|
+
401: {
|
|
61588
|
+
headers: {
|
|
61589
|
+
[name: string]: unknown;
|
|
61590
|
+
};
|
|
61591
|
+
content: {
|
|
61592
|
+
"application/json": components["schemas"]["Error"];
|
|
61593
|
+
};
|
|
61594
|
+
};
|
|
61595
|
+
/** @description Forbidden */
|
|
61596
|
+
403: {
|
|
61597
|
+
headers: {
|
|
61598
|
+
[name: string]: unknown;
|
|
61599
|
+
};
|
|
61600
|
+
content: {
|
|
61601
|
+
"application/json": components["schemas"]["Error"];
|
|
61602
|
+
};
|
|
61603
|
+
};
|
|
61604
|
+
/** @description Not found */
|
|
61605
|
+
404: {
|
|
61606
|
+
headers: {
|
|
61607
|
+
[name: string]: unknown;
|
|
61608
|
+
};
|
|
61609
|
+
content: {
|
|
61610
|
+
"application/json": components["schemas"]["Error"];
|
|
61611
|
+
};
|
|
61612
|
+
};
|
|
61613
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
61614
|
+
409: {
|
|
61615
|
+
headers: {
|
|
61616
|
+
[name: string]: unknown;
|
|
61617
|
+
};
|
|
61618
|
+
content: {
|
|
61619
|
+
"application/json": components["schemas"]["Error"];
|
|
61620
|
+
};
|
|
61621
|
+
};
|
|
61622
|
+
/** @description Rate limited */
|
|
61623
|
+
429: {
|
|
61624
|
+
headers: {
|
|
61625
|
+
[name: string]: unknown;
|
|
61626
|
+
};
|
|
61627
|
+
content: {
|
|
61628
|
+
"application/json": components["schemas"]["Error"];
|
|
61629
|
+
};
|
|
61630
|
+
};
|
|
61631
|
+
};
|
|
61632
|
+
};
|
|
61633
|
+
put?: never;
|
|
61634
|
+
post?: never;
|
|
61635
|
+
delete?: never;
|
|
61636
|
+
options?: never;
|
|
61637
|
+
head?: never;
|
|
61638
|
+
patch?: never;
|
|
61639
|
+
trace?: never;
|
|
61640
|
+
};
|
|
59564
61641
|
"/clinic/patients/{id}/encounters": {
|
|
59565
61642
|
parameters: {
|
|
59566
61643
|
query?: never;
|
|
@@ -75680,6 +77757,8 @@ interface paths {
|
|
|
75680
77757
|
* @description Answers the question the agent and the test-drive flow actually ask: is this car ours to hand over? Returns the ACTIVE contract (or null) plus a `not_on_lot` flag.
|
|
75681
77758
|
*
|
|
75682
77759
|
* Use this rather than filtering the list by `vehicle_id`: a vehicle can have several historical contracts and only ever one active, and this endpoint is the one that resolves that.
|
|
77760
|
+
*
|
|
77761
|
+
* `mandato` is the active contract’s mandato (ADR 0114 §5): `sin_emitir` — approving the sale of this car is refused until it is emitted; `sin_firmar` — emitted, but no signed copy was filed in the car’s expediente (the car shows an alert; nothing is blocked); `firmado`. `null` when there is no active contract.
|
|
75683
77762
|
*/
|
|
75684
77763
|
get: {
|
|
75685
77764
|
parameters: {
|
|
@@ -75701,6 +77780,12 @@ interface paths {
|
|
|
75701
77780
|
/**
|
|
75702
77781
|
* @example {
|
|
75703
77782
|
* "data": {
|
|
77783
|
+
* "vehicleId": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
77784
|
+
* "tenencia": "consignacion",
|
|
77785
|
+
* "tenenciaSource": "document",
|
|
77786
|
+
* "hasActiveContract": true,
|
|
77787
|
+
* "modalidad": "en_local",
|
|
77788
|
+
* "notOnLot": false,
|
|
75704
77789
|
* "contract": {
|
|
75705
77790
|
* "id": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
75706
77791
|
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
@@ -75720,7 +77805,12 @@ interface paths {
|
|
|
75720
77805
|
* "sale_iva_regime": "exento",
|
|
75721
77806
|
* "not_on_lot": false
|
|
75722
77807
|
* },
|
|
75723
|
-
* "
|
|
77808
|
+
* "mandato": {
|
|
77809
|
+
* "contractId": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
77810
|
+
* "estado": "sin_firmar",
|
|
77811
|
+
* "emittedAt": "2026-09-10T14:00:00.000Z",
|
|
77812
|
+
* "signedAt": null
|
|
77813
|
+
* }
|
|
75724
77814
|
* }
|
|
75725
77815
|
* }
|
|
75726
77816
|
*/
|
|
@@ -76197,6 +78287,8 @@ interface paths {
|
|
|
76197
78287
|
* Sell the car and settle with the owner
|
|
76198
78288
|
* @description One atomic action doing two things: moves the contract to `vendido`, and produces the **Liquidación** — sale price minus commission equals the amount owed to the owner, plus the payment record. Requires `amount_venta_clp`; `paid_at` records when the owner was actually paid.
|
|
76199
78289
|
*
|
|
78290
|
+
* **The payout is described in full or refused (400)**: `payout_method` (transferencia, vale_vista or cheque), `payout_bank`, `payout_account` (the cuenta de destino — only its last four digits are stored and returned as `payout_account_last4`), `payout_operation_number` and `payout_paid_by` («pagado por», an active member of the workspace). All of them print on the liquidación with the payment and registration dates.
|
|
78291
|
+
*
|
|
76200
78292
|
* Legal only from `activo`; anything else is a 409. Answers 201 with the contract and the Liquidación.
|
|
76201
78293
|
*
|
|
76202
78294
|
* It does NOT close the vehicle’s side — the estadía close belongs to the vehicle lifecycle, so mark the vehicle sold separately.
|
|
@@ -76218,13 +78310,34 @@ interface paths {
|
|
|
76218
78310
|
/**
|
|
76219
78311
|
* @example {
|
|
76220
78312
|
* "amount_venta_clp": 8900000,
|
|
76221
|
-
* "paid_at": "2026-09-18T15:00:00.000Z"
|
|
78313
|
+
* "paid_at": "2026-09-18T15:00:00.000Z",
|
|
78314
|
+
* "payout_method": "transferencia",
|
|
78315
|
+
* "payout_bank": "Banco de Chile",
|
|
78316
|
+
* "payout_account": "00-123-45678-21",
|
|
78317
|
+
* "payout_operation_number": "99887766",
|
|
78318
|
+
* "payout_paid_by": "11111111-0000-4000-8000-000000000001"
|
|
76222
78319
|
* }
|
|
76223
78320
|
*/
|
|
76224
78321
|
"application/json": {
|
|
76225
78322
|
amount_venta_clp: number;
|
|
76226
78323
|
/** Format: date-time */
|
|
76227
78324
|
paid_at?: string;
|
|
78325
|
+
/**
|
|
78326
|
+
* @description Medio de pago al consignante: `transferencia`, `vale_vista` o `cheque`.
|
|
78327
|
+
* @enum {string}
|
|
78328
|
+
*/
|
|
78329
|
+
payout_method: "transferencia" | "vale_vista" | "cheque";
|
|
78330
|
+
/** @description Banco por el que se pagó. */
|
|
78331
|
+
payout_bank: string;
|
|
78332
|
+
/** @description Cuenta de destino. Solo se guardan sus últimos 4 dígitos (`payout_account_last4`), que es lo que muestran la app y la liquidación. */
|
|
78333
|
+
payout_account: string;
|
|
78334
|
+
/** @description Número de operación del pago. */
|
|
78335
|
+
payout_operation_number: string;
|
|
78336
|
+
/**
|
|
78337
|
+
* Format: uuid
|
|
78338
|
+
* @description «Pagado por»: id de usuario de un miembro activo del equipo.
|
|
78339
|
+
*/
|
|
78340
|
+
payout_paid_by: string;
|
|
76228
78341
|
};
|
|
76229
78342
|
};
|
|
76230
78343
|
};
|
|
@@ -76272,6 +78385,12 @@ interface paths {
|
|
|
76272
78385
|
* "deducciones_clp": 0,
|
|
76273
78386
|
* "retiro_motivo": null,
|
|
76274
78387
|
* "retiro_by": null,
|
|
78388
|
+
* "payout_method": "transferencia",
|
|
78389
|
+
* "payout_bank": "Banco de Chile",
|
|
78390
|
+
* "payout_account_last4": "5821",
|
|
78391
|
+
* "payout_operation_number": "99887766",
|
|
78392
|
+
* "payout_paid_by": "11111111-0000-4000-8000-000000000001",
|
|
78393
|
+
* "payout_paid_by_name": "Ana Pérez",
|
|
76275
78394
|
* "paid_at": "2026-09-18T15:00:00.000Z",
|
|
76276
78395
|
* "created_at": "2026-09-18T15:00:05.000Z",
|
|
76277
78396
|
* "updated_at": "2026-09-18T15:00:05.000Z"
|
|
@@ -76356,6 +78475,8 @@ interface paths {
|
|
|
76356
78475
|
/**
|
|
76357
78476
|
* Fetch the settlement record
|
|
76358
78477
|
* @description The persisted Liquidación for a contract. It only exists once the contract has been sold — this is a read of a record, not a projection computed on demand, so the figures are what was agreed at settlement even if the terms changed afterwards.
|
|
78478
|
+
*
|
|
78479
|
+
* It carries how the owner was paid (`payout_*`, with `payout_paid_by_name` resolved for display). On a liquidación registered before the payout fields were required they are all `null`: nothing reconstructs them, and the app shows them as not registered.
|
|
76359
78480
|
*/
|
|
76360
78481
|
get: {
|
|
76361
78482
|
parameters: {
|
|
@@ -76391,6 +78512,12 @@ interface paths {
|
|
|
76391
78512
|
* "deducciones_clp": 0,
|
|
76392
78513
|
* "retiro_motivo": null,
|
|
76393
78514
|
* "retiro_by": null,
|
|
78515
|
+
* "payout_method": "transferencia",
|
|
78516
|
+
* "payout_bank": "Banco de Chile",
|
|
78517
|
+
* "payout_account_last4": "5821",
|
|
78518
|
+
* "payout_operation_number": "99887766",
|
|
78519
|
+
* "payout_paid_by": "11111111-0000-4000-8000-000000000001",
|
|
78520
|
+
* "payout_paid_by_name": "Ana Pérez",
|
|
76394
78521
|
* "paid_at": "2026-09-18T15:00:00.000Z",
|
|
76395
78522
|
* "created_at": "2026-09-18T15:00:05.000Z",
|
|
76396
78523
|
* "updated_at": "2026-09-18T15:00:05.000Z"
|
|
@@ -78307,7 +80434,7 @@ interface paths {
|
|
|
78307
80434
|
"application/json": components["schemas"]["OutboundVerdictError"];
|
|
78308
80435
|
};
|
|
78309
80436
|
};
|
|
78310
|
-
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact, an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
80437
|
+
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact (a single free-text reply to a customer who wrote in again after THEIR OWN opt-out passes inside the WhatsApp / Instagram / Messenger 24-hour window, or in the same email thread; a block your team set or a spam complaint still refuses), an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
78311
80438
|
422: {
|
|
78312
80439
|
headers: {
|
|
78313
80440
|
[name: string]: unknown;
|
|
@@ -78573,7 +80700,7 @@ interface paths {
|
|
|
78573
80700
|
};
|
|
78574
80701
|
/**
|
|
78575
80702
|
* List pending scheduled sends
|
|
78576
|
-
* @description The replies waiting to fire on this conversation
|
|
80703
|
+
* @description The replies waiting to fire on this conversation, plus the ones that FAILED in the last 7 days (`status: failed`), one per send. A failed row carries `failure: { code, label }`: `code` is one of `copy_refused`, `policy_blocked`, `conversation_missing`, `delivery_failed` or `not_sent`, and `label` is a Spanish sentence to show as is; the raw error is never exposed. `failure` is null on a pending row. One that has gone out, was cancelled or was dismissed leaves this list. `policy_acknowledged` records the Advertencias the author went ahead over when they scheduled it; those are not re-asked at fire time, a Bloqueo still is.
|
|
78577
80704
|
*/
|
|
78578
80705
|
get: {
|
|
78579
80706
|
parameters: {
|
|
@@ -78606,13 +80733,19 @@ interface paths {
|
|
|
78606
80733
|
* "bcc": [],
|
|
78607
80734
|
* "send_at": "2026-09-23T13:00:00+00:00",
|
|
78608
80735
|
* "status": "scheduled",
|
|
78609
|
-
* "
|
|
78610
|
-
* "
|
|
78611
|
-
*
|
|
78612
|
-
*
|
|
78613
|
-
*
|
|
78614
|
-
* "
|
|
78615
|
-
* "
|
|
80736
|
+
* "failure": null,
|
|
80737
|
+
* "created_at": "2026-09-22T11:09:04.112Z"
|
|
80738
|
+
* },
|
|
80739
|
+
* {
|
|
80740
|
+
* "id": "44444444-0000-4000-8000-00000000b002",
|
|
80741
|
+
* "content": "Adjunto la cotización que me pediste.",
|
|
80742
|
+
* "send_at": "2026-09-22T15:00:00+00:00",
|
|
80743
|
+
* "status": "failed",
|
|
80744
|
+
* "failure": {
|
|
80745
|
+
* "code": "copy_refused",
|
|
80746
|
+
* "label": "Una dirección en copia ya no puede recibir correos (se dio de baja, rebotó o marcó spam). Quítala de cc/bcc y vuelve a enviarlo."
|
|
80747
|
+
* },
|
|
80748
|
+
* "created_at": "2026-09-22T10:02:11.004Z"
|
|
78616
80749
|
* }
|
|
78617
80750
|
* ]
|
|
78618
80751
|
* }
|
|
@@ -78701,7 +80834,7 @@ interface paths {
|
|
|
78701
80834
|
post?: never;
|
|
78702
80835
|
/**
|
|
78703
80836
|
* Cancel a scheduled send
|
|
78704
|
-
* @description The reply never goes out and the row is gone — there is no un-cancel, rescheduling means composing it again. A message that already
|
|
80837
|
+
* @description The reply never goes out and the row is gone — there is no un-cancel, rescheduling means composing it again. On a FAILED row it dismisses it: the row leaves the list. A message that already went out (or was already cancelled or dismissed) is a 404.
|
|
78705
80838
|
*/
|
|
78706
80839
|
delete: {
|
|
78707
80840
|
parameters: {
|
|
@@ -78938,7 +81071,7 @@ interface paths {
|
|
|
78938
81071
|
"application/json": components["schemas"]["OutboundVerdictError"];
|
|
78939
81072
|
};
|
|
78940
81073
|
};
|
|
78941
|
-
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact, an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
81074
|
+
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact (a single free-text reply to a customer who wrote in again after THEIR OWN opt-out passes inside the WhatsApp / Instagram / Messenger 24-hour window, or in the same email thread; a block your team set or a spam complaint still refuses), an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
78942
81075
|
422: {
|
|
78943
81076
|
headers: {
|
|
78944
81077
|
[name: string]: unknown;
|
|
@@ -79125,7 +81258,7 @@ interface paths {
|
|
|
79125
81258
|
"application/json": components["schemas"]["OutboundVerdictError"];
|
|
79126
81259
|
};
|
|
79127
81260
|
};
|
|
79128
|
-
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact, an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
81261
|
+
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact (a single free-text reply to a customer who wrote in again after THEIR OWN opt-out passes inside the WhatsApp / Instagram / Messenger 24-hour window, or in the same email thread; a block your team set or a spam complaint still refuses), an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
79129
81262
|
422: {
|
|
79130
81263
|
headers: {
|
|
79131
81264
|
[name: string]: unknown;
|
|
@@ -79439,7 +81572,7 @@ interface paths {
|
|
|
79439
81572
|
"application/json": components["schemas"]["OutboundVerdictError"];
|
|
79440
81573
|
};
|
|
79441
81574
|
};
|
|
79442
|
-
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact, an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
81575
|
+
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact (a single free-text reply to a customer who wrote in again after THEIR OWN opt-out passes inside the WhatsApp / Instagram / Messenger 24-hour window, or in the same email thread; a block your team set or a spam complaint still refuses), an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
79443
81576
|
422: {
|
|
79444
81577
|
headers: {
|
|
79445
81578
|
[name: string]: unknown;
|
|
@@ -79616,7 +81749,7 @@ interface paths {
|
|
|
79616
81749
|
"application/json": components["schemas"]["OutboundVerdictError"];
|
|
79617
81750
|
};
|
|
79618
81751
|
};
|
|
79619
|
-
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact, an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
81752
|
+
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact (a single free-text reply to a customer who wrote in again after THEIR OWN opt-out passes inside the WhatsApp / Instagram / Messenger 24-hour window, or in the same email thread; a block your team set or a spam complaint still refuses), an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
79620
81753
|
422: {
|
|
79621
81754
|
headers: {
|
|
79622
81755
|
[name: string]: unknown;
|
|
@@ -79787,7 +81920,7 @@ interface paths {
|
|
|
79787
81920
|
"application/json": components["schemas"]["OutboundVerdictError"];
|
|
79788
81921
|
};
|
|
79789
81922
|
};
|
|
79790
|
-
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact, an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
81923
|
+
/** @description `OUTBOUND_BLOCKED` — a Bloqueo de envío: an opted-out contact (a single free-text reply to a customer who wrote in again after THEIR OWN opt-out passes inside the WhatsApp / Instagram / Messenger 24-hour window, or in the same email thread; a block your team set or a spam complaint still refuses), an active hold, a closed WhatsApp 24-hour window with no template, a template Meta will reject, no channel identity, a disconnected or red account. Never overridable; `error.hint` says what to do instead. */
|
|
79791
81924
|
422: {
|
|
79792
81925
|
headers: {
|
|
79793
81926
|
[name: string]: unknown;
|
|
@@ -96721,6 +98854,29 @@ interface paths {
|
|
|
96721
98854
|
* "outcomes": 42,
|
|
96722
98855
|
* "attributed_outcomes": 31,
|
|
96723
98856
|
* "coverage_percent": 73.8
|
|
98857
|
+
* },
|
|
98858
|
+
* "signals": {
|
|
98859
|
+
* "score": 72,
|
|
98860
|
+
* "components": [
|
|
98861
|
+
* {
|
|
98862
|
+
* "key": "meta",
|
|
98863
|
+
* "status": "ok",
|
|
98864
|
+
* "earned": 30,
|
|
98865
|
+
* "max": 30
|
|
98866
|
+
* },
|
|
98867
|
+
* {
|
|
98868
|
+
* "key": "origin",
|
|
98869
|
+
* "status": "partial",
|
|
98870
|
+
* "earned": 29.5,
|
|
98871
|
+
* "max": 40
|
|
98872
|
+
* },
|
|
98873
|
+
* {
|
|
98874
|
+
* "key": "site_tag",
|
|
98875
|
+
* "status": "partial",
|
|
98876
|
+
* "earned": 12,
|
|
98877
|
+
* "max": 30
|
|
98878
|
+
* }
|
|
98879
|
+
* ]
|
|
96724
98880
|
* }
|
|
96725
98881
|
* }
|
|
96726
98882
|
* }
|
|
@@ -97864,7 +100020,7 @@ interface paths {
|
|
|
97864
100020
|
* ],
|
|
97865
100021
|
* "primary": true,
|
|
97866
100022
|
* "title": "Pausar «Video testimonio · 30 s»",
|
|
97867
|
-
* "why": "Se desgasta: en sus últimos 7 días, frente a sus 28 días anteriores, el CTR cayó 30 % o más o el costo por resultado subió
|
|
100023
|
+
* "why": "Se desgasta: en sus últimos 7 días, frente a sus 28 días anteriores, el CTR cayó 30 % o más o el costo por resultado subió 43 % o más, durante 3 días seguidos. Lleva **$184.300** de gasto en los últimos 28 días y no le trae presupuestos aceptados.",
|
|
97868
100024
|
* "effect": "Deja de mostrarse de inmediato; puedes reactivarlo cuando quieras.",
|
|
97869
100025
|
* "target": {
|
|
97870
100026
|
* "level": "ad",
|
|
@@ -106265,7 +108421,11 @@ interface paths {
|
|
|
106265
108421
|
*
|
|
106266
108422
|
* `by_tenencia` (Tenencia, ADR 0025) splits the lot four ways: `propio`, `consignacion_en_local`, `consignacion_virtual` and `consignacion_sin_contrato` (consigned on the vehicle row with NO contract in `estado=activo`). The four PARTITION the lot — they sum to `total` — and each equals the length of the list its chip opens: `GET /vehicles?active=false&tenencia=…[&consignacion_modalidad=…]`, the same predicate builder serving both. Like `by_location` and `total`, they count the WHOLE lot rather than active stock only, which is what the Stock screen shows (it sends `active=false`).
|
|
106267
108423
|
*
|
|
106268
|
-
* `propio_sin_clasificar` (Phase 2, tenencia_source, 20270903000000) is a SUB-COUNT of `propio`, NOT a fifth bucket — the four above still sum to `total`. It is the cars nobody has ever classified (`tenencia_source=default`), provably coextensive with "sin clasificar" (a consignación can never be `default`). Measured on production 2026-08-31: 903 of 967 vehicles carried `propio` with nobody having said so — that is what this number answers, rather than leaving `propio` an unresolved warning. Opens with `GET /vehicles?active=false&tenencia=propio&tenencia_source=default`.
|
|
108424
|
+
* `propio_sin_clasificar` (Phase 2, tenencia_source, 20270903000000) is a SUB-COUNT of `propio`, NOT a fifth bucket — the four above still sum to `total`. It is the cars nobody has ever classified (`tenencia_source=default`), provably coextensive with "sin clasificar" (a consignación can never be `default`). Measured on production 2026-08-31: 903 of 967 vehicles carried `propio` with nobody having said so — that is what this number answers, rather than leaving `propio` an unresolved warning. Opens with `GET /vehicles?active=false&tenencia=propio&tenencia_source=default`.
|
|
108425
|
+
*
|
|
108426
|
+
* `sin_costo` (ADR 0114 §8, «Sin costo») counts the active, non-vendido cars with NO acquisition — no nota de compra, contrato de consignación or parte de pago — so their cost is unknown. Opens with `GET /vehicles?view=sin_costo`, the same predicate. A statement about the cost basis: ABSENT (not 0) for a caller without `dealership_economics:read`.
|
|
108427
|
+
*
|
|
108428
|
+
* `mandato_sin_firmar` (ADR 0114 §5) counts the cars whose consignación (activa, or vendida) has an emitted mandato and no signed copy filed in the expediente. Opens with `GET /vehicles?view=mandato_sin_firmar`, the same predicate. Automotive-vertical only: a workspace on another vertical gets 403 here however its scopes are set.
|
|
106269
108429
|
*/
|
|
106270
108430
|
get: {
|
|
106271
108431
|
parameters: {
|
|
@@ -106295,6 +108455,8 @@ interface paths {
|
|
|
106295
108455
|
* "with_error": 0,
|
|
106296
108456
|
* "unpublished": 7,
|
|
106297
108457
|
* "stale": 0,
|
|
108458
|
+
* "sin_costo": 7,
|
|
108459
|
+
* "mandato_sin_firmar": 1,
|
|
106298
108460
|
* "by_location": {
|
|
106299
108461
|
* "b1b1b1b1-0000-4000-8000-000000000001": 3,
|
|
106300
108462
|
* "b1b1b1b1-0000-4000-8000-000000000002": 1,
|
|
@@ -120787,12 +122949,12 @@ interface components {
|
|
|
120787
122949
|
/** @enum {string} */
|
|
120788
122950
|
code: "OUTBOUND_BLOCKED" | "OUTBOUND_WARNING";
|
|
120789
122951
|
message: string;
|
|
120790
|
-
reasons: ("contact_blocked" | "contact_spam" | "channel_suppressed" | "scope_blocked" | "marketing_consent_missing" | "email_not_subscribed" | "outbound_hold_active" | "window_closed" | "template_missing" | "template_not_approved" | "template_unsupported" | "template_params_incomplete" | "template_category_unknown" | "template_category_mismatch" | "legal_basis_mismatch" | "no_channel_identity" | "account_disconnected" | "account_quality_red" | "past_max_lateness" | "quiet_hours" | "conversation_human_owned" | "account_quality_degraded" | "conversation_closed" | "contact_archived" | "contact_merged" | "stale_context" | "input_unresolved" | "loop_same_content" | "loop_burst")[];
|
|
122952
|
+
reasons: ("contact_blocked" | "contact_spam" | "channel_suppressed" | "scope_blocked" | "marketing_consent_missing" | "email_not_subscribed" | "outbound_hold_active" | "window_closed" | "template_missing" | "template_not_approved" | "template_unsupported" | "template_params_incomplete" | "template_category_unknown" | "template_category_mismatch" | "legal_basis_mismatch" | "no_channel_identity" | "account_disconnected" | "account_quality_red" | "past_max_lateness" | "quiet_hours" | "conversation_human_owned" | "account_quality_degraded" | "conversation_closed" | "contact_archived" | "contact_merged" | "stale_context" | "input_unresolved" | "loop_same_content" | "loop_burst" | "copy_address_blocked")[];
|
|
120791
122953
|
hint: string;
|
|
120792
122954
|
details: {
|
|
120793
122955
|
reasons: {
|
|
120794
122956
|
/** @enum {string} */
|
|
120795
|
-
code: "contact_blocked" | "contact_spam" | "channel_suppressed" | "scope_blocked" | "marketing_consent_missing" | "email_not_subscribed" | "outbound_hold_active" | "window_closed" | "template_missing" | "template_not_approved" | "template_unsupported" | "template_params_incomplete" | "template_category_unknown" | "template_category_mismatch" | "legal_basis_mismatch" | "no_channel_identity" | "account_disconnected" | "account_quality_red" | "past_max_lateness" | "quiet_hours" | "conversation_human_owned" | "account_quality_degraded" | "conversation_closed" | "contact_archived" | "contact_merged" | "stale_context" | "input_unresolved" | "loop_same_content" | "loop_burst";
|
|
122957
|
+
code: "contact_blocked" | "contact_spam" | "channel_suppressed" | "scope_blocked" | "marketing_consent_missing" | "email_not_subscribed" | "outbound_hold_active" | "window_closed" | "template_missing" | "template_not_approved" | "template_unsupported" | "template_params_incomplete" | "template_category_unknown" | "template_category_mismatch" | "legal_basis_mismatch" | "no_channel_identity" | "account_disconnected" | "account_quality_red" | "past_max_lateness" | "quiet_hours" | "conversation_human_owned" | "account_quality_degraded" | "conversation_closed" | "contact_archived" | "contact_merged" | "stale_context" | "input_unresolved" | "loop_same_content" | "loop_burst" | "copy_address_blocked";
|
|
120796
122958
|
/** @enum {string} */
|
|
120797
122959
|
kind: "bloqueo" | "advertencia";
|
|
120798
122960
|
hint: string;
|
|
@@ -121053,6 +123215,11 @@ interface components {
|
|
|
121053
123215
|
outcome_counts: {
|
|
121054
123216
|
[key: string]: number;
|
|
121055
123217
|
};
|
|
123218
|
+
/** @description PIPELINE, never cash (not in `revenue` / `roas`): the period’s closes (`closed_won` — a clinic’s accepted plans, a dealer’s closed sales) that the attribution engine credited to an ad, with the value Vitrina recorded for them (CLP). On `current` only. `null` = unknown (the credit is still warming); absent on `previous` and on the sample. */
|
|
123219
|
+
attributed_pipeline?: {
|
|
123220
|
+
closed_count: number;
|
|
123221
|
+
closed_value: number;
|
|
123222
|
+
} | null;
|
|
121056
123223
|
};
|
|
121057
123224
|
previous: {
|
|
121058
123225
|
spend: number | null;
|
|
@@ -121079,6 +123246,11 @@ interface components {
|
|
|
121079
123246
|
outcome_counts: {
|
|
121080
123247
|
[key: string]: number;
|
|
121081
123248
|
};
|
|
123249
|
+
/** @description PIPELINE, never cash (not in `revenue` / `roas`): the period’s closes (`closed_won` — a clinic’s accepted plans, a dealer’s closed sales) that the attribution engine credited to an ad, with the value Vitrina recorded for them (CLP). On `current` only. `null` = unknown (the credit is still warming); absent on `previous` and on the sample. */
|
|
123250
|
+
attributed_pipeline?: {
|
|
123251
|
+
closed_count: number;
|
|
123252
|
+
closed_value: number;
|
|
123253
|
+
} | null;
|
|
121082
123254
|
};
|
|
121083
123255
|
/** @description `grain=day` only: every day of the window, oldest first. */
|
|
121084
123256
|
days?: components["schemas"]["AdsOverviewDay"][];
|
|
@@ -121118,7 +123290,7 @@ interface components {
|
|
|
121118
123290
|
campaign_name: string;
|
|
121119
123291
|
campaign_external_id: string | null;
|
|
121120
123292
|
spend: number;
|
|
121121
|
-
/** @description Conversions the attribution engine credits to this campaign over the period, under `model` —
|
|
123293
|
+
/** @description Conversions the attribution engine credits to this campaign over the period, under `model`. Today the engine counts CASH conversions only (payments; `revenue_type = cash`) — a lead, a cita or an accepted plan without a payment is not in it, so a workspace with no payments recorded reads 0 on every row. Not the population of `/ads/overview` `attributed_outcomes` (every kind) nor of `closed_outcome_count`. */
|
|
121122
123294
|
outcome_count: number;
|
|
121123
123295
|
outcome_value: number;
|
|
121124
123296
|
roas: number;
|
|
@@ -121208,6 +123380,22 @@ interface components {
|
|
|
121208
123380
|
conversational?: components["schemas"]["AdsConversational"] & unknown;
|
|
121209
123381
|
}[];
|
|
121210
123382
|
};
|
|
123383
|
+
AdsSignalComponent: {
|
|
123384
|
+
/** @enum {string} */
|
|
123385
|
+
key: "meta" | "origin" | "site_tag";
|
|
123386
|
+
/** @enum {string} */
|
|
123387
|
+
status: "ok" | "partial" | "missing" | "skipped" | "unknown";
|
|
123388
|
+
/** @description Points earned; 0 when `skipped` or `unknown`. */
|
|
123389
|
+
earned: number;
|
|
123390
|
+
/** @description The component’s weight (meta 30, origin 40, site_tag 30); it counts toward the total unless the status is `skipped` or `unknown`. */
|
|
123391
|
+
max: number;
|
|
123392
|
+
};
|
|
123393
|
+
/** @description Vitrina’s own signal score with partial credit: the Meta connection, the share of results with their origin identified (proportional — the same population as `outcomes_coverage`) and the website tag (live full, sparse partial, never reported 0; skipped when the workspace has no website). Not the engine’s `trust.instrumentation.score`, which grades a web checkout only. */
|
|
123394
|
+
AdsSignalsScore: {
|
|
123395
|
+
/** @description Salud’s «Puntaje de señales», 0–100: the earned share of the components that could be judged. `null` when none could. */
|
|
123396
|
+
score: number | null;
|
|
123397
|
+
components: components["schemas"]["AdsSignalComponent"][];
|
|
123398
|
+
};
|
|
121211
123399
|
AdsHealth: {
|
|
121212
123400
|
trust: {
|
|
121213
123401
|
model: string;
|
|
@@ -121272,6 +123460,7 @@ interface components {
|
|
|
121272
123460
|
attributed_outcomes: number;
|
|
121273
123461
|
coverage_percent: number;
|
|
121274
123462
|
} | null;
|
|
123463
|
+
signals: components["schemas"]["AdsSignalsScore"];
|
|
121275
123464
|
};
|
|
121276
123465
|
AdsFact: {
|
|
121277
123466
|
/** @description Stable fact key (`roas`, `best_campaign_name`, …) — a vocabulary name, not a resource id. */
|