@vitrina/api 13.7.0 → 14.1.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
@@ -7451,7 +7451,7 @@ interface paths {
7451
7451
  };
7452
7452
  /**
7453
7453
  * Get the funnel report
7454
- * @description The board's Pasos del embudo (ADR 0132) with the number of leads that reached each one in the period, the conversion from the step before, the split by stage inside each step, and Perdido apart. Counts only: this is the door the aggregates-only Consultor seat reads, next to `boards` lists the sales boards that can be read (id + name) so a board picker needs no other scope; `pipeline_id` selects one. The last step (Venta) carries `money`: what its people paid since their lead was created (`null` = more than 2 000 people, or unknown). `leads:read`. WHAT A COUNT MEANS. The cohort is the leads of the board CREATED in the period (`from` to `to`, both days inclusive, in the workspace clock). A lead counts in a step when it has ever stood on a stage of that step OR OF A LATER ONE — from its stage history, or from its current stage when it has none — so a lead that skipped a step still counts for the steps before it, and every cohort lead counts in the first step. The cohort is fixed by the creation date but how far it got is read as of now: a lead created in the period and sold next month counts in the last step the next time you look. `current` is where the cohort stands today. `lost` is the cohort leads standing on a lost stage today, split by the step they were lost from; `step_key: null` is history that cannot say (never guessed into a step). `sum(steps[].current) + lost.total + unplaced = cohort`.
7454
+ * @description The board's Pasos del embudo (ADR 0132) with the number of leads that reached each one in the period, the conversion from the step before, the split by stage inside each step, and Perdido apart. Counts only: this is the door the aggregates-only Consultor seat reads, next to `boards` lists the sales boards that can be read (id + name) so a board picker needs no other scope; `pipeline_id` selects one. The last step (Venta) carries `money`: what its people paid since they arrived (`null` = more than 2 000 people, or unknown). `leads:read`. WHAT A COUNT MEANS. The cohort is the leads of the board whose person ARRIVED in the period (`from` to `to`, both days inclusive, in the workspace clock): the start of the conversation the lead came from (within 30 days of the lead), else the lead's creation — a conversation lead is minted when the conversation closes, days after the first message. People rows carry it as `arrived_at`. A lead counts in a step when it has ever stood on a stage of that step OR OF A LATER ONE — from its stage history, or from its current stage when it has none — so a lead that skipped a step still counts for the steps before it, and every cohort lead counts in the first step. The cohort is fixed by the arrival date but how far it got is read as of now: a lead arrived in the period and sold next month counts in the last step the next time you look. `current` is where the cohort stands today. `lost` is the cohort leads standing on a lost stage today, split by the step they were lost from; `step_key: null` is history that cannot say (never guessed into a step). `sum(steps[].current) + lost.total + unplaced = cohort`.
7455
7455
  */
7456
7456
  get: {
7457
7457
  parameters: {
@@ -7636,7 +7636,7 @@ interface paths {
7636
7636
  };
7637
7637
  /**
7638
7638
  * Get the funnel report split by Línea
7639
- * @description One row per Línea of the clinic (and «Sin línea», `linea_id: null`, when leads carry none), each with how many of ITS cohort leads reached every step and stand there today. Same cohort and counting rules as `GET /funnel-report` with one more grouping, so the rows add up to it: for every step, `sum(lineas[].steps[].reached) = ` that step’s `reached` in the unsplit report, and `sum(lineas[].cohort) = cohort`. Open a cell’s people with `GET /funnel-report/people` and the same period plus `linea_id` (`none` for «Sin línea»). Counts only (the Consultor seat reads it). WHAT A COUNT MEANS. The cohort is the leads of the board CREATED in the period (`from` to `to`, both days inclusive, in the workspace clock). A lead counts in a step when it has ever stood on a stage of that step OR OF A LATER ONE — from its stage history, or from its current stage when it has none — so a lead that skipped a step still counts for the steps before it, and every cohort lead counts in the first step. The cohort is fixed by the creation date but how far it got is read as of now: a lead created in the period and sold next month counts in the last step the next time you look. `current` is where the cohort stands today. `lost` is the cohort leads standing on a lost stage today, split by the step they were lost from; `step_key: null` is history that cannot say (never guessed into a step). `sum(steps[].current) + lost.total + unplaced = cohort`.
7639
+ * @description One row per Línea of the clinic (and «Sin línea», `linea_id: null`, when leads carry none), each with how many of ITS cohort leads reached every step and stand there today. Same cohort and counting rules as `GET /funnel-report` with one more grouping, so the rows add up to it: for every step, `sum(lineas[].steps[].reached) = ` that step’s `reached` in the unsplit report, and `sum(lineas[].cohort) = cohort`. Open a cell’s people with `GET /funnel-report/people` and the same period plus `linea_id` (`none` for «Sin línea»). Counts only (the Consultor seat reads it). WHAT A COUNT MEANS. The cohort is the leads of the board whose person ARRIVED in the period (`from` to `to`, both days inclusive, in the workspace clock): the start of the conversation the lead came from (within 30 days of the lead), else the lead's creation — a conversation lead is minted when the conversation closes, days after the first message. People rows carry it as `arrived_at`. A lead counts in a step when it has ever stood on a stage of that step OR OF A LATER ONE — from its stage history, or from its current stage when it has none — so a lead that skipped a step still counts for the steps before it, and every cohort lead counts in the first step. The cohort is fixed by the arrival date but how far it got is read as of now: a lead arrived in the period and sold next month counts in the last step the next time you look. `current` is where the cohort stands today. `lost` is the cohort leads standing on a lost stage today, split by the step they were lost from; `step_key: null` is history that cannot say (never guessed into a step). `sum(steps[].current) + lost.total + unplaced = cohort`.
7640
7640
  */
7641
7641
  get: {
7642
7642
  parameters: {
@@ -7814,7 +7814,7 @@ interface paths {
7814
7814
  };
7815
7815
  /**
7816
7816
  * List the people behind a funnel count
7817
- * @description The leads behind one number of `GET /funnel-report`, read through the same cohort and the same rules, so the list always has as many rows as the count says (`total`). `measure=reached&step=` is a step headline; `measure=current` is who stands there today; `measure=lost` is Perdido (narrow with `step`, or `lost_from_unknown=true`); `measure=unplaced` is the leads on a stage that belongs to no step. Add `stage_id` for one stage of a step. Newest activity first. Needs `leads:read`; the contact name and phone ride only with `contacts:read`. D60: each person also carries `score` and `score_reason` («qué pasó»), `lost_reason` («motivo»), the next cita (else the last, `cita_at`/`cita_status`), `paid` (CLP the clinic recorded since the lead was created) and, for a clinic, `origin` (Meta naming the ad, Orgánico, Sin dato). WHAT A COUNT MEANS. The cohort is the leads of the board CREATED in the period (`from` to `to`, both days inclusive, in the workspace clock). A lead counts in a step when it has ever stood on a stage of that step OR OF A LATER ONE — from its stage history, or from its current stage when it has none — so a lead that skipped a step still counts for the steps before it, and every cohort lead counts in the first step. The cohort is fixed by the creation date but how far it got is read as of now: a lead created in the period and sold next month counts in the last step the next time you look. `current` is where the cohort stands today. `lost` is the cohort leads standing on a lost stage today, split by the step they were lost from; `step_key: null` is history that cannot say (never guessed into a step). `sum(steps[].current) + lost.total + unplaced = cohort`.
7817
+ * @description The leads behind one number of `GET /funnel-report`, read through the same cohort and the same rules, so the list always has as many rows as the count says (`total`). `measure=reached&step=` is a step headline; `measure=current` is who stands there today; `measure=lost` is Perdido (narrow with `step`, or `lost_from_unknown=true`); `measure=unplaced` is the leads on a stage that belongs to no step. Add `stage_id` for one stage of a step. Newest activity first. Needs `leads:read`; the contact name and phone ride only with `contacts:read`. D60: each person also carries `score` and `score_reason` («qué pasó»), `lost_reason` («motivo»), the next cita (else the last, `cita_at`/`cita_status`), `paid` (CLP the clinic recorded since the person arrived) and, for a clinic, `origin` (Meta naming the ad, Orgánico, Sin dato). WHAT A COUNT MEANS. The cohort is the leads of the board whose person ARRIVED in the period (`from` to `to`, both days inclusive, in the workspace clock): the start of the conversation the lead came from (within 30 days of the lead), else the lead's creation — a conversation lead is minted when the conversation closes, days after the first message. People rows carry it as `arrived_at`. A lead counts in a step when it has ever stood on a stage of that step OR OF A LATER ONE — from its stage history, or from its current stage when it has none — so a lead that skipped a step still counts for the steps before it, and every cohort lead counts in the first step. The cohort is fixed by the arrival date but how far it got is read as of now: a lead arrived in the period and sold next month counts in the last step the next time you look. `current` is where the cohort stands today. `lost` is the cohort leads standing on a lost stage today, split by the step they were lost from; `step_key: null` is history that cannot say (never guessed into a step). `sum(steps[].current) + lost.total + unplaced = cohort`.
7818
7818
  */
7819
7819
  get: {
7820
7820
  parameters: {
@@ -7876,6 +7876,7 @@ interface paths {
7876
7876
  * "stage_id": "0b1c2d3e-0000-4000-8000-0000000000a2",
7877
7877
  * "stage_name": "Evaluación agendada",
7878
7878
  * "created_at": "2026-09-12T14:03:00.000Z",
7879
+ * "arrived_at": "2026-09-12T14:01:00.000Z",
7879
7880
  * "last_activity_at": "2026-10-08T09:30:00.000Z",
7880
7881
  * "last_move_at": "2026-09-20T16:00:00.000Z",
7881
7882
  * "last_move_stage_name": "Evaluación agendada",
@@ -59720,6 +59721,7 @@ interface paths {
59720
59721
  * "lineages": 12,
59721
59722
  * "followed_up": 9,
59722
59723
  * "never_contacted": 3,
59724
+ * "accepted_without_contact": 0,
59723
59725
  * "in_progress": 4,
59724
59726
  * "closed_after_followup": 5
59725
59727
  * }
@@ -59857,7 +59859,10 @@ interface paths {
59857
59859
  to: string;
59858
59860
  lineages: number;
59859
59861
  followed_up: number;
59862
+ /** @description Ended (stopped) with no call that connected and no WhatsApp sent, excluding the ones the patient accepted on their own. */
59860
59863
  never_contacted: number;
59864
+ /** @description Ended with no contact because the patient accepted on their own. */
59865
+ accepted_without_contact: number;
59861
59866
  in_progress: number;
59862
59867
  closed_after_followup: number;
59863
59868
  };
@@ -60217,6 +60222,8 @@ interface paths {
60217
60222
  origin_ad_id?: string;
60218
60223
  /** @description Narrow to one Línea: a clinic línea id, or `none` for leads without one. `counts` follow the narrowing. */
60219
60224
  linea_id?: string | "none";
60225
+ /** @description Only these Prioridades in `rows`, comma-separated (`P1,P2`); each set pages on its own cursor. `counts` stay the whole section. */
60226
+ priority?: string;
60220
60227
  };
60221
60228
  header?: never;
60222
60229
  path?: never;
@@ -60245,6 +60252,12 @@ interface paths {
60245
60252
  * "P2": 2,
60246
60253
  * "P3": 3,
60247
60254
  * "P4": 4
60255
+ * },
60256
+ * "unlogged_by_priority": {
60257
+ * "P1": 1,
60258
+ * "P2": 2,
60259
+ * "P3": 3,
60260
+ * "P4": 4
60248
60261
  * }
60249
60262
  * },
60250
60263
  * "rows": [
@@ -60262,6 +60275,7 @@ interface paths {
60262
60275
  * "score_reason": "Pidió precio de implantes y preguntó por horarios.",
60263
60276
  * "temperature": "warm",
60264
60277
  * "stage_name": "Nuevo",
60278
+ * "stage_says_booked": false,
60265
60279
  * "line": "Implantes",
60266
60280
  * "linea": {
60267
60281
  * "id": "d1d1d1d1-0000-4000-8000-000000000001",
@@ -60297,7 +60311,7 @@ interface paths {
60297
60311
  data: {
60298
60312
  today: string;
60299
60313
  call_list: boolean;
60300
- /** @description When the clinic's day ends today (its latest closing among today's Horarios, clinic clock): if no call outcome is logged by then, the held WhatsApp is proposed for approval. `null` on a day the clinic does not open. */
60314
+ /** @description When the clinic's day ends today (its latest closing among today's Horarios, clinic clock). `null` on a day the clinic does not open. */
60301
60315
  day_ends_at: string | null;
60302
60316
  counts: {
60303
60317
  /** @description Leads in the section. */
@@ -60313,6 +60327,13 @@ interface paths {
60313
60327
  P3: number;
60314
60328
  P4: number;
60315
60329
  };
60330
+ /** @description Of those, per Prioridad, with no outcome logged today. */
60331
+ unlogged_by_priority: {
60332
+ P1: number;
60333
+ P2: number;
60334
+ P3: number;
60335
+ P4: number;
60336
+ };
60316
60337
  };
60317
60338
  rows: {
60318
60339
  /**
@@ -60321,10 +60342,10 @@ interface paths {
60321
60342
  */
60322
60343
  priority: "P1" | "P2" | "P3" | "P4";
60323
60344
  /**
60324
- * @description The fact that decided the tier.
60345
+ * @description The fact that decided the tier. `missed_cita` / `cancelled_cita`: a P1 whose requested hour was booked and then missed or cancelled.
60325
60346
  * @enum {string}
60326
60347
  */
60327
- priority_fact: "picked_time" | "asked_time" | "wrote_last" | "offered_unanswered" | "interested" | "cold";
60348
+ priority_fact: "picked_time" | "asked_time" | "missed_cita" | "cancelled_cita" | "wrote_last" | "offered_unanswered" | "interested" | "cold";
60328
60349
  /** @description That fact as a Spanish sentence, e.g. «Escribió hace 3 h, le debemos respuesta». */
60329
60350
  priority_reason: string;
60330
60351
  /**
@@ -60346,6 +60367,8 @@ interface paths {
60346
60367
  score_reason: string | null;
60347
60368
  temperature: string | null;
60348
60369
  stage_name: string | null;
60370
+ /** @description The stage says the evaluation is booked («Evaluación agendada») but no cita stands in the agenda (not under the contact, its conversations, its ficha or its WhatsApp number): check the agenda before calling. */
60371
+ stage_says_booked: boolean;
60349
60372
  /** @description Nombre of the lead's Línea; `null` when it has none. */
60350
60373
  line: string | null;
60351
60374
  /** @description The lead's Línea as an object (id, nombre, and why it carries it); `null` when it has none. */
@@ -60386,7 +60409,7 @@ interface paths {
60386
60409
  value: "accepted" | "declined" | "thinking" | "no_answer";
60387
60410
  at: string;
60388
60411
  } | null;
60389
- /** @description Where this patient's Recontacto stands today. `held`: the call goes first, no WhatsApp until the clinic's day ends. `proposed`: nobody logged a call, the WhatsApp waits for a person's approval. `null`: nothing pending. */
60412
+ /** @description Where this patient's Recontacto stands. `proposed`: a WhatsApp waits for a person's approval. `null`: nothing pending. `held` is no longer produced: calling never holds back a WhatsApp. */
60390
60413
  recontacto: {
60391
60414
  /** @enum {string} */
60392
60415
  state: "held";
@@ -60547,6 +60570,7 @@ interface paths {
60547
60570
  * "score_reason": "Pidió precio de implantes y preguntó por horarios.",
60548
60571
  * "temperature": "warm",
60549
60572
  * "stage_name": "Nuevo",
60573
+ * "stage_says_booked": false,
60550
60574
  * "line": "Implantes",
60551
60575
  * "linea": {
60552
60576
  * "id": "d1d1d1d1-0000-4000-8000-000000000001",
@@ -60582,10 +60606,10 @@ interface paths {
60582
60606
  */
60583
60607
  priority: "P1" | "P2" | "P3" | "P4";
60584
60608
  /**
60585
- * @description The fact that decided the tier.
60609
+ * @description The fact that decided the tier. `missed_cita` / `cancelled_cita`: a P1 whose requested hour was booked and then missed or cancelled.
60586
60610
  * @enum {string}
60587
60611
  */
60588
- priority_fact: "picked_time" | "asked_time" | "wrote_last" | "offered_unanswered" | "interested" | "cold";
60612
+ priority_fact: "picked_time" | "asked_time" | "missed_cita" | "cancelled_cita" | "wrote_last" | "offered_unanswered" | "interested" | "cold";
60589
60613
  /** @description That fact as a Spanish sentence, e.g. «Escribió hace 3 h, le debemos respuesta». */
60590
60614
  priority_reason: string;
60591
60615
  /**
@@ -60607,6 +60631,8 @@ interface paths {
60607
60631
  score_reason: string | null;
60608
60632
  temperature: string | null;
60609
60633
  stage_name: string | null;
60634
+ /** @description The stage says the evaluation is booked («Evaluación agendada») but no cita stands in the agenda (not under the contact, its conversations, its ficha or its WhatsApp number): check the agenda before calling. */
60635
+ stage_says_booked: boolean;
60610
60636
  /** @description Nombre of the lead's Línea; `null` when it has none. */
60611
60637
  line: string | null;
60612
60638
  /** @description The lead's Línea as an object (id, nombre, and why it carries it); `null` when it has none. */
@@ -60647,7 +60673,7 @@ interface paths {
60647
60673
  value: "accepted" | "declined" | "thinking" | "no_answer";
60648
60674
  at: string;
60649
60675
  } | null;
60650
- /** @description Where this patient's Recontacto stands today. `held`: the call goes first, no WhatsApp until the clinic's day ends. `proposed`: nobody logged a call, the WhatsApp waits for a person's approval. `null`: nothing pending. */
60676
+ /** @description Where this patient's Recontacto stands. `proposed`: a WhatsApp waits for a person's approval. `null`: nothing pending. `held` is no longer produced: calling never holds back a WhatsApp. */
60651
60677
  recontacto: {
60652
60678
  /** @enum {string} */
60653
60679
  state: "held";
@@ -101503,6 +101529,7 @@ interface paths {
101503
101529
  * "totals": {
101504
101530
  * "attended": 612,
101505
101531
  * "lines": 699,
101532
+ * "visits": 431,
101506
101533
  * "lines_without_price": 0,
101507
101534
  * "performed_clp": 57179516,
101508
101535
  * "collected_clp": 57172232,
@@ -103012,6 +103039,13 @@ interface paths {
103012
103039
  primeras_visitas: number;
103013
103040
  plata_clp: number | null;
103014
103041
  }[];
103042
+ /** @description Where the current month closes at the pace of the working days gone, with or without a target (the number a meta is picked from). `null` per figure outside the current month, while no working day has gone, for producción without the revenue mirror, and for cierres without a target. */
103043
+ projections: {
103044
+ primeras_visitas: number | null;
103045
+ cierres: number | null;
103046
+ cobrado_clp: number | null;
103047
+ produccion_clp: number | null;
103048
+ };
103015
103049
  pace: {
103016
103050
  primeras_visitas: {
103017
103051
  /** @enum {string} */
@@ -103312,6 +103346,13 @@ interface paths {
103312
103346
  primeras_visitas: number;
103313
103347
  plata_clp: number | null;
103314
103348
  }[];
103349
+ /** @description Where the current month closes at the pace of the working days gone, with or without a target (the number a meta is picked from). `null` per figure outside the current month, while no working day has gone, for producción without the revenue mirror, and for cierres without a target. */
103350
+ projections: {
103351
+ primeras_visitas: number | null;
103352
+ cierres: number | null;
103353
+ cobrado_clp: number | null;
103354
+ produccion_clp: number | null;
103355
+ };
103315
103356
  pace: {
103316
103357
  primeras_visitas: {
103317
103358
  /** @enum {string} */
@@ -151724,7 +151765,7 @@ interface paths {
151724
151765
  };
151725
151766
  /**
151726
151767
  * Instant Form mappings
151727
- * @description The Meta Instant Forms this workspace mapped, and the built-in presets. A form with no entry uses the default mapping (Meta’s standard fields — name, phone, email, company — and every other answer kept in the lead note) and the inbox intake. Submissions arrive from Atribu once Meta approves lead access for the app.
151768
+ * @description The Meta Instant Forms this workspace mapped, and the built-in presets. A form with no entry uses the default mapping (Meta’s standard fields — name, phone, email, company — and every other answer kept in the lead note) and the inbox intake. Submissions arrive once Meta approves lead access for the app.
151728
151769
  */
151729
151770
  get: {
151730
151771
  parameters: {
@@ -151747,6 +151788,7 @@ interface paths {
151747
151788
  * "forms": [
151748
151789
  * {
151749
151790
  * "form_id": "1234567890123456",
151791
+ * "meta_form": "1234567890123456",
151750
151792
  * "name": "Vitrina · Automotoras · Higher intent v1",
151751
151793
  * "intake": "demo",
151752
151794
  * "enabled": true,
@@ -151766,7 +151808,10 @@ interface paths {
151766
151808
  "application/json": {
151767
151809
  data: {
151768
151810
  forms: {
151811
+ /** @description The Instant Form's id in Meta. */
151769
151812
  form_id: string;
151813
+ /** @description Same value as `form_id` (kept for clients of the `meta_*` name). */
151814
+ meta_form: string;
151770
151815
  name: string | null;
151771
151816
  /** @enum {string} */
151772
151817
  intake: "inbox" | "demo";
@@ -151962,6 +152007,7 @@ interface paths {
151962
152007
  * @example {
151963
152008
  * "data": {
151964
152009
  * "form_id": "1234567890123456",
152010
+ * "meta_form": "1234567890123456",
151965
152011
  * "name": "Vitrina · Automotoras · Higher intent v1",
151966
152012
  * "intake": "demo",
151967
152013
  * "enabled": true,
@@ -151975,7 +152021,10 @@ interface paths {
151975
152021
  */
151976
152022
  "application/json": {
151977
152023
  data: {
152024
+ /** @description The Instant Form's id in Meta. */
151978
152025
  form_id: string;
152026
+ /** @description Same value as `form_id` (kept for clients of the `meta_*` name). */
152027
+ meta_form: string;
151979
152028
  name: string | null;
151980
152029
  /** @enum {string} */
151981
152030
  intake: "inbox" | "demo";
@@ -152235,6 +152284,7 @@ interface paths {
152235
152284
  * "submissions": [
152236
152285
  * {
152237
152286
  * "leadgen_id": "444444444444",
152287
+ * "meta_leadgen": "444444444444",
152238
152288
  * "status": "processed",
152239
152289
  * "route": "demo",
152240
152290
  * "attempts": 1,
@@ -152249,7 +152299,10 @@ interface paths {
152249
152299
  "application/json": {
152250
152300
  data: {
152251
152301
  submissions: {
152302
+ /** @description The submission's id in Meta (`leadgen_id`). */
152252
152303
  leadgen_id: string;
152304
+ /** @description Same value as `leadgen_id` (kept for clients of the `meta_*` name). */
152305
+ meta_leadgen: string;
152253
152306
  /** @enum {string} */
152254
152307
  status: "received" | "processed" | "failed";
152255
152308
  /** @enum {string|null} */
@@ -152363,6 +152416,370 @@ interface paths {
152363
152416
  patch?: never;
152364
152417
  trace?: never;
152365
152418
  };
152419
+ "/ads/conversion-leads": {
152420
+ parameters: {
152421
+ query?: never;
152422
+ header?: never;
152423
+ path?: never;
152424
+ cookie?: never;
152425
+ };
152426
+ /**
152427
+ * Conversion Leads feed
152428
+ * @description Whether the stages each Instant Form lead reaches in the CRM are sent back to Meta, and the Meta stage name of each. Meta uses them to optimise the form on lead quality instead of form fills. Off until configured; nothing is sent until the workspace has a Conversion Leads dataset in Meta.
152429
+ */
152430
+ get: {
152431
+ parameters: {
152432
+ query?: never;
152433
+ header?: never;
152434
+ path?: never;
152435
+ cookie?: never;
152436
+ };
152437
+ requestBody?: never;
152438
+ responses: {
152439
+ /** @description The feed configuration. */
152440
+ 200: {
152441
+ headers: {
152442
+ [name: string]: unknown;
152443
+ };
152444
+ content: {
152445
+ /**
152446
+ * @example {
152447
+ * "data": {
152448
+ * "dataset": {
152449
+ * "state": "missing",
152450
+ * "failed_7d": null,
152451
+ * "sent_7d": null
152452
+ * },
152453
+ * "enabled": true,
152454
+ * "lead_event_source": "Vitrina",
152455
+ * "stage_map": {
152456
+ * "lead_qualified": "qualified",
152457
+ * "appointment_booked": "booked",
152458
+ * "appointment_attended": "held",
152459
+ * "first_payment": "paid"
152460
+ * },
152461
+ * "stages": [
152462
+ * "lead_created",
152463
+ * "lead_qualified",
152464
+ * "appointment_booked",
152465
+ * "appointment_attended",
152466
+ * "first_payment"
152467
+ * ],
152468
+ * "updated_at": "2026-10-11T15:00:00.000Z"
152469
+ * }
152470
+ * }
152471
+ */
152472
+ "application/json": {
152473
+ data: {
152474
+ /** @description The Conversion Leads dataset in Meta: `missing` = nothing is sent yet; `ready` = stages ship to it; `failed_7d` counts failed deliveries of the last 7 days when the engine reports them. */
152475
+ dataset: {
152476
+ /** @enum {string} */
152477
+ state: "missing" | "paused" | "ready" | "unknown";
152478
+ failed_7d: number | null;
152479
+ sent_7d: number | null;
152480
+ };
152481
+ enabled: boolean;
152482
+ lead_event_source: string;
152483
+ stage_map: {
152484
+ [key: string]: string;
152485
+ };
152486
+ /** @description The CRM stages that can be mapped. */
152487
+ stages: string[];
152488
+ updated_at: string | null;
152489
+ };
152490
+ };
152491
+ };
152492
+ };
152493
+ /** @description Validation error */
152494
+ 400: {
152495
+ headers: {
152496
+ [name: string]: unknown;
152497
+ };
152498
+ content: {
152499
+ "application/json": components["schemas"]["Error"];
152500
+ };
152501
+ };
152502
+ /** @description Unauthorized */
152503
+ 401: {
152504
+ headers: {
152505
+ [name: string]: unknown;
152506
+ };
152507
+ content: {
152508
+ "application/json": components["schemas"]["Error"];
152509
+ };
152510
+ };
152511
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
152512
+ 402: {
152513
+ headers: {
152514
+ [name: string]: unknown;
152515
+ };
152516
+ content: {
152517
+ /**
152518
+ * @example {
152519
+ * "error": {
152520
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
152521
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
152522
+ * "details": {
152523
+ * "required": [
152524
+ * "vitrina_ads"
152525
+ * ],
152526
+ * "active": [],
152527
+ * "feature": "vitrina_ads",
152528
+ * "entitlement_state": "off"
152529
+ * }
152530
+ * }
152531
+ * }
152532
+ */
152533
+ "application/json": components["schemas"]["Error"];
152534
+ };
152535
+ };
152536
+ /** @description Forbidden */
152537
+ 403: {
152538
+ headers: {
152539
+ [name: string]: unknown;
152540
+ };
152541
+ content: {
152542
+ "application/json": components["schemas"]["Error"];
152543
+ };
152544
+ };
152545
+ /** @description Not found */
152546
+ 404: {
152547
+ headers: {
152548
+ [name: string]: unknown;
152549
+ };
152550
+ content: {
152551
+ "application/json": components["schemas"]["Error"];
152552
+ };
152553
+ };
152554
+ /** @description Vitrina Ads is active but the delegated key has not finished rotating (`ADS_KEY_NEEDS_REMINT`) — retry once `GET /ads/state` reports `needs_remint: false`. Also the generic conflict of a write. */
152555
+ 409: {
152556
+ headers: {
152557
+ [name: string]: unknown;
152558
+ };
152559
+ content: {
152560
+ /**
152561
+ * @example {
152562
+ * "error": {
152563
+ * "code": "ADS_KEY_NEEDS_REMINT",
152564
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
152565
+ * "details": {
152566
+ * "key_kind": "core"
152567
+ * }
152568
+ * }
152569
+ * }
152570
+ */
152571
+ "application/json": components["schemas"]["Error"];
152572
+ };
152573
+ };
152574
+ /** @description Rate limited */
152575
+ 429: {
152576
+ headers: {
152577
+ [name: string]: unknown;
152578
+ };
152579
+ content: {
152580
+ "application/json": components["schemas"]["Error"];
152581
+ };
152582
+ };
152583
+ };
152584
+ };
152585
+ /**
152586
+ * Configure the Conversion Leads feed
152587
+ * @description Replaces the feed configuration: the switch, the CRM name Meta shows and the stage mapping. A stage with no entry is not sent.
152588
+ */
152589
+ put: {
152590
+ parameters: {
152591
+ query?: never;
152592
+ header?: never;
152593
+ path?: never;
152594
+ cookie?: never;
152595
+ };
152596
+ requestBody?: {
152597
+ content: {
152598
+ /**
152599
+ * @example {
152600
+ * "enabled": true,
152601
+ * "lead_event_source": "Vitrina",
152602
+ * "stage_map": {
152603
+ * "lead_qualified": "qualified",
152604
+ * "appointment_booked": "booked",
152605
+ * "appointment_attended": "held",
152606
+ * "first_payment": "paid"
152607
+ * }
152608
+ * }
152609
+ */
152610
+ "application/json": {
152611
+ /** @description Send the stages of Instant Form leads to Meta. Nothing is sent until the workspace has a Conversion Leads dataset in Meta. */
152612
+ enabled: boolean;
152613
+ /**
152614
+ * @description The CRM name Meta shows next to the stage events.
152615
+ * @default Vitrina
152616
+ */
152617
+ lead_event_source?: string;
152618
+ /** @description CRM stage -> Meta stage name. Stages: lead_created, lead_qualified, appointment_booked, appointment_attended, first_payment. A stage with no entry is not sent. */
152619
+ stage_map: {
152620
+ lead_created?: string;
152621
+ lead_qualified?: string;
152622
+ appointment_booked?: string;
152623
+ appointment_attended?: string;
152624
+ first_payment?: string;
152625
+ };
152626
+ };
152627
+ };
152628
+ };
152629
+ responses: {
152630
+ /** @description The stored configuration. */
152631
+ 200: {
152632
+ headers: {
152633
+ [name: string]: unknown;
152634
+ };
152635
+ content: {
152636
+ /**
152637
+ * @example {
152638
+ * "data": {
152639
+ * "dataset": {
152640
+ * "state": "missing",
152641
+ * "failed_7d": null,
152642
+ * "sent_7d": null
152643
+ * },
152644
+ * "enabled": true,
152645
+ * "lead_event_source": "Vitrina",
152646
+ * "stage_map": {
152647
+ * "lead_qualified": "qualified",
152648
+ * "appointment_booked": "booked",
152649
+ * "appointment_attended": "held",
152650
+ * "first_payment": "paid"
152651
+ * },
152652
+ * "stages": [
152653
+ * "lead_created",
152654
+ * "lead_qualified",
152655
+ * "appointment_booked",
152656
+ * "appointment_attended",
152657
+ * "first_payment"
152658
+ * ],
152659
+ * "updated_at": "2026-10-11T15:00:00.000Z"
152660
+ * }
152661
+ * }
152662
+ */
152663
+ "application/json": {
152664
+ data: {
152665
+ /** @description The Conversion Leads dataset in Meta: `missing` = nothing is sent yet; `ready` = stages ship to it; `failed_7d` counts failed deliveries of the last 7 days when the engine reports them. */
152666
+ dataset: {
152667
+ /** @enum {string} */
152668
+ state: "missing" | "paused" | "ready" | "unknown";
152669
+ failed_7d: number | null;
152670
+ sent_7d: number | null;
152671
+ };
152672
+ enabled: boolean;
152673
+ lead_event_source: string;
152674
+ stage_map: {
152675
+ [key: string]: string;
152676
+ };
152677
+ /** @description The CRM stages that can be mapped. */
152678
+ stages: string[];
152679
+ updated_at: string | null;
152680
+ };
152681
+ };
152682
+ };
152683
+ };
152684
+ /** @description Validation error */
152685
+ 400: {
152686
+ headers: {
152687
+ [name: string]: unknown;
152688
+ };
152689
+ content: {
152690
+ "application/json": components["schemas"]["Error"];
152691
+ };
152692
+ };
152693
+ /** @description Unauthorized */
152694
+ 401: {
152695
+ headers: {
152696
+ [name: string]: unknown;
152697
+ };
152698
+ content: {
152699
+ "application/json": components["schemas"]["Error"];
152700
+ };
152701
+ };
152702
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
152703
+ 402: {
152704
+ headers: {
152705
+ [name: string]: unknown;
152706
+ };
152707
+ content: {
152708
+ /**
152709
+ * @example {
152710
+ * "error": {
152711
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
152712
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
152713
+ * "details": {
152714
+ * "required": [
152715
+ * "vitrina_ads"
152716
+ * ],
152717
+ * "active": [],
152718
+ * "feature": "vitrina_ads",
152719
+ * "entitlement_state": "off"
152720
+ * }
152721
+ * }
152722
+ * }
152723
+ */
152724
+ "application/json": components["schemas"]["Error"];
152725
+ };
152726
+ };
152727
+ /** @description Forbidden */
152728
+ 403: {
152729
+ headers: {
152730
+ [name: string]: unknown;
152731
+ };
152732
+ content: {
152733
+ "application/json": components["schemas"]["Error"];
152734
+ };
152735
+ };
152736
+ /** @description Not found */
152737
+ 404: {
152738
+ headers: {
152739
+ [name: string]: unknown;
152740
+ };
152741
+ content: {
152742
+ "application/json": components["schemas"]["Error"];
152743
+ };
152744
+ };
152745
+ /** @description Vitrina Ads is active but the delegated key has not finished rotating (`ADS_KEY_NEEDS_REMINT`) — retry once `GET /ads/state` reports `needs_remint: false`. Also the generic conflict of a write. */
152746
+ 409: {
152747
+ headers: {
152748
+ [name: string]: unknown;
152749
+ };
152750
+ content: {
152751
+ /**
152752
+ * @example {
152753
+ * "error": {
152754
+ * "code": "ADS_KEY_NEEDS_REMINT",
152755
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
152756
+ * "details": {
152757
+ * "key_kind": "core"
152758
+ * }
152759
+ * }
152760
+ * }
152761
+ */
152762
+ "application/json": components["schemas"]["Error"];
152763
+ };
152764
+ };
152765
+ /** @description Rate limited */
152766
+ 429: {
152767
+ headers: {
152768
+ [name: string]: unknown;
152769
+ };
152770
+ content: {
152771
+ "application/json": components["schemas"]["Error"];
152772
+ };
152773
+ };
152774
+ };
152775
+ };
152776
+ post?: never;
152777
+ delete?: never;
152778
+ options?: never;
152779
+ head?: never;
152780
+ patch?: never;
152781
+ trace?: never;
152782
+ };
152366
152783
  "/ads/audiences/customer-list": {
152367
152784
  parameters: {
152368
152785
  query?: never;
@@ -178517,6 +178934,8 @@ interface components {
178517
178934
  attended: number | null;
178518
178935
  /** @description `null` only for a caller without `clinic_money:read`, when it rests on 1–4 cases. */
178519
178936
  lines: number | null;
178937
+ /** @description `mirror_lines` only: distinct visits that produced (patient × day) — what the per-professional `appointments` count, so a table total sums its rows. `null` on the native arms (there `attended` is the total). `null` only for a caller without `clinic_money:read`, when it rests on 1–4 cases. */
178938
+ visits: number | null;
178520
178939
  /** @description `null` only for a caller without `clinic_money:read`, when it rests on 1–4 cases. */
178521
178940
  lines_without_price: number | null;
178522
178941
  /** @description `null` only for a caller without `clinic_money:read`, when it rests on 1–4 cases. */
@@ -180664,6 +181083,8 @@ interface components {
180664
181083
  held: number;
180665
181084
  /** @description People with a first paid invoice (`first_payment`). */
180666
181085
  paid: number;
181086
+ /** @description People with BOTH a booking and a held appointment: the show-rate numerator, so the rate never passes 100 %. */
181087
+ booked_held: number;
180667
181088
  /** @description Leads that got a reply (agent, human or API) within 24 h of the lead. */
180668
181089
  contacted_24h: number;
180669
181090
  /** @description `null` = unknown or none on this row. */
@@ -180683,7 +181104,7 @@ interface components {
180683
181104
  contacted_24h_rate: number | null;
180684
181105
  /** @description booked ÷ leads */
180685
181106
  lead_to_booked: number | null;
180686
- /** @description held ÷ booked */
181107
+ /** @description booked_held ÷ booked (never above 1) */
180687
181108
  show_rate: number | null;
180688
181109
  };
180689
181110
  };
@@ -180698,6 +181119,7 @@ interface components {
180698
181119
  };
180699
181120
  rows: components["schemas"]["AdsDemoFunnelRow"][];
180700
181121
  arms: components["schemas"]["AdsDemoFunnelRow"][];
181122
+ /** @description Every person in the window, ad or not; Σ rows = totals. */
180701
181123
  totals: {
180702
181124
  /** @description People with a lead (`lead_created`). */
180703
181125
  leads: number;
@@ -180709,6 +181131,8 @@ interface components {
180709
181131
  held: number;
180710
181132
  /** @description People with a first paid invoice (`first_payment`). */
180711
181133
  paid: number;
181134
+ /** @description People with BOTH a booking and a held appointment: the show-rate numerator, so the rate never passes 100 %. */
181135
+ booked_held: number;
180712
181136
  /** @description Leads that got a reply (agent, human or API) within 24 h of the lead. */
180713
181137
  contacted_24h: number;
180714
181138
  spend: number | null;
@@ -180727,10 +181151,53 @@ interface components {
180727
181151
  contacted_24h_rate: number | null;
180728
181152
  /** @description booked ÷ leads */
180729
181153
  lead_to_booked: number | null;
180730
- /** @description held ÷ booked */
181154
+ /** @description booked_held ÷ booked (never above 1) */
180731
181155
  show_rate: number | null;
180732
181156
  };
180733
181157
  };
181158
+ /** @description The paid funnel: all ad spend over the people an ad brought (every arm but `other`). Its costs are the ones to quote as «cost per …». */
181159
+ ad_totals: {
181160
+ /** @description People with a lead (`lead_created`). */
181161
+ leads: number;
181162
+ /** @description Of those, ICP-qualified (`lead_qualified`). */
181163
+ qualified: number;
181164
+ /** @description People with a demo booked (`appointment_booked`). */
181165
+ booked: number;
181166
+ /** @description People whose demo was held (`appointment_attended`). */
181167
+ held: number;
181168
+ /** @description People with a first paid invoice (`first_payment`). */
181169
+ paid: number;
181170
+ /** @description People with BOTH a booking and a held appointment: the show-rate numerator, so the rate never passes 100 %. */
181171
+ booked_held: number;
181172
+ /** @description Leads that got a reply (agent, human or API) within 24 h of the lead. */
181173
+ contacted_24h: number;
181174
+ spend: number | null;
181175
+ costs: {
181176
+ per_lead: number | null;
181177
+ per_qualified: number | null;
181178
+ per_booked: number | null;
181179
+ /** @description THE metric the A/B is judged on (D5). */
181180
+ per_held: number | null;
181181
+ per_paid: number | null;
181182
+ };
181183
+ rates: {
181184
+ /** @description qualified ÷ leads */
181185
+ qualified_share: number | null;
181186
+ /** @description contacted within 24 h ÷ leads */
181187
+ contacted_24h_rate: number | null;
181188
+ /** @description booked ÷ leads */
181189
+ lead_to_booked: number | null;
181190
+ /** @description booked_held ÷ booked (never above 1) */
181191
+ show_rate: number | null;
181192
+ };
181193
+ };
181194
+ /** @description Set when the outcome ledger starts after the requested `from`: `window.from` was moved to this day, spend included. */
181195
+ measured_since: string | null;
181196
+ /** @description Which funnel steps this tenant has. */
181197
+ steps: {
181198
+ /** @description False when the tenant never recorded `lead_qualified` (no qualifying step, e.g. a clinic): the column is structurally 0. */
181199
+ qualified: boolean;
181200
+ };
180734
181201
  reconciliation: {
180735
181202
  overview_spend: number | null;
180736
181203
  spend_matches: boolean | null;