@vitrina/api 11.17.0 → 11.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -10215,7 +10215,7 @@ interface paths {
10215
10215
  };
10216
10216
  /**
10217
10217
  * List channels
10218
- * @description Every messaging account in the workspace, secrets redacted. Connecting a new one is a browser flow (OAuth/Atribu/IMAP) — see the `MessagingAccounts` reference — but everything already connected is readable here.
10218
+ * @description Every messaging account in the workspace, secrets redacted. Connecting a new one is a browser flow (OAuth, a partner connection or IMAP) — see the `MessagingAccounts` reference — but everything already connected is readable here.
10219
10219
  */
10220
10220
  get: {
10221
10221
  parameters: {
@@ -12923,7 +12923,7 @@ interface paths {
12923
12923
  };
12924
12924
  /**
12925
12925
  * Live channel identity & health
12926
- * @description Dials the provider (or Atribu, for a partner-connected account) right now — the connected phone/IG account/mailbox identity, webhook delivery state, and WhatsApp account health (quality rating, messaging limit) where applicable. `stored` rides along: the last health snapshot the periodic checker wrote, for comparing a live read against what was already known. `?refresh=true` forces a fresh probe instead of the provider’s own cache. A live check that itself fails (provider down, expired token) still answers 200, with a fallback `identity`/`webhook` reporting the failure — this call never breaks a health dashboard by 500ing.
12926
+ * @description Dials the provider (or the partner connection provider, for a partner-connected account) right now — the connected phone/IG account/mailbox identity, webhook delivery state, and WhatsApp account health (quality rating, messaging limit) where applicable. `stored` rides along: the last health snapshot the periodic checker wrote, for comparing a live read against what was already known. `?refresh=true` forces a fresh probe instead of the provider’s own cache. A live check that itself fails (provider down, expired token) still answers 200, with a fallback `identity`/`webhook` reporting the failure — this call never breaks a health dashboard by 500ing.
12927
12927
  */
12928
12928
  get: {
12929
12929
  parameters: {
@@ -48021,7 +48021,7 @@ interface paths {
48021
48021
  * "days_left": 100
48022
48022
  * },
48023
48023
  * "delivered": "email",
48024
- * "accept_url": "https://vitrinadev-api.atribu.app/api/v1/public/clinic/budget/<token>",
48024
+ * "accept_url": "https://api.example.com/api/v1/public/clinic/budget/<token>",
48025
48025
  * "reason": null
48026
48026
  * }
48027
48027
  * }
@@ -66456,7 +66456,7 @@ interface paths {
66456
66456
  };
66457
66457
  /**
66458
66458
  * The tenant's Vitrina Ads entitlement and delegated-key state
66459
- * @description Distinguishes "not entitled" (`entitlement: off`) from "needs re-mint" (`needs_remint: true` — the live key is the wrong kind for the declared entitlement) and from an in-flight change (`pending_on` / `pending_off`). `grant_scopes` are the scopes Atribu returned on the last provision or entitlement call. Requires `ads:read`.
66459
+ * @description Distinguishes "not entitled" (`entitlement: off`) from "needs re-mint" (`needs_remint: true` — the live key is the wrong kind for the declared entitlement) and from an in-flight change (`pending_on` / `pending_off`). `grant_scopes` are the scopes the attribution engine returned on the last provision or entitlement call. Requires `ads:read`.
66460
66460
  */
66461
66461
  get: {
66462
66462
  parameters: {
@@ -66565,7 +66565,7 @@ interface paths {
66565
66565
  };
66566
66566
  /**
66567
66567
  * Conversion Sync catalog: definitions, connections, destinations, privacy settings
66568
- * @description Step 0 of the setup. `definitions[].id` is a rule's `source_ref_id`; `connections[].id` is a destination's `connection_id`. Relayed verbatim from Atribu. Gated by the Add-on like every `/ads/*` route but `/ads/state`. Requires `ads:read`.
66568
+ * @description Step 0 of the setup. `definitions[].id` is a rule's `source_ref_id`; `connections[].id` is a destination's `connection_id`. Relayed verbatim from the conversion provider. Gated by the Add-on like every `/ads/*` route but `/ads/state`. Requires `ads:read`.
66569
66569
  */
66570
66570
  get: {
66571
66571
  parameters: {
@@ -66890,7 +66890,7 @@ interface paths {
66890
66890
  };
66891
66891
  /**
66892
66892
  * The configured export destinations (pre-fills a re-run)
66893
- * @description Relayed verbatim from Atribu, including each destination's `routing`. Requires `ads:read`.
66893
+ * @description Relayed verbatim from the conversion provider, including each destination's `routing`. Requires `ads:read`.
66894
66894
  */
66895
66895
  get: {
66896
66896
  parameters: {
@@ -67570,14 +67570,16 @@ interface paths {
67570
67570
  cookie?: never;
67571
67571
  };
67572
67572
  /**
67573
- * Whether the dealer's ad sets optimize for the events Vitrina sends
67574
- * @description Atribu's per-rule verdicts and remediation, verbatim (served from a 6h cache; `force=1` re-verifies live — still a read). `privacy` reports whether a clinic profile carries `platform_safe`. Requires `ads:read`.
67573
+ * Whether the ad sets optimize for the events Vitrina sends
67574
+ * @description The conversion provider's per-rule verdicts and remediation, verbatim (served from a 6-hour cache; `force=1` re-verifies live — still a read). `privacy` reports whether a clinic profile carries `platform_safe`. `sample=1` (or a sandbox workspace) answers the sample dataset's verdicts — one `wired` row per rule the vertical sends to Meta, fresh, no entitlement required and nothing read — like every other Ads read. Requires `ads:read`.
67575
67575
  */
67576
67576
  get: {
67577
67577
  parameters: {
67578
67578
  query?: {
67579
- /** @description Re-verify live against Meta instead of Atribu's 6h cache. Still a read — several Meta API calls, use sparingly. */
67579
+ /** @description Re-verify live against Meta instead of the conversion provider's 6-hour cache. Still a read — several Meta API calls, use sparingly. */
67580
67580
  force?: "0" | "1" | "true" | "false";
67581
+ /** @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. */
67582
+ sample?: "1" | "true";
67581
67583
  };
67582
67584
  header?: never;
67583
67585
  path?: never;
@@ -67597,8 +67599,42 @@ interface paths {
67597
67599
  * "results": [
67598
67600
  * {
67599
67601
  * "rule_id": "e1e1e1e1-0000-4000-8000-000000000001",
67600
- * "status": "wired",
67601
- * "remediation": null
67602
+ * "destination_id": "d0d0d0d0-0000-4000-8000-000000000001",
67603
+ * "verdict": "wired",
67604
+ * "event_name": "Purchase",
67605
+ * "checks": {
67606
+ * "connection": {
67607
+ * "ok": true
67608
+ * },
67609
+ * "pixel": {
67610
+ * "ok": true,
67611
+ * "isUnavailable": false,
67612
+ * "lastFiredAt": "2026-09-22T11:53:00.000Z"
67613
+ * },
67614
+ * "eventsArriving": {
67615
+ * "ok": true,
67616
+ * "volume7d": 64
67617
+ * },
67618
+ * "customConversion": {
67619
+ * "exists": false,
67620
+ * "required": false
67621
+ * },
67622
+ * "optimizationGoal": {
67623
+ * "usedByActiveAdSets": [
67624
+ * {
67625
+ * "adSetName": "Implantes · Las Condes",
67626
+ * "campaignName": "Implantes · Septiembre",
67627
+ * "objective": "OUTCOME_SALES",
67628
+ * "optimizationGoal": "OFFSITE_CONVERSIONS",
67629
+ * "customEventType": "PURCHASE",
67630
+ * "via": "custom_event_type"
67631
+ * }
67632
+ * ]
67633
+ * }
67634
+ * },
67635
+ * "remediation": [],
67636
+ * "checked_at": "2026-09-22T12:00:00.000Z",
67637
+ * "stale": false
67602
67638
  * }
67603
67639
  * ],
67604
67640
  * "checked_at": "2026-09-22T12:00:00.000Z",
@@ -67769,8 +67805,42 @@ interface paths {
67769
67805
  * "results": [
67770
67806
  * {
67771
67807
  * "rule_id": "e1e1e1e1-0000-4000-8000-000000000001",
67772
- * "status": "wired",
67773
- * "remediation": null
67808
+ * "destination_id": "d0d0d0d0-0000-4000-8000-000000000001",
67809
+ * "verdict": "wired",
67810
+ * "event_name": "Purchase",
67811
+ * "checks": {
67812
+ * "connection": {
67813
+ * "ok": true
67814
+ * },
67815
+ * "pixel": {
67816
+ * "ok": true,
67817
+ * "isUnavailable": false,
67818
+ * "lastFiredAt": "2026-09-22T11:53:00.000Z"
67819
+ * },
67820
+ * "eventsArriving": {
67821
+ * "ok": true,
67822
+ * "volume7d": 64
67823
+ * },
67824
+ * "customConversion": {
67825
+ * "exists": false,
67826
+ * "required": false
67827
+ * },
67828
+ * "optimizationGoal": {
67829
+ * "usedByActiveAdSets": [
67830
+ * {
67831
+ * "adSetName": "Implantes · Las Condes",
67832
+ * "campaignName": "Implantes · Septiembre",
67833
+ * "objective": "OUTCOME_SALES",
67834
+ * "optimizationGoal": "OFFSITE_CONVERSIONS",
67835
+ * "customEventType": "PURCHASE",
67836
+ * "via": "custom_event_type"
67837
+ * }
67838
+ * ]
67839
+ * }
67840
+ * },
67841
+ * "remediation": [],
67842
+ * "checked_at": "2026-09-22T12:00:00.000Z",
67843
+ * "stale": false
67774
67844
  * }
67775
67845
  * ],
67776
67846
  * "checked_at": "2026-09-22T12:00:00.000Z",
@@ -88673,13 +88743,13 @@ interface paths {
88673
88743
  put?: never;
88674
88744
  /**
88675
88745
  * Start a Meta Ads connect and get the consent URL
88676
- * @description Mints Atribu’s **connect hand-off** for `meta_ads` and answers the session-less consent URL to redirect the WHOLE PAGE to. It is not an iframe target: Meta’s own consent dialog renders inside it.
88746
+ * @description Mints the connection provider’s **connect hand-off** for `meta_ads` and answers the session-less consent URL to redirect the WHOLE PAGE to. It is not an iframe target: Meta’s own consent dialog renders inside it.
88677
88747
  *
88678
- * `return_to` must be an absolute URL on the app’s own origin. The backend appends `meta_ads=return` and a short opaque `state`, preserving any query the URL already carried, and passes the result to Atribu as `return_url`. An origin that is not the app’s is a 400 here rather than a silent substitution — Atribu itself only checks the origin when the human CLICKS, where it surfaces as a failed hand-off (`result.reason: origin_not_allowed`) after the dealer has already walked through a consent screen for nothing.
88748
+ * `return_to` must be an absolute URL on the app’s own origin. The backend appends `meta_ads=return` and a short opaque `state`, preserving any query the URL already carried, and passes the result to the provider as `return_url`. An origin that is not the app’s is a 400 here rather than a silent substitution — the provider itself only checks the origin when the human CLICKS, where it surfaces as a failed hand-off (`result.reason: origin_not_allowed`) after the dealer has already walked through a consent screen for nothing.
88679
88749
  *
88680
- * **A second click reuses the live hand-off.** Atribu’s URL is single-use and 45-minute-lived, and minting twice yields two hand-offs rather than an error, so a dealer who clicks, gets distracted and clicks again gets the SAME `url` and `handoff_id` back until it expires.
88750
+ * **A second click reuses the live hand-off.** The provider’s URL is single-use and 45-minute-lived, and minting twice yields two hand-offs rather than an error, so a dealer who clicks, gets distracted and clicks again gets the SAME `url` and `handoff_id` back until it expires.
88681
88751
  *
88682
- * Before anything is minted, the tenant’s attribution profile and its delegated key are ensured (ADR 0099). This rail never uses the global `ATRIBU_API_KEY`.
88752
+ * Before anything is minted, the tenant’s attribution profile and its delegated key are ensured (ADR 0099). This rail never uses a platform-wide provider key.
88683
88753
  */
88684
88754
  post: {
88685
88755
  parameters: {
@@ -88711,7 +88781,7 @@ interface paths {
88711
88781
  /**
88712
88782
  * @example {
88713
88783
  * "data": {
88714
- * "url": "https://consent.atribu.app/connect/meta-ads/ho_4d8f2a91c6b3",
88784
+ * "url": "https://consent.example.com/connect/meta-ads/ho_4d8f2a91c6b3",
88715
88785
  * "handoff_id": "ho_4d8f2a91c6b3",
88716
88786
  * "expires_at": "2026-09-23T15:45:00.000Z"
88717
88787
  * }
@@ -88797,14 +88867,14 @@ interface paths {
88797
88867
  * Settle a Meta Ads connect after the dealer comes back
88798
88868
  * @description Reads the hand-off ONCE and settles the row:
88799
88869
  *
88800
- * * `completed` with a connection id → the connection is read back from Atribu and the row becomes `connected`, carrying the ad account’s name, id, currency, timezone and whether the platform has ever delivered spend.
88801
- * * `completed` with a pending selection → the row becomes `pending_selection` and carries the candidates the picker renders. **A consent that resolved to exactly one account never reaches this branch** — Atribu finalizes it in its own callback, which is why there is no auto-finalize step on this side.
88870
+ * * `completed` with a connection id → the connection is read back from the provider and the row becomes `connected`, carrying the ad account’s name, id, currency, timezone and whether the platform has ever delivered spend.
88871
+ * * `completed` with a pending selection → the row becomes `pending_selection` and carries the candidates the picker renders. **A consent that resolved to exactly one account never reaches this branch** — the provider finalizes it in its own callback, which is why there is no auto-finalize step on this side.
88802
88872
  * * `expired` / `cancelled` / `failed` → the row becomes `error` with a retryable `reason` of `handoff_<status>`. The recovery is identical for all three: mint a fresh hand-off.
88803
88873
  * * still `pending` → nothing is settled and the row comes back unchanged.
88804
88874
  *
88805
88875
  * **Neither field is required.** The hand-off id only exists in the RESPONSE to the mint while `return_url` is an argument to that same mint, so the return URL structurally cannot carry it — it carries `meta_ads=return` and the opaque `state` instead. Send `handoff_id` if you kept it, `state` if you read it off the URL, or an empty body, in which case the backend settles the row’s own pending hand-off (unambiguous: a tenant has at most one).
88806
88876
  *
88807
- * Safe to repeat — a settled hand-off stays readable at Atribu, so a re-post on a refresh re-derives the same state.
88877
+ * Safe to repeat — a settled hand-off stays readable at the provider, so a re-post on a refresh re-derives the same state.
88808
88878
  *
88809
88879
  * 409 `handoff_mismatch` when the id or state presented does not name the hand-off this tenant’s row is waiting on, and for a tenant with no connect in flight at all (the two are deliberately the same answer).
88810
88880
  */
@@ -88937,11 +89007,11 @@ interface paths {
88937
89007
  put?: never;
88938
89008
  /**
88939
89009
  * Disconnect the workspace’s Meta Ads ad account
88940
- * @description Calls Atribu’s `connections/{id}/disconnect` operation on the delegated key and settles the row `disconnected`, keeping its history: `account_label` and `connected_at` stay, and `config.last_account` remembers which account this was so the card can still name it. Reconnecting afterwards is a plain new `/connect` — it mints a fresh hand-off. A tenant must always be able to walk away from a connection it made.
89010
+ * @description Calls the provider’s disconnect for the connection on the delegated key and settles the row `disconnected`, keeping its history: `account_label` and `connected_at` stay, and `config.last_account` remembers which account this was so the card can still name it. Reconnecting afterwards is a plain new `/connect` — it mints a fresh hand-off. A tenant must always be able to walk away from a connection it made.
88941
89011
  *
88942
- * A row with nothing at Atribu to revoke — `pending` / `pending_selection` with no connection — is cancelled LOCALLY: no Atribu call, the row moves straight to `disconnected`, and the pending hand-off simply expires on its own (Atribu has no endpoint to cancel one early). A row already `disconnected` answers 200 unchanged (idempotent).
89012
+ * A row with nothing at the provider to revoke — `pending` / `pending_selection` with no connection — is cancelled LOCALLY: no provider call, the row moves straight to `disconnected`, and the pending hand-off simply expires on its own (the provider has no endpoint to cancel one early). A row already `disconnected` answers 200 unchanged (idempotent).
88943
89013
  *
88944
- * 409 `sync_in_flight` when Atribu is mid-sync on the connection — the row is left exactly as it was; the whole recovery is trying again in a few minutes. 502 `atribu_refused` when Atribu’s own 403 says the delegated key is no longer good for this connection — also left unchanged. A 404 from Atribu (the connection is already gone there) is treated as success: the state this call exists to ensure already holds.
89014
+ * 409 `sync_in_flight` when the provider is mid-sync on the connection — the row is left exactly as it was; the whole recovery is trying again in a few minutes. 502 `atribu_refused` when the provider’s own 403 says the delegated key is no longer good for this connection — also left unchanged. A 404 from the provider (the connection is already gone there) is treated as success: the state this call exists to ensure already holds.
88945
89015
  */
88946
89016
  post: {
88947
89017
  parameters: {
@@ -89056,15 +89126,15 @@ interface paths {
89056
89126
  put?: never;
89057
89127
  /**
89058
89128
  * Finalize a Meta Ads pending selection with a chosen candidate
89059
- * @description Only meaningful while `status` is `pending_selection`. Calls Atribu’s finalize on the parked provider token with the chosen `candidate_id` — a `MetaAdsCandidate.candidate_id` from the SAME row’s `candidates`, sent back verbatim — reads the resulting connection back (Atribu’s `connections?channel=meta_ads` operation) and runs it through the same settle path `/return` uses, so the row reads identically whichever produced it: `connected`, with `account` populated.
89129
+ * @description Only meaningful while `status` is `pending_selection`. Calls the provider’s finalize on the parked provider token with the chosen `candidate_id` — a `MetaAdsCandidate.candidate_id` from the SAME row’s `candidates`, sent back verbatim — reads the resulting connection back (the provider’s Meta Ads connections read) and runs it through the same settle path `/return` uses, so the row reads identically whichever produced it: `connected`, with `account` populated.
89060
89130
  *
89061
- * **Retrying the same `candidate_id` is safe** and answers 200 with the current row — Atribu’s `already_finalized: true` on its own idempotent replay, reapplied through the same write path a fresh finalize uses.
89131
+ * **Retrying the same `candidate_id` is safe** and answers 200 with the current row — the provider’s `already_finalized: true` on its own idempotent replay, reapplied through the same write path a fresh finalize uses.
89062
89132
  *
89063
- * **A DIFFERENT `candidate_id`** after Atribu’s parked token already finalized a choice is 409 `start_again` (the row moves to `error`, `reason: selection_conflict`, retryable) — switching accounts needs a fresh connect, there is no token left to retarget.
89133
+ * **A DIFFERENT `candidate_id`** after the provider’s parked token already finalized a choice is 409 `start_again` (the row moves to `error`, `reason: selection_conflict`, retryable) — switching accounts needs a fresh connect, there is no token left to retarget.
89064
89134
  *
89065
89135
  * **The picker’s 60-minute parked token already gone** (elapsed, or never existed for this profile) is 410 `reconnect` (the row moves to `error`, `reason: selection_expired`, retryable).
89066
89136
  *
89067
- * **The row is not `pending_selection`** — nothing started, already connected, or already in `error` — is 409 `handoff_mismatch`, checked before Atribu is ever called.
89137
+ * **The row is not `pending_selection`** — nothing started, already connected, or already in `error` — is 409 `handoff_mismatch`, checked before the provider is ever called.
89068
89138
  */
89069
89139
  post: {
89070
89140
  parameters: {
@@ -89202,17 +89272,17 @@ interface paths {
89202
89272
  };
89203
89273
  /**
89204
89274
  * The tenant's click-to-WhatsApp ads, with connect/greeting checks
89205
- * @description Proxies Atribu’s 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).
89275
+ * @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).
89206
89276
  *
89207
89277
  * An admin-scoped read (`integrations:read` is admin-only in the scope catalog, not "any member"), free for every tenant (no Add-on gate).
89208
89278
  *
89209
89279
  * `data.state` is `not_connected` in TWO cases, told apart by an optional `reason`:
89210
89280
  * * no `reason` — the tenant has never connected a Meta Ads account (the integration row is missing or not `connected`).
89211
- * * `reason: "whatsapp_not_connected"` — Meta Ads may be connected, but the tenant holds no `whatsapp_cloud` account carrying an Atribu partner token, so there is no scope to list ads under.
89281
+ * * `reason: "whatsapp_not_connected"` — Meta Ads may be connected, but the tenant holds no `whatsapp_cloud` account carrying an partner token, so there is no scope to list ads under.
89212
89282
  *
89213
- * `cursor` is Atribu’s own opaque keyset cursor (its `pagination.cursor`, a Meta ad id ascending), passed straight through as `after`. `next_cursor` is `null` once Atribu reports `has_next: false`. `last_synced_at` is the max over the returned PAGE only, not a tenant-wide sync timestamp.
89283
+ * `cursor` is the provider’s own opaque keyset cursor (its `pagination.cursor`, a Meta ad id ascending), passed straight through as `after`. `next_cursor` is `null` once the provider reports `has_next: false`. `last_synced_at` is the max over the returned PAGE only, not a tenant-wide sync timestamp.
89214
89284
  *
89215
- * 502 `UPSTREAM_ERROR` on an Atribu 5xx, timeout, or a response shape this route does not recognise. 502 `partner_token_invalid` when Atribu answers 401 on the WhatsApp partner token — that token is never auto-rotated; the dealer must reconnect WhatsApp.
89285
+ * 502 `UPSTREAM_ERROR` on a provider 5xx, timeout, or a response shape this route does not recognise. 502 `partner_token_invalid` when the provider answers 401 on the WhatsApp partner token — that token is never auto-rotated; the dealer must reconnect WhatsApp.
89216
89286
  */
89217
89287
  get: {
89218
89288
  parameters: {
@@ -89355,11 +89425,11 @@ interface paths {
89355
89425
  };
89356
89426
  /**
89357
89427
  * Ad spend, attributed revenue, ROAS and outcomes for a window
89358
- * @description Proxies Atribu’s `overview` operation: `current` and `previous` (the immediately-preceding window of equal length), each carrying spend, clicks, ROAS, the cash/first-payment/recurring/refund/dispute legs and per-conversion-type outcome counts.
89428
+ * @description The attribution engine’s overview: `current` and `previous` (the immediately-preceding window of equal length), each carrying spend, clicks, ROAS, the cash/first-payment/recurring/refund/dispute legs and per-conversion-type outcome counts.
89359
89429
  *
89360
89430
  * `spend`, `roas` and `clicks` are `null` — never `0` — exactly when `spend_available` is `false` (#1809): the engine could not scope spend to the window/model requested. A measured zero still arrives as `0` with `spend_available: true`. Render `null` as "—", never as zero, and let every ratio you derive from it inherit the null.
89361
89431
  *
89362
- * Every other money field (`revenue`, `cash_revenue`, `first_payment_revenue`, …) is parsed from Atribu’s exact-decimal wire string (ADR 0018) to a number ONCE, at the provider mapper.
89432
+ * Every other money field (`revenue`, `cash_revenue`, `first_payment_revenue`, …) is parsed from the engine’s exact-decimal wire string (ADR 0018) to a number ONCE, at the provider mapper.
89363
89433
  */
89364
89434
  get: {
89365
89435
  parameters: {
@@ -89368,7 +89438,7 @@ interface paths {
89368
89438
  from: string;
89369
89439
  /** @description Window end (inclusive), YYYY-MM-DD. */
89370
89440
  to: string;
89371
- /** @description Atribu attribution model. Defaults to `last_touch`. */
89441
+ /** @description The attribution model. Defaults to `last_touch`. */
89372
89442
  model?: string;
89373
89443
  /** @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. */
89374
89444
  sample?: "1" | "true";
@@ -90062,7 +90132,7 @@ interface paths {
90062
90132
  from: string;
90063
90133
  /** @description Window end (inclusive), YYYY-MM-DD. */
90064
90134
  to: string;
90065
- /** @description Atribu attribution model. Defaults to `last_touch`. */
90135
+ /** @description The attribution model. Defaults to `last_touch`. */
90066
90136
  model?: string;
90067
90137
  /** @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. */
90068
90138
  sample?: "1" | "true";
@@ -90373,7 +90443,7 @@ interface paths {
90373
90443
  };
90374
90444
  /**
90375
90445
  * One campaign’s attributed conversions (the drill-down)
90376
- * @description Proxies Atribu’s `campaigns/{id}/conversions` operation: every conversion credited to `campaign_id` under the window/model, each carrying its credited share (`credited_value`/`credited_weight`), its position in the touch path, and whether the credit is `is_inherited` (bridged lead→cash, never counted in ROAS).
90446
+ * @description The attribution engine’s conversions for one campaign: every conversion credited to `campaign_id` under the window/model, each carrying its credited share (`credited_value`/`credited_weight`), its position in the touch path, and whether the credit is `is_inherited` (bridged lead→cash, never counted in ROAS).
90377
90447
  *
90378
90448
  * `customer_name`/`customer_email` are `null` unless the tenant’s delegated key also carries `customers:read` — every other field is visible under `campaigns:read` alone.
90379
90449
  */
@@ -90384,11 +90454,11 @@ interface paths {
90384
90454
  from: string;
90385
90455
  /** @description Window end (inclusive), YYYY-MM-DD. */
90386
90456
  to: string;
90387
- /** @description Atribu attribution model. Defaults to `last_touch`. */
90457
+ /** @description The attribution model. Defaults to `last_touch`. */
90388
90458
  model?: string;
90389
90459
  /** @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. */
90390
90460
  sample?: "1" | "true";
90391
- /** @description The campaign’s PLATFORM id — the `campaign_external_id` an `/ads/campaigns` row returns, never Atribu’s internal `campaign_id`. */
90461
+ /** @description The campaign’s PLATFORM id — the `campaign_external_id` an `/ads/campaigns` row returns, never the engine’s internal `campaign_id`. */
90392
90462
  campaign_id: string;
90393
90463
  };
90394
90464
  header?: never;
@@ -90543,14 +90613,14 @@ interface paths {
90543
90613
  };
90544
90614
  /**
90545
90615
  * Top-performing ads (cohort-normalized creative scoring)
90546
- * @description Proxies Atribu’s `top-performers` operation — a ROLLING lookback (`window`), not a date range: that is the real endpoint’s own shape. Each ad carries three distinct measures, presented separately — `composite_score` (0-100, a transparent rule blend), `top_performer_likelihood` (0-1, a probability, never ROAS) and `attributed_revenue`/`roas` (real cash attribution, present when `truth_grade` is `attributed`).
90616
+ * @description The attribution engine’s top-performing ads — a ROLLING lookback (`window`), not a date range: that is the real endpoint’s own shape. Each ad carries three distinct measures, presented separately — `composite_score` (0-100, a transparent rule blend), `top_performer_likelihood` (0-1, an UNVALIDATED ranker output passed through as the engine sends it — never show it as a probability; Vitrina derives nothing from it, nor from `fatigue_risk_tier`: the wear verdict is the observed `fatigue_state` = `degraded`) and `attributed_revenue`/`roas` (real cash attribution, present when `truth_grade` is `attributed`).
90547
90617
  *
90548
- * This is the PROFILE-scoped read — every Vitrina tenant’s delegated key is minted for exactly one Atribu profile, so it cannot call Atribu’s cross-profile `/workspaces/{id}/top-performers` (that route is session-bearer-only and answers `403 insufficient_scope` to any API key).
90618
+ * This is the PROFILE-scoped read — every Vitrina tenant’s delegated key is minted for exactly one attribution profile, so it never reads the engine’s cross-profile ranking.
90549
90619
  */
90550
90620
  get: {
90551
90621
  parameters: {
90552
90622
  query?: {
90553
- /** @description A rolling lookback, not a date range — Atribu’s `top-performers` operation takes no `from`/`to`. Defaults to `28d`. */
90623
+ /** @description A rolling lookback, not a date range — the engine ranks ads over a rolling window, never `from`/`to`. Defaults to `28d`. */
90554
90624
  window?: "7d" | "14d" | "28d" | "lifetime";
90555
90625
  limit?: number;
90556
90626
  /** @description `1` adds each row’s `series[]`: the last 14 days of `{date, spend, ctr}` (the first 50 rows; later rows answer `series: null`). */
@@ -90788,13 +90858,11 @@ interface paths {
90788
90858
  };
90789
90859
  /**
90790
90860
  * Attribution trust, UTM quality and attribution coverage
90791
- * @description One combined read over three Atribu operations, so a dashboard panel needs one call, not three:
90861
+ * @description One combined read over three attribution-engine reads, so a dashboard panel needs one call, not three:
90792
90862
  *
90793
- * * `trust` — Atribu’s `trust` operation: how much of the profile’s cash is traceable to an ad (`traceable_pct_by_value`/`_by_count`), whether the instrumentation producing that number is sound (`instrumentation.tracking_healthy`), and which way the traceable half is moving (`traceable_roas_trend`). READ `instrumentation` BEFORE rendering `traceable_pct_by_value` as an indictment — a low number reads as "great organic" when tracking is healthy and "broken tracking" when it is not.
90794
- * * `utm` — Atribu’s `quality/utm` operation: the cached UTM-health badge (malformed/missing/dangling-ad-id anomaly counts over the traffic side) plus the dangling-ad-ids rollup (attributed cash that cannot be placed in the ad hierarchy).
90795
- * * `attribution_coverage` — Atribu’s `quality/attribution` operation: the conversion side — how many of the window’s conversions carry a real ad id, an `fbclid` only, or nothing, partitioning `total_conversions`.
90796
- *
90797
- * ⚠ Named `/attribution-coverage` in this ticket’s original prose — the live Atribu spec names this operation `quality/attribution`; there is no separate `/attribution-coverage` path. Same read, corrected name.
90863
+ * * `trust` — how much of the profile’s cash is traceable to an ad (`traceable_pct_by_value`/`_by_count`), whether the instrumentation producing that number is sound (`instrumentation.tracking_healthy`), and which way the traceable half is moving (`traceable_roas_trend`). READ `instrumentation` BEFORE rendering `traceable_pct_by_value` as an indictment — a low number reads as "great organic" when tracking is healthy and "broken tracking" when it is not.
90864
+ * * `utm` — the cached UTM-health badge (malformed/missing/dangling-ad-id anomaly counts over the traffic side) plus the dangling-ad-ids rollup (attributed cash that cannot be placed in the ad hierarchy).
90865
+ * * `attribution_coverage` — the conversion side — how many of the window’s conversions carry a real ad id, an `fbclid` only, or nothing, partitioning `total_conversions`.
90798
90866
  */
90799
90867
  get: {
90800
90868
  parameters: {
@@ -90803,7 +90871,7 @@ interface paths {
90803
90871
  from: string;
90804
90872
  /** @description Window end (inclusive), YYYY-MM-DD. */
90805
90873
  to: string;
90806
- /** @description Atribu attribution model. Defaults to `last_touch`. */
90874
+ /** @description The attribution model. Defaults to `last_touch`. */
90807
90875
  model?: string;
90808
90876
  /** @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. */
90809
90877
  sample?: "1" | "true";
@@ -90995,9 +91063,11 @@ interface paths {
90995
91063
  * The briefing: ≤3 sentences about a screen’s figures
90996
91064
  * @description A short Spanish briefing for one Ads screen, written from PINNED aggregate facts: every figure in `lead`/`lines` is quoted verbatim from `facts[].display`, and `facts` is returned alongside so a client can show «¿Por qué?». Facts are aggregates only — campaign and ad names, never a person.
90997
91065
  *
90998
- * `source` says who wrote the sentences: `model` (a narrator bound by a guard that rejects any number, name or sentence outside the rules) or `template` (deterministic — first week, Meta disconnected, no spend reading, the model slow or rejected). Both read identically. A briefing is cached per facts hash for 24 h, so two tabs and a reload read the same text; when the model misses its budget the template answers and the model briefing is finished in the background for the next load.
91066
+ * `source` says who wrote the sentences: `model` (a narrator bound by a guard that rejects any number, name or sentence outside the rules), `template` (built from the facts where the model is never used — first week, Meta disconnected, no spend reading, nothing to report, sample mode — or the model was rejected) or `facts` (built from the facts because no model briefing was cached yet). All read identically.
91067
+ *
91068
+ * The read never waits on the model: a model briefing is cached per facts hash for 24 h (two tabs and a reload read the same text) and precomputed daily for the default windows; on a miss the answer is `source: facts` at once and the model briefing is written in the background, so a later read returns it. `wait=1` writes it live instead (up to ~8 s). Sample mode never calls the model.
90999
91069
  *
91000
- * `lead.figure` names the number the lead is built around (`display` is its exact substring in `lead.text`). `lines[].ask` is a suggested follow-up question. `from`/`to` are required except for `creativos`, which takes the rolling `window`.
91070
+ * `lead.figure` names the number the lead is built around (`display` is its exact substring in `lead.text`). `lines[].ask_key` is the follow-up question a line invites, by recipe key (`best_campaign`, `goal_pace`, `worst_spend`, `missing_signals`, …) — derived from the facts the line quotes, each at most once — and `lines[].ask` its label. A fact that rests on a rule carries it as `threshold`. `from`/`to` are required except for `creativos`, which takes the rolling `window`.
91001
91071
  */
91002
91072
  get: {
91003
91073
  parameters: {
@@ -91012,6 +91082,8 @@ interface paths {
91012
91082
  window?: "7d" | "14d" | "28d" | "lifetime";
91013
91083
  /** @description Attribution model. Defaults to `last_touch`. */
91014
91084
  model?: string;
91085
+ /** @description On a cache miss, `1` writes the model briefing live (up to ~8 s) instead of answering at once. Without it a miss answers immediately with the sentences built from the facts (`source: facts`) and the model briefing is written in the background for the next read. */
91086
+ wait?: "0" | "1" | "true" | "false";
91015
91087
  /** @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. */
91016
91088
  sample?: "1" | "true";
91017
91089
  };
@@ -91058,7 +91130,17 @@ interface paths {
91058
91130
  * "best_campaign_roas",
91059
91131
  * "ads_share"
91060
91132
  * ],
91133
+ * "ask_key": "best_campaign",
91061
91134
  * "ask": "¿Qué campaña me conviene subir?"
91135
+ * },
91136
+ * {
91137
+ * "text": "Revisa «Promoción de temporada · Stories»: gastó $118.400 sin resultados.",
91138
+ * "fact_keys": [
91139
+ * "worst_spend_campaign_name",
91140
+ * "worst_spend_campaign_spend"
91141
+ * ],
91142
+ * "ask_key": "worst_spend",
91143
+ * "ask": "¿Cuánto gasta sin resultados?"
91062
91144
  * }
91063
91145
  * ],
91064
91146
  * "facts": [
@@ -91616,9 +91698,11 @@ interface paths {
91616
91698
  };
91617
91699
  /**
91618
91700
  * The suggested actions for one Ads screen
91619
- * @description Up to 6 suggested actions for a screen, primary first, derived from the screen’s figures and the open recommendations of the measurement engine: pause a worn-out ad, pause the delivering ads of a campaign that spent with no results in the period (one card per ad), raise a winning ad set’s budget, re-check the conversion wiring, re-scan the ad links — or, when Meta is not connected, only a `nav` card to reconnect it. Nothing here runs by itself: preview → confirm → execute.
91701
+ * @description Up to 6 suggested actions for a screen, primary first, derived from the screen’s figures and the open recommendations of the measurement engine: pause an ad that «se desgasta» (the observed `fatigue_state: degraded` — on 3 days in a row its trailing 7-day CTR at or under 70 % of its own previous 28 days, or its trailing 7-day cost per result at or over 1/0.7× (+42.86 %); never a learned tier or a probability) AND no longer pays for itself (no attributed value, or a return under 1× — a worn ad still returning 1× or more gets «Prepara una variante» instead, never the pause), pause the delivering ads of a campaign that spent with no results in the period (one card per ad), raise a winning ad set’s budget, re-check the conversion wiring, re-scan the ad links — or, when Meta is not connected, only a `nav` card to reconnect it. Nothing here runs by itself: preview → confirm → execute.
91620
91702
  *
91621
- * `nav` cards only open a page and never execute (dismissable like any card): Campañas — «Mira quién llegó por …», the lowest cost per result among campaigns with 3 or more results, into the attributed list filtered by that campaign; Creativos — «Prepara una variante de …» for a worn-out ad and «Usa … como base» for the best-scored ad that is not worn out, both opening the ad in Meta Ads Manager; Salud — «Instalar el tag en …» when the tag sent nothing in the last 24 hours while Meta is connected, into the set-up’s tag step.
91703
+ * `nav` cards only open a page and never execute (dismissable like any card): Campañas — «Mira quién llegó por …», the lowest cost per result among campaigns with 3 or more results, into the attributed list filtered by that campaign; Creativos — «Prepara una variante de …» for an ad that se desgasta and «Usa … como base» for the best-scored ad that does not, both opening the ad in Meta Ads Manager; Salud — «Instalar el tag en …» (never seen) or «El tag dejó de reportar en …» (installed, silent) when the tag sent nothing in the last 24 hours while Meta is connected, into the set-up’s tag step.
91704
+ *
91705
+ * Every figure a `why` prints names its window: an ad’s spend is the creatives read’s rolling window («en los últimos 28 días» — what the gallery shows), a campaign’s spend is the requested period.
91622
91706
  *
91623
91707
  * `window` (Creativos only) derives the rail on the same rolling creatives window as `GET /ads/creatives`; pass the same `window` to preview.
91624
91708
  *
@@ -91665,7 +91749,7 @@ interface paths {
91665
91749
  * ],
91666
91750
  * "primary": true,
91667
91751
  * "title": "Pausar «Video testimonio · 30 s»",
91668
- * "why": "Está desgastado: la gente ya lo vio demasiadas veces y **$184.300** de gasto rinde cada vez menos.",
91752
+ * "why": "Se desgasta: en sus últimos 7 días, frente a sus 28 días anteriores, el CTR cayó 30 % o más o el costo por resultado subió 42,86 % o más (1/0,7 veces), durante 3 días seguidos. Lleva **$184.300** de gasto en los últimos 28 días y no le trae presupuestos aceptados.",
91669
91753
  * "effect": "Deja de mostrarse de inmediato; puedes reactivarlo cuando quieras.",
91670
91754
  * "target": {
91671
91755
  * "level": "ad",
@@ -92943,7 +93027,7 @@ interface paths {
92943
93027
  * "data": {
92944
93028
  * "key_id": "abababab-0000-4000-8000-000000000001",
92945
93029
  * "public_key": "trk_live_abc123",
92946
- * "snippet": "<script src=\"https://track.atribu.app/t.js?k=trk_live_abc123\" async></script>",
93030
+ * "snippet": "<script src=\"https://track.example.com/t.js?k=trk_live_abc123\" async></script>",
92947
93031
  * "combined_snippet": "<script src=\"https://api.vitrinadev.com/tag.js?site=pk_live_sitekey000000000000\" async></script>",
92948
93032
  * "site_key": "pk_live_sitekey000000000000",
92949
93033
  * "meta_pixel_id": null
@@ -113414,7 +113498,7 @@ interface components {
113414
113498
  rules: components["schemas"]["AdsRuleSyncResult"];
113415
113499
  };
113416
113500
  AdsConversionSyncWiring: {
113417
- /** @description Atribu's per-rule × destination verdicts and remediation, verbatim. */
113501
+ /** @description The conversion provider's per-rule × destination verdicts and remediation, verbatim: `{rule_id, destination_id, verdict, event_name, checks, remediation[], checked_at, stale}`, `verdict` ∈ `wired | sent_not_used | below_threshold | custom_conversion_broken | connection_broken | check_failed`. `checks` also carries Meta ids (`pixel.pixelId`, `optimizationGoal.usedByActiveAdSets[].adSetId` / `campaignId`), elided from the example. */
113418
113502
  results: Record<string, never>[];
113419
113503
  checked_at: string | null;
113420
113504
  stale: boolean;
@@ -113703,6 +113787,7 @@ interface components {
113703
113787
  creative_thumbnail_url: string | null;
113704
113788
  score_window: string;
113705
113789
  composite_score: number | null;
113790
+ /** @description Passed through as the engine sends it: an UNVALIDATED ranker output. Not a probability to show — Vitrina derives nothing from it. */
113706
113791
  top_performer_likelihood: number | null;
113707
113792
  maturity_stage: string;
113708
113793
  truth_grade: string;
@@ -113712,9 +113797,15 @@ interface components {
113712
113797
  ctr: number;
113713
113798
  attributed_revenue: number | null;
113714
113799
  roas: number | null;
113715
- /** @enum {string|null} */
113800
+ /**
113801
+ * @description The OBSERVED delivery state. `degraded` = the ad «se desgasta»: on 3 consecutive days its trailing 7-day CTR was at or under 70 % of its own previous 28 days, or its trailing 7-day cost per result at or over 1/0.7× (+42.86 %) of it (≥ 1,000 impressions, ≥ 5 baseline results). The only input to every wear verdict, card and fact.
113802
+ * @enum {string|null}
113803
+ */
113716
113804
  fatigue_state: "active" | "paused" | "degraded" | null;
113717
- /** @enum {string|null} */
113805
+ /**
113806
+ * @description Passed through as the engine sends it: a learned risk tier that has not cleared an out-of-time evaluation. Vitrina derives nothing from it — key on `fatigue_state`.
113807
+ * @enum {string|null}
113808
+ */
113718
113809
  fatigue_risk_tier: "low" | "medium" | "high" | "critical" | null;
113719
113810
  /** @description `series=1` only: the last 14 days (America/Santiago). `null` past the first 50 rows or when this ad’s daily read failed (never a zero-filled line for an unknown); `spend: 0` days are measured no-delivery days. */
113720
113811
  series?: {
@@ -113791,6 +113882,8 @@ interface components {
113791
113882
  format: "clp" | "int" | "times" | "pct" | "text" | "date" | "days";
113792
113883
  /** @description Where the value was read. */
113793
113884
  source: string;
113885
+ /** @description Present only on a fact that rests on a rule: the rule itself, in the owner’s words (for the wear verdict: «CTR 30 % o más bajo, o costo por resultado 43 % o más alto, durante 3 días seguidos frente a sus 28 días anteriores»). Nothing in a fact is a probability. */
113886
+ threshold?: string;
113794
113887
  /**
113795
113888
  * @description Facts never carry a person.
113796
113889
  * @enum {string}
@@ -113810,7 +113903,12 @@ interface components {
113810
113903
  text: string;
113811
113904
  /** @description The facts this sentence quotes. */
113812
113905
  fact_keys: string[];
113813
- /** @description A suggested «Pregúntale» question this line invites. */
113906
+ /**
113907
+ * @description The «Pregúntale» question this line invites, by recipe key (select the question by this, never by its label). Derived from the facts the line quotes. Absent when the line invites none; each key appears at most once per briefing.
113908
+ * @enum {string}
113909
+ */
113910
+ ask_key?: "best_campaign" | "goal_pace" | "cash_vs_value" | "wearing_ads" | "cheapest_outcome" | "worst_spend" | "top_ad_closings" | "time_to_close" | "unmatched_today" | "why_best" | "what_if_pause" | "missing_signals" | "tag_impact" | "traceable_cash";
113911
+ /** @description That question’s label in the workspace’s words (present exactly when `ask_key` is). */
113814
113912
  ask?: string;
113815
113913
  figure: {
113816
113914
  fact_key: string;
@@ -113828,17 +113926,22 @@ interface components {
113828
113926
  text: string;
113829
113927
  /** @description The facts this sentence quotes. */
113830
113928
  fact_keys: string[];
113831
- /** @description A suggested «Pregúntale» question this line invites. */
113929
+ /**
113930
+ * @description The «Pregúntale» question this line invites, by recipe key (select the question by this, never by its label). Derived from the facts the line quotes. Absent when the line invites none; each key appears at most once per briefing.
113931
+ * @enum {string}
113932
+ */
113933
+ ask_key?: "best_campaign" | "goal_pace" | "cash_vs_value" | "wearing_ads" | "cheapest_outcome" | "worst_spend" | "top_ad_closings" | "time_to_close" | "unmatched_today" | "why_best" | "what_if_pause" | "missing_signals" | "tag_impact" | "traceable_cash";
113934
+ /** @description That question’s label in the workspace’s words (present exactly when `ask_key` is). */
113832
113935
  ask?: string;
113833
113936
  }[];
113834
113937
  facts: components["schemas"]["AdsFact"][];
113835
113938
  /** @description Ids of the actions the rail should surface first (may be empty). */
113836
113939
  actions: string[];
113837
113940
  /**
113838
- * @description Who wrote the sentences — both read from the same pinned facts.
113941
+ * @description Who wrote the sentences — all from the same pinned facts. `model`: the language model (cached for these facts). `template`: built from the facts where the model is never used (first week, Meta disconnected, no spend reading, nothing to report, sample mode). `facts`: built from the facts because no model briefing was cached yet — one is being written in the background, so a later read returns `model`.
113839
113942
  * @enum {string}
113840
113943
  */
113841
- source: "model" | "template";
113944
+ source: "model" | "template" | "facts";
113842
113945
  generated_at: string;
113843
113946
  /** @enum {string} */
113844
113947
  vocabulary: "automotive" | "healthcare" | "generic";
package/dist/index.d.ts CHANGED
@@ -10215,7 +10215,7 @@ interface paths {
10215
10215
  };
10216
10216
  /**
10217
10217
  * List channels
10218
- * @description Every messaging account in the workspace, secrets redacted. Connecting a new one is a browser flow (OAuth/Atribu/IMAP) — see the `MessagingAccounts` reference — but everything already connected is readable here.
10218
+ * @description Every messaging account in the workspace, secrets redacted. Connecting a new one is a browser flow (OAuth, a partner connection or IMAP) — see the `MessagingAccounts` reference — but everything already connected is readable here.
10219
10219
  */
10220
10220
  get: {
10221
10221
  parameters: {
@@ -12923,7 +12923,7 @@ interface paths {
12923
12923
  };
12924
12924
  /**
12925
12925
  * Live channel identity & health
12926
- * @description Dials the provider (or Atribu, for a partner-connected account) right now — the connected phone/IG account/mailbox identity, webhook delivery state, and WhatsApp account health (quality rating, messaging limit) where applicable. `stored` rides along: the last health snapshot the periodic checker wrote, for comparing a live read against what was already known. `?refresh=true` forces a fresh probe instead of the provider’s own cache. A live check that itself fails (provider down, expired token) still answers 200, with a fallback `identity`/`webhook` reporting the failure — this call never breaks a health dashboard by 500ing.
12926
+ * @description Dials the provider (or the partner connection provider, for a partner-connected account) right now — the connected phone/IG account/mailbox identity, webhook delivery state, and WhatsApp account health (quality rating, messaging limit) where applicable. `stored` rides along: the last health snapshot the periodic checker wrote, for comparing a live read against what was already known. `?refresh=true` forces a fresh probe instead of the provider’s own cache. A live check that itself fails (provider down, expired token) still answers 200, with a fallback `identity`/`webhook` reporting the failure — this call never breaks a health dashboard by 500ing.
12927
12927
  */
12928
12928
  get: {
12929
12929
  parameters: {
@@ -48021,7 +48021,7 @@ interface paths {
48021
48021
  * "days_left": 100
48022
48022
  * },
48023
48023
  * "delivered": "email",
48024
- * "accept_url": "https://vitrinadev-api.atribu.app/api/v1/public/clinic/budget/<token>",
48024
+ * "accept_url": "https://api.example.com/api/v1/public/clinic/budget/<token>",
48025
48025
  * "reason": null
48026
48026
  * }
48027
48027
  * }
@@ -66456,7 +66456,7 @@ interface paths {
66456
66456
  };
66457
66457
  /**
66458
66458
  * The tenant's Vitrina Ads entitlement and delegated-key state
66459
- * @description Distinguishes "not entitled" (`entitlement: off`) from "needs re-mint" (`needs_remint: true` — the live key is the wrong kind for the declared entitlement) and from an in-flight change (`pending_on` / `pending_off`). `grant_scopes` are the scopes Atribu returned on the last provision or entitlement call. Requires `ads:read`.
66459
+ * @description Distinguishes "not entitled" (`entitlement: off`) from "needs re-mint" (`needs_remint: true` — the live key is the wrong kind for the declared entitlement) and from an in-flight change (`pending_on` / `pending_off`). `grant_scopes` are the scopes the attribution engine returned on the last provision or entitlement call. Requires `ads:read`.
66460
66460
  */
66461
66461
  get: {
66462
66462
  parameters: {
@@ -66565,7 +66565,7 @@ interface paths {
66565
66565
  };
66566
66566
  /**
66567
66567
  * Conversion Sync catalog: definitions, connections, destinations, privacy settings
66568
- * @description Step 0 of the setup. `definitions[].id` is a rule's `source_ref_id`; `connections[].id` is a destination's `connection_id`. Relayed verbatim from Atribu. Gated by the Add-on like every `/ads/*` route but `/ads/state`. Requires `ads:read`.
66568
+ * @description Step 0 of the setup. `definitions[].id` is a rule's `source_ref_id`; `connections[].id` is a destination's `connection_id`. Relayed verbatim from the conversion provider. Gated by the Add-on like every `/ads/*` route but `/ads/state`. Requires `ads:read`.
66569
66569
  */
66570
66570
  get: {
66571
66571
  parameters: {
@@ -66890,7 +66890,7 @@ interface paths {
66890
66890
  };
66891
66891
  /**
66892
66892
  * The configured export destinations (pre-fills a re-run)
66893
- * @description Relayed verbatim from Atribu, including each destination's `routing`. Requires `ads:read`.
66893
+ * @description Relayed verbatim from the conversion provider, including each destination's `routing`. Requires `ads:read`.
66894
66894
  */
66895
66895
  get: {
66896
66896
  parameters: {
@@ -67570,14 +67570,16 @@ interface paths {
67570
67570
  cookie?: never;
67571
67571
  };
67572
67572
  /**
67573
- * Whether the dealer's ad sets optimize for the events Vitrina sends
67574
- * @description Atribu's per-rule verdicts and remediation, verbatim (served from a 6h cache; `force=1` re-verifies live — still a read). `privacy` reports whether a clinic profile carries `platform_safe`. Requires `ads:read`.
67573
+ * Whether the ad sets optimize for the events Vitrina sends
67574
+ * @description The conversion provider's per-rule verdicts and remediation, verbatim (served from a 6-hour cache; `force=1` re-verifies live — still a read). `privacy` reports whether a clinic profile carries `platform_safe`. `sample=1` (or a sandbox workspace) answers the sample dataset's verdicts — one `wired` row per rule the vertical sends to Meta, fresh, no entitlement required and nothing read — like every other Ads read. Requires `ads:read`.
67575
67575
  */
67576
67576
  get: {
67577
67577
  parameters: {
67578
67578
  query?: {
67579
- /** @description Re-verify live against Meta instead of Atribu's 6h cache. Still a read — several Meta API calls, use sparingly. */
67579
+ /** @description Re-verify live against Meta instead of the conversion provider's 6-hour cache. Still a read — several Meta API calls, use sparingly. */
67580
67580
  force?: "0" | "1" | "true" | "false";
67581
+ /** @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. */
67582
+ sample?: "1" | "true";
67581
67583
  };
67582
67584
  header?: never;
67583
67585
  path?: never;
@@ -67597,8 +67599,42 @@ interface paths {
67597
67599
  * "results": [
67598
67600
  * {
67599
67601
  * "rule_id": "e1e1e1e1-0000-4000-8000-000000000001",
67600
- * "status": "wired",
67601
- * "remediation": null
67602
+ * "destination_id": "d0d0d0d0-0000-4000-8000-000000000001",
67603
+ * "verdict": "wired",
67604
+ * "event_name": "Purchase",
67605
+ * "checks": {
67606
+ * "connection": {
67607
+ * "ok": true
67608
+ * },
67609
+ * "pixel": {
67610
+ * "ok": true,
67611
+ * "isUnavailable": false,
67612
+ * "lastFiredAt": "2026-09-22T11:53:00.000Z"
67613
+ * },
67614
+ * "eventsArriving": {
67615
+ * "ok": true,
67616
+ * "volume7d": 64
67617
+ * },
67618
+ * "customConversion": {
67619
+ * "exists": false,
67620
+ * "required": false
67621
+ * },
67622
+ * "optimizationGoal": {
67623
+ * "usedByActiveAdSets": [
67624
+ * {
67625
+ * "adSetName": "Implantes · Las Condes",
67626
+ * "campaignName": "Implantes · Septiembre",
67627
+ * "objective": "OUTCOME_SALES",
67628
+ * "optimizationGoal": "OFFSITE_CONVERSIONS",
67629
+ * "customEventType": "PURCHASE",
67630
+ * "via": "custom_event_type"
67631
+ * }
67632
+ * ]
67633
+ * }
67634
+ * },
67635
+ * "remediation": [],
67636
+ * "checked_at": "2026-09-22T12:00:00.000Z",
67637
+ * "stale": false
67602
67638
  * }
67603
67639
  * ],
67604
67640
  * "checked_at": "2026-09-22T12:00:00.000Z",
@@ -67769,8 +67805,42 @@ interface paths {
67769
67805
  * "results": [
67770
67806
  * {
67771
67807
  * "rule_id": "e1e1e1e1-0000-4000-8000-000000000001",
67772
- * "status": "wired",
67773
- * "remediation": null
67808
+ * "destination_id": "d0d0d0d0-0000-4000-8000-000000000001",
67809
+ * "verdict": "wired",
67810
+ * "event_name": "Purchase",
67811
+ * "checks": {
67812
+ * "connection": {
67813
+ * "ok": true
67814
+ * },
67815
+ * "pixel": {
67816
+ * "ok": true,
67817
+ * "isUnavailable": false,
67818
+ * "lastFiredAt": "2026-09-22T11:53:00.000Z"
67819
+ * },
67820
+ * "eventsArriving": {
67821
+ * "ok": true,
67822
+ * "volume7d": 64
67823
+ * },
67824
+ * "customConversion": {
67825
+ * "exists": false,
67826
+ * "required": false
67827
+ * },
67828
+ * "optimizationGoal": {
67829
+ * "usedByActiveAdSets": [
67830
+ * {
67831
+ * "adSetName": "Implantes · Las Condes",
67832
+ * "campaignName": "Implantes · Septiembre",
67833
+ * "objective": "OUTCOME_SALES",
67834
+ * "optimizationGoal": "OFFSITE_CONVERSIONS",
67835
+ * "customEventType": "PURCHASE",
67836
+ * "via": "custom_event_type"
67837
+ * }
67838
+ * ]
67839
+ * }
67840
+ * },
67841
+ * "remediation": [],
67842
+ * "checked_at": "2026-09-22T12:00:00.000Z",
67843
+ * "stale": false
67774
67844
  * }
67775
67845
  * ],
67776
67846
  * "checked_at": "2026-09-22T12:00:00.000Z",
@@ -88673,13 +88743,13 @@ interface paths {
88673
88743
  put?: never;
88674
88744
  /**
88675
88745
  * Start a Meta Ads connect and get the consent URL
88676
- * @description Mints Atribu’s **connect hand-off** for `meta_ads` and answers the session-less consent URL to redirect the WHOLE PAGE to. It is not an iframe target: Meta’s own consent dialog renders inside it.
88746
+ * @description Mints the connection provider’s **connect hand-off** for `meta_ads` and answers the session-less consent URL to redirect the WHOLE PAGE to. It is not an iframe target: Meta’s own consent dialog renders inside it.
88677
88747
  *
88678
- * `return_to` must be an absolute URL on the app’s own origin. The backend appends `meta_ads=return` and a short opaque `state`, preserving any query the URL already carried, and passes the result to Atribu as `return_url`. An origin that is not the app’s is a 400 here rather than a silent substitution — Atribu itself only checks the origin when the human CLICKS, where it surfaces as a failed hand-off (`result.reason: origin_not_allowed`) after the dealer has already walked through a consent screen for nothing.
88748
+ * `return_to` must be an absolute URL on the app’s own origin. The backend appends `meta_ads=return` and a short opaque `state`, preserving any query the URL already carried, and passes the result to the provider as `return_url`. An origin that is not the app’s is a 400 here rather than a silent substitution — the provider itself only checks the origin when the human CLICKS, where it surfaces as a failed hand-off (`result.reason: origin_not_allowed`) after the dealer has already walked through a consent screen for nothing.
88679
88749
  *
88680
- * **A second click reuses the live hand-off.** Atribu’s URL is single-use and 45-minute-lived, and minting twice yields two hand-offs rather than an error, so a dealer who clicks, gets distracted and clicks again gets the SAME `url` and `handoff_id` back until it expires.
88750
+ * **A second click reuses the live hand-off.** The provider’s URL is single-use and 45-minute-lived, and minting twice yields two hand-offs rather than an error, so a dealer who clicks, gets distracted and clicks again gets the SAME `url` and `handoff_id` back until it expires.
88681
88751
  *
88682
- * Before anything is minted, the tenant’s attribution profile and its delegated key are ensured (ADR 0099). This rail never uses the global `ATRIBU_API_KEY`.
88752
+ * Before anything is minted, the tenant’s attribution profile and its delegated key are ensured (ADR 0099). This rail never uses a platform-wide provider key.
88683
88753
  */
88684
88754
  post: {
88685
88755
  parameters: {
@@ -88711,7 +88781,7 @@ interface paths {
88711
88781
  /**
88712
88782
  * @example {
88713
88783
  * "data": {
88714
- * "url": "https://consent.atribu.app/connect/meta-ads/ho_4d8f2a91c6b3",
88784
+ * "url": "https://consent.example.com/connect/meta-ads/ho_4d8f2a91c6b3",
88715
88785
  * "handoff_id": "ho_4d8f2a91c6b3",
88716
88786
  * "expires_at": "2026-09-23T15:45:00.000Z"
88717
88787
  * }
@@ -88797,14 +88867,14 @@ interface paths {
88797
88867
  * Settle a Meta Ads connect after the dealer comes back
88798
88868
  * @description Reads the hand-off ONCE and settles the row:
88799
88869
  *
88800
- * * `completed` with a connection id → the connection is read back from Atribu and the row becomes `connected`, carrying the ad account’s name, id, currency, timezone and whether the platform has ever delivered spend.
88801
- * * `completed` with a pending selection → the row becomes `pending_selection` and carries the candidates the picker renders. **A consent that resolved to exactly one account never reaches this branch** — Atribu finalizes it in its own callback, which is why there is no auto-finalize step on this side.
88870
+ * * `completed` with a connection id → the connection is read back from the provider and the row becomes `connected`, carrying the ad account’s name, id, currency, timezone and whether the platform has ever delivered spend.
88871
+ * * `completed` with a pending selection → the row becomes `pending_selection` and carries the candidates the picker renders. **A consent that resolved to exactly one account never reaches this branch** — the provider finalizes it in its own callback, which is why there is no auto-finalize step on this side.
88802
88872
  * * `expired` / `cancelled` / `failed` → the row becomes `error` with a retryable `reason` of `handoff_<status>`. The recovery is identical for all three: mint a fresh hand-off.
88803
88873
  * * still `pending` → nothing is settled and the row comes back unchanged.
88804
88874
  *
88805
88875
  * **Neither field is required.** The hand-off id only exists in the RESPONSE to the mint while `return_url` is an argument to that same mint, so the return URL structurally cannot carry it — it carries `meta_ads=return` and the opaque `state` instead. Send `handoff_id` if you kept it, `state` if you read it off the URL, or an empty body, in which case the backend settles the row’s own pending hand-off (unambiguous: a tenant has at most one).
88806
88876
  *
88807
- * Safe to repeat — a settled hand-off stays readable at Atribu, so a re-post on a refresh re-derives the same state.
88877
+ * Safe to repeat — a settled hand-off stays readable at the provider, so a re-post on a refresh re-derives the same state.
88808
88878
  *
88809
88879
  * 409 `handoff_mismatch` when the id or state presented does not name the hand-off this tenant’s row is waiting on, and for a tenant with no connect in flight at all (the two are deliberately the same answer).
88810
88880
  */
@@ -88937,11 +89007,11 @@ interface paths {
88937
89007
  put?: never;
88938
89008
  /**
88939
89009
  * Disconnect the workspace’s Meta Ads ad account
88940
- * @description Calls Atribu’s `connections/{id}/disconnect` operation on the delegated key and settles the row `disconnected`, keeping its history: `account_label` and `connected_at` stay, and `config.last_account` remembers which account this was so the card can still name it. Reconnecting afterwards is a plain new `/connect` — it mints a fresh hand-off. A tenant must always be able to walk away from a connection it made.
89010
+ * @description Calls the provider’s disconnect for the connection on the delegated key and settles the row `disconnected`, keeping its history: `account_label` and `connected_at` stay, and `config.last_account` remembers which account this was so the card can still name it. Reconnecting afterwards is a plain new `/connect` — it mints a fresh hand-off. A tenant must always be able to walk away from a connection it made.
88941
89011
  *
88942
- * A row with nothing at Atribu to revoke — `pending` / `pending_selection` with no connection — is cancelled LOCALLY: no Atribu call, the row moves straight to `disconnected`, and the pending hand-off simply expires on its own (Atribu has no endpoint to cancel one early). A row already `disconnected` answers 200 unchanged (idempotent).
89012
+ * A row with nothing at the provider to revoke — `pending` / `pending_selection` with no connection — is cancelled LOCALLY: no provider call, the row moves straight to `disconnected`, and the pending hand-off simply expires on its own (the provider has no endpoint to cancel one early). A row already `disconnected` answers 200 unchanged (idempotent).
88943
89013
  *
88944
- * 409 `sync_in_flight` when Atribu is mid-sync on the connection — the row is left exactly as it was; the whole recovery is trying again in a few minutes. 502 `atribu_refused` when Atribu’s own 403 says the delegated key is no longer good for this connection — also left unchanged. A 404 from Atribu (the connection is already gone there) is treated as success: the state this call exists to ensure already holds.
89014
+ * 409 `sync_in_flight` when the provider is mid-sync on the connection — the row is left exactly as it was; the whole recovery is trying again in a few minutes. 502 `atribu_refused` when the provider’s own 403 says the delegated key is no longer good for this connection — also left unchanged. A 404 from the provider (the connection is already gone there) is treated as success: the state this call exists to ensure already holds.
88945
89015
  */
88946
89016
  post: {
88947
89017
  parameters: {
@@ -89056,15 +89126,15 @@ interface paths {
89056
89126
  put?: never;
89057
89127
  /**
89058
89128
  * Finalize a Meta Ads pending selection with a chosen candidate
89059
- * @description Only meaningful while `status` is `pending_selection`. Calls Atribu’s finalize on the parked provider token with the chosen `candidate_id` — a `MetaAdsCandidate.candidate_id` from the SAME row’s `candidates`, sent back verbatim — reads the resulting connection back (Atribu’s `connections?channel=meta_ads` operation) and runs it through the same settle path `/return` uses, so the row reads identically whichever produced it: `connected`, with `account` populated.
89129
+ * @description Only meaningful while `status` is `pending_selection`. Calls the provider’s finalize on the parked provider token with the chosen `candidate_id` — a `MetaAdsCandidate.candidate_id` from the SAME row’s `candidates`, sent back verbatim — reads the resulting connection back (the provider’s Meta Ads connections read) and runs it through the same settle path `/return` uses, so the row reads identically whichever produced it: `connected`, with `account` populated.
89060
89130
  *
89061
- * **Retrying the same `candidate_id` is safe** and answers 200 with the current row — Atribu’s `already_finalized: true` on its own idempotent replay, reapplied through the same write path a fresh finalize uses.
89131
+ * **Retrying the same `candidate_id` is safe** and answers 200 with the current row — the provider’s `already_finalized: true` on its own idempotent replay, reapplied through the same write path a fresh finalize uses.
89062
89132
  *
89063
- * **A DIFFERENT `candidate_id`** after Atribu’s parked token already finalized a choice is 409 `start_again` (the row moves to `error`, `reason: selection_conflict`, retryable) — switching accounts needs a fresh connect, there is no token left to retarget.
89133
+ * **A DIFFERENT `candidate_id`** after the provider’s parked token already finalized a choice is 409 `start_again` (the row moves to `error`, `reason: selection_conflict`, retryable) — switching accounts needs a fresh connect, there is no token left to retarget.
89064
89134
  *
89065
89135
  * **The picker’s 60-minute parked token already gone** (elapsed, or never existed for this profile) is 410 `reconnect` (the row moves to `error`, `reason: selection_expired`, retryable).
89066
89136
  *
89067
- * **The row is not `pending_selection`** — nothing started, already connected, or already in `error` — is 409 `handoff_mismatch`, checked before Atribu is ever called.
89137
+ * **The row is not `pending_selection`** — nothing started, already connected, or already in `error` — is 409 `handoff_mismatch`, checked before the provider is ever called.
89068
89138
  */
89069
89139
  post: {
89070
89140
  parameters: {
@@ -89202,17 +89272,17 @@ interface paths {
89202
89272
  };
89203
89273
  /**
89204
89274
  * The tenant's click-to-WhatsApp ads, with connect/greeting checks
89205
- * @description Proxies Atribu’s 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).
89275
+ * @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).
89206
89276
  *
89207
89277
  * An admin-scoped read (`integrations:read` is admin-only in the scope catalog, not "any member"), free for every tenant (no Add-on gate).
89208
89278
  *
89209
89279
  * `data.state` is `not_connected` in TWO cases, told apart by an optional `reason`:
89210
89280
  * * no `reason` — the tenant has never connected a Meta Ads account (the integration row is missing or not `connected`).
89211
- * * `reason: "whatsapp_not_connected"` — Meta Ads may be connected, but the tenant holds no `whatsapp_cloud` account carrying an Atribu partner token, so there is no scope to list ads under.
89281
+ * * `reason: "whatsapp_not_connected"` — Meta Ads may be connected, but the tenant holds no `whatsapp_cloud` account carrying an partner token, so there is no scope to list ads under.
89212
89282
  *
89213
- * `cursor` is Atribu’s own opaque keyset cursor (its `pagination.cursor`, a Meta ad id ascending), passed straight through as `after`. `next_cursor` is `null` once Atribu reports `has_next: false`. `last_synced_at` is the max over the returned PAGE only, not a tenant-wide sync timestamp.
89283
+ * `cursor` is the provider’s own opaque keyset cursor (its `pagination.cursor`, a Meta ad id ascending), passed straight through as `after`. `next_cursor` is `null` once the provider reports `has_next: false`. `last_synced_at` is the max over the returned PAGE only, not a tenant-wide sync timestamp.
89214
89284
  *
89215
- * 502 `UPSTREAM_ERROR` on an Atribu 5xx, timeout, or a response shape this route does not recognise. 502 `partner_token_invalid` when Atribu answers 401 on the WhatsApp partner token — that token is never auto-rotated; the dealer must reconnect WhatsApp.
89285
+ * 502 `UPSTREAM_ERROR` on a provider 5xx, timeout, or a response shape this route does not recognise. 502 `partner_token_invalid` when the provider answers 401 on the WhatsApp partner token — that token is never auto-rotated; the dealer must reconnect WhatsApp.
89216
89286
  */
89217
89287
  get: {
89218
89288
  parameters: {
@@ -89355,11 +89425,11 @@ interface paths {
89355
89425
  };
89356
89426
  /**
89357
89427
  * Ad spend, attributed revenue, ROAS and outcomes for a window
89358
- * @description Proxies Atribu’s `overview` operation: `current` and `previous` (the immediately-preceding window of equal length), each carrying spend, clicks, ROAS, the cash/first-payment/recurring/refund/dispute legs and per-conversion-type outcome counts.
89428
+ * @description The attribution engine’s overview: `current` and `previous` (the immediately-preceding window of equal length), each carrying spend, clicks, ROAS, the cash/first-payment/recurring/refund/dispute legs and per-conversion-type outcome counts.
89359
89429
  *
89360
89430
  * `spend`, `roas` and `clicks` are `null` — never `0` — exactly when `spend_available` is `false` (#1809): the engine could not scope spend to the window/model requested. A measured zero still arrives as `0` with `spend_available: true`. Render `null` as "—", never as zero, and let every ratio you derive from it inherit the null.
89361
89431
  *
89362
- * Every other money field (`revenue`, `cash_revenue`, `first_payment_revenue`, …) is parsed from Atribu’s exact-decimal wire string (ADR 0018) to a number ONCE, at the provider mapper.
89432
+ * Every other money field (`revenue`, `cash_revenue`, `first_payment_revenue`, …) is parsed from the engine’s exact-decimal wire string (ADR 0018) to a number ONCE, at the provider mapper.
89363
89433
  */
89364
89434
  get: {
89365
89435
  parameters: {
@@ -89368,7 +89438,7 @@ interface paths {
89368
89438
  from: string;
89369
89439
  /** @description Window end (inclusive), YYYY-MM-DD. */
89370
89440
  to: string;
89371
- /** @description Atribu attribution model. Defaults to `last_touch`. */
89441
+ /** @description The attribution model. Defaults to `last_touch`. */
89372
89442
  model?: string;
89373
89443
  /** @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. */
89374
89444
  sample?: "1" | "true";
@@ -90062,7 +90132,7 @@ interface paths {
90062
90132
  from: string;
90063
90133
  /** @description Window end (inclusive), YYYY-MM-DD. */
90064
90134
  to: string;
90065
- /** @description Atribu attribution model. Defaults to `last_touch`. */
90135
+ /** @description The attribution model. Defaults to `last_touch`. */
90066
90136
  model?: string;
90067
90137
  /** @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. */
90068
90138
  sample?: "1" | "true";
@@ -90373,7 +90443,7 @@ interface paths {
90373
90443
  };
90374
90444
  /**
90375
90445
  * One campaign’s attributed conversions (the drill-down)
90376
- * @description Proxies Atribu’s `campaigns/{id}/conversions` operation: every conversion credited to `campaign_id` under the window/model, each carrying its credited share (`credited_value`/`credited_weight`), its position in the touch path, and whether the credit is `is_inherited` (bridged lead→cash, never counted in ROAS).
90446
+ * @description The attribution engine’s conversions for one campaign: every conversion credited to `campaign_id` under the window/model, each carrying its credited share (`credited_value`/`credited_weight`), its position in the touch path, and whether the credit is `is_inherited` (bridged lead→cash, never counted in ROAS).
90377
90447
  *
90378
90448
  * `customer_name`/`customer_email` are `null` unless the tenant’s delegated key also carries `customers:read` — every other field is visible under `campaigns:read` alone.
90379
90449
  */
@@ -90384,11 +90454,11 @@ interface paths {
90384
90454
  from: string;
90385
90455
  /** @description Window end (inclusive), YYYY-MM-DD. */
90386
90456
  to: string;
90387
- /** @description Atribu attribution model. Defaults to `last_touch`. */
90457
+ /** @description The attribution model. Defaults to `last_touch`. */
90388
90458
  model?: string;
90389
90459
  /** @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. */
90390
90460
  sample?: "1" | "true";
90391
- /** @description The campaign’s PLATFORM id — the `campaign_external_id` an `/ads/campaigns` row returns, never Atribu’s internal `campaign_id`. */
90461
+ /** @description The campaign’s PLATFORM id — the `campaign_external_id` an `/ads/campaigns` row returns, never the engine’s internal `campaign_id`. */
90392
90462
  campaign_id: string;
90393
90463
  };
90394
90464
  header?: never;
@@ -90543,14 +90613,14 @@ interface paths {
90543
90613
  };
90544
90614
  /**
90545
90615
  * Top-performing ads (cohort-normalized creative scoring)
90546
- * @description Proxies Atribu’s `top-performers` operation — a ROLLING lookback (`window`), not a date range: that is the real endpoint’s own shape. Each ad carries three distinct measures, presented separately — `composite_score` (0-100, a transparent rule blend), `top_performer_likelihood` (0-1, a probability, never ROAS) and `attributed_revenue`/`roas` (real cash attribution, present when `truth_grade` is `attributed`).
90616
+ * @description The attribution engine’s top-performing ads — a ROLLING lookback (`window`), not a date range: that is the real endpoint’s own shape. Each ad carries three distinct measures, presented separately — `composite_score` (0-100, a transparent rule blend), `top_performer_likelihood` (0-1, an UNVALIDATED ranker output passed through as the engine sends it — never show it as a probability; Vitrina derives nothing from it, nor from `fatigue_risk_tier`: the wear verdict is the observed `fatigue_state` = `degraded`) and `attributed_revenue`/`roas` (real cash attribution, present when `truth_grade` is `attributed`).
90547
90617
  *
90548
- * This is the PROFILE-scoped read — every Vitrina tenant’s delegated key is minted for exactly one Atribu profile, so it cannot call Atribu’s cross-profile `/workspaces/{id}/top-performers` (that route is session-bearer-only and answers `403 insufficient_scope` to any API key).
90618
+ * This is the PROFILE-scoped read — every Vitrina tenant’s delegated key is minted for exactly one attribution profile, so it never reads the engine’s cross-profile ranking.
90549
90619
  */
90550
90620
  get: {
90551
90621
  parameters: {
90552
90622
  query?: {
90553
- /** @description A rolling lookback, not a date range — Atribu’s `top-performers` operation takes no `from`/`to`. Defaults to `28d`. */
90623
+ /** @description A rolling lookback, not a date range — the engine ranks ads over a rolling window, never `from`/`to`. Defaults to `28d`. */
90554
90624
  window?: "7d" | "14d" | "28d" | "lifetime";
90555
90625
  limit?: number;
90556
90626
  /** @description `1` adds each row’s `series[]`: the last 14 days of `{date, spend, ctr}` (the first 50 rows; later rows answer `series: null`). */
@@ -90788,13 +90858,11 @@ interface paths {
90788
90858
  };
90789
90859
  /**
90790
90860
  * Attribution trust, UTM quality and attribution coverage
90791
- * @description One combined read over three Atribu operations, so a dashboard panel needs one call, not three:
90861
+ * @description One combined read over three attribution-engine reads, so a dashboard panel needs one call, not three:
90792
90862
  *
90793
- * * `trust` — Atribu’s `trust` operation: how much of the profile’s cash is traceable to an ad (`traceable_pct_by_value`/`_by_count`), whether the instrumentation producing that number is sound (`instrumentation.tracking_healthy`), and which way the traceable half is moving (`traceable_roas_trend`). READ `instrumentation` BEFORE rendering `traceable_pct_by_value` as an indictment — a low number reads as "great organic" when tracking is healthy and "broken tracking" when it is not.
90794
- * * `utm` — Atribu’s `quality/utm` operation: the cached UTM-health badge (malformed/missing/dangling-ad-id anomaly counts over the traffic side) plus the dangling-ad-ids rollup (attributed cash that cannot be placed in the ad hierarchy).
90795
- * * `attribution_coverage` — Atribu’s `quality/attribution` operation: the conversion side — how many of the window’s conversions carry a real ad id, an `fbclid` only, or nothing, partitioning `total_conversions`.
90796
- *
90797
- * ⚠ Named `/attribution-coverage` in this ticket’s original prose — the live Atribu spec names this operation `quality/attribution`; there is no separate `/attribution-coverage` path. Same read, corrected name.
90863
+ * * `trust` — how much of the profile’s cash is traceable to an ad (`traceable_pct_by_value`/`_by_count`), whether the instrumentation producing that number is sound (`instrumentation.tracking_healthy`), and which way the traceable half is moving (`traceable_roas_trend`). READ `instrumentation` BEFORE rendering `traceable_pct_by_value` as an indictment — a low number reads as "great organic" when tracking is healthy and "broken tracking" when it is not.
90864
+ * * `utm` — the cached UTM-health badge (malformed/missing/dangling-ad-id anomaly counts over the traffic side) plus the dangling-ad-ids rollup (attributed cash that cannot be placed in the ad hierarchy).
90865
+ * * `attribution_coverage` — the conversion side — how many of the window’s conversions carry a real ad id, an `fbclid` only, or nothing, partitioning `total_conversions`.
90798
90866
  */
90799
90867
  get: {
90800
90868
  parameters: {
@@ -90803,7 +90871,7 @@ interface paths {
90803
90871
  from: string;
90804
90872
  /** @description Window end (inclusive), YYYY-MM-DD. */
90805
90873
  to: string;
90806
- /** @description Atribu attribution model. Defaults to `last_touch`. */
90874
+ /** @description The attribution model. Defaults to `last_touch`. */
90807
90875
  model?: string;
90808
90876
  /** @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. */
90809
90877
  sample?: "1" | "true";
@@ -90995,9 +91063,11 @@ interface paths {
90995
91063
  * The briefing: ≤3 sentences about a screen’s figures
90996
91064
  * @description A short Spanish briefing for one Ads screen, written from PINNED aggregate facts: every figure in `lead`/`lines` is quoted verbatim from `facts[].display`, and `facts` is returned alongside so a client can show «¿Por qué?». Facts are aggregates only — campaign and ad names, never a person.
90997
91065
  *
90998
- * `source` says who wrote the sentences: `model` (a narrator bound by a guard that rejects any number, name or sentence outside the rules) or `template` (deterministic — first week, Meta disconnected, no spend reading, the model slow or rejected). Both read identically. A briefing is cached per facts hash for 24 h, so two tabs and a reload read the same text; when the model misses its budget the template answers and the model briefing is finished in the background for the next load.
91066
+ * `source` says who wrote the sentences: `model` (a narrator bound by a guard that rejects any number, name or sentence outside the rules), `template` (built from the facts where the model is never used — first week, Meta disconnected, no spend reading, nothing to report, sample mode — or the model was rejected) or `facts` (built from the facts because no model briefing was cached yet). All read identically.
91067
+ *
91068
+ * The read never waits on the model: a model briefing is cached per facts hash for 24 h (two tabs and a reload read the same text) and precomputed daily for the default windows; on a miss the answer is `source: facts` at once and the model briefing is written in the background, so a later read returns it. `wait=1` writes it live instead (up to ~8 s). Sample mode never calls the model.
90999
91069
  *
91000
- * `lead.figure` names the number the lead is built around (`display` is its exact substring in `lead.text`). `lines[].ask` is a suggested follow-up question. `from`/`to` are required except for `creativos`, which takes the rolling `window`.
91070
+ * `lead.figure` names the number the lead is built around (`display` is its exact substring in `lead.text`). `lines[].ask_key` is the follow-up question a line invites, by recipe key (`best_campaign`, `goal_pace`, `worst_spend`, `missing_signals`, …) — derived from the facts the line quotes, each at most once — and `lines[].ask` its label. A fact that rests on a rule carries it as `threshold`. `from`/`to` are required except for `creativos`, which takes the rolling `window`.
91001
91071
  */
91002
91072
  get: {
91003
91073
  parameters: {
@@ -91012,6 +91082,8 @@ interface paths {
91012
91082
  window?: "7d" | "14d" | "28d" | "lifetime";
91013
91083
  /** @description Attribution model. Defaults to `last_touch`. */
91014
91084
  model?: string;
91085
+ /** @description On a cache miss, `1` writes the model briefing live (up to ~8 s) instead of answering at once. Without it a miss answers immediately with the sentences built from the facts (`source: facts`) and the model briefing is written in the background for the next read. */
91086
+ wait?: "0" | "1" | "true" | "false";
91015
91087
  /** @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. */
91016
91088
  sample?: "1" | "true";
91017
91089
  };
@@ -91058,7 +91130,17 @@ interface paths {
91058
91130
  * "best_campaign_roas",
91059
91131
  * "ads_share"
91060
91132
  * ],
91133
+ * "ask_key": "best_campaign",
91061
91134
  * "ask": "¿Qué campaña me conviene subir?"
91135
+ * },
91136
+ * {
91137
+ * "text": "Revisa «Promoción de temporada · Stories»: gastó $118.400 sin resultados.",
91138
+ * "fact_keys": [
91139
+ * "worst_spend_campaign_name",
91140
+ * "worst_spend_campaign_spend"
91141
+ * ],
91142
+ * "ask_key": "worst_spend",
91143
+ * "ask": "¿Cuánto gasta sin resultados?"
91062
91144
  * }
91063
91145
  * ],
91064
91146
  * "facts": [
@@ -91616,9 +91698,11 @@ interface paths {
91616
91698
  };
91617
91699
  /**
91618
91700
  * The suggested actions for one Ads screen
91619
- * @description Up to 6 suggested actions for a screen, primary first, derived from the screen’s figures and the open recommendations of the measurement engine: pause a worn-out ad, pause the delivering ads of a campaign that spent with no results in the period (one card per ad), raise a winning ad set’s budget, re-check the conversion wiring, re-scan the ad links — or, when Meta is not connected, only a `nav` card to reconnect it. Nothing here runs by itself: preview → confirm → execute.
91701
+ * @description Up to 6 suggested actions for a screen, primary first, derived from the screen’s figures and the open recommendations of the measurement engine: pause an ad that «se desgasta» (the observed `fatigue_state: degraded` — on 3 days in a row its trailing 7-day CTR at or under 70 % of its own previous 28 days, or its trailing 7-day cost per result at or over 1/0.7× (+42.86 %); never a learned tier or a probability) AND no longer pays for itself (no attributed value, or a return under 1× — a worn ad still returning 1× or more gets «Prepara una variante» instead, never the pause), pause the delivering ads of a campaign that spent with no results in the period (one card per ad), raise a winning ad set’s budget, re-check the conversion wiring, re-scan the ad links — or, when Meta is not connected, only a `nav` card to reconnect it. Nothing here runs by itself: preview → confirm → execute.
91620
91702
  *
91621
- * `nav` cards only open a page and never execute (dismissable like any card): Campañas — «Mira quién llegó por …», the lowest cost per result among campaigns with 3 or more results, into the attributed list filtered by that campaign; Creativos — «Prepara una variante de …» for a worn-out ad and «Usa … como base» for the best-scored ad that is not worn out, both opening the ad in Meta Ads Manager; Salud — «Instalar el tag en …» when the tag sent nothing in the last 24 hours while Meta is connected, into the set-up’s tag step.
91703
+ * `nav` cards only open a page and never execute (dismissable like any card): Campañas — «Mira quién llegó por …», the lowest cost per result among campaigns with 3 or more results, into the attributed list filtered by that campaign; Creativos — «Prepara una variante de …» for an ad that se desgasta and «Usa … como base» for the best-scored ad that does not, both opening the ad in Meta Ads Manager; Salud — «Instalar el tag en …» (never seen) or «El tag dejó de reportar en …» (installed, silent) when the tag sent nothing in the last 24 hours while Meta is connected, into the set-up’s tag step.
91704
+ *
91705
+ * Every figure a `why` prints names its window: an ad’s spend is the creatives read’s rolling window («en los últimos 28 días» — what the gallery shows), a campaign’s spend is the requested period.
91622
91706
  *
91623
91707
  * `window` (Creativos only) derives the rail on the same rolling creatives window as `GET /ads/creatives`; pass the same `window` to preview.
91624
91708
  *
@@ -91665,7 +91749,7 @@ interface paths {
91665
91749
  * ],
91666
91750
  * "primary": true,
91667
91751
  * "title": "Pausar «Video testimonio · 30 s»",
91668
- * "why": "Está desgastado: la gente ya lo vio demasiadas veces y **$184.300** de gasto rinde cada vez menos.",
91752
+ * "why": "Se desgasta: en sus últimos 7 días, frente a sus 28 días anteriores, el CTR cayó 30 % o más o el costo por resultado subió 42,86 % o más (1/0,7 veces), durante 3 días seguidos. Lleva **$184.300** de gasto en los últimos 28 días y no le trae presupuestos aceptados.",
91669
91753
  * "effect": "Deja de mostrarse de inmediato; puedes reactivarlo cuando quieras.",
91670
91754
  * "target": {
91671
91755
  * "level": "ad",
@@ -92943,7 +93027,7 @@ interface paths {
92943
93027
  * "data": {
92944
93028
  * "key_id": "abababab-0000-4000-8000-000000000001",
92945
93029
  * "public_key": "trk_live_abc123",
92946
- * "snippet": "<script src=\"https://track.atribu.app/t.js?k=trk_live_abc123\" async></script>",
93030
+ * "snippet": "<script src=\"https://track.example.com/t.js?k=trk_live_abc123\" async></script>",
92947
93031
  * "combined_snippet": "<script src=\"https://api.vitrinadev.com/tag.js?site=pk_live_sitekey000000000000\" async></script>",
92948
93032
  * "site_key": "pk_live_sitekey000000000000",
92949
93033
  * "meta_pixel_id": null
@@ -113414,7 +113498,7 @@ interface components {
113414
113498
  rules: components["schemas"]["AdsRuleSyncResult"];
113415
113499
  };
113416
113500
  AdsConversionSyncWiring: {
113417
- /** @description Atribu's per-rule × destination verdicts and remediation, verbatim. */
113501
+ /** @description The conversion provider's per-rule × destination verdicts and remediation, verbatim: `{rule_id, destination_id, verdict, event_name, checks, remediation[], checked_at, stale}`, `verdict` ∈ `wired | sent_not_used | below_threshold | custom_conversion_broken | connection_broken | check_failed`. `checks` also carries Meta ids (`pixel.pixelId`, `optimizationGoal.usedByActiveAdSets[].adSetId` / `campaignId`), elided from the example. */
113418
113502
  results: Record<string, never>[];
113419
113503
  checked_at: string | null;
113420
113504
  stale: boolean;
@@ -113703,6 +113787,7 @@ interface components {
113703
113787
  creative_thumbnail_url: string | null;
113704
113788
  score_window: string;
113705
113789
  composite_score: number | null;
113790
+ /** @description Passed through as the engine sends it: an UNVALIDATED ranker output. Not a probability to show — Vitrina derives nothing from it. */
113706
113791
  top_performer_likelihood: number | null;
113707
113792
  maturity_stage: string;
113708
113793
  truth_grade: string;
@@ -113712,9 +113797,15 @@ interface components {
113712
113797
  ctr: number;
113713
113798
  attributed_revenue: number | null;
113714
113799
  roas: number | null;
113715
- /** @enum {string|null} */
113800
+ /**
113801
+ * @description The OBSERVED delivery state. `degraded` = the ad «se desgasta»: on 3 consecutive days its trailing 7-day CTR was at or under 70 % of its own previous 28 days, or its trailing 7-day cost per result at or over 1/0.7× (+42.86 %) of it (≥ 1,000 impressions, ≥ 5 baseline results). The only input to every wear verdict, card and fact.
113802
+ * @enum {string|null}
113803
+ */
113716
113804
  fatigue_state: "active" | "paused" | "degraded" | null;
113717
- /** @enum {string|null} */
113805
+ /**
113806
+ * @description Passed through as the engine sends it: a learned risk tier that has not cleared an out-of-time evaluation. Vitrina derives nothing from it — key on `fatigue_state`.
113807
+ * @enum {string|null}
113808
+ */
113718
113809
  fatigue_risk_tier: "low" | "medium" | "high" | "critical" | null;
113719
113810
  /** @description `series=1` only: the last 14 days (America/Santiago). `null` past the first 50 rows or when this ad’s daily read failed (never a zero-filled line for an unknown); `spend: 0` days are measured no-delivery days. */
113720
113811
  series?: {
@@ -113791,6 +113882,8 @@ interface components {
113791
113882
  format: "clp" | "int" | "times" | "pct" | "text" | "date" | "days";
113792
113883
  /** @description Where the value was read. */
113793
113884
  source: string;
113885
+ /** @description Present only on a fact that rests on a rule: the rule itself, in the owner’s words (for the wear verdict: «CTR 30 % o más bajo, o costo por resultado 43 % o más alto, durante 3 días seguidos frente a sus 28 días anteriores»). Nothing in a fact is a probability. */
113886
+ threshold?: string;
113794
113887
  /**
113795
113888
  * @description Facts never carry a person.
113796
113889
  * @enum {string}
@@ -113810,7 +113903,12 @@ interface components {
113810
113903
  text: string;
113811
113904
  /** @description The facts this sentence quotes. */
113812
113905
  fact_keys: string[];
113813
- /** @description A suggested «Pregúntale» question this line invites. */
113906
+ /**
113907
+ * @description The «Pregúntale» question this line invites, by recipe key (select the question by this, never by its label). Derived from the facts the line quotes. Absent when the line invites none; each key appears at most once per briefing.
113908
+ * @enum {string}
113909
+ */
113910
+ ask_key?: "best_campaign" | "goal_pace" | "cash_vs_value" | "wearing_ads" | "cheapest_outcome" | "worst_spend" | "top_ad_closings" | "time_to_close" | "unmatched_today" | "why_best" | "what_if_pause" | "missing_signals" | "tag_impact" | "traceable_cash";
113911
+ /** @description That question’s label in the workspace’s words (present exactly when `ask_key` is). */
113814
113912
  ask?: string;
113815
113913
  figure: {
113816
113914
  fact_key: string;
@@ -113828,17 +113926,22 @@ interface components {
113828
113926
  text: string;
113829
113927
  /** @description The facts this sentence quotes. */
113830
113928
  fact_keys: string[];
113831
- /** @description A suggested «Pregúntale» question this line invites. */
113929
+ /**
113930
+ * @description The «Pregúntale» question this line invites, by recipe key (select the question by this, never by its label). Derived from the facts the line quotes. Absent when the line invites none; each key appears at most once per briefing.
113931
+ * @enum {string}
113932
+ */
113933
+ ask_key?: "best_campaign" | "goal_pace" | "cash_vs_value" | "wearing_ads" | "cheapest_outcome" | "worst_spend" | "top_ad_closings" | "time_to_close" | "unmatched_today" | "why_best" | "what_if_pause" | "missing_signals" | "tag_impact" | "traceable_cash";
113934
+ /** @description That question’s label in the workspace’s words (present exactly when `ask_key` is). */
113832
113935
  ask?: string;
113833
113936
  }[];
113834
113937
  facts: components["schemas"]["AdsFact"][];
113835
113938
  /** @description Ids of the actions the rail should surface first (may be empty). */
113836
113939
  actions: string[];
113837
113940
  /**
113838
- * @description Who wrote the sentences — both read from the same pinned facts.
113941
+ * @description Who wrote the sentences — all from the same pinned facts. `model`: the language model (cached for these facts). `template`: built from the facts where the model is never used (first week, Meta disconnected, no spend reading, nothing to report, sample mode). `facts`: built from the facts because no model briefing was cached yet — one is being written in the background, so a later read returns `model`.
113839
113942
  * @enum {string}
113840
113943
  */
113841
- source: "model" | "template";
113944
+ source: "model" | "template" | "facts";
113842
113945
  generated_at: string;
113843
113946
  /** @enum {string} */
113844
113947
  vocabulary: "automotive" | "healthcare" | "generic";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "11.17.0",
3
+ "version": "11.19.0",
4
4
  "description": "Typed TypeScript SDK for the Vitrina API pública — generated from the committed openapi.public.json (ADR 0106).",
5
5
  "type": "module",
6
6
  "license": "MIT",