@vitrina/api 11.25.0 → 11.27.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 +1207 -24
  2. package/dist/index.d.ts +1207 -24
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -11859,7 +11859,7 @@ interface paths {
11859
11859
  /** Format: uuid */
11860
11860
  user_id: string;
11861
11861
  /** @enum {string} */
11862
- role: "owner" | "admin" | "supervisor" | "agent" | "consultant";
11862
+ role: "owner" | "admin" | "supervisor" | "agent" | "consultant" | "marketing";
11863
11863
  /** Format: uuid */
11864
11864
  custom_role_id?: string | null;
11865
11865
  /** Format: email */
@@ -11997,7 +11997,7 @@ interface paths {
11997
11997
  */
11998
11998
  "application/json": {
11999
11999
  /** @enum {string} */
12000
- role?: "owner" | "admin" | "supervisor" | "agent" | "consultant";
12000
+ role?: "owner" | "admin" | "supervisor" | "agent" | "consultant" | "marketing";
12001
12001
  /** Format: uuid */
12002
12002
  custom_role_id?: string | null;
12003
12003
  /** @enum {string} */
@@ -12597,7 +12597,7 @@ interface paths {
12597
12597
  /** Format: email */
12598
12598
  email: string;
12599
12599
  /** @enum {string} */
12600
- role: "owner" | "admin" | "supervisor" | "agent" | "consultant";
12600
+ role: "owner" | "admin" | "supervisor" | "agent" | "consultant" | "marketing";
12601
12601
  /** Format: uuid */
12602
12602
  custom_role_id?: string | null;
12603
12603
  location_ids?: string[] | null;
@@ -13577,7 +13577,7 @@ interface paths {
13577
13577
  };
13578
13578
  /**
13579
13579
  * 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.
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`. 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`; writing `••••` back keeps the stored webhook, a new URL replaces it, and `null` or an empty string clears it.
13581
13581
  */
13582
13582
  get: {
13583
13583
  parameters: {
@@ -13679,7 +13679,7 @@ interface paths {
13679
13679
  };
13680
13680
  /**
13681
13681
  * 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.
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. 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`; writing `••••` back keeps the stored webhook, a new URL replaces it, and `null` or an empty string clears it.
13683
13683
  */
13684
13684
  put: {
13685
13685
  parameters: {
@@ -67483,7 +67483,7 @@ interface paths {
67483
67483
  put?: never;
67484
67484
  /**
67485
67485
  * 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`).
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 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
67487
  */
67488
67488
  post: {
67489
67489
  parameters: {
@@ -68244,6 +68244,958 @@ interface paths {
68244
68244
  patch?: never;
68245
68245
  trace?: never;
68246
68246
  };
68247
+ "/ads/conversion-sync/status": {
68248
+ parameters: {
68249
+ query?: never;
68250
+ header?: never;
68251
+ path?: never;
68252
+ cookie?: never;
68253
+ };
68254
+ /**
68255
+ * What reaches Meta, stage by stage («Enviar a Meta»)
68256
+ * @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
+ */
68258
+ get: {
68259
+ parameters: {
68260
+ query?: {
68261
+ /** @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. */
68262
+ sample?: "1" | "true";
68263
+ };
68264
+ header?: never;
68265
+ path?: never;
68266
+ cookie?: never;
68267
+ };
68268
+ requestBody?: never;
68269
+ responses: {
68270
+ /** @description The send status */
68271
+ 200: {
68272
+ headers: {
68273
+ [name: string]: unknown;
68274
+ };
68275
+ content: {
68276
+ /**
68277
+ * @example {
68278
+ * "data": {
68279
+ * "state": "partial",
68280
+ * "blocked_reason": null,
68281
+ * "wizard_done": true,
68282
+ * "meta_connection": "connected",
68283
+ * "dataset": {
68284
+ * "external_id": "1234567890123456",
68285
+ * "id_tail": "3456",
68286
+ * "name": "Clínica Dental",
68287
+ * "last_fired_at": "2026-09-25T11:40:00.000Z",
68288
+ * "is_unavailable": false
68289
+ * },
68290
+ * "datasets": [
68291
+ * {
68292
+ * "external_id": "1234567890123456",
68293
+ * "id_tail": "3456",
68294
+ * "name": "Clínica Dental",
68295
+ * "last_fired_at": "2026-09-25T11:40:00.000Z",
68296
+ * "is_unavailable": false,
68297
+ * "recommended": true,
68298
+ * "recommended_reason": "used_by_ad_sets",
68299
+ * "selected": true
68300
+ * }
68301
+ * ],
68302
+ * "stages": [
68303
+ * {
68304
+ * "stage": "lead_created",
68305
+ * "label": "Contacto nuevo",
68306
+ * "meta_event": "Lead",
68307
+ * "meta_event_kind": "standard",
68308
+ * "value": "none",
68309
+ * "enabled": true,
68310
+ * "switchable": true,
68311
+ * "lock": null,
68312
+ * "awaiting_switch": false,
68313
+ * "source": "available",
68314
+ * "verdict": "below_threshold",
68315
+ * "active_ad_sets": 0,
68316
+ * "last_sent_at": "2026-09-25T12:40:00.000Z",
68317
+ * "sent_7d": 12,
68318
+ * "meta_volume_7d": null,
68319
+ * "series_7d": [
68320
+ * {
68321
+ * "date": "2026-09-19",
68322
+ * "count": 0
68323
+ * },
68324
+ * {
68325
+ * "date": "2026-09-20",
68326
+ * "count": 0
68327
+ * },
68328
+ * {
68329
+ * "date": "2026-09-21",
68330
+ * "count": 0
68331
+ * },
68332
+ * {
68333
+ * "date": "2026-09-22",
68334
+ * "count": 0
68335
+ * },
68336
+ * {
68337
+ * "date": "2026-09-23",
68338
+ * "count": 0
68339
+ * },
68340
+ * {
68341
+ * "date": "2026-09-24",
68342
+ * "count": 0
68343
+ * },
68344
+ * {
68345
+ * "date": "2026-09-25",
68346
+ * "count": 0
68347
+ * }
68348
+ * ],
68349
+ * "weekly_learning_target": 50,
68350
+ * "changed_by": null,
68351
+ * "changed_at": null,
68352
+ * "value_capped_7d": 0,
68353
+ * "value_cap_clp": null,
68354
+ * "too_old_28d": 0,
68355
+ * "purchases_reversed_28d": 0
68356
+ * },
68357
+ * {
68358
+ * "stage": "appointment_booked",
68359
+ * "label": "Cita agendada",
68360
+ * "meta_event": "Schedule",
68361
+ * "meta_event_kind": "standard",
68362
+ * "value": "none",
68363
+ * "enabled": true,
68364
+ * "switchable": true,
68365
+ * "lock": null,
68366
+ * "awaiting_switch": false,
68367
+ * "source": "available",
68368
+ * "verdict": "not_checked",
68369
+ * "active_ad_sets": 0,
68370
+ * "last_sent_at": "2026-09-25T11:40:00.000Z",
68371
+ * "sent_7d": 11,
68372
+ * "meta_volume_7d": null,
68373
+ * "series_7d": [
68374
+ * {
68375
+ * "date": "2026-09-19",
68376
+ * "count": 0
68377
+ * },
68378
+ * {
68379
+ * "date": "2026-09-20",
68380
+ * "count": 0
68381
+ * },
68382
+ * {
68383
+ * "date": "2026-09-21",
68384
+ * "count": 0
68385
+ * },
68386
+ * {
68387
+ * "date": "2026-09-22",
68388
+ * "count": 0
68389
+ * },
68390
+ * {
68391
+ * "date": "2026-09-23",
68392
+ * "count": 0
68393
+ * },
68394
+ * {
68395
+ * "date": "2026-09-24",
68396
+ * "count": 0
68397
+ * },
68398
+ * {
68399
+ * "date": "2026-09-25",
68400
+ * "count": 0
68401
+ * }
68402
+ * ],
68403
+ * "weekly_learning_target": 50,
68404
+ * "changed_by": null,
68405
+ * "changed_at": null,
68406
+ * "value_capped_7d": 0,
68407
+ * "value_cap_clp": null,
68408
+ * "too_old_28d": 0,
68409
+ * "purchases_reversed_28d": 0
68410
+ * },
68411
+ * {
68412
+ * "stage": "appointment_attended",
68413
+ * "label": "Cita atendida",
68414
+ * "meta_event": "appointment_attended",
68415
+ * "meta_event_kind": "custom",
68416
+ * "value": "none",
68417
+ * "enabled": false,
68418
+ * "switchable": true,
68419
+ * "lock": null,
68420
+ * "awaiting_switch": false,
68421
+ * "source": "available",
68422
+ * "verdict": "not_checked",
68423
+ * "active_ad_sets": 0,
68424
+ * "last_sent_at": "2026-09-25T10:40:00.000Z",
68425
+ * "sent_7d": 10,
68426
+ * "meta_volume_7d": null,
68427
+ * "series_7d": [
68428
+ * {
68429
+ * "date": "2026-09-19",
68430
+ * "count": 0
68431
+ * },
68432
+ * {
68433
+ * "date": "2026-09-20",
68434
+ * "count": 0
68435
+ * },
68436
+ * {
68437
+ * "date": "2026-09-21",
68438
+ * "count": 0
68439
+ * },
68440
+ * {
68441
+ * "date": "2026-09-22",
68442
+ * "count": 0
68443
+ * },
68444
+ * {
68445
+ * "date": "2026-09-23",
68446
+ * "count": 0
68447
+ * },
68448
+ * {
68449
+ * "date": "2026-09-24",
68450
+ * "count": 0
68451
+ * },
68452
+ * {
68453
+ * "date": "2026-09-25",
68454
+ * "count": 0
68455
+ * }
68456
+ * ],
68457
+ * "weekly_learning_target": 50,
68458
+ * "changed_by": null,
68459
+ * "changed_at": "2026-09-23T13:40:00.000Z",
68460
+ * "value_capped_7d": 0,
68461
+ * "value_cap_clp": null,
68462
+ * "too_old_28d": 0,
68463
+ * "purchases_reversed_28d": 0
68464
+ * },
68465
+ * {
68466
+ * "stage": "quote_presented",
68467
+ * "label": "Presupuesto presentado",
68468
+ * "meta_event": "quote_presented",
68469
+ * "meta_event_kind": "custom",
68470
+ * "value": "none",
68471
+ * "enabled": true,
68472
+ * "switchable": true,
68473
+ * "lock": null,
68474
+ * "awaiting_switch": false,
68475
+ * "source": "available",
68476
+ * "verdict": "not_checked",
68477
+ * "active_ad_sets": 0,
68478
+ * "last_sent_at": "2026-09-25T09:40:00.000Z",
68479
+ * "sent_7d": 9,
68480
+ * "meta_volume_7d": null,
68481
+ * "series_7d": [
68482
+ * {
68483
+ * "date": "2026-09-19",
68484
+ * "count": 0
68485
+ * },
68486
+ * {
68487
+ * "date": "2026-09-20",
68488
+ * "count": 0
68489
+ * },
68490
+ * {
68491
+ * "date": "2026-09-21",
68492
+ * "count": 0
68493
+ * },
68494
+ * {
68495
+ * "date": "2026-09-22",
68496
+ * "count": 0
68497
+ * },
68498
+ * {
68499
+ * "date": "2026-09-23",
68500
+ * "count": 0
68501
+ * },
68502
+ * {
68503
+ * "date": "2026-09-24",
68504
+ * "count": 0
68505
+ * },
68506
+ * {
68507
+ * "date": "2026-09-25",
68508
+ * "count": 0
68509
+ * }
68510
+ * ],
68511
+ * "weekly_learning_target": 50,
68512
+ * "changed_by": null,
68513
+ * "changed_at": null,
68514
+ * "value_capped_7d": 0,
68515
+ * "value_cap_clp": null,
68516
+ * "too_old_28d": 0,
68517
+ * "purchases_reversed_28d": 0
68518
+ * },
68519
+ * {
68520
+ * "stage": "closed_won",
68521
+ * "label": "Presupuesto aceptado",
68522
+ * "meta_event": "closed_won",
68523
+ * "meta_event_kind": "custom",
68524
+ * "value": "none",
68525
+ * "enabled": true,
68526
+ * "switchable": true,
68527
+ * "lock": null,
68528
+ * "awaiting_switch": false,
68529
+ * "source": "available",
68530
+ * "verdict": "wired",
68531
+ * "active_ad_sets": 2,
68532
+ * "last_sent_at": "2026-09-25T08:40:00.000Z",
68533
+ * "sent_7d": 8,
68534
+ * "meta_volume_7d": 14,
68535
+ * "series_7d": [
68536
+ * {
68537
+ * "date": "2026-09-19",
68538
+ * "count": 0
68539
+ * },
68540
+ * {
68541
+ * "date": "2026-09-20",
68542
+ * "count": 0
68543
+ * },
68544
+ * {
68545
+ * "date": "2026-09-21",
68546
+ * "count": 0
68547
+ * },
68548
+ * {
68549
+ * "date": "2026-09-22",
68550
+ * "count": 0
68551
+ * },
68552
+ * {
68553
+ * "date": "2026-09-23",
68554
+ * "count": 1
68555
+ * },
68556
+ * {
68557
+ * "date": "2026-09-24",
68558
+ * "count": 1
68559
+ * },
68560
+ * {
68561
+ * "date": "2026-09-25",
68562
+ * "count": 1
68563
+ * }
68564
+ * ],
68565
+ * "weekly_learning_target": 50,
68566
+ * "changed_by": null,
68567
+ * "changed_at": null,
68568
+ * "value_capped_7d": 0,
68569
+ * "value_cap_clp": null,
68570
+ * "too_old_28d": 0,
68571
+ * "purchases_reversed_28d": 0
68572
+ * },
68573
+ * {
68574
+ * "stage": "first_payment",
68575
+ * "label": "Primer pago",
68576
+ * "meta_event": "Purchase",
68577
+ * "meta_event_kind": "standard",
68578
+ * "value": "accepted_total",
68579
+ * "enabled": false,
68580
+ * "switchable": false,
68581
+ * "lock": null,
68582
+ * "awaiting_switch": false,
68583
+ * "source": "definition_missing",
68584
+ * "verdict": "not_checked",
68585
+ * "active_ad_sets": 0,
68586
+ * "last_sent_at": null,
68587
+ * "sent_7d": 0,
68588
+ * "meta_volume_7d": null,
68589
+ * "series_7d": [
68590
+ * {
68591
+ * "date": "2026-09-19",
68592
+ * "count": 0
68593
+ * },
68594
+ * {
68595
+ * "date": "2026-09-20",
68596
+ * "count": 0
68597
+ * },
68598
+ * {
68599
+ * "date": "2026-09-21",
68600
+ * "count": 0
68601
+ * },
68602
+ * {
68603
+ * "date": "2026-09-22",
68604
+ * "count": 0
68605
+ * },
68606
+ * {
68607
+ * "date": "2026-09-23",
68608
+ * "count": 0
68609
+ * },
68610
+ * {
68611
+ * "date": "2026-09-24",
68612
+ * "count": 0
68613
+ * },
68614
+ * {
68615
+ * "date": "2026-09-25",
68616
+ * "count": 0
68617
+ * }
68618
+ * ],
68619
+ * "weekly_learning_target": 50,
68620
+ * "changed_by": null,
68621
+ * "changed_at": null,
68622
+ * "value_capped_7d": 0,
68623
+ * "value_cap_clp": null,
68624
+ * "too_old_28d": 0,
68625
+ * "purchases_reversed_28d": 0
68626
+ * },
68627
+ * {
68628
+ * "stage": "payment_received",
68629
+ * "label": "Pago recibido",
68630
+ * "meta_event": "Purchase",
68631
+ * "meta_event_kind": "standard",
68632
+ * "value": "payment",
68633
+ * "enabled": false,
68634
+ * "switchable": false,
68635
+ * "lock": "installments",
68636
+ * "awaiting_switch": false,
68637
+ * "source": "available",
68638
+ * "verdict": "not_checked",
68639
+ * "active_ad_sets": 0,
68640
+ * "last_sent_at": "2026-09-25T07:40:00.000Z",
68641
+ * "sent_7d": 7,
68642
+ * "meta_volume_7d": null,
68643
+ * "series_7d": [
68644
+ * {
68645
+ * "date": "2026-09-19",
68646
+ * "count": 0
68647
+ * },
68648
+ * {
68649
+ * "date": "2026-09-20",
68650
+ * "count": 0
68651
+ * },
68652
+ * {
68653
+ * "date": "2026-09-21",
68654
+ * "count": 0
68655
+ * },
68656
+ * {
68657
+ * "date": "2026-09-22",
68658
+ * "count": 0
68659
+ * },
68660
+ * {
68661
+ * "date": "2026-09-23",
68662
+ * "count": 0
68663
+ * },
68664
+ * {
68665
+ * "date": "2026-09-24",
68666
+ * "count": 0
68667
+ * },
68668
+ * {
68669
+ * "date": "2026-09-25",
68670
+ * "count": 0
68671
+ * }
68672
+ * ],
68673
+ * "weekly_learning_target": 50,
68674
+ * "changed_by": null,
68675
+ * "changed_at": null,
68676
+ * "value_capped_7d": 0,
68677
+ * "value_cap_clp": null,
68678
+ * "too_old_28d": 0,
68679
+ * "purchases_reversed_28d": 0
68680
+ * }
68681
+ * ],
68682
+ * "enabled_count": 4,
68683
+ * "stage_count": 6,
68684
+ * "restriction": {
68685
+ * "kind": "unknown",
68686
+ * "since": null
68687
+ * },
68688
+ * "protected_dataset": null,
68689
+ * "recommended_optimization_stage": {
68690
+ * "stage": "appointment_attended",
68691
+ * "reason": "default",
68692
+ * "rate": null
68693
+ * },
68694
+ * "purchase_stage": "first_payment",
68695
+ * "purchase_switch_available": false,
68696
+ * "grant": "full",
68697
+ * "protection_required": true,
68698
+ * "protected": true,
68699
+ * "consent": {
68700
+ * "version": "2026-09-25.send-to-meta.v1",
68701
+ * "current": true,
68702
+ * "accepted_at": "2026-09-22T13:40:00.000Z"
68703
+ * },
68704
+ * "meta_links": {
68705
+ * "create_dataset": "https://business.facebook.com/events_manager2/overview?act=1000000000000001",
68706
+ * "events_manager": "https://business.facebook.com/events_manager2/list/pixel/1234567890123456/overview?act=1000000000000001",
68707
+ * "test_events": "https://business.facebook.com/events_manager2/list/pixel/1234567890123456/test_events?act=1000000000000001",
68708
+ * "ad_sets": "https://www.facebook.com/adsmanager/manage/adsets?act=1000000000000001"
68709
+ * },
68710
+ * "checked_at": "2026-09-25T10:40:00.000Z",
68711
+ * "stale": false,
68712
+ * "sample": false
68713
+ * }
68714
+ * }
68715
+ */
68716
+ "application/json": {
68717
+ data: components["schemas"]["AdsSendStatus"];
68718
+ };
68719
+ };
68720
+ };
68721
+ /** @description Validation error */
68722
+ 400: {
68723
+ headers: {
68724
+ [name: string]: unknown;
68725
+ };
68726
+ content: {
68727
+ "application/json": components["schemas"]["Error"];
68728
+ };
68729
+ };
68730
+ /** @description Unauthorized */
68731
+ 401: {
68732
+ headers: {
68733
+ [name: string]: unknown;
68734
+ };
68735
+ content: {
68736
+ "application/json": components["schemas"]["Error"];
68737
+ };
68738
+ };
68739
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
68740
+ 402: {
68741
+ headers: {
68742
+ [name: string]: unknown;
68743
+ };
68744
+ content: {
68745
+ /**
68746
+ * @example {
68747
+ * "error": {
68748
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
68749
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
68750
+ * "details": {
68751
+ * "required": [
68752
+ * "vitrina_ads"
68753
+ * ],
68754
+ * "active": [],
68755
+ * "feature": "vitrina_ads",
68756
+ * "entitlement_state": "off"
68757
+ * }
68758
+ * }
68759
+ * }
68760
+ */
68761
+ "application/json": components["schemas"]["Error"];
68762
+ };
68763
+ };
68764
+ /** @description Forbidden */
68765
+ 403: {
68766
+ headers: {
68767
+ [name: string]: unknown;
68768
+ };
68769
+ content: {
68770
+ "application/json": components["schemas"]["Error"];
68771
+ };
68772
+ };
68773
+ /** @description Not found */
68774
+ 404: {
68775
+ headers: {
68776
+ [name: string]: unknown;
68777
+ };
68778
+ content: {
68779
+ "application/json": components["schemas"]["Error"];
68780
+ };
68781
+ };
68782
+ /** @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. */
68783
+ 409: {
68784
+ headers: {
68785
+ [name: string]: unknown;
68786
+ };
68787
+ content: {
68788
+ /**
68789
+ * @example {
68790
+ * "error": {
68791
+ * "code": "ADS_KEY_NEEDS_REMINT",
68792
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
68793
+ * "details": {
68794
+ * "key_kind": "core"
68795
+ * }
68796
+ * }
68797
+ * }
68798
+ */
68799
+ "application/json": components["schemas"]["Error"];
68800
+ };
68801
+ };
68802
+ /** @description Rate limited */
68803
+ 429: {
68804
+ headers: {
68805
+ [name: string]: unknown;
68806
+ };
68807
+ content: {
68808
+ "application/json": components["schemas"]["Error"];
68809
+ };
68810
+ };
68811
+ };
68812
+ };
68813
+ put?: never;
68814
+ post?: never;
68815
+ delete?: never;
68816
+ options?: never;
68817
+ head?: never;
68818
+ patch?: never;
68819
+ trace?: never;
68820
+ };
68821
+ "/ads/conversion-sync/preview-event": {
68822
+ parameters: {
68823
+ query?: never;
68824
+ header?: never;
68825
+ path?: never;
68826
+ cookie?: never;
68827
+ };
68828
+ /**
68829
+ * A real event, field by field, as Meta receives it
68830
+ * @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`.
68831
+ */
68832
+ get: {
68833
+ parameters: {
68834
+ query: {
68835
+ /** @description The outcome stage to preview. One the workspace sends (a stage outside its vertical → 404). */
68836
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
68837
+ /** @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. */
68838
+ sample?: "1" | "true";
68839
+ };
68840
+ header?: never;
68841
+ path?: never;
68842
+ cookie?: never;
68843
+ };
68844
+ requestBody?: never;
68845
+ responses: {
68846
+ /** @description The previewed event */
68847
+ 200: {
68848
+ headers: {
68849
+ [name: string]: unknown;
68850
+ };
68851
+ content: {
68852
+ /**
68853
+ * @example {
68854
+ * "data": {
68855
+ * "stage": "closed_won",
68856
+ * "source": "own",
68857
+ * "vitrina": {
68858
+ * "stage_label": "Presupuesto aceptado",
68859
+ * "occurred_at": "2026-09-25T08:40:00.000Z",
68860
+ * "value_clp": 1200000,
68861
+ * "contact_tail": "a3f2"
68862
+ * },
68863
+ * "meta": {
68864
+ * "event": "closed_won",
68865
+ * "reaches_meta": true,
68866
+ * "not_sent_reason": null,
68867
+ * "fields": [
68868
+ * {
68869
+ * "key": "event",
68870
+ * "label": "Evento",
68871
+ * "state": "sent",
68872
+ * "display": "closed_won"
68873
+ * },
68874
+ * {
68875
+ * "key": "time",
68876
+ * "label": "Cuándo",
68877
+ * "state": "sent",
68878
+ * "display": "2026-09-25T08:40:00.000Z"
68879
+ * },
68880
+ * {
68881
+ * "key": "value",
68882
+ * "label": "Valor",
68883
+ * "state": "withheld"
68884
+ * },
68885
+ * {
68886
+ * "key": "action_source",
68887
+ * "label": "Dónde pasó",
68888
+ * "state": "sent",
68889
+ * "display": "business_messaging"
68890
+ * },
68891
+ * {
68892
+ * "key": "email",
68893
+ * "label": "Correo",
68894
+ * "state": "hashed"
68895
+ * },
68896
+ * {
68897
+ * "key": "phone",
68898
+ * "label": "Teléfono",
68899
+ * "state": "hashed"
68900
+ * },
68901
+ * {
68902
+ * "key": "contact_ref",
68903
+ * "label": "Id del contacto",
68904
+ * "state": "hashed"
68905
+ * },
68906
+ * {
68907
+ * "key": "ad_click",
68908
+ * "label": "Clic del anuncio",
68909
+ * "state": "sent"
68910
+ * }
68911
+ * ]
68912
+ * },
68913
+ * "never_sent": [
68914
+ * "national_id",
68915
+ * "clinical_data",
68916
+ * "notes",
68917
+ * "treatment_name",
68918
+ * "site_urls"
68919
+ * ]
68920
+ * }
68921
+ * }
68922
+ */
68923
+ "application/json": {
68924
+ data: components["schemas"]["AdsSendPreviewEvent"];
68925
+ };
68926
+ };
68927
+ };
68928
+ /** @description Validation error */
68929
+ 400: {
68930
+ headers: {
68931
+ [name: string]: unknown;
68932
+ };
68933
+ content: {
68934
+ "application/json": components["schemas"]["Error"];
68935
+ };
68936
+ };
68937
+ /** @description Unauthorized */
68938
+ 401: {
68939
+ headers: {
68940
+ [name: string]: unknown;
68941
+ };
68942
+ content: {
68943
+ "application/json": components["schemas"]["Error"];
68944
+ };
68945
+ };
68946
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
68947
+ 402: {
68948
+ headers: {
68949
+ [name: string]: unknown;
68950
+ };
68951
+ content: {
68952
+ /**
68953
+ * @example {
68954
+ * "error": {
68955
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
68956
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
68957
+ * "details": {
68958
+ * "required": [
68959
+ * "vitrina_ads"
68960
+ * ],
68961
+ * "active": [],
68962
+ * "feature": "vitrina_ads",
68963
+ * "entitlement_state": "off"
68964
+ * }
68965
+ * }
68966
+ * }
68967
+ */
68968
+ "application/json": components["schemas"]["Error"];
68969
+ };
68970
+ };
68971
+ /** @description Forbidden */
68972
+ 403: {
68973
+ headers: {
68974
+ [name: string]: unknown;
68975
+ };
68976
+ content: {
68977
+ "application/json": components["schemas"]["Error"];
68978
+ };
68979
+ };
68980
+ /** @description Not found */
68981
+ 404: {
68982
+ headers: {
68983
+ [name: string]: unknown;
68984
+ };
68985
+ content: {
68986
+ "application/json": components["schemas"]["Error"];
68987
+ };
68988
+ };
68989
+ /** @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. */
68990
+ 409: {
68991
+ headers: {
68992
+ [name: string]: unknown;
68993
+ };
68994
+ content: {
68995
+ /**
68996
+ * @example {
68997
+ * "error": {
68998
+ * "code": "ADS_KEY_NEEDS_REMINT",
68999
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
69000
+ * "details": {
69001
+ * "key_kind": "core"
69002
+ * }
69003
+ * }
69004
+ * }
69005
+ */
69006
+ "application/json": components["schemas"]["Error"];
69007
+ };
69008
+ };
69009
+ /** @description Rate limited */
69010
+ 429: {
69011
+ headers: {
69012
+ [name: string]: unknown;
69013
+ };
69014
+ content: {
69015
+ "application/json": components["schemas"]["Error"];
69016
+ };
69017
+ };
69018
+ };
69019
+ };
69020
+ put?: never;
69021
+ post?: never;
69022
+ delete?: never;
69023
+ options?: never;
69024
+ head?: never;
69025
+ patch?: never;
69026
+ trace?: never;
69027
+ };
69028
+ "/ads/conversion-sync/test": {
69029
+ parameters: {
69030
+ query?: never;
69031
+ header?: never;
69032
+ path?: never;
69033
+ cookie?: never;
69034
+ };
69035
+ get?: never;
69036
+ put?: never;
69037
+ /**
69038
+ * Send one Meta TEST event (Test Events only)
69039
+ * @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`).
69040
+ */
69041
+ post: {
69042
+ parameters: {
69043
+ query?: never;
69044
+ header?: {
69045
+ /** @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. */
69046
+ "Idempotency-Key"?: string;
69047
+ };
69048
+ path?: never;
69049
+ cookie?: never;
69050
+ };
69051
+ requestBody?: {
69052
+ content: {
69053
+ /**
69054
+ * @example {
69055
+ * "stage": "closed_won"
69056
+ * }
69057
+ */
69058
+ "application/json": {
69059
+ /**
69060
+ * @description Which stage the test imitates (its rule and event name). Defaults to the Purchase stage, else the first stage that reaches Meta.
69061
+ * @enum {string}
69062
+ */
69063
+ stage?: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
69064
+ /** @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. */
69065
+ test_event_code?: string;
69066
+ /**
69067
+ * @description `business_messaging` imitates an event born in a WhatsApp conversation. Default `website`.
69068
+ * @enum {string}
69069
+ */
69070
+ channel?: "website" | "business_messaging";
69071
+ sample?: boolean;
69072
+ };
69073
+ };
69074
+ };
69075
+ responses: {
69076
+ /** @description What Meta answered */
69077
+ 200: {
69078
+ headers: {
69079
+ [name: string]: unknown;
69080
+ };
69081
+ content: {
69082
+ /**
69083
+ * @example {
69084
+ * "data": {
69085
+ * "result": "received",
69086
+ * "test_event_code": "TEST04821",
69087
+ * "event_id": "a0a0a0a0-0000-4000-8000-000000000001",
69088
+ * "stage": "closed_won",
69089
+ * "meta_event": "Purchase",
69090
+ * "quality_warning": false,
69091
+ * "test_events_link": "https://business.facebook.com/events_manager2/list/pixel/1234567890123456/test_events?act=1000000000000001",
69092
+ * "simulated": false
69093
+ * }
69094
+ * }
69095
+ */
69096
+ "application/json": {
69097
+ data: components["schemas"]["AdsSendTestResult"];
69098
+ };
69099
+ };
69100
+ };
69101
+ /** @description Validation error */
69102
+ 400: {
69103
+ headers: {
69104
+ [name: string]: unknown;
69105
+ };
69106
+ content: {
69107
+ "application/json": components["schemas"]["Error"];
69108
+ };
69109
+ };
69110
+ /** @description Unauthorized */
69111
+ 401: {
69112
+ headers: {
69113
+ [name: string]: unknown;
69114
+ };
69115
+ content: {
69116
+ "application/json": components["schemas"]["Error"];
69117
+ };
69118
+ };
69119
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
69120
+ 402: {
69121
+ headers: {
69122
+ [name: string]: unknown;
69123
+ };
69124
+ content: {
69125
+ /**
69126
+ * @example {
69127
+ * "error": {
69128
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
69129
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
69130
+ * "details": {
69131
+ * "required": [
69132
+ * "vitrina_ads"
69133
+ * ],
69134
+ * "active": [],
69135
+ * "feature": "vitrina_ads",
69136
+ * "entitlement_state": "off"
69137
+ * }
69138
+ * }
69139
+ * }
69140
+ */
69141
+ "application/json": components["schemas"]["Error"];
69142
+ };
69143
+ };
69144
+ /** @description Forbidden */
69145
+ 403: {
69146
+ headers: {
69147
+ [name: string]: unknown;
69148
+ };
69149
+ content: {
69150
+ "application/json": components["schemas"]["Error"];
69151
+ };
69152
+ };
69153
+ /** @description Not found */
69154
+ 404: {
69155
+ headers: {
69156
+ [name: string]: unknown;
69157
+ };
69158
+ content: {
69159
+ "application/json": components["schemas"]["Error"];
69160
+ };
69161
+ };
69162
+ /** @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. */
69163
+ 409: {
69164
+ headers: {
69165
+ [name: string]: unknown;
69166
+ };
69167
+ content: {
69168
+ /**
69169
+ * @example {
69170
+ * "error": {
69171
+ * "code": "ADS_KEY_NEEDS_REMINT",
69172
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
69173
+ * "details": {
69174
+ * "key_kind": "core"
69175
+ * }
69176
+ * }
69177
+ * }
69178
+ */
69179
+ "application/json": components["schemas"]["Error"];
69180
+ };
69181
+ };
69182
+ /** @description Rate limited */
69183
+ 429: {
69184
+ headers: {
69185
+ [name: string]: unknown;
69186
+ };
69187
+ content: {
69188
+ "application/json": components["schemas"]["Error"];
69189
+ };
69190
+ };
69191
+ };
69192
+ };
69193
+ delete?: never;
69194
+ options?: never;
69195
+ head?: never;
69196
+ patch?: never;
69197
+ trace?: never;
69198
+ };
68247
69199
  "/payments": {
68248
69200
  parameters: {
68249
69201
  query?: never;
@@ -88928,7 +89880,7 @@ interface paths {
88928
89880
  *
88929
89881
  * `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
89882
  *
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.
89883
+ * 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
89884
  */
88933
89885
  get: {
88934
89886
  parameters: {
@@ -89207,7 +90159,8 @@ interface paths {
89207
90159
  * "currency": "CLP",
89208
90160
  * "timezone": "America/Santiago",
89209
90161
  * "delivers_spend": true,
89210
- * "atribu_connection_id": "conn_9f3a2d7c8b1e"
90162
+ * "provider_connection_id": "c0c0c0c0-0000-4000-8000-000000000001",
90163
+ * "atribu_connection_id": "c0c0c0c0-0000-4000-8000-000000000001"
89211
90164
  * },
89212
90165
  * "error": null,
89213
90166
  * "handoff": null,
@@ -89465,7 +90418,8 @@ interface paths {
89465
90418
  * "currency": "CLP",
89466
90419
  * "timezone": "America/Santiago",
89467
90420
  * "delivers_spend": true,
89468
- * "atribu_connection_id": "conn_9f3a2d7c8b1e"
90421
+ * "provider_connection_id": "c0c0c0c0-0000-4000-8000-000000000001",
90422
+ * "atribu_connection_id": "c0c0c0c0-0000-4000-8000-000000000001"
89469
90423
  * },
89470
90424
  * "error": null,
89471
90425
  * "handoff": null,
@@ -89561,7 +90515,7 @@ interface paths {
89561
90515
  * The tenant's click-to-WhatsApp ads, with connect/greeting checks
89562
90516
  * @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
90517
  *
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).
90518
+ * Requires `integrations:read` or `ads:read` (owner, admin and the Marketing role — not "any member"), free for every tenant (no Add-on gate).
89565
90519
  *
89566
90520
  * `data.state` is `not_connected` in TWO cases, told apart by an optional `reason`:
89567
90521
  * * no `reason` — the tenant has never connected a Meta Ads account (the integration row is missing or not `connected`).
@@ -92000,8 +92954,8 @@ interface paths {
92000
92954
  get: {
92001
92955
  parameters: {
92002
92956
  query: {
92003
- /** @description The screen whose action rail to list (`atribuidos` has none). */
92004
- screen: "resumen" | "campanas" | "atribuidos" | "creativos" | "salud";
92957
+ /** @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. */
92958
+ screen: "resumen" | "campanas" | "atribuidos" | "creativos" | "salud" | "envio";
92005
92959
  from: string;
92006
92960
  to: string;
92007
92961
  /** @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 +93468,7 @@ interface paths {
92514
93468
  */
92515
93469
  preview_id: string;
92516
93470
  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. */
93471
+ /** @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
93472
  consent?: {
92519
93473
  version: string;
92520
93474
  text_hash: string;
@@ -113517,6 +114471,13 @@ interface components {
113517
114471
  [key: string]: string;
113518
114472
  };
113519
114473
  };
114474
+ /**
114475
+ * @description Write-only secret: the Slack incoming-webhook URL is never returned. `••••` when one is configured; absent otherwise. Read `slack_webhook_configured` instead.
114476
+ * @enum {string}
114477
+ */
114478
+ slack_webhook_url?: "••••";
114479
+ /** @description Whether a Slack incoming webhook is configured for workspace alerts. */
114480
+ slack_webhook_configured?: boolean;
113520
114481
  };
113521
114482
  TenantSettingsPublicWrite: {
113522
114483
  /** @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 +114843,12 @@ interface components {
113882
114843
  vertical: string | null;
113883
114844
  rules: {
113884
114845
  /** @enum {string} */
113885
- stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received";
113886
- /** @enum {string} */
113887
- action: "created" | "updated" | "skipped";
114846
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
114847
+ /**
114848
+ * @description `unchanged` = the rule already held this body; nothing was written.
114849
+ * @enum {string}
114850
+ */
114851
+ action: "created" | "updated" | "unchanged" | "skipped";
113888
114852
  rule_id: string | null;
113889
114853
  meta_enabled: boolean;
113890
114854
  meta_event_name: string;
@@ -113904,6 +114868,211 @@ interface components {
113904
114868
  ttl_ms: number;
113905
114869
  privacy?: components["schemas"]["AdsPrivacyCheck"];
113906
114870
  };
114871
+ AdsSendStatus: {
114872
+ /**
114873
+ * @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`).
114874
+ * @enum {string}
114875
+ */
114876
+ state: "not_started" | "on" | "partial" | "off" | "blocked" | "measure_only";
114877
+ /** @enum {string|null} */
114878
+ blocked_reason: "no_dataset" | "datasets_unavailable" | null;
114879
+ /** @description The activation wizard’s «Enviar a Meta» step is resolved: `state` is `on`, `partial`, `blocked` or `measure_only`. */
114880
+ wizard_done: boolean;
114881
+ /** @enum {string} */
114882
+ meta_connection: "connected" | "not_connected" | "reconnect_required" | "unknown";
114883
+ /** @description The dataset Meta receives the events in today. */
114884
+ dataset: {
114885
+ /** @description Meta’s dataset (pixel) id. */
114886
+ external_id: string;
114887
+ /** @description Its last 4 digits («…4821»). */
114888
+ id_tail: string;
114889
+ name: string | null;
114890
+ last_fired_at: string | null;
114891
+ /** @description `null` = Meta gave no verdict (unknown, not healthy). */
114892
+ is_unavailable: boolean | null;
114893
+ } | null;
114894
+ /** @description The datasets of the connected ad account. */
114895
+ datasets: {
114896
+ /** @description Meta’s dataset (pixel) id. */
114897
+ external_id: string;
114898
+ /** @description Its last 4 digits («…4821»). */
114899
+ id_tail: string;
114900
+ name: string | null;
114901
+ last_fired_at: string | null;
114902
+ /** @description `null` = Meta gave no verdict (unknown, not healthy). */
114903
+ is_unavailable: boolean | null;
114904
+ recommended: boolean;
114905
+ /**
114906
+ * @description `used_by_ad_sets` = active ad sets already optimise on it (keep it: Meta keeps learning where it learns).
114907
+ * @enum {string|null}
114908
+ */
114909
+ recommended_reason: "used_by_ad_sets" | "most_recent" | "only_one" | null;
114910
+ selected: boolean;
114911
+ }[];
114912
+ stages: {
114913
+ /** @enum {string} */
114914
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
114915
+ /** @description The stage in the workspace’s words. */
114916
+ label: string;
114917
+ /** @description What Meta receives. */
114918
+ meta_event: string;
114919
+ /** @enum {string} */
114920
+ meta_event_kind: "standard" | "custom";
114921
+ /**
114922
+ * @description The value Meta receives with the event.
114923
+ * @enum {string}
114924
+ */
114925
+ value: "accepted_total" | "payment" | "none";
114926
+ /** @description It reaches Meta today. */
114927
+ enabled: boolean;
114928
+ switchable: boolean;
114929
+ /**
114930
+ * @description `installments`: a clinic’s later payments never reach Meta, so one sale is never counted twice. No switch.
114931
+ * @enum {string|null}
114932
+ */
114933
+ lock: "installments" | null;
114934
+ /** @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. */
114935
+ awaiting_switch: boolean;
114936
+ /**
114937
+ * @description `definition_missing` heals on its own (no user step); `no_payments_source` = no payments recorded to send yet.
114938
+ * @enum {string}
114939
+ */
114940
+ source: "available" | "no_payments_source" | "definition_missing";
114941
+ /** @enum {string} */
114942
+ verdict: "wired" | "sent_not_used" | "below_threshold" | "custom_conversion_broken" | "missing_custom_conversion" | "connection_broken" | "check_failed" | "not_checked";
114943
+ active_ad_sets: number;
114944
+ last_sent_at: string | null;
114945
+ sent_7d: number;
114946
+ /** @description What Meta counted for this event on the dataset over 7 days. */
114947
+ meta_volume_7d: number | null;
114948
+ series_7d: {
114949
+ /** @description America/Santiago day, `YYYY-MM-DD`. */
114950
+ date: string;
114951
+ count: number;
114952
+ }[];
114953
+ weekly_learning_target: number;
114954
+ /** @description Who turned it off — a display name, only for a caller holding `memberships:read`. */
114955
+ changed_by: string | null;
114956
+ changed_at: string | null;
114957
+ /** @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. */
114958
+ value_capped_7d: number;
114959
+ /** @description The cap applied, CLP. */
114960
+ value_cap_clp: number | null;
114961
+ /** @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. */
114962
+ too_old_28d: number;
114963
+ /** @description `first_payment` only: Purchases of the last 28 days whose payment was later reversed. Meta keeps them (it has no refund event). */
114964
+ purchases_reversed_28d: number;
114965
+ /** @description Sample mode only: when the scripted arrival plays. */
114966
+ sample_arrival_ms?: number;
114967
+ }[];
114968
+ enabled_count: number;
114969
+ /** @description «{enabled_count} de {stage_count} etapas»; locked stages excluded. */
114970
+ stage_count: number;
114971
+ /** @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. */
114972
+ restriction: {
114973
+ /** @enum {string} */
114974
+ kind: "none" | "limited" | "blocked" | "unknown";
114975
+ since: string | null;
114976
+ };
114977
+ /** @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. */
114978
+ protected_dataset: {
114979
+ /** @enum {string} */
114980
+ state: "provisioned" | "missing" | "preparing";
114981
+ /** @description Active ad sets still optimising on the restricted dataset (null = not read). */
114982
+ ad_sets_to_move: number | null;
114983
+ } | null;
114984
+ /**
114985
+ * @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.
114986
+ * @enum {string|null}
114987
+ */
114988
+ purchase_stage: "closed_won" | "first_payment" | null;
114989
+ /** @description The switch of the Purchase to the first payment can be made now. */
114990
+ purchase_switch_available: boolean;
114991
+ /** @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. */
114992
+ recommended_optimization_stage: {
114993
+ /** @enum {string} */
114994
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
114995
+ /** @enum {string} */
114996
+ reason: "rate_band" | "default";
114997
+ rate: number | null;
114998
+ } | null;
114999
+ /**
115000
+ * @description `read_only`: the Meta connection cannot manage ads — sending works, fixes that write in Meta do not.
115001
+ * @enum {string}
115002
+ */
115003
+ grant: "full" | "read_only" | "unknown";
115004
+ /** @description Health data protection applies (clinics). */
115005
+ protection_required: boolean;
115006
+ protected: boolean;
115007
+ /** @description The owner’s last acceptance of the send (the `send_setup` consent). */
115008
+ consent: {
115009
+ version: string;
115010
+ current: boolean;
115011
+ accepted_at: string;
115012
+ } | null;
115013
+ /** @description Meta links built on the server from Meta ids. Open in a new tab; they change nothing by themselves. */
115014
+ meta_links: {
115015
+ create_dataset: string | null;
115016
+ events_manager: string | null;
115017
+ test_events: string | null;
115018
+ ad_sets: string | null;
115019
+ };
115020
+ checked_at: string | null;
115021
+ stale: boolean;
115022
+ sample: boolean;
115023
+ };
115024
+ AdsSendPreviewEvent: {
115025
+ /** @enum {string} */
115026
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
115027
+ /**
115028
+ * @description `example` when the workspace has no event of this stage yet.
115029
+ * @enum {string}
115030
+ */
115031
+ source: "own" | "example";
115032
+ vitrina: {
115033
+ stage_label: string;
115034
+ occurred_at: string;
115035
+ value_clp: number | null;
115036
+ /** @description Last 4 characters of the contact’s opaque reference; never a name or a contact detail. */
115037
+ contact_tail: string | null;
115038
+ };
115039
+ meta: {
115040
+ event: string;
115041
+ reaches_meta: boolean;
115042
+ /** @enum {string|null} */
115043
+ not_sent_reason: "marketing_opt_out" | "stage_off" | "stage_locked" | null;
115044
+ fields: {
115045
+ /** @enum {string} */
115046
+ key: "event" | "time" | "value" | "action_source" | "email" | "phone" | "contact_ref" | "national_id" | "ad_click";
115047
+ label: string;
115048
+ /**
115049
+ * @description `hashed`: it crosses only as a hash Meta can match, not read. Identifiers never carry a value.
115050
+ * @enum {string}
115051
+ */
115052
+ state: "sent" | "hashed" | "withheld" | "absent";
115053
+ /** @description Non-identifying fields only (event, time, value, where it happened). */
115054
+ display?: string;
115055
+ }[];
115056
+ };
115057
+ /** @description What never leaves Vitrina, as keys (`national_id`, `clinical_data`, `notes`, …). */
115058
+ never_sent: string[];
115059
+ };
115060
+ AdsSendTestResult: {
115061
+ /**
115062
+ * @description `rejected` = Meta refused it; `blocked` = the privacy protection held the payload back.
115063
+ * @enum {string}
115064
+ */
115065
+ result: "received" | "rejected" | "blocked";
115066
+ test_event_code: string;
115067
+ /** @description Search for it in Events Manager → Test Events. */
115068
+ event_id: string | null;
115069
+ /** @enum {string|null} */
115070
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received" | null;
115071
+ meta_event: string | null;
115072
+ quality_warning: boolean;
115073
+ test_events_link: string | null;
115074
+ simulated: boolean;
115075
+ };
113907
115076
  Message: {
113908
115077
  id: string;
113909
115078
  conversation_id: string;
@@ -113956,6 +115125,15 @@ interface components {
113956
115125
  currency: string | null;
113957
115126
  timezone: string | null;
113958
115127
  delivers_spend: boolean;
115128
+ /**
115129
+ * Format: uuid
115130
+ * @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.
115131
+ */
115132
+ provider_connection_id: string;
115133
+ /**
115134
+ * @deprecated
115135
+ * @description Deprecated: the same value as `provider_connection_id` — read that instead. Kept on the wire for existing clients; removed in a later release.
115136
+ */
113959
115137
  atribu_connection_id: string;
113960
115138
  } | null;
113961
115139
  MetaAdsCandidate: {
@@ -114363,8 +115541,8 @@ interface components {
114363
115541
  /** @description `<kind>:<target external id>:<YYYY-MM-DD>` — a composite key, stable for a day. */
114364
115542
  key: string;
114365
115543
  /** @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")[];
115544
+ 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";
115545
+ screen: ("resumen" | "campanas" | "creativos" | "salud" | "envio")[];
114368
115546
  /** @description The one card the rail leads with. */
114369
115547
  primary: boolean;
114370
115548
  title: string;
@@ -114394,7 +115572,7 @@ interface components {
114394
115572
  campaign_name: string | null;
114395
115573
  }[];
114396
115574
  };
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. */
115575
+ /** @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
115576
  params: {
114399
115577
  [key: string]: unknown;
114400
115578
  };
@@ -114404,7 +115582,7 @@ interface components {
114404
115582
  /** @description Which operation executes it; `null` for `nav`. */
114405
115583
  engine_ref: {
114406
115584
  /** @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";
115585
+ 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
115586
  recommendation_id?: string;
114409
115587
  } | null;
114410
115588
  /** @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 +115591,11 @@ interface components {
114413
115591
  /** @description Fact keys the card is built from. */
114414
115592
  facts: string[];
114415
115593
  dismissed_until: string | null;
115594
+ /**
115595
+ * @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).
115596
+ * @enum {string}
115597
+ */
115598
+ disabled_reason?: "consent_pending";
114416
115599
  };
114417
115600
  AdsActionPreview: {
114418
115601
  /** Format: uuid */
@@ -114426,9 +115609,9 @@ interface components {
114426
115609
  after: string;
114427
115610
  }[];
114428
115611
  warnings: string[];
114429
- /** @description Duplicate-and-swap and `url_tags_fix` only: `consent_terms.text` split into lines, for display (verbatim). */
115612
+ /** @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
115613
  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. */
115614
+ /** @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
115615
  consent_terms: {
114433
115616
  version: string;
114434
115617
  /** @enum {string} */
@@ -114440,14 +115623,14 @@ interface components {
114440
115623
  } | null;
114441
115624
  reversible: boolean;
114442
115625
  /** @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;
115626
+ 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
115627
  };
114445
115628
  AdsActionExecution: {
114446
115629
  /** Format: uuid */
114447
115630
  id: string;
114448
115631
  action_key: string;
114449
115632
  /** @enum {string} */
114450
- kind: "pause_ad" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix";
115633
+ kind: "pause_ad" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "send_setup" | "send_stage" | "send_dataset" | "send_stop";
114451
115634
  /** @enum {string} */
114452
115635
  status: "queued" | "running" | "succeeded" | "failed" | "refused" | "rolled_back";
114453
115636
  target: {