@vitrina/api 11.26.0 → 11.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.cts +1407 -98
  2. package/dist/index.d.ts +1407 -98
  3. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -10546,6 +10546,124 @@ interface paths {
10546
10546
  patch?: never;
10547
10547
  trace?: never;
10548
10548
  };
10549
+ "/messaging-accounts/email-sender/mine": {
10550
+ parameters: {
10551
+ query?: never;
10552
+ header?: never;
10553
+ path?: never;
10554
+ cookie?: never;
10555
+ };
10556
+ /**
10557
+ * Mailboxes you can send a new email from
10558
+ * @description Lists the mailboxes the signed-in teammate may send a new email from: their own connected mailbox (the one whose address is their login email) and the workspace principal mailbox. `default_id` is the one used when a send or a draft does not set `from_account_id` — their own mailbox if they have one, otherwise the principal. `can_connect_own` is true when they have no mailbox of their own yet. Pass one of these ids as `from_account_id` to `POST /conversations/email` or to an email draft; any other mailbox is refused.
10559
+ */
10560
+ get: {
10561
+ parameters: {
10562
+ query?: never;
10563
+ header?: never;
10564
+ path?: never;
10565
+ cookie?: never;
10566
+ };
10567
+ requestBody?: never;
10568
+ responses: {
10569
+ /** @description Sendable mailboxes */
10570
+ 200: {
10571
+ headers: {
10572
+ [name: string]: unknown;
10573
+ };
10574
+ content: {
10575
+ /**
10576
+ * @example {
10577
+ * "options": [
10578
+ * {
10579
+ * "id": "0b5f4c2e-7d1a-4e9b-9c3f-2a6d8e1f4b70",
10580
+ * "name": "María",
10581
+ * "address": "maria@ejemplo.cl",
10582
+ * "role": "own"
10583
+ * },
10584
+ * {
10585
+ * "id": "5e2a9d14-3c8b-4f60-a1e7-9b4c2d7f0a35",
10586
+ * "name": "Ventas",
10587
+ * "address": "ventas@ejemplo.cl",
10588
+ * "role": "principal"
10589
+ * }
10590
+ * ],
10591
+ * "default_id": "0b5f4c2e-7d1a-4e9b-9c3f-2a6d8e1f4b70",
10592
+ * "can_connect_own": false
10593
+ * }
10594
+ */
10595
+ "application/json": {
10596
+ data?: unknown;
10597
+ meta?: {
10598
+ [key: string]: unknown;
10599
+ };
10600
+ };
10601
+ };
10602
+ };
10603
+ /** @description Validation error */
10604
+ 400: {
10605
+ headers: {
10606
+ [name: string]: unknown;
10607
+ };
10608
+ content: {
10609
+ "application/json": components["schemas"]["Error"];
10610
+ };
10611
+ };
10612
+ /** @description Unauthorized */
10613
+ 401: {
10614
+ headers: {
10615
+ [name: string]: unknown;
10616
+ };
10617
+ content: {
10618
+ "application/json": components["schemas"]["Error"];
10619
+ };
10620
+ };
10621
+ /** @description Forbidden */
10622
+ 403: {
10623
+ headers: {
10624
+ [name: string]: unknown;
10625
+ };
10626
+ content: {
10627
+ "application/json": components["schemas"]["Error"];
10628
+ };
10629
+ };
10630
+ /** @description Not found */
10631
+ 404: {
10632
+ headers: {
10633
+ [name: string]: unknown;
10634
+ };
10635
+ content: {
10636
+ "application/json": components["schemas"]["Error"];
10637
+ };
10638
+ };
10639
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
10640
+ 409: {
10641
+ headers: {
10642
+ [name: string]: unknown;
10643
+ };
10644
+ content: {
10645
+ "application/json": components["schemas"]["Error"];
10646
+ };
10647
+ };
10648
+ /** @description Rate limited */
10649
+ 429: {
10650
+ headers: {
10651
+ [name: string]: unknown;
10652
+ };
10653
+ content: {
10654
+ "application/json": components["schemas"]["Error"];
10655
+ };
10656
+ };
10657
+ };
10658
+ };
10659
+ put?: never;
10660
+ post?: never;
10661
+ delete?: never;
10662
+ options?: never;
10663
+ head?: never;
10664
+ patch?: never;
10665
+ trace?: never;
10666
+ };
10549
10667
  "/webhooks": {
10550
10668
  parameters: {
10551
10669
  query?: never;
@@ -11859,7 +11977,7 @@ interface paths {
11859
11977
  /** Format: uuid */
11860
11978
  user_id: string;
11861
11979
  /** @enum {string} */
11862
- role: "owner" | "admin" | "supervisor" | "agent" | "consultant";
11980
+ role: "owner" | "admin" | "supervisor" | "agent" | "consultant" | "marketing";
11863
11981
  /** Format: uuid */
11864
11982
  custom_role_id?: string | null;
11865
11983
  /** Format: email */
@@ -11997,7 +12115,7 @@ interface paths {
11997
12115
  */
11998
12116
  "application/json": {
11999
12117
  /** @enum {string} */
12000
- role?: "owner" | "admin" | "supervisor" | "agent" | "consultant";
12118
+ role?: "owner" | "admin" | "supervisor" | "agent" | "consultant" | "marketing";
12001
12119
  /** Format: uuid */
12002
12120
  custom_role_id?: string | null;
12003
12121
  /** @enum {string} */
@@ -12597,7 +12715,7 @@ interface paths {
12597
12715
  /** Format: email */
12598
12716
  email: string;
12599
12717
  /** @enum {string} */
12600
- role: "owner" | "admin" | "supervisor" | "agent" | "consultant";
12718
+ role: "owner" | "admin" | "supervisor" | "agent" | "consultant" | "marketing";
12601
12719
  /** Format: uuid */
12602
12720
  custom_role_id?: string | null;
12603
12721
  location_ids?: string[] | null;
@@ -13577,7 +13695,7 @@ interface paths {
13577
13695
  };
13578
13696
  /**
13579
13697
  * Read tenant-level settings
13580
- * @description The stored settings object, as saved through `PUT /tenant/settings`. Among its keys, `ads` holds the Vitrina Ads wizard choice: `{ tag_choice: "site" | "no_site" | null, tag_choice_at: string | null }` (`tag_choice_at` is stamped by the server on every write); absent when the workspace never answered the «Instalar el tag» step. Only the keys documented here are part of the API pública: the workspace's general identity (`name`, `timezone`, `language`, `currency`, `date_format`, `website`) and the Vitrina Ads choices under `ads`. A connected app receives exactly those keys; the workspace's own credentials may see further workspace-configuration keys, which are not contract and may change without notice.
13698
+ * @description The stored settings object, as saved through `PUT /tenant/settings`. Among its keys, `ads` holds the Vitrina Ads wizard choice: `{ tag_choice: "site" | "no_site" | null, tag_choice_at: string | null }` (`tag_choice_at` is stamped by the server on every write); absent when the workspace never answered the «Instalar el tag» step. Only the keys documented here are part of the API pública: the workspace's general identity (`name`, `timezone`, `language`, `currency`, `date_format`, `website`) and the Vitrina Ads choices under `ads`. Every API credential (API key, personal token, connected app, and the MCP) receives exactly those keys. Secrets are write-only: `slack_webhook_url` is never returned — a read answers `••••` plus `slack_webhook_configured`. Connected apps write only `ads`: any other key, `slack_webhook_url` included, is refused with 403, so a connected app cannot send the mask back either. For a workspace's own API key or personal token with `tenant:write`, writing `••••` back keeps the stored webhook, a new URL replaces it, and `null` or an empty string clears it. The webhook receives only the workspace's own alerts (pricing alerts and digests, reminders about its listings, consignments, credit applications and post-sale obligations, SLA breaches and safety holds); Vitrina never posts its internal alerts to it.
13581
13699
  */
13582
13700
  get: {
13583
13701
  parameters: {
@@ -13612,7 +13730,8 @@ interface paths {
13612
13730
  * },
13613
13731
  * "goal_at": "2026-09-01T12:00:00.000Z",
13614
13732
  * "goal_by": "20000000-0000-4000-8000-000000000001"
13615
- * }
13733
+ * },
13734
+ * "slack_webhook_configured": false
13616
13735
  * }
13617
13736
  * }
13618
13737
  */
@@ -13679,7 +13798,7 @@ interface paths {
13679
13798
  };
13680
13799
  /**
13681
13800
  * Patch tenant-level settings
13682
- * @description Shallow-merges the body into the stored settings and answers the result. `ads` is merged key by key (a write that sends only `ads.tag_choice` keeps `ads.goal`), and the server stamps `tag_choice_at` / `goal_at` / `goal_by` — a client never sends them (400). A connected app may write only `ads`; any other key is refused with 403 and nothing is written. Only the keys documented here are part of the API pública: the workspace's general identity (`name`, `timezone`, `language`, `currency`, `date_format`, `website`) and the Vitrina Ads choices under `ads`. A connected app receives exactly those keys; the workspace's own credentials may see further workspace-configuration keys, which are not contract and may change without notice.
13801
+ * @description Shallow-merges the body into the stored settings and answers the result. `ads` is merged key by key (a write that sends only `ads.tag_choice` keeps `ads.goal`), and the server stamps `tag_choice_at` / `goal_at` / `goal_by` — a client never sends them (400). A connected app may write only `ads`; any other key is refused with 403 and nothing is written. Requires `tenant:write`, or `ads:write` for a body that carries only `ads`. Only the keys documented here are part of the API pública: the workspace's general identity (`name`, `timezone`, `language`, `currency`, `date_format`, `website`) and the Vitrina Ads choices under `ads`. Every API credential (API key, personal token, connected app, and the MCP) receives exactly those keys. Secrets are write-only: `slack_webhook_url` is never returned — a read answers `••••` plus `slack_webhook_configured`. Connected apps write only `ads`: any other key, `slack_webhook_url` included, is refused with 403, so a connected app cannot send the mask back either. For a workspace's own API key or personal token with `tenant:write`, writing `••••` back keeps the stored webhook, a new URL replaces it, and `null` or an empty string clears it. The webhook receives only the workspace's own alerts (pricing alerts and digests, reminders about its listings, consignments, credit applications and post-sale obligations, SLA breaches and safety holds); Vitrina never posts its internal alerts to it.
13683
13802
  */
13684
13803
  put: {
13685
13804
  parameters: {
@@ -13718,7 +13837,8 @@ interface paths {
13718
13837
  * "ads": {
13719
13838
  * "tag_choice": "site",
13720
13839
  * "tag_choice_at": "2026-09-24T12:00:00.000Z"
13721
- * }
13840
+ * },
13841
+ * "slack_webhook_configured": false
13722
13842
  * }
13723
13843
  * }
13724
13844
  */
@@ -67483,7 +67603,7 @@ interface paths {
67483
67603
  put?: never;
67484
67604
  /**
67485
67605
  * Create or update one export rule per outcome Vitrina emits
67486
- * @description Automotive: `lead_created`→Lead, `appointment_booked`→Schedule, `payment_received`→Purchase (event value). Clinic: `lead_created`→Lead, `appointment_booked`→Schedule, `appointment_attended` and `quote_presented`→generic custom events, `closed_won`→Purchase (event value), and `payment_received` with its Meta destination DISABLED (cash ledger only). Idempotent: matched to existing rules by definition. A definition missing from the catalog is reported as `skipped`. Requires `ads:write`. Errors: `402 ENTITLEMENT_NOT_ACTIVE` (`details.feature: vitrina_ads`, with `hint`) when the Vitrina Ads Add-on is not active — never retried; `409 ADS_KEY_NEEDS_REMINT` when the Add-on is on but the delegated key has not finished rotating, or still lacks `exports:write` after one automatic re-mint (the entitlement rail converges it; see `GET /ads/state`).
67606
+ * @description Automotive: `lead_created`→Lead, `appointment_booked`→Schedule, `payment_received`→Purchase (event value). Clinic: `lead_created`→Lead, `appointment_booked`→Schedule, `appointment_attended` and `quote_presented`→generic custom events without value, `payment_received` with its Meta destination DISABLED (instalments never reach Meta), and the Purchase on the stage the clinic chose: the accepted presupuesto (`closed_won`, with its accepted value; the default) or — after the owner’s consented switch in «Enviar a Meta» (`send_stage:first_payment:on`) — the first payment of each accepted plan (`first_payment`, once per plan), `closed_won` then being a custom event without value. This route NEVER moves the Purchase, and a stage turned off from «Enviar a Meta» stays off. Idempotent: matched to existing rules by definition; a rule that already holds its body is `unchanged` (nothing written). A definition missing from the catalog is reported as `skipped`. Requires `ads:write`. Errors: `402 ENTITLEMENT_NOT_ACTIVE` (`details.feature: vitrina_ads`, with `hint`) when the Vitrina Ads Add-on is not active — never retried; `409 ADS_KEY_NEEDS_REMINT` when the Add-on is on but the delegated key has not finished rotating, or still lacks `exports:write` after one automatic re-mint (the entitlement rail converges it; see `GET /ads/state`).
67487
67607
  */
67488
67608
  post: {
67489
67609
  parameters: {
@@ -68244,7 +68364,7 @@ interface paths {
68244
68364
  patch?: never;
68245
68365
  trace?: never;
68246
68366
  };
68247
- "/payments": {
68367
+ "/ads/conversion-sync/status": {
68248
68368
  parameters: {
68249
68369
  query?: never;
68250
68370
  header?: never;
@@ -68252,20 +68372,14 @@ interface paths {
68252
68372
  cookie?: never;
68253
68373
  };
68254
68374
  /**
68255
- * Money that arrived — the Transferencias queue, or one contact
68256
- * @description `payments:read`. Without filters, the tenant's recent payments newest first. `unapplied=true` is the **Transferencias queue**: `Σ live allocations < amount_clp`, i.e. money we hold that is not fully spoken for — it covers all three shapes staff sees (no payer, a payer and no allocation, partly applied with a remainder), and `unidentified=true` narrows it to the first. Every row carries `unallocated_clp`, `suggested_contact_id` and `payer_reasons` (the matcher's stable codes, rendered as chips) plus its full allocation trail, released rows included — the Historial tab draws payment → allocations → obligations with no request per row. Reversed money is EXCLUDED unless `include_reversed=true`: reversed money is not money we hold.
68375
+ * What reaches Meta, stage by stage («Enviar a Meta»)
68376
+ * @description One read for the «Enviar a Meta» page and the wizard step: the state (`not_started | on | partial | off | blocked`, `wizard_done` = the step is resolved), the datasets of the connected ad account with the recommended one (the dataset active ad sets already optimise on, else the most recent), one lane per stage (the Meta event, its value, on/off, a typed wiring verdict, active ad sets, deliveries over 7 days with a per-day series), the Meta grant, the health-data protection, the owner’s consent and Meta links built on the server. The Meta connection is resolved server-side. A stage the workspace cannot send yet because its definition is missing heals on its own. `sample=1` (or a sandbox) answers the healthy sample page with a scripted arrival per lane (`sample_arrival_ms`). Poll-safe (`Cache-Control: no-store`). Changes go through `GET /ads/actions?screen=envio` (`send_setup`, `send_stage`, `send_dataset`, `send_stop`). Requires `ads:read`.
68257
68377
  */
68258
68378
  get: {
68259
68379
  parameters: {
68260
68380
  query?: {
68261
- contact_id?: string;
68262
- unapplied?: boolean | ("true" | "false");
68263
- unidentified?: boolean | ("true" | "false");
68264
- include_reversed?: boolean | ("true" | "false");
68265
- from?: string;
68266
- to?: string;
68267
- limit?: number;
68268
- offset?: number | null;
68381
+ /** @description `1` serves the deterministic sample dataset («Ver con datos de ejemplo»): same shapes, invented but internally consistent figures, no entitlement required (the scope still is). A sandbox workspace is always served the sample, with or without this parameter. */
68382
+ sample?: "1" | "true";
68269
68383
  };
68270
68384
  header?: never;
68271
68385
  path?: never;
@@ -68273,7 +68387,7 @@ interface paths {
68273
68387
  };
68274
68388
  requestBody?: never;
68275
68389
  responses: {
68276
- /** @description Payments */
68390
+ /** @description The send status */
68277
68391
  200: {
68278
68392
  headers: {
68279
68393
  [name: string]: unknown;
@@ -68281,70 +68395,1028 @@ interface paths {
68281
68395
  content: {
68282
68396
  /**
68283
68397
  * @example {
68284
- * "data": [
68285
- * {
68286
- * "id": "e86256b2-0000-4000-8000-000000000001",
68287
- * "contact_id": "1a73af9e-0000-4000-8000-000000000001",
68288
- * "suggested_contact_id": null,
68289
- * "payer_reasons": [
68290
- * "payer_recorded_by_staff"
68291
- * ],
68292
- * "source": "manual",
68293
- * "provenance": "manual",
68294
- * "instrument": "transferencia",
68295
- * "amount_clp": 50000,
68296
- * "paid_on": "2026-09-24",
68297
- * "allocated_clp": 50000,
68298
- * "unallocated_clp": 0,
68299
- * "bank": "Banco de Chile",
68300
- * "account_number": null,
68301
- * "document_number": "884213",
68302
- * "operation_id": null,
68303
- * "note": "Abono de la primera cuota",
68304
- * "card_fee_bps": null,
68305
- * "card_surcharge_clp": null,
68306
- * "card_surcharge_source": null,
68307
- * "location_id": null,
68308
- * "bank_movement_id": null,
68309
- * "gateway_transaction_id": null,
68310
- * "recorded_by": null,
68311
- * "recorded_at": "2026-09-22T22:21:16.954Z",
68312
- * "reversed": false,
68313
- * "reversed_at": null,
68314
- * "reversal_reason": null,
68315
- * "allocations": [
68316
- * {
68317
- * "id": "e8df2087-0000-4000-8000-000000000001",
68318
- * "customer_payment_id": "e86256b2-0000-4000-8000-000000000001",
68319
- * "customer_obligation_id": "b44936d0-0000-4000-8000-000000000004",
68320
- * "amount_clp": 50000,
68321
- * "method": "staff",
68322
- * "reasons": [
68323
- * "allocation_staff_manual"
68324
- * ],
68325
- * "allocated_by": null,
68326
- * "allocated_at": "2026-09-22T22:21:16.990Z",
68327
- * "released_at": null,
68328
- * "release_reason": null,
68329
- * "live": true
68330
- * }
68331
- * ]
68332
- * }
68333
- * ],
68334
- * "meta": {
68335
- * "pagination": {
68336
- * "limit": 50,
68337
- * "offset": 0,
68338
- * "total": 1
68339
- * }
68398
+ * "data": {
68399
+ * "state": "partial",
68400
+ * "blocked_reason": null,
68401
+ * "wizard_done": true,
68402
+ * "meta_connection": "connected",
68403
+ * "dataset": {
68404
+ * "external_id": "1234567890123456",
68405
+ * "id_tail": "3456",
68406
+ * "name": "Clínica Dental",
68407
+ * "last_fired_at": "2026-09-25T11:40:00.000Z",
68408
+ * "is_unavailable": false
68409
+ * },
68410
+ * "datasets": [
68411
+ * {
68412
+ * "external_id": "1234567890123456",
68413
+ * "id_tail": "3456",
68414
+ * "name": "Clínica Dental",
68415
+ * "last_fired_at": "2026-09-25T11:40:00.000Z",
68416
+ * "is_unavailable": false,
68417
+ * "recommended": true,
68418
+ * "recommended_reason": "used_by_ad_sets",
68419
+ * "selected": true
68420
+ * }
68421
+ * ],
68422
+ * "stages": [
68423
+ * {
68424
+ * "stage": "lead_created",
68425
+ * "label": "Contacto nuevo",
68426
+ * "meta_event": "Lead",
68427
+ * "meta_event_kind": "standard",
68428
+ * "value": "none",
68429
+ * "enabled": true,
68430
+ * "switchable": true,
68431
+ * "lock": null,
68432
+ * "awaiting_switch": false,
68433
+ * "source": "available",
68434
+ * "verdict": "below_threshold",
68435
+ * "active_ad_sets": 0,
68436
+ * "last_sent_at": "2026-09-25T12:40:00.000Z",
68437
+ * "sent_7d": 12,
68438
+ * "meta_volume_7d": null,
68439
+ * "series_7d": [
68440
+ * {
68441
+ * "date": "2026-09-19",
68442
+ * "count": 0
68443
+ * },
68444
+ * {
68445
+ * "date": "2026-09-20",
68446
+ * "count": 0
68447
+ * },
68448
+ * {
68449
+ * "date": "2026-09-21",
68450
+ * "count": 0
68451
+ * },
68452
+ * {
68453
+ * "date": "2026-09-22",
68454
+ * "count": 0
68455
+ * },
68456
+ * {
68457
+ * "date": "2026-09-23",
68458
+ * "count": 0
68459
+ * },
68460
+ * {
68461
+ * "date": "2026-09-24",
68462
+ * "count": 0
68463
+ * },
68464
+ * {
68465
+ * "date": "2026-09-25",
68466
+ * "count": 0
68467
+ * }
68468
+ * ],
68469
+ * "weekly_learning_target": 50,
68470
+ * "changed_by": null,
68471
+ * "changed_at": null,
68472
+ * "value_capped_7d": 0,
68473
+ * "value_cap_clp": null,
68474
+ * "too_old_28d": 0,
68475
+ * "purchases_reversed_28d": 0
68476
+ * },
68477
+ * {
68478
+ * "stage": "appointment_booked",
68479
+ * "label": "Cita agendada",
68480
+ * "meta_event": "Schedule",
68481
+ * "meta_event_kind": "standard",
68482
+ * "value": "none",
68483
+ * "enabled": true,
68484
+ * "switchable": true,
68485
+ * "lock": null,
68486
+ * "awaiting_switch": false,
68487
+ * "source": "available",
68488
+ * "verdict": "not_checked",
68489
+ * "active_ad_sets": 0,
68490
+ * "last_sent_at": "2026-09-25T11:40:00.000Z",
68491
+ * "sent_7d": 11,
68492
+ * "meta_volume_7d": null,
68493
+ * "series_7d": [
68494
+ * {
68495
+ * "date": "2026-09-19",
68496
+ * "count": 0
68497
+ * },
68498
+ * {
68499
+ * "date": "2026-09-20",
68500
+ * "count": 0
68501
+ * },
68502
+ * {
68503
+ * "date": "2026-09-21",
68504
+ * "count": 0
68505
+ * },
68506
+ * {
68507
+ * "date": "2026-09-22",
68508
+ * "count": 0
68509
+ * },
68510
+ * {
68511
+ * "date": "2026-09-23",
68512
+ * "count": 0
68513
+ * },
68514
+ * {
68515
+ * "date": "2026-09-24",
68516
+ * "count": 0
68517
+ * },
68518
+ * {
68519
+ * "date": "2026-09-25",
68520
+ * "count": 0
68521
+ * }
68522
+ * ],
68523
+ * "weekly_learning_target": 50,
68524
+ * "changed_by": null,
68525
+ * "changed_at": null,
68526
+ * "value_capped_7d": 0,
68527
+ * "value_cap_clp": null,
68528
+ * "too_old_28d": 0,
68529
+ * "purchases_reversed_28d": 0
68530
+ * },
68531
+ * {
68532
+ * "stage": "appointment_attended",
68533
+ * "label": "Cita atendida",
68534
+ * "meta_event": "appointment_attended",
68535
+ * "meta_event_kind": "custom",
68536
+ * "value": "none",
68537
+ * "enabled": false,
68538
+ * "switchable": true,
68539
+ * "lock": null,
68540
+ * "awaiting_switch": false,
68541
+ * "source": "available",
68542
+ * "verdict": "not_checked",
68543
+ * "active_ad_sets": 0,
68544
+ * "last_sent_at": "2026-09-25T10:40:00.000Z",
68545
+ * "sent_7d": 10,
68546
+ * "meta_volume_7d": null,
68547
+ * "series_7d": [
68548
+ * {
68549
+ * "date": "2026-09-19",
68550
+ * "count": 0
68551
+ * },
68552
+ * {
68553
+ * "date": "2026-09-20",
68554
+ * "count": 0
68555
+ * },
68556
+ * {
68557
+ * "date": "2026-09-21",
68558
+ * "count": 0
68559
+ * },
68560
+ * {
68561
+ * "date": "2026-09-22",
68562
+ * "count": 0
68563
+ * },
68564
+ * {
68565
+ * "date": "2026-09-23",
68566
+ * "count": 0
68567
+ * },
68568
+ * {
68569
+ * "date": "2026-09-24",
68570
+ * "count": 0
68571
+ * },
68572
+ * {
68573
+ * "date": "2026-09-25",
68574
+ * "count": 0
68575
+ * }
68576
+ * ],
68577
+ * "weekly_learning_target": 50,
68578
+ * "changed_by": null,
68579
+ * "changed_at": "2026-09-23T13:40:00.000Z",
68580
+ * "value_capped_7d": 0,
68581
+ * "value_cap_clp": null,
68582
+ * "too_old_28d": 0,
68583
+ * "purchases_reversed_28d": 0
68584
+ * },
68585
+ * {
68586
+ * "stage": "quote_presented",
68587
+ * "label": "Presupuesto presentado",
68588
+ * "meta_event": "quote_presented",
68589
+ * "meta_event_kind": "custom",
68590
+ * "value": "none",
68591
+ * "enabled": true,
68592
+ * "switchable": true,
68593
+ * "lock": null,
68594
+ * "awaiting_switch": false,
68595
+ * "source": "available",
68596
+ * "verdict": "not_checked",
68597
+ * "active_ad_sets": 0,
68598
+ * "last_sent_at": "2026-09-25T09:40:00.000Z",
68599
+ * "sent_7d": 9,
68600
+ * "meta_volume_7d": null,
68601
+ * "series_7d": [
68602
+ * {
68603
+ * "date": "2026-09-19",
68604
+ * "count": 0
68605
+ * },
68606
+ * {
68607
+ * "date": "2026-09-20",
68608
+ * "count": 0
68609
+ * },
68610
+ * {
68611
+ * "date": "2026-09-21",
68612
+ * "count": 0
68613
+ * },
68614
+ * {
68615
+ * "date": "2026-09-22",
68616
+ * "count": 0
68617
+ * },
68618
+ * {
68619
+ * "date": "2026-09-23",
68620
+ * "count": 0
68621
+ * },
68622
+ * {
68623
+ * "date": "2026-09-24",
68624
+ * "count": 0
68625
+ * },
68626
+ * {
68627
+ * "date": "2026-09-25",
68628
+ * "count": 0
68629
+ * }
68630
+ * ],
68631
+ * "weekly_learning_target": 50,
68632
+ * "changed_by": null,
68633
+ * "changed_at": null,
68634
+ * "value_capped_7d": 0,
68635
+ * "value_cap_clp": null,
68636
+ * "too_old_28d": 0,
68637
+ * "purchases_reversed_28d": 0
68638
+ * },
68639
+ * {
68640
+ * "stage": "closed_won",
68641
+ * "label": "Presupuesto aceptado",
68642
+ * "meta_event": "closed_won",
68643
+ * "meta_event_kind": "custom",
68644
+ * "value": "none",
68645
+ * "enabled": true,
68646
+ * "switchable": true,
68647
+ * "lock": null,
68648
+ * "awaiting_switch": false,
68649
+ * "source": "available",
68650
+ * "verdict": "wired",
68651
+ * "active_ad_sets": 2,
68652
+ * "last_sent_at": "2026-09-25T08:40:00.000Z",
68653
+ * "sent_7d": 8,
68654
+ * "meta_volume_7d": 14,
68655
+ * "series_7d": [
68656
+ * {
68657
+ * "date": "2026-09-19",
68658
+ * "count": 0
68659
+ * },
68660
+ * {
68661
+ * "date": "2026-09-20",
68662
+ * "count": 0
68663
+ * },
68664
+ * {
68665
+ * "date": "2026-09-21",
68666
+ * "count": 0
68667
+ * },
68668
+ * {
68669
+ * "date": "2026-09-22",
68670
+ * "count": 0
68671
+ * },
68672
+ * {
68673
+ * "date": "2026-09-23",
68674
+ * "count": 1
68675
+ * },
68676
+ * {
68677
+ * "date": "2026-09-24",
68678
+ * "count": 1
68679
+ * },
68680
+ * {
68681
+ * "date": "2026-09-25",
68682
+ * "count": 1
68683
+ * }
68684
+ * ],
68685
+ * "weekly_learning_target": 50,
68686
+ * "changed_by": null,
68687
+ * "changed_at": null,
68688
+ * "value_capped_7d": 0,
68689
+ * "value_cap_clp": null,
68690
+ * "too_old_28d": 0,
68691
+ * "purchases_reversed_28d": 0
68692
+ * },
68693
+ * {
68694
+ * "stage": "first_payment",
68695
+ * "label": "Primer pago",
68696
+ * "meta_event": "Purchase",
68697
+ * "meta_event_kind": "standard",
68698
+ * "value": "accepted_total",
68699
+ * "enabled": false,
68700
+ * "switchable": false,
68701
+ * "lock": null,
68702
+ * "awaiting_switch": false,
68703
+ * "source": "definition_missing",
68704
+ * "verdict": "not_checked",
68705
+ * "active_ad_sets": 0,
68706
+ * "last_sent_at": null,
68707
+ * "sent_7d": 0,
68708
+ * "meta_volume_7d": null,
68709
+ * "series_7d": [
68710
+ * {
68711
+ * "date": "2026-09-19",
68712
+ * "count": 0
68713
+ * },
68714
+ * {
68715
+ * "date": "2026-09-20",
68716
+ * "count": 0
68717
+ * },
68718
+ * {
68719
+ * "date": "2026-09-21",
68720
+ * "count": 0
68721
+ * },
68722
+ * {
68723
+ * "date": "2026-09-22",
68724
+ * "count": 0
68725
+ * },
68726
+ * {
68727
+ * "date": "2026-09-23",
68728
+ * "count": 0
68729
+ * },
68730
+ * {
68731
+ * "date": "2026-09-24",
68732
+ * "count": 0
68733
+ * },
68734
+ * {
68735
+ * "date": "2026-09-25",
68736
+ * "count": 0
68737
+ * }
68738
+ * ],
68739
+ * "weekly_learning_target": 50,
68740
+ * "changed_by": null,
68741
+ * "changed_at": null,
68742
+ * "value_capped_7d": 0,
68743
+ * "value_cap_clp": null,
68744
+ * "too_old_28d": 0,
68745
+ * "purchases_reversed_28d": 0
68746
+ * },
68747
+ * {
68748
+ * "stage": "payment_received",
68749
+ * "label": "Pago recibido",
68750
+ * "meta_event": "Purchase",
68751
+ * "meta_event_kind": "standard",
68752
+ * "value": "payment",
68753
+ * "enabled": false,
68754
+ * "switchable": false,
68755
+ * "lock": "installments",
68756
+ * "awaiting_switch": false,
68757
+ * "source": "available",
68758
+ * "verdict": "not_checked",
68759
+ * "active_ad_sets": 0,
68760
+ * "last_sent_at": "2026-09-25T07:40:00.000Z",
68761
+ * "sent_7d": 7,
68762
+ * "meta_volume_7d": null,
68763
+ * "series_7d": [
68764
+ * {
68765
+ * "date": "2026-09-19",
68766
+ * "count": 0
68767
+ * },
68768
+ * {
68769
+ * "date": "2026-09-20",
68770
+ * "count": 0
68771
+ * },
68772
+ * {
68773
+ * "date": "2026-09-21",
68774
+ * "count": 0
68775
+ * },
68776
+ * {
68777
+ * "date": "2026-09-22",
68778
+ * "count": 0
68779
+ * },
68780
+ * {
68781
+ * "date": "2026-09-23",
68782
+ * "count": 0
68783
+ * },
68784
+ * {
68785
+ * "date": "2026-09-24",
68786
+ * "count": 0
68787
+ * },
68788
+ * {
68789
+ * "date": "2026-09-25",
68790
+ * "count": 0
68791
+ * }
68792
+ * ],
68793
+ * "weekly_learning_target": 50,
68794
+ * "changed_by": null,
68795
+ * "changed_at": null,
68796
+ * "value_capped_7d": 0,
68797
+ * "value_cap_clp": null,
68798
+ * "too_old_28d": 0,
68799
+ * "purchases_reversed_28d": 0
68800
+ * }
68801
+ * ],
68802
+ * "enabled_count": 4,
68803
+ * "stage_count": 6,
68804
+ * "restriction": {
68805
+ * "kind": "unknown",
68806
+ * "since": null
68807
+ * },
68808
+ * "protected_dataset": null,
68809
+ * "recommended_optimization_stage": {
68810
+ * "stage": "appointment_attended",
68811
+ * "reason": "default",
68812
+ * "rate": null
68813
+ * },
68814
+ * "purchase_stage": "first_payment",
68815
+ * "purchase_switch_available": false,
68816
+ * "grant": "full",
68817
+ * "protection_required": true,
68818
+ * "protected": true,
68819
+ * "consent": {
68820
+ * "version": "2026-09-25.send-to-meta.v1",
68821
+ * "current": true,
68822
+ * "accepted_at": "2026-09-22T13:40:00.000Z"
68823
+ * },
68824
+ * "meta_links": {
68825
+ * "create_dataset": "https://business.facebook.com/events_manager2/overview?act=1000000000000001",
68826
+ * "events_manager": "https://business.facebook.com/events_manager2/list/pixel/1234567890123456/overview?act=1000000000000001",
68827
+ * "test_events": "https://business.facebook.com/events_manager2/list/pixel/1234567890123456/test_events?act=1000000000000001",
68828
+ * "ad_sets": "https://www.facebook.com/adsmanager/manage/adsets?act=1000000000000001"
68829
+ * },
68830
+ * "checked_at": "2026-09-25T10:40:00.000Z",
68831
+ * "stale": false,
68832
+ * "sample": false
68340
68833
  * }
68341
68834
  * }
68342
68835
  */
68343
68836
  "application/json": {
68344
- data?: unknown;
68345
- meta?: {
68346
- [key: string]: unknown;
68347
- };
68837
+ data: components["schemas"]["AdsSendStatus"];
68838
+ };
68839
+ };
68840
+ };
68841
+ /** @description Validation error */
68842
+ 400: {
68843
+ headers: {
68844
+ [name: string]: unknown;
68845
+ };
68846
+ content: {
68847
+ "application/json": components["schemas"]["Error"];
68848
+ };
68849
+ };
68850
+ /** @description Unauthorized */
68851
+ 401: {
68852
+ headers: {
68853
+ [name: string]: unknown;
68854
+ };
68855
+ content: {
68856
+ "application/json": components["schemas"]["Error"];
68857
+ };
68858
+ };
68859
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
68860
+ 402: {
68861
+ headers: {
68862
+ [name: string]: unknown;
68863
+ };
68864
+ content: {
68865
+ /**
68866
+ * @example {
68867
+ * "error": {
68868
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
68869
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
68870
+ * "details": {
68871
+ * "required": [
68872
+ * "vitrina_ads"
68873
+ * ],
68874
+ * "active": [],
68875
+ * "feature": "vitrina_ads",
68876
+ * "entitlement_state": "off"
68877
+ * }
68878
+ * }
68879
+ * }
68880
+ */
68881
+ "application/json": components["schemas"]["Error"];
68882
+ };
68883
+ };
68884
+ /** @description Forbidden */
68885
+ 403: {
68886
+ headers: {
68887
+ [name: string]: unknown;
68888
+ };
68889
+ content: {
68890
+ "application/json": components["schemas"]["Error"];
68891
+ };
68892
+ };
68893
+ /** @description Not found */
68894
+ 404: {
68895
+ headers: {
68896
+ [name: string]: unknown;
68897
+ };
68898
+ content: {
68899
+ "application/json": components["schemas"]["Error"];
68900
+ };
68901
+ };
68902
+ /** @description Vitrina Ads is active but the delegated key has not finished rotating (`ADS_KEY_NEEDS_REMINT`) — retry once `GET /ads/state` reports `needs_remint: false`. Also the generic conflict of a write. */
68903
+ 409: {
68904
+ headers: {
68905
+ [name: string]: unknown;
68906
+ };
68907
+ content: {
68908
+ /**
68909
+ * @example {
68910
+ * "error": {
68911
+ * "code": "ADS_KEY_NEEDS_REMINT",
68912
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
68913
+ * "details": {
68914
+ * "key_kind": "core"
68915
+ * }
68916
+ * }
68917
+ * }
68918
+ */
68919
+ "application/json": components["schemas"]["Error"];
68920
+ };
68921
+ };
68922
+ /** @description Rate limited */
68923
+ 429: {
68924
+ headers: {
68925
+ [name: string]: unknown;
68926
+ };
68927
+ content: {
68928
+ "application/json": components["schemas"]["Error"];
68929
+ };
68930
+ };
68931
+ };
68932
+ };
68933
+ put?: never;
68934
+ post?: never;
68935
+ delete?: never;
68936
+ options?: never;
68937
+ head?: never;
68938
+ patch?: never;
68939
+ trace?: never;
68940
+ };
68941
+ "/ads/conversion-sync/preview-event": {
68942
+ parameters: {
68943
+ query?: never;
68944
+ header?: never;
68945
+ path?: never;
68946
+ cookie?: never;
68947
+ };
68948
+ /**
68949
+ * A real event, field by field, as Meta receives it
68950
+ * @description Built from the workspace’s own last event of the stage (else an example, `source: example`). Each field says how it reaches Meta — `sent`, `hashed` (matchable, not readable), `withheld` or `absent` — and identifiers never carry a value or a hash. `never_sent` lists what never leaves Vitrina. Requires `ads:read`.
68951
+ */
68952
+ get: {
68953
+ parameters: {
68954
+ query: {
68955
+ /** @description The outcome stage to preview. One the workspace sends (a stage outside its vertical → 404). */
68956
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
68957
+ /** @description `1` serves the deterministic sample dataset («Ver con datos de ejemplo»): same shapes, invented but internally consistent figures, no entitlement required (the scope still is). A sandbox workspace is always served the sample, with or without this parameter. */
68958
+ sample?: "1" | "true";
68959
+ };
68960
+ header?: never;
68961
+ path?: never;
68962
+ cookie?: never;
68963
+ };
68964
+ requestBody?: never;
68965
+ responses: {
68966
+ /** @description The previewed event */
68967
+ 200: {
68968
+ headers: {
68969
+ [name: string]: unknown;
68970
+ };
68971
+ content: {
68972
+ /**
68973
+ * @example {
68974
+ * "data": {
68975
+ * "stage": "closed_won",
68976
+ * "source": "own",
68977
+ * "vitrina": {
68978
+ * "stage_label": "Presupuesto aceptado",
68979
+ * "occurred_at": "2026-09-25T08:40:00.000Z",
68980
+ * "value_clp": 1200000,
68981
+ * "contact_tail": "a3f2"
68982
+ * },
68983
+ * "meta": {
68984
+ * "event": "closed_won",
68985
+ * "reaches_meta": true,
68986
+ * "not_sent_reason": null,
68987
+ * "fields": [
68988
+ * {
68989
+ * "key": "event",
68990
+ * "label": "Evento",
68991
+ * "state": "sent",
68992
+ * "display": "closed_won"
68993
+ * },
68994
+ * {
68995
+ * "key": "time",
68996
+ * "label": "Cuándo",
68997
+ * "state": "sent",
68998
+ * "display": "2026-09-25T08:40:00.000Z"
68999
+ * },
69000
+ * {
69001
+ * "key": "value",
69002
+ * "label": "Valor",
69003
+ * "state": "withheld"
69004
+ * },
69005
+ * {
69006
+ * "key": "action_source",
69007
+ * "label": "Dónde pasó",
69008
+ * "state": "sent",
69009
+ * "display": "business_messaging"
69010
+ * },
69011
+ * {
69012
+ * "key": "email",
69013
+ * "label": "Correo",
69014
+ * "state": "hashed"
69015
+ * },
69016
+ * {
69017
+ * "key": "phone",
69018
+ * "label": "Teléfono",
69019
+ * "state": "hashed"
69020
+ * },
69021
+ * {
69022
+ * "key": "contact_ref",
69023
+ * "label": "Id del contacto",
69024
+ * "state": "hashed"
69025
+ * },
69026
+ * {
69027
+ * "key": "ad_click",
69028
+ * "label": "Clic del anuncio",
69029
+ * "state": "sent"
69030
+ * }
69031
+ * ]
69032
+ * },
69033
+ * "never_sent": [
69034
+ * "national_id",
69035
+ * "clinical_data",
69036
+ * "notes",
69037
+ * "treatment_name",
69038
+ * "site_urls"
69039
+ * ]
69040
+ * }
69041
+ * }
69042
+ */
69043
+ "application/json": {
69044
+ data: components["schemas"]["AdsSendPreviewEvent"];
69045
+ };
69046
+ };
69047
+ };
69048
+ /** @description Validation error */
69049
+ 400: {
69050
+ headers: {
69051
+ [name: string]: unknown;
69052
+ };
69053
+ content: {
69054
+ "application/json": components["schemas"]["Error"];
69055
+ };
69056
+ };
69057
+ /** @description Unauthorized */
69058
+ 401: {
69059
+ headers: {
69060
+ [name: string]: unknown;
69061
+ };
69062
+ content: {
69063
+ "application/json": components["schemas"]["Error"];
69064
+ };
69065
+ };
69066
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
69067
+ 402: {
69068
+ headers: {
69069
+ [name: string]: unknown;
69070
+ };
69071
+ content: {
69072
+ /**
69073
+ * @example {
69074
+ * "error": {
69075
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
69076
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
69077
+ * "details": {
69078
+ * "required": [
69079
+ * "vitrina_ads"
69080
+ * ],
69081
+ * "active": [],
69082
+ * "feature": "vitrina_ads",
69083
+ * "entitlement_state": "off"
69084
+ * }
69085
+ * }
69086
+ * }
69087
+ */
69088
+ "application/json": components["schemas"]["Error"];
69089
+ };
69090
+ };
69091
+ /** @description Forbidden */
69092
+ 403: {
69093
+ headers: {
69094
+ [name: string]: unknown;
69095
+ };
69096
+ content: {
69097
+ "application/json": components["schemas"]["Error"];
69098
+ };
69099
+ };
69100
+ /** @description Not found */
69101
+ 404: {
69102
+ headers: {
69103
+ [name: string]: unknown;
69104
+ };
69105
+ content: {
69106
+ "application/json": components["schemas"]["Error"];
69107
+ };
69108
+ };
69109
+ /** @description Vitrina Ads is active but the delegated key has not finished rotating (`ADS_KEY_NEEDS_REMINT`) — retry once `GET /ads/state` reports `needs_remint: false`. Also the generic conflict of a write. */
69110
+ 409: {
69111
+ headers: {
69112
+ [name: string]: unknown;
69113
+ };
69114
+ content: {
69115
+ /**
69116
+ * @example {
69117
+ * "error": {
69118
+ * "code": "ADS_KEY_NEEDS_REMINT",
69119
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
69120
+ * "details": {
69121
+ * "key_kind": "core"
69122
+ * }
69123
+ * }
69124
+ * }
69125
+ */
69126
+ "application/json": components["schemas"]["Error"];
69127
+ };
69128
+ };
69129
+ /** @description Rate limited */
69130
+ 429: {
69131
+ headers: {
69132
+ [name: string]: unknown;
69133
+ };
69134
+ content: {
69135
+ "application/json": components["schemas"]["Error"];
69136
+ };
69137
+ };
69138
+ };
69139
+ };
69140
+ put?: never;
69141
+ post?: never;
69142
+ delete?: never;
69143
+ options?: never;
69144
+ head?: never;
69145
+ patch?: never;
69146
+ trace?: never;
69147
+ };
69148
+ "/ads/conversion-sync/test": {
69149
+ parameters: {
69150
+ query?: never;
69151
+ header?: never;
69152
+ path?: never;
69153
+ cookie?: never;
69154
+ };
69155
+ get?: never;
69156
+ put?: never;
69157
+ /**
69158
+ * Send one Meta TEST event (Test Events only)
69159
+ * @description One synthetic event to the dataset Meta receives the workspace’s events in, always with a Test Events code (generated when omitted), so it shows in Events Manager → Test Events and never counts as a real event. `result`: `received`, `rejected` (Meta refused it) or `blocked` (the privacy protection held it back). `409 CONFLICT` (`details.reason: not_set_up`) before the send is set up; `429` when Meta limits test events (5 a minute). `sample` simulates it. Requires `ads:write`. Errors: `402 ENTITLEMENT_NOT_ACTIVE` (`details.feature: vitrina_ads`, with `hint`) when the Vitrina Ads Add-on is not active — never retried; `409 ADS_KEY_NEEDS_REMINT` when the Add-on is on but the delegated key has not finished rotating, or still lacks `exports:write` after one automatic re-mint (the entitlement rail converges it; see `GET /ads/state`).
69160
+ */
69161
+ post: {
69162
+ parameters: {
69163
+ query?: never;
69164
+ header?: {
69165
+ /** @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. */
69166
+ "Idempotency-Key"?: string;
69167
+ };
69168
+ path?: never;
69169
+ cookie?: never;
69170
+ };
69171
+ requestBody?: {
69172
+ content: {
69173
+ /**
69174
+ * @example {
69175
+ * "stage": "closed_won"
69176
+ * }
69177
+ */
69178
+ "application/json": {
69179
+ /**
69180
+ * @description Which stage the test imitates (its rule and event name). Defaults to the Purchase stage, else the first stage that reaches Meta.
69181
+ * @enum {string}
69182
+ */
69183
+ stage?: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
69184
+ /** @description The code Meta shows in Events Manager → Test Events. Omit it and one is generated: a test ALWAYS carries a code, so it lands in Test Events only and never counts as a real event. */
69185
+ test_event_code?: string;
69186
+ /**
69187
+ * @description `business_messaging` imitates an event born in a WhatsApp conversation. Default `website`.
69188
+ * @enum {string}
69189
+ */
69190
+ channel?: "website" | "business_messaging";
69191
+ sample?: boolean;
69192
+ };
69193
+ };
69194
+ };
69195
+ responses: {
69196
+ /** @description What Meta answered */
69197
+ 200: {
69198
+ headers: {
69199
+ [name: string]: unknown;
69200
+ };
69201
+ content: {
69202
+ /**
69203
+ * @example {
69204
+ * "data": {
69205
+ * "result": "received",
69206
+ * "test_event_code": "TEST04821",
69207
+ * "event_id": "a0a0a0a0-0000-4000-8000-000000000001",
69208
+ * "stage": "closed_won",
69209
+ * "meta_event": "Purchase",
69210
+ * "quality_warning": false,
69211
+ * "test_events_link": "https://business.facebook.com/events_manager2/list/pixel/1234567890123456/test_events?act=1000000000000001",
69212
+ * "simulated": false
69213
+ * }
69214
+ * }
69215
+ */
69216
+ "application/json": {
69217
+ data: components["schemas"]["AdsSendTestResult"];
69218
+ };
69219
+ };
69220
+ };
69221
+ /** @description Validation error */
69222
+ 400: {
69223
+ headers: {
69224
+ [name: string]: unknown;
69225
+ };
69226
+ content: {
69227
+ "application/json": components["schemas"]["Error"];
69228
+ };
69229
+ };
69230
+ /** @description Unauthorized */
69231
+ 401: {
69232
+ headers: {
69233
+ [name: string]: unknown;
69234
+ };
69235
+ content: {
69236
+ "application/json": components["schemas"]["Error"];
69237
+ };
69238
+ };
69239
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
69240
+ 402: {
69241
+ headers: {
69242
+ [name: string]: unknown;
69243
+ };
69244
+ content: {
69245
+ /**
69246
+ * @example {
69247
+ * "error": {
69248
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
69249
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
69250
+ * "details": {
69251
+ * "required": [
69252
+ * "vitrina_ads"
69253
+ * ],
69254
+ * "active": [],
69255
+ * "feature": "vitrina_ads",
69256
+ * "entitlement_state": "off"
69257
+ * }
69258
+ * }
69259
+ * }
69260
+ */
69261
+ "application/json": components["schemas"]["Error"];
69262
+ };
69263
+ };
69264
+ /** @description Forbidden */
69265
+ 403: {
69266
+ headers: {
69267
+ [name: string]: unknown;
69268
+ };
69269
+ content: {
69270
+ "application/json": components["schemas"]["Error"];
69271
+ };
69272
+ };
69273
+ /** @description Not found */
69274
+ 404: {
69275
+ headers: {
69276
+ [name: string]: unknown;
69277
+ };
69278
+ content: {
69279
+ "application/json": components["schemas"]["Error"];
69280
+ };
69281
+ };
69282
+ /** @description Vitrina Ads is active but the delegated key has not finished rotating (`ADS_KEY_NEEDS_REMINT`) — retry once `GET /ads/state` reports `needs_remint: false`. Also the generic conflict of a write. */
69283
+ 409: {
69284
+ headers: {
69285
+ [name: string]: unknown;
69286
+ };
69287
+ content: {
69288
+ /**
69289
+ * @example {
69290
+ * "error": {
69291
+ * "code": "ADS_KEY_NEEDS_REMINT",
69292
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
69293
+ * "details": {
69294
+ * "key_kind": "core"
69295
+ * }
69296
+ * }
69297
+ * }
69298
+ */
69299
+ "application/json": components["schemas"]["Error"];
69300
+ };
69301
+ };
69302
+ /** @description Rate limited */
69303
+ 429: {
69304
+ headers: {
69305
+ [name: string]: unknown;
69306
+ };
69307
+ content: {
69308
+ "application/json": components["schemas"]["Error"];
69309
+ };
69310
+ };
69311
+ };
69312
+ };
69313
+ delete?: never;
69314
+ options?: never;
69315
+ head?: never;
69316
+ patch?: never;
69317
+ trace?: never;
69318
+ };
69319
+ "/payments": {
69320
+ parameters: {
69321
+ query?: never;
69322
+ header?: never;
69323
+ path?: never;
69324
+ cookie?: never;
69325
+ };
69326
+ /**
69327
+ * Money that arrived — the Transferencias queue, or one contact
69328
+ * @description `payments:read`. Without filters, the tenant's recent payments newest first. `unapplied=true` is the **Transferencias queue**: `Σ live allocations < amount_clp`, i.e. money we hold that is not fully spoken for — it covers all three shapes staff sees (no payer, a payer and no allocation, partly applied with a remainder), and `unidentified=true` narrows it to the first. Every row carries `unallocated_clp`, `suggested_contact_id` and `payer_reasons` (the matcher's stable codes, rendered as chips) plus its full allocation trail, released rows included — the Historial tab draws payment → allocations → obligations with no request per row. Reversed money is EXCLUDED unless `include_reversed=true`: reversed money is not money we hold.
69329
+ */
69330
+ get: {
69331
+ parameters: {
69332
+ query?: {
69333
+ contact_id?: string;
69334
+ unapplied?: boolean | ("true" | "false");
69335
+ unidentified?: boolean | ("true" | "false");
69336
+ include_reversed?: boolean | ("true" | "false");
69337
+ from?: string;
69338
+ to?: string;
69339
+ limit?: number;
69340
+ offset?: number | null;
69341
+ };
69342
+ header?: never;
69343
+ path?: never;
69344
+ cookie?: never;
69345
+ };
69346
+ requestBody?: never;
69347
+ responses: {
69348
+ /** @description Payments */
69349
+ 200: {
69350
+ headers: {
69351
+ [name: string]: unknown;
69352
+ };
69353
+ content: {
69354
+ /**
69355
+ * @example {
69356
+ * "data": [
69357
+ * {
69358
+ * "id": "e86256b2-0000-4000-8000-000000000001",
69359
+ * "contact_id": "1a73af9e-0000-4000-8000-000000000001",
69360
+ * "suggested_contact_id": null,
69361
+ * "payer_reasons": [
69362
+ * "payer_recorded_by_staff"
69363
+ * ],
69364
+ * "source": "manual",
69365
+ * "provenance": "manual",
69366
+ * "instrument": "transferencia",
69367
+ * "amount_clp": 50000,
69368
+ * "paid_on": "2026-09-24",
69369
+ * "allocated_clp": 50000,
69370
+ * "unallocated_clp": 0,
69371
+ * "bank": "Banco de Chile",
69372
+ * "account_number": null,
69373
+ * "document_number": "884213",
69374
+ * "operation_id": null,
69375
+ * "note": "Abono de la primera cuota",
69376
+ * "card_fee_bps": null,
69377
+ * "card_surcharge_clp": null,
69378
+ * "card_surcharge_source": null,
69379
+ * "location_id": null,
69380
+ * "bank_movement_id": null,
69381
+ * "gateway_transaction_id": null,
69382
+ * "recorded_by": null,
69383
+ * "recorded_at": "2026-09-22T22:21:16.954Z",
69384
+ * "reversed": false,
69385
+ * "reversed_at": null,
69386
+ * "reversal_reason": null,
69387
+ * "allocations": [
69388
+ * {
69389
+ * "id": "e8df2087-0000-4000-8000-000000000001",
69390
+ * "customer_payment_id": "e86256b2-0000-4000-8000-000000000001",
69391
+ * "customer_obligation_id": "b44936d0-0000-4000-8000-000000000004",
69392
+ * "amount_clp": 50000,
69393
+ * "method": "staff",
69394
+ * "reasons": [
69395
+ * "allocation_staff_manual"
69396
+ * ],
69397
+ * "allocated_by": null,
69398
+ * "allocated_at": "2026-09-22T22:21:16.990Z",
69399
+ * "released_at": null,
69400
+ * "release_reason": null,
69401
+ * "live": true
69402
+ * }
69403
+ * ]
69404
+ * }
69405
+ * ],
69406
+ * "meta": {
69407
+ * "pagination": {
69408
+ * "limit": 50,
69409
+ * "offset": 0,
69410
+ * "total": 1
69411
+ * }
69412
+ * }
69413
+ * }
69414
+ */
69415
+ "application/json": {
69416
+ data?: unknown;
69417
+ meta?: {
69418
+ [key: string]: unknown;
69419
+ };
68348
69420
  };
68349
69421
  };
68350
69422
  };
@@ -73969,6 +75041,8 @@ interface paths {
73969
75041
  html?: string;
73970
75042
  /** Format: uuid */
73971
75043
  signature_id?: string | null;
75044
+ /** Format: uuid */
75045
+ from_account_id?: string;
73972
75046
  };
73973
75047
  };
73974
75048
  };
@@ -81039,6 +82113,8 @@ interface paths {
81039
82113
  body_text?: string;
81040
82114
  signature_id?: string | "none" | null;
81041
82115
  /** Format: uuid */
82116
+ from_account_id?: string | null;
82117
+ /** Format: uuid */
81042
82118
  conversation_id?: string | null;
81043
82119
  };
81044
82120
  };
@@ -81378,6 +82454,8 @@ interface paths {
81378
82454
  body_html?: string;
81379
82455
  body_text?: string;
81380
82456
  signature_id?: string | "none" | null;
82457
+ /** Format: uuid */
82458
+ from_account_id?: string | null;
81381
82459
  };
81382
82460
  };
81383
82461
  };
@@ -88928,7 +90006,7 @@ interface paths {
88928
90006
  *
88929
90007
  * `handoff` is populated only while `status` is `pending` and `candidates` only while it is `pending_selection` — a spent consent URL would render a button leading to a dead page.
88930
90008
  *
88931
- * Admin-scoped (`integrations:read`), like the rest of Integraciones — that scope lives only in the admin bundle, so a `supervisor` or `agent` gets 403 here and never sees the card. The two writes need `integrations:write` on top.
90009
+ * Requires `integrations:read` or `ads:read` (owner, admin and the Marketing role); a `supervisor` or `agent` gets 403 here and never sees the card. The writes need `integrations:write` or `ads:write`.
88932
90010
  */
88933
90011
  get: {
88934
90012
  parameters: {
@@ -89207,7 +90285,8 @@ interface paths {
89207
90285
  * "currency": "CLP",
89208
90286
  * "timezone": "America/Santiago",
89209
90287
  * "delivers_spend": true,
89210
- * "atribu_connection_id": "conn_9f3a2d7c8b1e"
90288
+ * "provider_connection_id": "c0c0c0c0-0000-4000-8000-000000000001",
90289
+ * "atribu_connection_id": "c0c0c0c0-0000-4000-8000-000000000001"
89211
90290
  * },
89212
90291
  * "error": null,
89213
90292
  * "handoff": null,
@@ -89465,7 +90544,8 @@ interface paths {
89465
90544
  * "currency": "CLP",
89466
90545
  * "timezone": "America/Santiago",
89467
90546
  * "delivers_spend": true,
89468
- * "atribu_connection_id": "conn_9f3a2d7c8b1e"
90547
+ * "provider_connection_id": "c0c0c0c0-0000-4000-8000-000000000001",
90548
+ * "atribu_connection_id": "c0c0c0c0-0000-4000-8000-000000000001"
89469
90549
  * },
89470
90550
  * "error": null,
89471
90551
  * "handoff": null,
@@ -89561,7 +90641,7 @@ interface paths {
89561
90641
  * The tenant's click-to-WhatsApp ads, with connect/greeting checks
89562
90642
  * @description Reads the partner click-to-WhatsApp ads list with the tenant’s WhatsApp **partner** token — a different credential than the connect rail above’s delegated key — and derives two facts per ad: `checks.destination_connected` (the ad’s WhatsApp number, compared as E.164, is one of the tenant’s connected WhatsApp messaging accounts) and `checks.greeting_configured` (a "Saludo automático" — text or tappable ice breakers — is actually set).
89563
90643
  *
89564
- * An admin-scoped read (`integrations:read` is admin-only in the scope catalog, not "any member"), free for every tenant (no Add-on gate).
90644
+ * Requires `integrations:read` or `ads:read` (owner, admin and the Marketing role — not "any member"), free for every tenant (no Add-on gate).
89565
90645
  *
89566
90646
  * `data.state` is `not_connected` in TWO cases, told apart by an optional `reason`:
89567
90647
  * * no `reason` — the tenant has never connected a Meta Ads account (the integration row is missing or not `connected`).
@@ -92000,8 +93080,8 @@ interface paths {
92000
93080
  get: {
92001
93081
  parameters: {
92002
93082
  query: {
92003
- /** @description The screen whose action rail to list (`atribuidos` has none). */
92004
- screen: "resumen" | "campanas" | "atribuidos" | "creativos" | "salud";
93083
+ /** @description The screen whose action rail to list (`atribuidos` has none). `envio` = «Enviar a Meta»: its owner-initiated changes (`send_setup`, `send_stage`, `send_dataset`, `send_stop`), invoked from the page’s switches — never a rail, not capped. */
93084
+ screen: "resumen" | "campanas" | "atribuidos" | "creativos" | "salud" | "envio";
92005
93085
  from: string;
92006
93086
  to: string;
92007
93087
  /** @description `creativos` only: the creatives window the rail is derived for — the same rolling lookback as `GET /ads/creatives?window=`, so a card’s figures (the worn-out ad’s spend) match the gallery. Defaults to `28d`. Sent with any other screen → 400. */
@@ -92514,7 +93594,7 @@ interface paths {
92514
93594
  */
92515
93595
  preview_id: string;
92516
93596
  sample?: boolean;
92517
- /** @description Required for a duplicate-and-swap and a URL-parameter fix (`url_tags_fix`), ignored otherwise: the owner's acceptance of `consent_terms` from the preview — echo its `version` and `text_hash`. The accepting person is always the caller. */
93597
+ /** @description Required whenever the preview returned `consent_terms` (a duplicate-and-swap, a URL-parameter fix `url_tags_fix`, «Enviar a Meta»'s `send_setup` and `send_dataset`, and a `send_stage` off / `send_stop` that stops an event active ad sets optimise on), ignored otherwise: the owner's acceptance of `consent_terms` — echo its `version` and `text_hash`. The accepting person is always the caller. */
92518
93598
  consent?: {
92519
93599
  version: string;
92520
93600
  text_hash: string;
@@ -113517,6 +114597,13 @@ interface components {
113517
114597
  [key: string]: string;
113518
114598
  };
113519
114599
  };
114600
+ /**
114601
+ * @description Write-only secret: the Slack incoming-webhook URL is never returned. `••••` when one is configured; absent otherwise. Read `slack_webhook_configured` instead.
114602
+ * @enum {string}
114603
+ */
114604
+ slack_webhook_url?: "••••";
114605
+ /** @description Whether a Slack incoming webhook is configured for workspace alerts. */
114606
+ slack_webhook_configured?: boolean;
113520
114607
  };
113521
114608
  TenantSettingsPublicWrite: {
113522
114609
  /** @description Vitrina Ads workspace choices. `tag_choice`: how the «Instalar el tag» step was answered — `site` (the tag goes on the workspace's website, pasted or through Google Tag Manager) or `no_site` (no website; step skipped on purpose); `null` clears it. `goal`: the monthly goal the Ads hero measures pace against (`{kind, target, period:'month'}`; `null` clears it — `PUT /ads/goal` is the dedicated door). `dismissed_actions`: `{ [action id]: until ISO }` merged onto the stored map (`null` removes an id; expired entries are pruned). Merged into the stored `ads` object; the server stamps `tag_choice_at` / `goal_at` / `goal_by` on every write, and `GET /tenant/settings` returns them under `ads`. */
@@ -113882,9 +114969,12 @@ interface components {
113882
114969
  vertical: string | null;
113883
114970
  rules: {
113884
114971
  /** @enum {string} */
113885
- stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received";
113886
- /** @enum {string} */
113887
- action: "created" | "updated" | "skipped";
114972
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
114973
+ /**
114974
+ * @description `unchanged` = the rule already held this body; nothing was written.
114975
+ * @enum {string}
114976
+ */
114977
+ action: "created" | "updated" | "unchanged" | "skipped";
113888
114978
  rule_id: string | null;
113889
114979
  meta_enabled: boolean;
113890
114980
  meta_event_name: string;
@@ -113904,6 +114994,211 @@ interface components {
113904
114994
  ttl_ms: number;
113905
114995
  privacy?: components["schemas"]["AdsPrivacyCheck"];
113906
114996
  };
114997
+ AdsSendStatus: {
114998
+ /**
114999
+ * @description `blocked` = only Meta or the owner outside Vitrina can fix it (`blocked_reason`). `off` = set up once and every stage stopped. `measure_only` = the owner chose «Solo medir, no enviar a Meta» (reversible with `send_setup`).
115000
+ * @enum {string}
115001
+ */
115002
+ state: "not_started" | "on" | "partial" | "off" | "blocked" | "measure_only";
115003
+ /** @enum {string|null} */
115004
+ blocked_reason: "no_dataset" | "datasets_unavailable" | null;
115005
+ /** @description The activation wizard’s «Enviar a Meta» step is resolved: `state` is `on`, `partial`, `blocked` or `measure_only`. */
115006
+ wizard_done: boolean;
115007
+ /** @enum {string} */
115008
+ meta_connection: "connected" | "not_connected" | "reconnect_required" | "unknown";
115009
+ /** @description The dataset Meta receives the events in today. */
115010
+ dataset: {
115011
+ /** @description Meta’s dataset (pixel) id. */
115012
+ external_id: string;
115013
+ /** @description Its last 4 digits («…4821»). */
115014
+ id_tail: string;
115015
+ name: string | null;
115016
+ last_fired_at: string | null;
115017
+ /** @description `null` = Meta gave no verdict (unknown, not healthy). */
115018
+ is_unavailable: boolean | null;
115019
+ } | null;
115020
+ /** @description The datasets of the connected ad account. */
115021
+ datasets: {
115022
+ /** @description Meta’s dataset (pixel) id. */
115023
+ external_id: string;
115024
+ /** @description Its last 4 digits («…4821»). */
115025
+ id_tail: string;
115026
+ name: string | null;
115027
+ last_fired_at: string | null;
115028
+ /** @description `null` = Meta gave no verdict (unknown, not healthy). */
115029
+ is_unavailable: boolean | null;
115030
+ recommended: boolean;
115031
+ /**
115032
+ * @description `used_by_ad_sets` = active ad sets already optimise on it (keep it: Meta keeps learning where it learns).
115033
+ * @enum {string|null}
115034
+ */
115035
+ recommended_reason: "used_by_ad_sets" | "most_recent" | "only_one" | null;
115036
+ selected: boolean;
115037
+ }[];
115038
+ stages: {
115039
+ /** @enum {string} */
115040
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
115041
+ /** @description The stage in the workspace’s words. */
115042
+ label: string;
115043
+ /** @description What Meta receives. */
115044
+ meta_event: string;
115045
+ /** @enum {string} */
115046
+ meta_event_kind: "standard" | "custom";
115047
+ /**
115048
+ * @description The value Meta receives with the event.
115049
+ * @enum {string}
115050
+ */
115051
+ value: "accepted_total" | "payment" | "none";
115052
+ /** @description It reaches Meta today. */
115053
+ enabled: boolean;
115054
+ switchable: boolean;
115055
+ /**
115056
+ * @description `installments`: a clinic’s later payments never reach Meta, so one sale is never counted twice. No switch.
115057
+ * @enum {string|null}
115058
+ */
115059
+ lock: "installments" | null;
115060
+ /** @description A clinic’s first payment before the switch: Meta does not receive it yet (its Purchase is still the accepted presupuesto). `send_stage:first_payment:on` makes the switch, with consent. */
115061
+ awaiting_switch: boolean;
115062
+ /**
115063
+ * @description `definition_missing` heals on its own (no user step); `no_payments_source` = no payments recorded to send yet.
115064
+ * @enum {string}
115065
+ */
115066
+ source: "available" | "no_payments_source" | "definition_missing";
115067
+ /** @enum {string} */
115068
+ verdict: "wired" | "sent_not_used" | "below_threshold" | "custom_conversion_broken" | "missing_custom_conversion" | "connection_broken" | "check_failed" | "not_checked";
115069
+ active_ad_sets: number;
115070
+ last_sent_at: string | null;
115071
+ sent_7d: number;
115072
+ /** @description What Meta counted for this event on the dataset over 7 days. */
115073
+ meta_volume_7d: number | null;
115074
+ series_7d: {
115075
+ /** @description America/Santiago day, `YYYY-MM-DD`. */
115076
+ date: string;
115077
+ count: number;
115078
+ }[];
115079
+ weekly_learning_target: number;
115080
+ /** @description Who turned it off — a display name, only for a caller holding `memberships:read`. */
115081
+ changed_by: string | null;
115082
+ changed_at: string | null;
115083
+ /** @description Events of the last 7 days whose value Meta received capped at the workspace’s 95th percentile of accepted plans (≥ 20 plans). The full value stays in Vitrina’s reporting. */
115084
+ value_capped_7d: number;
115085
+ /** @description The cap applied, CLP. */
115086
+ value_cap_clp: number | null;
115087
+ /** @description Events recorded in the last 28 days more than 7 days after they happened: Meta refuses events older than 7 days, so these never reach it. Never retried. */
115088
+ too_old_28d: number;
115089
+ /** @description `first_payment` only: Purchases of the last 28 days whose payment was later reversed. Meta keeps them (it has no refund event). */
115090
+ purchases_reversed_28d: number;
115091
+ /** @description Sample mode only: when the scripted arrival plays. */
115092
+ sample_arrival_ms?: number;
115093
+ }[];
115094
+ enabled_count: number;
115095
+ /** @description «{enabled_count} de {stage_count} etapas»; locked stages excluded. */
115096
+ stage_count: number;
115097
+ /** @description Health-dataset restriction by Meta (clinics): `blocked` = Meta counted none of the Lead / Schedule / Purchase sent on ≥ 3 of the last 7 days. `unknown` when it could not be read; `none` outside clinics. */
115098
+ restriction: {
115099
+ /** @enum {string} */
115100
+ kind: "none" | "limited" | "blocked" | "unknown";
115101
+ since: string | null;
115102
+ };
115103
+ /** @description Clinics: the protected replacement dataset Vitrina prepares on its own when Meta restricts the dataset. Sending never waits for it; moving the ad sets is a separate, consented action. `null` outside clinics. */
115104
+ protected_dataset: {
115105
+ /** @enum {string} */
115106
+ state: "provisioned" | "missing" | "preparing";
115107
+ /** @description Active ad sets still optimising on the restricted dataset (null = not read). */
115108
+ ad_sets_to_move: number | null;
115109
+ } | null;
115110
+ /**
115111
+ * @description Clinics: which stage carries the Meta Purchase today — the accepted presupuesto until the owner’s consented switch to the first payment. No rules sync ever moves it. `null` outside clinics.
115112
+ * @enum {string|null}
115113
+ */
115114
+ purchase_stage: "closed_won" | "first_payment" | null;
115115
+ /** @description The switch of the Purchase to the first payment can be made now. */
115116
+ purchase_switch_available: boolean;
115117
+ /** @description Advice only — Vitrina never changes an ad set’s goal: the earliest stage reached by 1–40 % of new contacts over 28 days, once there are ≥ 50 (what Meta learns best from with this volume); `default` = not enough data yet, the usual answer for the business type. Never a standard event on a health-restricted dataset. */
115118
+ recommended_optimization_stage: {
115119
+ /** @enum {string} */
115120
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
115121
+ /** @enum {string} */
115122
+ reason: "rate_band" | "default";
115123
+ rate: number | null;
115124
+ } | null;
115125
+ /**
115126
+ * @description `read_only`: the Meta connection cannot manage ads — sending works, fixes that write in Meta do not.
115127
+ * @enum {string}
115128
+ */
115129
+ grant: "full" | "read_only" | "unknown";
115130
+ /** @description Health data protection applies (clinics). */
115131
+ protection_required: boolean;
115132
+ protected: boolean;
115133
+ /** @description The owner’s last acceptance of the send (the `send_setup` consent). */
115134
+ consent: {
115135
+ version: string;
115136
+ current: boolean;
115137
+ accepted_at: string;
115138
+ } | null;
115139
+ /** @description Meta links built on the server from Meta ids. Open in a new tab; they change nothing by themselves. */
115140
+ meta_links: {
115141
+ create_dataset: string | null;
115142
+ events_manager: string | null;
115143
+ test_events: string | null;
115144
+ ad_sets: string | null;
115145
+ };
115146
+ checked_at: string | null;
115147
+ stale: boolean;
115148
+ sample: boolean;
115149
+ };
115150
+ AdsSendPreviewEvent: {
115151
+ /** @enum {string} */
115152
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
115153
+ /**
115154
+ * @description `example` when the workspace has no event of this stage yet.
115155
+ * @enum {string}
115156
+ */
115157
+ source: "own" | "example";
115158
+ vitrina: {
115159
+ stage_label: string;
115160
+ occurred_at: string;
115161
+ value_clp: number | null;
115162
+ /** @description Last 4 characters of the contact’s opaque reference; never a name or a contact detail. */
115163
+ contact_tail: string | null;
115164
+ };
115165
+ meta: {
115166
+ event: string;
115167
+ reaches_meta: boolean;
115168
+ /** @enum {string|null} */
115169
+ not_sent_reason: "marketing_opt_out" | "stage_off" | "stage_locked" | null;
115170
+ fields: {
115171
+ /** @enum {string} */
115172
+ key: "event" | "time" | "value" | "action_source" | "email" | "phone" | "contact_ref" | "national_id" | "ad_click";
115173
+ label: string;
115174
+ /**
115175
+ * @description `hashed`: it crosses only as a hash Meta can match, not read. Identifiers never carry a value.
115176
+ * @enum {string}
115177
+ */
115178
+ state: "sent" | "hashed" | "withheld" | "absent";
115179
+ /** @description Non-identifying fields only (event, time, value, where it happened). */
115180
+ display?: string;
115181
+ }[];
115182
+ };
115183
+ /** @description What never leaves Vitrina, as keys (`national_id`, `clinical_data`, `notes`, …). */
115184
+ never_sent: string[];
115185
+ };
115186
+ AdsSendTestResult: {
115187
+ /**
115188
+ * @description `rejected` = Meta refused it; `blocked` = the privacy protection held the payload back.
115189
+ * @enum {string}
115190
+ */
115191
+ result: "received" | "rejected" | "blocked";
115192
+ test_event_code: string;
115193
+ /** @description Search for it in Events Manager → Test Events. */
115194
+ event_id: string | null;
115195
+ /** @enum {string|null} */
115196
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received" | null;
115197
+ meta_event: string | null;
115198
+ quality_warning: boolean;
115199
+ test_events_link: string | null;
115200
+ simulated: boolean;
115201
+ };
113907
115202
  Message: {
113908
115203
  id: string;
113909
115204
  conversation_id: string;
@@ -113956,6 +115251,15 @@ interface components {
113956
115251
  currency: string | null;
113957
115252
  timezone: string | null;
113958
115253
  delivers_spend: boolean;
115254
+ /**
115255
+ * Format: uuid
115256
+ * @description The id of the provider connection this ad account ships through. Opaque; Vitrina resolves it server-side for every Ads read and write, so a client never needs to send it back.
115257
+ */
115258
+ provider_connection_id: string;
115259
+ /**
115260
+ * @deprecated
115261
+ * @description Deprecated: the same value as `provider_connection_id` — read that instead. Kept on the wire for existing clients; removed in a later release.
115262
+ */
113959
115263
  atribu_connection_id: string;
113960
115264
  } | null;
113961
115265
  MetaAdsCandidate: {
@@ -114363,8 +115667,8 @@ interface components {
114363
115667
  /** @description `<kind>:<target external id>:<YYYY-MM-DD>` — a composite key, stable for a day. */
114364
115668
  key: string;
114365
115669
  /** @enum {string} */
114366
- kind: "pause_ad" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "nav";
114367
- screen: ("resumen" | "campanas" | "creativos" | "salud")[];
115670
+ kind: "pause_ad" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "send_setup" | "send_stage" | "send_dataset" | "send_stop" | "send_protected_move" | "nav";
115671
+ screen: ("resumen" | "campanas" | "creativos" | "salud" | "envio")[];
114368
115672
  /** @description The one card the rail leads with. */
114369
115673
  primary: boolean;
114370
115674
  title: string;
@@ -114394,7 +115698,7 @@ interface components {
114394
115698
  campaign_name: string | null;
114395
115699
  }[];
114396
115700
  };
114397
- /** @description The engine’s own vocabulary, e.g. `{ budget_change_pct: 20 }`. `url_tags_fix`: `{ ads: [{ external_id, expected_url_tags, url_tags }] }` — each ad’s current parameters (null = none) and exactly what it gets. */
115701
+ /** @description The engine’s own vocabulary, e.g. `{ budget_change_pct: 20 }`. `url_tags_fix`: `{ ads: [{ external_id, expected_url_tags, url_tags }] }` — each ad’s current parameters (null = none) and exactly what it gets. «Enviar a Meta»: `send_setup`/`send_dataset` `{ dataset_id }`, `send_stage` `{ stage, enabled, meta_event, active_ad_sets }`. */
114398
115702
  params: {
114399
115703
  [key: string]: unknown;
114400
115704
  };
@@ -114404,7 +115708,7 @@ interface components {
114404
115708
  /** @description Which operation executes it; `null` for `nav`. */
114405
115709
  engine_ref: {
114406
115710
  /** @enum {string} */
114407
- op: "recommendations.apply" | "ads.pause" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo";
115711
+ op: "recommendations.apply" | "ads.pause" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo" | "send.setup" | "send.dataset" | "send.stage" | "send.stop" | "send.restore";
114408
115712
  recommendation_id?: string;
114409
115713
  } | null;
114410
115714
  /** @description `nav` only: a workspace-relative path (`/anuncios/atribuidos?c=…`, `/anuncios/activar?paso=tag`), or an absolute Meta Ads Manager URL built from Meta ids (`https://www.facebook.com/adsmanager/…`) — open it in a new tab; it changes nothing by itself. */
@@ -114413,6 +115717,11 @@ interface components {
114413
115717
  /** @description Fact keys the card is built from. */
114414
115718
  facts: string[];
114415
115719
  dismissed_until: string | null;
115720
+ /**
115721
+ * @description Set on a listed action that cannot run yet — show it disabled. `consent_pending`: its consent text is not published yet (`send_protected_move`, the move of the ad sets onto the protected dataset of a restricted clinic dataset).
115722
+ * @enum {string}
115723
+ */
115724
+ disabled_reason?: "consent_pending";
114416
115725
  };
114417
115726
  AdsActionPreview: {
114418
115727
  /** Format: uuid */
@@ -114426,9 +115735,9 @@ interface components {
114426
115735
  after: string;
114427
115736
  }[];
114428
115737
  warnings: string[];
114429
- /** @description Duplicate-and-swap and `url_tags_fix` only: `consent_terms.text` split into lines, for display (verbatim). */
115738
+ /** @description The consent-bearing previews only (duplicate-and-swap, `url_tags_fix`, «Enviar a Meta» when it asks): `consent_terms.text` split into lines, for display (verbatim). */
114430
115739
  consent: string[];
114431
- /** @description Duplicate-and-swap and `url_tags_fix` only: what the owner accepts before confirming. Execute must send `consent: { version, text_hash }`. For `url_tags_fix` the text is one sentence: rewriting an ad’s parameters replaces its creative, which can restart the learning phase of the affected ad sets. */
115740
+ /** @description The consent-bearing previews only: what the owner accepts before confirming. Execute must send `consent: { version, text_hash }`. For `url_tags_fix` the text is one sentence: rewriting an ad’s parameters replaces its creative, which can restart the learning phase of the affected ad sets. «Enviar a Meta»: `send_setup` always carries the owner’s authorisation of the send; `send_dataset`, and a `send_stage` off or `send_stop` that stops an event active ad sets optimise on, carry the learning-reset line. */
114432
115741
  consent_terms: {
114433
115742
  version: string;
114434
115743
  /** @enum {string} */
@@ -114440,14 +115749,14 @@ interface components {
114440
115749
  } | null;
114441
115750
  reversible: boolean;
114442
115751
  /** @enum {string|null} */
114443
- engine_op: "recommendations.apply" | "ads.pause" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo" | null;
115752
+ engine_op: "recommendations.apply" | "ads.pause" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo" | "send.setup" | "send.dataset" | "send.stage" | "send.stop" | "send.restore" | null;
114444
115753
  };
114445
115754
  AdsActionExecution: {
114446
115755
  /** Format: uuid */
114447
115756
  id: string;
114448
115757
  action_key: string;
114449
115758
  /** @enum {string} */
114450
- kind: "pause_ad" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix";
115759
+ kind: "pause_ad" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "send_setup" | "send_stage" | "send_dataset" | "send_stop";
114451
115760
  /** @enum {string} */
114452
115761
  status: "queued" | "running" | "succeeded" | "failed" | "refused" | "rolled_back";
114453
115762
  target: {