@vitrina/api 13.4.0 → 13.5.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 `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. `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`.
7455
7455
  */
7456
7456
  get: {
7457
7457
  parameters: {
@@ -7544,7 +7544,191 @@ interface paths {
7544
7544
  * "stages": []
7545
7545
  * },
7546
7546
  * "unplaced": 0,
7547
- * "unplaced_stages": []
7547
+ * "unplaced_stages": [],
7548
+ * "boards": [
7549
+ * {
7550
+ * "id": "0b1c2d3e-0000-4000-8000-000000000001",
7551
+ * "name": "Tratamientos"
7552
+ * }
7553
+ * ]
7554
+ * }
7555
+ * }
7556
+ */
7557
+ "application/json": {
7558
+ data?: unknown;
7559
+ meta?: {
7560
+ [key: string]: unknown;
7561
+ };
7562
+ };
7563
+ };
7564
+ };
7565
+ /** @description Validation error */
7566
+ 400: {
7567
+ headers: {
7568
+ [name: string]: unknown;
7569
+ };
7570
+ content: {
7571
+ "application/json": components["schemas"]["Error"];
7572
+ };
7573
+ };
7574
+ /** @description Unauthorized */
7575
+ 401: {
7576
+ headers: {
7577
+ [name: string]: unknown;
7578
+ };
7579
+ content: {
7580
+ "application/json": components["schemas"]["Error"];
7581
+ };
7582
+ };
7583
+ /** @description Forbidden */
7584
+ 403: {
7585
+ headers: {
7586
+ [name: string]: unknown;
7587
+ };
7588
+ content: {
7589
+ "application/json": components["schemas"]["Error"];
7590
+ };
7591
+ };
7592
+ /** @description Not found */
7593
+ 404: {
7594
+ headers: {
7595
+ [name: string]: unknown;
7596
+ };
7597
+ content: {
7598
+ "application/json": components["schemas"]["Error"];
7599
+ };
7600
+ };
7601
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
7602
+ 409: {
7603
+ headers: {
7604
+ [name: string]: unknown;
7605
+ };
7606
+ content: {
7607
+ "application/json": components["schemas"]["Error"];
7608
+ };
7609
+ };
7610
+ /** @description Rate limited */
7611
+ 429: {
7612
+ headers: {
7613
+ [name: string]: unknown;
7614
+ };
7615
+ content: {
7616
+ "application/json": components["schemas"]["Error"];
7617
+ };
7618
+ };
7619
+ };
7620
+ };
7621
+ put?: never;
7622
+ post?: never;
7623
+ delete?: never;
7624
+ options?: never;
7625
+ head?: never;
7626
+ patch?: never;
7627
+ trace?: never;
7628
+ };
7629
+ "/funnel-report/by-linea": {
7630
+ parameters: {
7631
+ query?: never;
7632
+ header?: never;
7633
+ path?: never;
7634
+ cookie?: never;
7635
+ };
7636
+ /**
7637
+ * Get the funnel report split by Línea
7638
+ * @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
+ */
7640
+ get: {
7641
+ parameters: {
7642
+ query?: {
7643
+ /** @description The board to read. Defaults to the workspace's sales board. */
7644
+ pipeline_id?: string;
7645
+ /** @description First day of the period, inclusive. Defaults to 29 days before `to`. */
7646
+ from?: string;
7647
+ /** @description Last day of the period, INCLUSIVE. Defaults to today in the workspace's clock. */
7648
+ to?: string;
7649
+ /** @description Origen of the patient: `meta` (came from a Meta ad), `organic` (a linked contact with no ad touch) or `unknown` («Sin dato»: no linked contact). Same attribution as Vitrina Ads' people from ads. */
7650
+ origin?: "meta" | "organic" | "unknown";
7651
+ /** @description Narrow `origin=meta` to one Meta ad (its platform ad id). */
7652
+ origin_ad_id?: string;
7653
+ };
7654
+ header?: never;
7655
+ path?: never;
7656
+ cookie?: never;
7657
+ };
7658
+ requestBody?: never;
7659
+ responses: {
7660
+ /** @description Funnel report by Línea */
7661
+ 200: {
7662
+ headers: {
7663
+ [name: string]: unknown;
7664
+ };
7665
+ content: {
7666
+ /**
7667
+ * @example {
7668
+ * "data": {
7669
+ * "pipeline_id": "0b1c2d3e-0000-4000-8000-000000000001",
7670
+ * "period": {
7671
+ * "from": "2026-09-10",
7672
+ * "to": "2026-10-09",
7673
+ * "timezone": "America/Santiago"
7674
+ * },
7675
+ * "cohort": 120,
7676
+ * "steps": [
7677
+ * {
7678
+ * "key": "no_appointment",
7679
+ * "name": "Sin cita",
7680
+ * "position": 0
7681
+ * },
7682
+ * {
7683
+ * "key": "scheduled",
7684
+ * "name": "Agendado",
7685
+ * "position": 1
7686
+ * }
7687
+ * ],
7688
+ * "lineas": [
7689
+ * {
7690
+ * "linea_id": "0b1c2d3e-0000-4000-8000-0000000000b1",
7691
+ * "nombre": "Implantes",
7692
+ * "cohort": 70,
7693
+ * "steps": [
7694
+ * {
7695
+ * "key": "no_appointment",
7696
+ * "reached": 70,
7697
+ * "current": 30,
7698
+ * "conversion_from_previous": null
7699
+ * },
7700
+ * {
7701
+ * "key": "scheduled",
7702
+ * "reached": 35,
7703
+ * "current": 10,
7704
+ * "conversion_from_previous": 0.5
7705
+ * }
7706
+ * ],
7707
+ * "lost": 12,
7708
+ * "unplaced": 0
7709
+ * },
7710
+ * {
7711
+ * "linea_id": null,
7712
+ * "nombre": null,
7713
+ * "cohort": 50,
7714
+ * "steps": [
7715
+ * {
7716
+ * "key": "no_appointment",
7717
+ * "reached": 50,
7718
+ * "current": 31,
7719
+ * "conversion_from_previous": null
7720
+ * },
7721
+ * {
7722
+ * "key": "scheduled",
7723
+ * "reached": 13,
7724
+ * "current": 4,
7725
+ * "conversion_from_previous": 0.26
7726
+ * }
7727
+ * ],
7728
+ * "lost": 10,
7729
+ * "unplaced": 0
7730
+ * }
7731
+ * ]
7548
7732
  * }
7549
7733
  * }
7550
7734
  */
@@ -12506,7 +12690,7 @@ interface paths {
12506
12690
  "application/json": {
12507
12691
  /** Format: uri */
12508
12692
  url?: string;
12509
- events?: ("*" | "ai_agent.publish" | "ai_agent_graph.publish" | "agent_scenario_run.completed" | "agent_scenario_suite.completed" | "conversation.created" | "conversation.assigned" | "conversation.resolved" | "message.received" | "message.sent" | "ticket.opened" | "ticket.reopened" | "ticket.resolved" | "ticket.closed" | "sla.breached" | "kb.source.create" | "kb.source.embed" | "kb.source.update" | "kb.source.delete" | "kb_file.uploaded" | "kb_file.deleted" | "skill.created" | "skill.updated" | "skill.deleted" | "custom_tool.created" | "custom_tool.updated" | "custom_tool.deleted" | "macro.applied" | "cost.budget_alert" | "runtime.budget_exceeded" | "lead.created" | "lead.stage_changed" | "lead.pipeline_changed" | "lead.assigned" | "lead.won" | "lead.lost" | "lead.unqualified" | "stock.synced" | "stock.source_retired" | "vehicle.published" | "vehicle.unpublished" | "vehicle.publish_failed" | "vehicle.created" | "vehicle.attachment.created" | "mercadolibre.order" | "mercadolibre.vis_lead" | "chileautos.lead" | "yapo.lead" | "website.lead" | "consignment.candidate.created" | "quote.issued" | "quote.voided" | "quote.extended" | "quote.archived" | "reservation.created" | "reservation.voided" | "reservation.abono_disposed" | "reservation.converted" | "sale_note.issued" | "sale_note.approved" | "sale_note.voided" | "purchase_note.issued" | "purchase_note.corrected" | "purchase_note.voided" | "payment.recorded" | "consignment.created" | "consignment.returned" | "consignment.sold" | "credit_application.recorded" | "credit_application.submitted" | "credit_application.decided" | "credit_application.withdrawn" | "price_approval.requested" | "price_approval.decided" | "contact.created" | "contact.updated" | "contact.merged" | "appointment.booked" | "appointment.rescheduled" | "appointment.cancelled" | "appointment.completed" | "appointment.no_show" | "appointment.reminded" | "appointment.imported" | "campaign.sent" | "campaign.paused" | "sending_domain.verified" | "coach.proposals_ready" | "coach.finding_ready" | "voice.autonomous_call" | "safety_hold.placed" | "safety_hold.ack_overdue" | "safety_hold.first_response_overdue" | "team.created" | "team.updated" | "team.deleted" | "custom_role.created" | "custom_role.updated" | "custom_role.deleted" | "macro.created" | "macro.updated" | "macro.deleted" | "assignment_rule.created" | "assignment_rule.updated" | "assignment_rule.deleted" | "sla_policy.created" | "sla_policy.updated" | "sla_policy.deleted" | "automation_trigger.created" | "automation_trigger.updated" | "automation_trigger.deleted" | "sending_domain.created" | "sending_domain.deleted" | "whatsapp_template.created" | "whatsapp_template.status_changed" | "whatsapp_template.deleted" | "whatsapp_flow.created" | "whatsapp_flow.published" | "whatsapp_flow.deprecated" | "whatsapp_flow.deleted" | "whatsapp_flow.completed" | "channel.connected" | "channel.updated" | "channel.disconnected" | "membership.created" | "membership.updated" | "membership.removed" | "clinic_professional.created" | "clinic_professional.updated" | "clinic_professional.deleted" | "clinic_service.created" | "clinic_service.updated" | "clinic_service.deleted" | "clinic_price_list.updated" | "clinic_pack_purchase.created" | "clinic_pack_purchase.session_consumed" | "clinic_pack_purchase.cancelled" | "clinic_budget.created" | "clinic_budget.sent" | "clinic_budget.accepted" | "clinic_budget.rejected" | "clinic_budget.voided" | "clinic_budget.mirror_changed" | "clinic_cash_session.opened" | "clinic_cash_session.closed" | "clinic_patient.created" | "clinic_patient.updated" | "clinic_patient.deleted" | "clinic_patient.merged" | "clinic_encounter.opened" | "clinic_encounter.closed" | "clinic_note.signed" | "clinic_note.amended" | "clinic_consent.signed" | "clinic_consent.revoked" | "clinic_document.uploaded" | "clinic_document.deleted" | "clinic_privacy_request.completed")[];
12693
+ events?: ("*" | "ai_agent.publish" | "ai_agent_graph.publish" | "agent_scenario_run.completed" | "agent_scenario_suite.completed" | "conversation.created" | "conversation.assigned" | "conversation.resolved" | "message.received" | "message.sent" | "ticket.opened" | "ticket.reopened" | "ticket.resolved" | "ticket.closed" | "sla.breached" | "kb.source.create" | "kb.source.embed" | "kb.source.update" | "kb.source.delete" | "kb_file.uploaded" | "kb_file.deleted" | "skill.created" | "skill.updated" | "skill.deleted" | "custom_tool.created" | "custom_tool.updated" | "custom_tool.deleted" | "macro.applied" | "cost.budget_alert" | "runtime.budget_exceeded" | "lead.created" | "lead.stage_changed" | "lead.pipeline_changed" | "lead.assigned" | "lead.won" | "lead.lost" | "lead.unqualified" | "stock.synced" | "stock.source_retired" | "vehicle.published" | "vehicle.unpublished" | "vehicle.publish_failed" | "vehicle.created" | "vehicle.attachment.created" | "mercadolibre.order" | "mercadolibre.vis_lead" | "chileautos.lead" | "yapo.lead" | "website.lead" | "demo_lead.created" | "demo_lead.pending_scheduling" | "demo_lead.routed" | "demo_booking.booked" | "demo_booking.rescheduled" | "demo_booking.cancelled" | "consignment.candidate.created" | "quote.issued" | "quote.voided" | "quote.extended" | "quote.archived" | "reservation.created" | "reservation.voided" | "reservation.abono_disposed" | "reservation.converted" | "sale_note.issued" | "sale_note.approved" | "sale_note.voided" | "purchase_note.issued" | "purchase_note.corrected" | "purchase_note.voided" | "payment.recorded" | "consignment.created" | "consignment.returned" | "consignment.sold" | "credit_application.recorded" | "credit_application.submitted" | "credit_application.decided" | "credit_application.withdrawn" | "price_approval.requested" | "price_approval.decided" | "contact.created" | "contact.updated" | "contact.merged" | "appointment.booked" | "appointment.rescheduled" | "appointment.cancelled" | "appointment.completed" | "appointment.no_show" | "appointment.reminded" | "appointment.imported" | "campaign.sent" | "campaign.paused" | "sending_domain.verified" | "coach.proposals_ready" | "coach.finding_ready" | "voice.autonomous_call" | "safety_hold.placed" | "safety_hold.ack_overdue" | "safety_hold.first_response_overdue" | "team.created" | "team.updated" | "team.deleted" | "custom_role.created" | "custom_role.updated" | "custom_role.deleted" | "macro.created" | "macro.updated" | "macro.deleted" | "assignment_rule.created" | "assignment_rule.updated" | "assignment_rule.deleted" | "sla_policy.created" | "sla_policy.updated" | "sla_policy.deleted" | "automation_trigger.created" | "automation_trigger.updated" | "automation_trigger.deleted" | "sending_domain.created" | "sending_domain.deleted" | "whatsapp_template.created" | "whatsapp_template.status_changed" | "whatsapp_template.deleted" | "whatsapp_flow.created" | "whatsapp_flow.published" | "whatsapp_flow.deprecated" | "whatsapp_flow.deleted" | "whatsapp_flow.completed" | "channel.connected" | "channel.updated" | "channel.disconnected" | "membership.created" | "membership.updated" | "membership.removed" | "clinic_professional.created" | "clinic_professional.updated" | "clinic_professional.deleted" | "clinic_service.created" | "clinic_service.updated" | "clinic_service.deleted" | "clinic_price_list.updated" | "clinic_pack_purchase.created" | "clinic_pack_purchase.session_consumed" | "clinic_pack_purchase.cancelled" | "clinic_budget.created" | "clinic_budget.sent" | "clinic_budget.accepted" | "clinic_budget.rejected" | "clinic_budget.voided" | "clinic_budget.mirror_changed" | "clinic_cash_session.opened" | "clinic_cash_session.closed" | "clinic_patient.created" | "clinic_patient.updated" | "clinic_patient.deleted" | "clinic_patient.merged" | "clinic_encounter.opened" | "clinic_encounter.closed" | "clinic_note.signed" | "clinic_note.amended" | "clinic_consent.signed" | "clinic_consent.revoked" | "clinic_document.uploaded" | "clinic_document.deleted" | "clinic_privacy_request.completed")[];
12510
12694
  enabled?: boolean;
12511
12695
  description?: string | null;
12512
12696
  /** @description «Incluir datos del recurso». `false` (the default) = every delivery is the notice: resource, changes, author, time and `url`, with `data_omitted: "not_requested"`. `true` = each delivery also carries `data` when, at dispatch time, this subscription's OWNER — whoever created it or last changed its url, events or this flag — holds the resource read scope (`read_scope` in the catalogue) and sees every record; otherwise `data_omitted` says why. An event about a dato sensible is always the notice. */
@@ -100583,7 +100767,7 @@ interface paths {
100583
100767
  };
100584
100768
  /**
100585
100769
  * Ingresos: producción, presupuestado and recaudación by day
100586
- * @description «Ingresos» (D56) for a Dentalink / Medilink clinic (revenue mirror on; otherwise `state: unavailable`). Per day: producción (performed plan lines by fecha de realización), presupuestado (plans issued, header total, evaluación included, as the vendor's panel) and recaudación (live payments by fecha de recepción), each split `nuevos` (the patient's primera visita starts in that month) vs `tratamiento`. `hoy` carries today's three numbers whatever the window. `by_professional`: producción by PERFORMER; presupuestos, aceptación and monto aceptado by the QUOTING professional under Números comerciales' acceptance rule ($0 and evaluación-only presupuestos out); abonado = paid so far on the plans issued in the period; new patients presented / accepted. Default window: the current month to today. With `professional_id` recaudación is `null` (a payment names no professional). Requires `clinic_money:read`. Accepts `from` / `to` (bare `YYYY-MM-DD`, `to` INCLUSIVE), `location_id` and `professional_id`. The default window is the 90 days ending today in the clinic's own zone. A `professional_id` that is not yours is a 404, never an empty report. Also reachable with `clinic_insights:read` — the aggregates-only «Consultor» role (spec #2441 D11) — in addition to the scope named above. A caller WITHOUT the report’s own scope never receives a patient-identifiable row (`inasistencias.citas` and `packs.expiring` come back empty with `aggregate_only: true` and `rows_withheld` naming the field) and reads the minimum-count floor: always the last 3 closed calendar months with no professional or sucursal filter, whatever was asked (`suppression.filters_ignored`); a count or CLP resting on 1–4 cases is `null`; a rate over fewer than 5 cases, or whose numerator is withheld, is `null`; list rows that add up to a shown total get complementary suppression and leave the list (`suppression.withheld_rows`); per-professional/prestación/weekday outcome rows and per-channel confirmation rows carry rates only; producción serves no per-prestación rows (they nest inside the categorías); clinic-wide cash over whole months stays while its slices are floored. `suppression.min_count` is the floor.
100770
+ * @description «Ingresos» (D56) for a Dentalink / Medilink clinic (revenue mirror on; otherwise `state: unavailable`). Per day: producción (performed plan lines by fecha de realización), presupuestado (plans issued, header total, evaluación included, as the vendor's panel) and recaudación (live payments by fecha de recepción), each split `nuevos` (the patient's primera visita starts in that month) vs `tratamiento`. `hoy` carries today's three numbers whatever the window. `by_professional`: producción by PERFORMER; presupuestos, aceptación and monto aceptado by the QUOTING professional under Números comerciales' acceptance rule ($0 and evaluación-only presupuestos out); abonado = paid so far on the plans issued in the period; new patients presented / accepted. Default window: the current month to today. With `professional_id` recaudación is `null` (a payment names no professional). Every day and the totals also carry `by_origen` (D77): the three flows split Meta / Orgánico / Sin dato by the shared person-origin resolver; `origin` narrows the whole report to one Origen. Requires `clinic_money:read`, or `clinic_insights:read` (the Consultor seat, D76: the payload is aggregates only). Accepts `from` / `to` (bare `YYYY-MM-DD`, `to` INCLUSIVE), `location_id` and `professional_id`. The default window is the 90 days ending today in the clinic's own zone. A `professional_id` that is not yours is a 404, never an empty report. Also reachable with `clinic_insights:read` — the aggregates-only «Consultor» role (spec #2441 D11) — in addition to the scope named above. A caller WITHOUT the report’s own scope never receives a patient-identifiable row (`inasistencias.citas` and `packs.expiring` come back empty with `aggregate_only: true` and `rows_withheld` naming the field) and reads the minimum-count floor: always the last 3 closed calendar months with no professional or sucursal filter, whatever was asked (`suppression.filters_ignored`); a count or CLP resting on 1–4 cases is `null`; a rate over fewer than 5 cases, or whose numerator is withheld, is `null`; list rows that add up to a shown total get complementary suppression and leave the list (`suppression.withheld_rows`); per-professional/prestación/weekday outcome rows and per-channel confirmation rows carry rates only; producción serves no per-prestación rows (they nest inside the categorías); clinic-wide cash over whole months stays while its slices are floored. `suppression.min_count` is the floor.
100587
100771
  *
100588
100772
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
100589
100773
  */
@@ -100598,6 +100782,8 @@ interface paths {
100598
100782
  location_id?: string;
100599
100783
  /** @description One profesional. A foreign id is a 404, never an empty report. */
100600
100784
  professional_id?: string;
100785
+ /** @description Narrow every figure to the people of one Origen: `meta` (came from a Meta ad), `organic` (a linked contact with no ad touch) or `unknown` («Sin dato»: no contact is linked). Same resolver as the agenda's Origen filter. */
100786
+ origin?: "meta" | "organic" | "unknown";
100601
100787
  };
100602
100788
  header?: never;
100603
100789
  path?: never;
@@ -100620,6 +100806,7 @@ interface paths {
100620
100806
  * "timezone": "America/Santiago",
100621
100807
  * "location_id": null,
100622
100808
  * "professional_id": null,
100809
+ * "origin": null,
100623
100810
  * "state": "ready",
100624
100811
  * "state_reason": null,
100625
100812
  * "source": {
@@ -100661,6 +100848,23 @@ interface paths {
100661
100848
  * "nuevos_clp": 811084,
100662
100849
  * "tratamiento_clp": 2496908,
100663
100850
  * "pagos": 21
100851
+ * },
100852
+ * "by_origen": {
100853
+ * "meta": {
100854
+ * "produccion_clp": 1204000,
100855
+ * "presupuestado_clp": 1830000,
100856
+ * "recaudado_clp": 1020000
100857
+ * },
100858
+ * "organic": {
100859
+ * "produccion_clp": 2210982,
100860
+ * "presupuestado_clp": 2301028,
100861
+ * "recaudado_clp": 1987992
100862
+ * },
100863
+ * "unknown": {
100864
+ * "produccion_clp": 256000,
100865
+ * "presupuestado_clp": 250000,
100866
+ * "recaudado_clp": 300000
100867
+ * }
100664
100868
  * }
100665
100869
  * },
100666
100870
  * "days": [
@@ -100683,6 +100887,23 @@ interface paths {
100683
100887
  * "nuevos_clp": 811084,
100684
100888
  * "tratamiento_clp": 2496908,
100685
100889
  * "pagos": 21
100890
+ * },
100891
+ * "by_origen": {
100892
+ * "meta": {
100893
+ * "produccion_clp": 1204000,
100894
+ * "presupuestado_clp": 1830000,
100895
+ * "recaudado_clp": 1020000
100896
+ * },
100897
+ * "organic": {
100898
+ * "produccion_clp": 2210982,
100899
+ * "presupuestado_clp": 2301028,
100900
+ * "recaudado_clp": 1987992
100901
+ * },
100902
+ * "unknown": {
100903
+ * "produccion_clp": 256000,
100904
+ * "presupuestado_clp": 250000,
100905
+ * "recaudado_clp": 300000
100906
+ * }
100686
100907
  * }
100687
100908
  * }
100688
100909
  * ],
@@ -100795,7 +101016,7 @@ interface paths {
100795
101016
  };
100796
101017
  /**
100797
101018
  * Ingresos: doctor × month comparison
100798
- * @description The last `months` calendar months (default 6, at most 12, the current one to today): per month the clinic's producción, recaudación, presupuestos, aceptación and monto aceptado; per doctor the same by month (producción by performer, the rest by the quoting professional over the presupuestos issued that month). Requires `clinic_money:read`.
101019
+ * @description The last `months` calendar months (default 6, at most 12, the current one to today): per month the clinic's producción, recaudación, presupuestos, aceptación and monto aceptado; per doctor the same by month (producción by performer, the rest by the quoting professional over the presupuestos issued that month). Requires `clinic_money:read` or `clinic_insights:read` (aggregates only).
100799
101020
  *
100800
101021
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
100801
101022
  */
@@ -100940,7 +101161,7 @@ interface paths {
100940
101161
  };
100941
101162
  /**
100942
101163
  * Ingresos: one day opened (its plans, payments and producción)
100943
- * @description The plans issued and payments received on one clinic day, each marked `nuevo` / `tratamiento`, plans with the Números comerciales verdict, plus producción per performer. Patient names only for a caller allowed to see identity (`contacts:read` + `clinic:read`, plus `clinic_patients:read` for an API credential); otherwise `patient.name` is `null`. Requires `clinic_money:read`.
101164
+ * @description The plans issued and payments received on one clinic day, each marked `nuevo` / `tratamiento`, plans with the Números comerciales verdict, plus producción per performer. Patient names only for a caller allowed to see identity (`contacts:read` + `clinic:read`, plus `clinic_patients:read` for an API credential); otherwise `patient.name` is `null`. Each row carries the Origen of its patient (`origen`). Requires `clinic_money:read`, or `clinic_insights:read`, which never gets a patient reference (`patient.id` and `patient.name` are `null`).
100944
101165
  *
100945
101166
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
100946
101167
  */
@@ -100979,6 +101200,7 @@ interface paths {
100979
101200
  * "abonado_clp": 120000,
100980
101201
  * "deuda_clp": 520000,
100981
101202
  * "tipo": "nuevo",
101203
+ * "origen": "meta",
100982
101204
  * "aceptado": true
100983
101205
  * }
100984
101206
  * ],
@@ -100991,7 +101213,8 @@ interface paths {
100991
101213
  * "name": "Paciente de ejemplo"
100992
101214
  * },
100993
101215
  * "amount_clp": 120000,
100994
- * "tipo": "nuevo"
101216
+ * "tipo": "nuevo",
101217
+ * "origen": "meta"
100995
101218
  * }
100996
101219
  * ],
100997
101220
  * "produccion": [
@@ -101789,7 +102012,7 @@ interface paths {
101789
102012
  };
101790
102013
  /**
101791
102014
  * The month's Meta mensual and its progress
101792
- * @description Requires `clinic_money:read`. The owner's three targets for the month (primeras visitas booked, cierres, cobrado in CLP; `null` = not set) with what has been achieved so far: primeras visitas = citas created in the month whose Tipo de agendamiento is Nuevo or Nuevo · reagenda; cierres as Números comerciales counts them; cobrado = payments received. For the current month, `pace` carries the ritmo diario. The ritmo diario is a catch-up pace: (meta − achieved before today) ÷ working days left, today included, each day weighed by its opening hours against the clinic's longest day (a 9–14 Saturday next to 9–19 weekdays weighs 0.5), times today's weight (`per_day`). Working days come from the clinic's opening hours and holidays, in the clinic's timezone. A figure with no target has a count and no pace. This is not the Ads goal, which is marketing's own.
102015
+ * @description Requires `clinic_money:read` or `clinic_insights:read` (the Consultor seat: the payload is aggregates only, D76). The owner's four targets for the month (primeras visitas booked, cierres, cobrado = recaudación in CLP, producción in CLP; `null` = not set) with what has been achieved so far: primeras visitas = citas created in the month whose Tipo de agendamiento is Nuevo or Nuevo · reagenda; cierres as Números comerciales counts them; cobrado = payments received; producción = performed plan lines by fecha de realización, as «Ingresos» (`null` without the revenue mirror). For the current month, `pace` carries the ritmo diario and, per figure, `week_need` («esta semana hay que generar») and `projection` (the end-of-month projection at the current pace: `gap` = projected − target). The ritmo diario is a catch-up pace: (meta − achieved before today) ÷ working days left, today included, each day weighed by its opening hours against the clinic's longest day (a 9–14 Saturday next to 9–19 weekdays weighs 0.5), times today's weight (`per_day`). Working days come from the clinic's opening hours and holidays, in the clinic's timezone. A figure with no target has a count and no pace. This is not the Ads goal, which is marketing's own.
101793
102016
  *
101794
102017
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
101795
102018
  */
@@ -101820,13 +102043,15 @@ interface paths {
101820
102043
  * "primeras_visitas": 40,
101821
102044
  * "cierres": 12,
101822
102045
  * "cobrado_clp": 18000000,
102046
+ * "produccion_clp": 60000000,
101823
102047
  * "updated_at": "2026-10-01T13:05:00.000Z",
101824
102048
  * "updated_by": null
101825
102049
  * },
101826
102050
  * "achieved": {
101827
102051
  * "primeras_visitas": 18,
101828
102052
  * "cierres": 5,
101829
- * "cobrado_clp": 7450000
102053
+ * "cobrado_clp": 7450000,
102054
+ * "produccion_clp": 21300000
101830
102055
  * },
101831
102056
  * "working_days": {
101832
102057
  * "total": 21,
@@ -101855,7 +102080,13 @@ interface paths {
101855
102080
  * "working_days_left": 10,
101856
102081
  * "weighted_days_left": 9.5,
101857
102082
  * "day_weight": 1,
101858
- * "per_day": 3
102083
+ * "per_day": 3,
102084
+ * "week_need": 12,
102085
+ * "projection": {
102086
+ * "projected": 36,
102087
+ * "gap": -4,
102088
+ * "meets_target": false
102089
+ * }
101859
102090
  * },
101860
102091
  * "cierres": null,
101861
102092
  * "cobrado_clp": {
@@ -101866,7 +102097,29 @@ interface paths {
101866
102097
  * "working_days_left": 10,
101867
102098
  * "weighted_days_left": 9.5,
101868
102099
  * "day_weight": 1,
101869
- * "per_day": 1110527
102100
+ * "per_day": 1110527,
102101
+ * "week_need": 5550000,
102102
+ * "projection": {
102103
+ * "projected": 15900000,
102104
+ * "gap": -2100000,
102105
+ * "meets_target": false
102106
+ * }
102107
+ * },
102108
+ * "produccion_clp": {
102109
+ * "status": "open",
102110
+ * "target": 60000000,
102111
+ * "achieved_before_today": 21300000,
102112
+ * "remaining": 38700000,
102113
+ * "working_days_left": 10,
102114
+ * "weighted_days_left": 9.5,
102115
+ * "day_weight": 1,
102116
+ * "per_day": 3927000,
102117
+ * "week_need": 19600000,
102118
+ * "projection": {
102119
+ * "projected": 52400000,
102120
+ * "gap": -7600000,
102121
+ * "meets_target": false
102122
+ * }
101870
102123
  * }
101871
102124
  * }
101872
102125
  * }
@@ -101881,6 +102134,7 @@ interface paths {
101881
102134
  primeras_visitas: number | null;
101882
102135
  cierres: number | null;
101883
102136
  cobrado_clp: number | null;
102137
+ produccion_clp: number | null;
101884
102138
  updated_at: string | null;
101885
102139
  updated_by: string | null;
101886
102140
  };
@@ -101888,6 +102142,8 @@ interface paths {
101888
102142
  primeras_visitas: number;
101889
102143
  cierres: number;
101890
102144
  cobrado_clp: number;
102145
+ /** @description `null` without the revenue mirror. */
102146
+ produccion_clp: number | null;
101891
102147
  };
101892
102148
  working_days: {
101893
102149
  total: number;
@@ -101910,6 +102166,14 @@ interface paths {
101910
102166
  weighted_days_left: number;
101911
102167
  day_weight: number;
101912
102168
  per_day: number | null;
102169
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102170
+ week_need: number | null;
102171
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102172
+ projection: {
102173
+ projected: number;
102174
+ gap: number;
102175
+ meets_target: boolean;
102176
+ } | null;
101913
102177
  } | null;
101914
102178
  cierres: {
101915
102179
  /** @enum {string} */
@@ -101921,6 +102185,14 @@ interface paths {
101921
102185
  weighted_days_left: number;
101922
102186
  day_weight: number;
101923
102187
  per_day: number | null;
102188
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102189
+ week_need: number | null;
102190
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102191
+ projection: {
102192
+ projected: number;
102193
+ gap: number;
102194
+ meets_target: boolean;
102195
+ } | null;
101924
102196
  } | null;
101925
102197
  cobrado_clp: {
101926
102198
  /** @enum {string} */
@@ -101932,6 +102204,33 @@ interface paths {
101932
102204
  weighted_days_left: number;
101933
102205
  day_weight: number;
101934
102206
  per_day: number | null;
102207
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102208
+ week_need: number | null;
102209
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102210
+ projection: {
102211
+ projected: number;
102212
+ gap: number;
102213
+ meets_target: boolean;
102214
+ } | null;
102215
+ } | null;
102216
+ produccion_clp: {
102217
+ /** @enum {string} */
102218
+ status: "open" | "met" | "missed";
102219
+ target: number;
102220
+ achieved_before_today: number;
102221
+ remaining: number;
102222
+ working_days_left: number;
102223
+ weighted_days_left: number;
102224
+ day_weight: number;
102225
+ per_day: number | null;
102226
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102227
+ week_need: number | null;
102228
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102229
+ projection: {
102230
+ projected: number;
102231
+ gap: number;
102232
+ meets_target: boolean;
102233
+ } | null;
101935
102234
  } | null;
101936
102235
  } | null;
101937
102236
  };
@@ -101996,7 +102295,7 @@ interface paths {
101996
102295
  };
101997
102296
  /**
101998
102297
  * Set the month's Meta mensual
101999
- * @description Requires `clinic_admin:write`. Replaces the month's targets: a figure left out or `null` is cleared. Answers with the same targets and progress as the GET.
102298
+ * @description Requires `clinic_admin:write`. Replaces the month's targets: a figure left out or `null` is cleared (except `produccion_clp`, which keeps its value when left out). Answers with the same targets and progress as the GET.
102000
102299
  *
102001
102300
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
102002
102301
  */
@@ -102015,13 +102314,15 @@ interface paths {
102015
102314
  * @example {
102016
102315
  * "primeras_visitas": 40,
102017
102316
  * "cierres": 12,
102018
- * "cobrado_clp": 18000000
102317
+ * "cobrado_clp": 18000000,
102318
+ * "produccion_clp": 60000000
102019
102319
  * }
102020
102320
  */
102021
102321
  "application/json": {
102022
102322
  primeras_visitas?: number | null;
102023
102323
  cierres?: number | null;
102024
102324
  cobrado_clp?: number | null;
102325
+ produccion_clp?: number | null;
102025
102326
  };
102026
102327
  };
102027
102328
  };
@@ -102042,13 +102343,15 @@ interface paths {
102042
102343
  * "primeras_visitas": 40,
102043
102344
  * "cierres": 12,
102044
102345
  * "cobrado_clp": 18000000,
102346
+ * "produccion_clp": 60000000,
102045
102347
  * "updated_at": "2026-10-01T13:05:00.000Z",
102046
102348
  * "updated_by": null
102047
102349
  * },
102048
102350
  * "achieved": {
102049
102351
  * "primeras_visitas": 18,
102050
102352
  * "cierres": 5,
102051
- * "cobrado_clp": 7450000
102353
+ * "cobrado_clp": 7450000,
102354
+ * "produccion_clp": 21300000
102052
102355
  * },
102053
102356
  * "working_days": {
102054
102357
  * "total": 21,
@@ -102077,7 +102380,13 @@ interface paths {
102077
102380
  * "working_days_left": 10,
102078
102381
  * "weighted_days_left": 9.5,
102079
102382
  * "day_weight": 1,
102080
- * "per_day": 3
102383
+ * "per_day": 3,
102384
+ * "week_need": 12,
102385
+ * "projection": {
102386
+ * "projected": 36,
102387
+ * "gap": -4,
102388
+ * "meets_target": false
102389
+ * }
102081
102390
  * },
102082
102391
  * "cierres": null,
102083
102392
  * "cobrado_clp": {
@@ -102088,7 +102397,29 @@ interface paths {
102088
102397
  * "working_days_left": 10,
102089
102398
  * "weighted_days_left": 9.5,
102090
102399
  * "day_weight": 1,
102091
- * "per_day": 1110527
102400
+ * "per_day": 1110527,
102401
+ * "week_need": 5550000,
102402
+ * "projection": {
102403
+ * "projected": 15900000,
102404
+ * "gap": -2100000,
102405
+ * "meets_target": false
102406
+ * }
102407
+ * },
102408
+ * "produccion_clp": {
102409
+ * "status": "open",
102410
+ * "target": 60000000,
102411
+ * "achieved_before_today": 21300000,
102412
+ * "remaining": 38700000,
102413
+ * "working_days_left": 10,
102414
+ * "weighted_days_left": 9.5,
102415
+ * "day_weight": 1,
102416
+ * "per_day": 3927000,
102417
+ * "week_need": 19600000,
102418
+ * "projection": {
102419
+ * "projected": 52400000,
102420
+ * "gap": -7600000,
102421
+ * "meets_target": false
102422
+ * }
102092
102423
  * }
102093
102424
  * }
102094
102425
  * }
@@ -102103,6 +102434,7 @@ interface paths {
102103
102434
  primeras_visitas: number | null;
102104
102435
  cierres: number | null;
102105
102436
  cobrado_clp: number | null;
102437
+ produccion_clp: number | null;
102106
102438
  updated_at: string | null;
102107
102439
  updated_by: string | null;
102108
102440
  };
@@ -102110,6 +102442,8 @@ interface paths {
102110
102442
  primeras_visitas: number;
102111
102443
  cierres: number;
102112
102444
  cobrado_clp: number;
102445
+ /** @description `null` without the revenue mirror. */
102446
+ produccion_clp: number | null;
102113
102447
  };
102114
102448
  working_days: {
102115
102449
  total: number;
@@ -102132,6 +102466,14 @@ interface paths {
102132
102466
  weighted_days_left: number;
102133
102467
  day_weight: number;
102134
102468
  per_day: number | null;
102469
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102470
+ week_need: number | null;
102471
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102472
+ projection: {
102473
+ projected: number;
102474
+ gap: number;
102475
+ meets_target: boolean;
102476
+ } | null;
102135
102477
  } | null;
102136
102478
  cierres: {
102137
102479
  /** @enum {string} */
@@ -102143,6 +102485,14 @@ interface paths {
102143
102485
  weighted_days_left: number;
102144
102486
  day_weight: number;
102145
102487
  per_day: number | null;
102488
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102489
+ week_need: number | null;
102490
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102491
+ projection: {
102492
+ projected: number;
102493
+ gap: number;
102494
+ meets_target: boolean;
102495
+ } | null;
102146
102496
  } | null;
102147
102497
  cobrado_clp: {
102148
102498
  /** @enum {string} */
@@ -102154,6 +102504,33 @@ interface paths {
102154
102504
  weighted_days_left: number;
102155
102505
  day_weight: number;
102156
102506
  per_day: number | null;
102507
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102508
+ week_need: number | null;
102509
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102510
+ projection: {
102511
+ projected: number;
102512
+ gap: number;
102513
+ meets_target: boolean;
102514
+ } | null;
102515
+ } | null;
102516
+ produccion_clp: {
102517
+ /** @enum {string} */
102518
+ status: "open" | "met" | "missed";
102519
+ target: number;
102520
+ achieved_before_today: number;
102521
+ remaining: number;
102522
+ working_days_left: number;
102523
+ weighted_days_left: number;
102524
+ day_weight: number;
102525
+ per_day: number | null;
102526
+ /** @description «Esta semana hay que generar»: the share of the remaining target the rest of this week carries (today through Sunday or the month end), weighed by opening hours. `null` unless `open`. */
102527
+ week_need: number | null;
102528
+ /** @description End-of-month projection at the current pace (what was achieved before today per weighted working day gone, carried over the weighted days left). `gap` = projected − target; `null` while no working day has gone. */
102529
+ projection: {
102530
+ projected: number;
102531
+ gap: number;
102532
+ meets_target: boolean;
102533
+ } | null;
102157
102534
  } | null;
102158
102535
  } | null;
102159
102536
  };
@@ -105108,7 +105485,7 @@ interface paths {
105108
105485
  parameters: {
105109
105486
  query: {
105110
105487
  /** @description The outcome stage to preview. One the workspace sends (a stage outside its vertical → 404). */
105111
- stage: "lead_created" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
105488
+ stage: "lead_created" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
105112
105489
  /** @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. */
105113
105490
  sample?: "1" | "true";
105114
105491
  };
@@ -105340,7 +105717,7 @@ interface paths {
105340
105717
  * @description Which stage the test imitates (its rule and event name). Defaults to the Purchase stage, else the first stage that reaches Meta.
105341
105718
  * @enum {string}
105342
105719
  */
105343
- stage?: "lead_created" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
105720
+ stage?: "lead_created" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
105344
105721
  /** @description The code Meta shows in Events Manager → Test Events. Omit it and one is generated: a test ALWAYS carries a code, so it lands in Test Events only and never counts as a real event. */
105345
105722
  test_event_code?: string;
105346
105723
  /**
@@ -141482,6 +141859,8 @@ interface paths {
141482
141859
  from?: string;
141483
141860
  /** @description With `from`: the page period’s end. */
141484
141861
  to?: string;
141862
+ /** @description Narrow to the ads of one Línea of the clinic (its id from the Líneas list), or `none` for the ads no rule places in any Línea. An ad belongs to the Línea the clinic’s rules give its campaign, ad set and ad names. Ranks, ratios and totals of the remaining rows are unchanged; `limit` applies before the filter. */
141863
+ linea_id?: string | "none";
141485
141864
  /** @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. */
141486
141865
  sample?: "1" | "true";
141487
141866
  };
@@ -141732,6 +142111,8 @@ interface paths {
141732
142111
  window?: "7d" | "14d" | "28d" | "lifetime";
141733
142112
  /** @description The attribution model. Defaults to `last_touch`. */
141734
142113
  model?: string;
142114
+ /** @description Narrow to the ads of one Línea of the clinic (its id from the Líneas list), or `none` for the ads no rule places in any Línea. An ad belongs to the Línea the clinic’s rules give its campaign, ad set and ad names. Ranks, ratios and totals of the remaining rows are unchanged; `limit` applies before the filter. */
142115
+ linea_id?: string | "none";
141735
142116
  /** @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. */
141736
142117
  sample?: "1" | "true";
141737
142118
  };
@@ -141916,6 +142297,225 @@ interface paths {
141916
142297
  patch?: never;
141917
142298
  trace?: never;
141918
142299
  };
142300
+ "/ads/lineas": {
142301
+ parameters: {
142302
+ query?: never;
142303
+ header?: never;
142304
+ path?: never;
142305
+ cookie?: never;
142306
+ };
142307
+ /**
142308
+ * Ads by Línea: spend, people and attributed cash per Línea
142309
+ * @description The per-ad scorecard (`/ads/scorecard`) summed by the Línea of each ad (D53). An ad belongs to the Línea the clinic’s own rules give its campaign, ad set and ad names (the same rules that set a lead’s Línea at first touch); an ad no rule places is «Sin línea» (`linea_id: null`). Same covered window, same numbers: the Líneas plus «Sin línea» add up to `totals`, which is the scorecard’s own sum. Every live Línea is listed, with zeros when no ad of the window belongs to it. Empty `lineas` for a workspace that is not a clinic. To list one Línea’s ads, send its id as `linea_id` to `/ads/scorecard` or `/ads/creatives`.
142310
+ */
142311
+ get: {
142312
+ parameters: {
142313
+ query: {
142314
+ /** @description Window start (inclusive), YYYY-MM-DD. */
142315
+ from: string;
142316
+ /** @description Window end (inclusive), YYYY-MM-DD. */
142317
+ to: string;
142318
+ /** @description The attribution model. Defaults to `last_touch`. */
142319
+ model?: string;
142320
+ /** @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. */
142321
+ sample?: "1" | "true";
142322
+ };
142323
+ header?: never;
142324
+ path?: never;
142325
+ cookie?: never;
142326
+ };
142327
+ requestBody?: never;
142328
+ responses: {
142329
+ /** @description Ads grouped by Línea */
142330
+ 200: {
142331
+ headers: {
142332
+ [name: string]: unknown;
142333
+ };
142334
+ content: {
142335
+ /**
142336
+ * @example {
142337
+ * "data": {
142338
+ * "window": {
142339
+ * "from": "2026-09-20",
142340
+ * "to": "2026-09-30",
142341
+ * "days": 11
142342
+ * },
142343
+ * "coverage": null,
142344
+ * "lineas": [
142345
+ * {
142346
+ * "linea_id": "0b1c2d3e-0000-4000-8000-0000000000b1",
142347
+ * "nombre": "Implantes",
142348
+ * "ads": 2,
142349
+ * "spend": 100935,
142350
+ * "people": 96,
142351
+ * "booked": 4,
142352
+ * "attended": 0,
142353
+ * "accepted": {
142354
+ * "count": 2,
142355
+ * "value": 1357355
142356
+ * },
142357
+ * "cash": {
142358
+ * "first": 18990,
142359
+ * "recurring": 0,
142360
+ * "total": 18990,
142361
+ * "payments": 2
142362
+ * },
142363
+ * "ratios": {
142364
+ * "accepted_return": 13.45,
142365
+ * "cash_return": 0.19,
142366
+ * "first_payment_return": 0.19,
142367
+ * "cost_per_person": 1051
142368
+ * }
142369
+ * },
142370
+ * {
142371
+ * "linea_id": null,
142372
+ * "nombre": null,
142373
+ * "ads": 1,
142374
+ * "spend": 120088,
142375
+ * "people": 37,
142376
+ * "booked": 0,
142377
+ * "attended": 0,
142378
+ * "accepted": null,
142379
+ * "cash": null,
142380
+ * "ratios": {
142381
+ * "accepted_return": null,
142382
+ * "cash_return": null,
142383
+ * "first_payment_return": null,
142384
+ * "cost_per_person": 3246
142385
+ * }
142386
+ * }
142387
+ * ],
142388
+ * "totals": {
142389
+ * "ads": 3,
142390
+ * "spend": 221023,
142391
+ * "people": 133,
142392
+ * "booked": 4,
142393
+ * "attended": 0,
142394
+ * "accepted": {
142395
+ * "count": 2,
142396
+ * "value": 1357355
142397
+ * },
142398
+ * "cash": {
142399
+ * "first": 18990,
142400
+ * "recurring": 0,
142401
+ * "total": 18990,
142402
+ * "payments": 2
142403
+ * },
142404
+ * "ratios": {
142405
+ * "accepted_return": 6.14,
142406
+ * "cash_return": 0.09,
142407
+ * "first_payment_return": 0.09,
142408
+ * "cost_per_person": 1662
142409
+ * }
142410
+ * }
142411
+ * }
142412
+ * }
142413
+ */
142414
+ "application/json": {
142415
+ data: components["schemas"]["AdsByLinea"];
142416
+ };
142417
+ };
142418
+ };
142419
+ /** @description Validation error */
142420
+ 400: {
142421
+ headers: {
142422
+ [name: string]: unknown;
142423
+ };
142424
+ content: {
142425
+ "application/json": components["schemas"]["Error"];
142426
+ };
142427
+ };
142428
+ /** @description Unauthorized */
142429
+ 401: {
142430
+ headers: {
142431
+ [name: string]: unknown;
142432
+ };
142433
+ content: {
142434
+ "application/json": components["schemas"]["Error"];
142435
+ };
142436
+ };
142437
+ /** @description Vitrina Ads is not active for this workspace. `error.code` is `ENTITLEMENT_NOT_ACTIVE`, `error.details.feature` is `vitrina_ads`. */
142438
+ 402: {
142439
+ headers: {
142440
+ [name: string]: unknown;
142441
+ };
142442
+ content: {
142443
+ /**
142444
+ * @example {
142445
+ * "error": {
142446
+ * "code": "ENTITLEMENT_NOT_ACTIVE",
142447
+ * "message": "El complemento Vitrina Ads no está activo en este espacio de trabajo.",
142448
+ * "details": {
142449
+ * "required": [
142450
+ * "vitrina_ads"
142451
+ * ],
142452
+ * "active": [],
142453
+ * "feature": "vitrina_ads",
142454
+ * "entitlement_state": "off"
142455
+ * }
142456
+ * }
142457
+ * }
142458
+ */
142459
+ "application/json": components["schemas"]["Error"];
142460
+ };
142461
+ };
142462
+ /** @description Forbidden */
142463
+ 403: {
142464
+ headers: {
142465
+ [name: string]: unknown;
142466
+ };
142467
+ content: {
142468
+ "application/json": components["schemas"]["Error"];
142469
+ };
142470
+ };
142471
+ /** @description Not found */
142472
+ 404: {
142473
+ headers: {
142474
+ [name: string]: unknown;
142475
+ };
142476
+ content: {
142477
+ "application/json": components["schemas"]["Error"];
142478
+ };
142479
+ };
142480
+ /** @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. */
142481
+ 409: {
142482
+ headers: {
142483
+ [name: string]: unknown;
142484
+ };
142485
+ content: {
142486
+ /**
142487
+ * @example {
142488
+ * "error": {
142489
+ * "code": "ADS_KEY_NEEDS_REMINT",
142490
+ * "message": "Vitrina Ads is active but the delegated key has not finished rotating (key_kind: core)",
142491
+ * "details": {
142492
+ * "key_kind": "core"
142493
+ * }
142494
+ * }
142495
+ * }
142496
+ */
142497
+ "application/json": components["schemas"]["Error"];
142498
+ };
142499
+ };
142500
+ /** @description Rate limited */
142501
+ 429: {
142502
+ headers: {
142503
+ [name: string]: unknown;
142504
+ };
142505
+ content: {
142506
+ "application/json": components["schemas"]["Error"];
142507
+ };
142508
+ };
142509
+ };
142510
+ };
142511
+ put?: never;
142512
+ post?: never;
142513
+ delete?: never;
142514
+ options?: never;
142515
+ head?: never;
142516
+ patch?: never;
142517
+ trace?: never;
142518
+ };
141919
142519
  "/ads/booking-rate": {
141920
142520
  parameters: {
141921
142521
  query?: never;
@@ -148102,7 +148702,7 @@ interface paths {
148102
148702
  /** @description Window end (inclusive, Santiago day), YYYY-MM-DD. */
148103
148703
  to: string;
148104
148704
  /** @description Only outcomes of this stage. */
148105
- stage?: "lead_created" | "web_form" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received";
148705
+ stage?: "lead_created" | "web_form" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received";
148106
148706
  /** @description `1` keeps only outcomes the engine credited to a campaign (the enrichment covers the requested window, up to 92 days back; check `meta.enrichment`). */
148107
148707
  only_ads?: "1" | "true";
148108
148708
  /** @description Only outcomes credited to this campaign (its PLATFORM id). */
@@ -148239,7 +148839,7 @@ interface paths {
148239
148839
  recorded_from: string | null;
148240
148840
  by_stage: {
148241
148841
  /** @enum {string} */
148242
- stage: "lead_created" | "web_form" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
148842
+ stage: "lead_created" | "web_form" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
148243
148843
  total: number;
148244
148844
  from_ads: number;
148245
148845
  kept: number;
@@ -174993,7 +175593,7 @@ interface components {
174993
175593
  };
174994
175594
  WebhookEventDoc: {
174995
175595
  /** @enum {string} */
174996
- name: "ai_agent.publish" | "ai_agent_graph.publish" | "agent_scenario_run.completed" | "agent_scenario_suite.completed" | "conversation.created" | "conversation.assigned" | "conversation.resolved" | "message.received" | "message.sent" | "ticket.opened" | "ticket.reopened" | "ticket.resolved" | "ticket.closed" | "sla.breached" | "kb.source.create" | "kb.source.embed" | "kb.source.update" | "kb.source.delete" | "kb_file.uploaded" | "kb_file.deleted" | "skill.created" | "skill.updated" | "skill.deleted" | "custom_tool.created" | "custom_tool.updated" | "custom_tool.deleted" | "macro.applied" | "cost.budget_alert" | "runtime.budget_exceeded" | "lead.created" | "lead.stage_changed" | "lead.pipeline_changed" | "lead.assigned" | "lead.won" | "lead.lost" | "lead.unqualified" | "stock.synced" | "stock.source_retired" | "vehicle.published" | "vehicle.unpublished" | "vehicle.publish_failed" | "vehicle.created" | "vehicle.attachment.created" | "mercadolibre.order" | "mercadolibre.vis_lead" | "chileautos.lead" | "yapo.lead" | "website.lead" | "consignment.candidate.created" | "quote.issued" | "quote.voided" | "quote.extended" | "quote.archived" | "reservation.created" | "reservation.voided" | "reservation.abono_disposed" | "reservation.converted" | "sale_note.issued" | "sale_note.approved" | "sale_note.voided" | "purchase_note.issued" | "purchase_note.corrected" | "purchase_note.voided" | "payment.recorded" | "consignment.created" | "consignment.returned" | "consignment.sold" | "credit_application.recorded" | "credit_application.submitted" | "credit_application.decided" | "credit_application.withdrawn" | "price_approval.requested" | "price_approval.decided" | "contact.created" | "contact.updated" | "contact.merged" | "appointment.booked" | "appointment.rescheduled" | "appointment.cancelled" | "appointment.completed" | "appointment.no_show" | "appointment.reminded" | "appointment.imported" | "campaign.sent" | "campaign.paused" | "sending_domain.verified" | "coach.proposals_ready" | "coach.finding_ready" | "voice.autonomous_call" | "safety_hold.placed" | "safety_hold.ack_overdue" | "safety_hold.first_response_overdue" | "team.created" | "team.updated" | "team.deleted" | "custom_role.created" | "custom_role.updated" | "custom_role.deleted" | "macro.created" | "macro.updated" | "macro.deleted" | "assignment_rule.created" | "assignment_rule.updated" | "assignment_rule.deleted" | "sla_policy.created" | "sla_policy.updated" | "sla_policy.deleted" | "automation_trigger.created" | "automation_trigger.updated" | "automation_trigger.deleted" | "sending_domain.created" | "sending_domain.deleted" | "whatsapp_template.created" | "whatsapp_template.status_changed" | "whatsapp_template.deleted" | "whatsapp_flow.created" | "whatsapp_flow.published" | "whatsapp_flow.deprecated" | "whatsapp_flow.deleted" | "whatsapp_flow.completed" | "channel.connected" | "channel.updated" | "channel.disconnected" | "membership.created" | "membership.updated" | "membership.removed" | "clinic_professional.created" | "clinic_professional.updated" | "clinic_professional.deleted" | "clinic_service.created" | "clinic_service.updated" | "clinic_service.deleted" | "clinic_price_list.updated" | "clinic_pack_purchase.created" | "clinic_pack_purchase.session_consumed" | "clinic_pack_purchase.cancelled" | "clinic_budget.created" | "clinic_budget.sent" | "clinic_budget.accepted" | "clinic_budget.rejected" | "clinic_budget.voided" | "clinic_budget.mirror_changed" | "clinic_cash_session.opened" | "clinic_cash_session.closed" | "clinic_patient.created" | "clinic_patient.updated" | "clinic_patient.deleted" | "clinic_patient.merged" | "clinic_encounter.opened" | "clinic_encounter.closed" | "clinic_note.signed" | "clinic_note.amended" | "clinic_consent.signed" | "clinic_consent.revoked" | "clinic_document.uploaded" | "clinic_document.deleted" | "clinic_privacy_request.completed";
175596
+ name: "ai_agent.publish" | "ai_agent_graph.publish" | "agent_scenario_run.completed" | "agent_scenario_suite.completed" | "conversation.created" | "conversation.assigned" | "conversation.resolved" | "message.received" | "message.sent" | "ticket.opened" | "ticket.reopened" | "ticket.resolved" | "ticket.closed" | "sla.breached" | "kb.source.create" | "kb.source.embed" | "kb.source.update" | "kb.source.delete" | "kb_file.uploaded" | "kb_file.deleted" | "skill.created" | "skill.updated" | "skill.deleted" | "custom_tool.created" | "custom_tool.updated" | "custom_tool.deleted" | "macro.applied" | "cost.budget_alert" | "runtime.budget_exceeded" | "lead.created" | "lead.stage_changed" | "lead.pipeline_changed" | "lead.assigned" | "lead.won" | "lead.lost" | "lead.unqualified" | "stock.synced" | "stock.source_retired" | "vehicle.published" | "vehicle.unpublished" | "vehicle.publish_failed" | "vehicle.created" | "vehicle.attachment.created" | "mercadolibre.order" | "mercadolibre.vis_lead" | "chileautos.lead" | "yapo.lead" | "website.lead" | "demo_lead.created" | "demo_lead.pending_scheduling" | "demo_lead.routed" | "demo_booking.booked" | "demo_booking.rescheduled" | "demo_booking.cancelled" | "consignment.candidate.created" | "quote.issued" | "quote.voided" | "quote.extended" | "quote.archived" | "reservation.created" | "reservation.voided" | "reservation.abono_disposed" | "reservation.converted" | "sale_note.issued" | "sale_note.approved" | "sale_note.voided" | "purchase_note.issued" | "purchase_note.corrected" | "purchase_note.voided" | "payment.recorded" | "consignment.created" | "consignment.returned" | "consignment.sold" | "credit_application.recorded" | "credit_application.submitted" | "credit_application.decided" | "credit_application.withdrawn" | "price_approval.requested" | "price_approval.decided" | "contact.created" | "contact.updated" | "contact.merged" | "appointment.booked" | "appointment.rescheduled" | "appointment.cancelled" | "appointment.completed" | "appointment.no_show" | "appointment.reminded" | "appointment.imported" | "campaign.sent" | "campaign.paused" | "sending_domain.verified" | "coach.proposals_ready" | "coach.finding_ready" | "voice.autonomous_call" | "safety_hold.placed" | "safety_hold.ack_overdue" | "safety_hold.first_response_overdue" | "team.created" | "team.updated" | "team.deleted" | "custom_role.created" | "custom_role.updated" | "custom_role.deleted" | "macro.created" | "macro.updated" | "macro.deleted" | "assignment_rule.created" | "assignment_rule.updated" | "assignment_rule.deleted" | "sla_policy.created" | "sla_policy.updated" | "sla_policy.deleted" | "automation_trigger.created" | "automation_trigger.updated" | "automation_trigger.deleted" | "sending_domain.created" | "sending_domain.deleted" | "whatsapp_template.created" | "whatsapp_template.status_changed" | "whatsapp_template.deleted" | "whatsapp_flow.created" | "whatsapp_flow.published" | "whatsapp_flow.deprecated" | "whatsapp_flow.deleted" | "whatsapp_flow.completed" | "channel.connected" | "channel.updated" | "channel.disconnected" | "membership.created" | "membership.updated" | "membership.removed" | "clinic_professional.created" | "clinic_professional.updated" | "clinic_professional.deleted" | "clinic_service.created" | "clinic_service.updated" | "clinic_service.deleted" | "clinic_price_list.updated" | "clinic_pack_purchase.created" | "clinic_pack_purchase.session_consumed" | "clinic_pack_purchase.cancelled" | "clinic_budget.created" | "clinic_budget.sent" | "clinic_budget.accepted" | "clinic_budget.rejected" | "clinic_budget.voided" | "clinic_budget.mirror_changed" | "clinic_cash_session.opened" | "clinic_cash_session.closed" | "clinic_patient.created" | "clinic_patient.updated" | "clinic_patient.deleted" | "clinic_patient.merged" | "clinic_encounter.opened" | "clinic_encounter.closed" | "clinic_note.signed" | "clinic_note.amended" | "clinic_consent.signed" | "clinic_consent.revoked" | "clinic_document.uploaded" | "clinic_document.deleted" | "clinic_privacy_request.completed";
174997
175597
  /** @description The schema version of this event type — every delivery carries it as `version`. Bumped only on a breaking change to `data`. */
174998
175598
  version: number;
174999
175599
  /** @description What the event is about — the `resource.type` of every delivery (`lead`, `vehicle`, `contact`, …). */
@@ -175060,7 +175660,7 @@ interface components {
175060
175660
  CreateWebhookBody: {
175061
175661
  /** Format: uri */
175062
175662
  url: string;
175063
- events: ("*" | "ai_agent.publish" | "ai_agent_graph.publish" | "agent_scenario_run.completed" | "agent_scenario_suite.completed" | "conversation.created" | "conversation.assigned" | "conversation.resolved" | "message.received" | "message.sent" | "ticket.opened" | "ticket.reopened" | "ticket.resolved" | "ticket.closed" | "sla.breached" | "kb.source.create" | "kb.source.embed" | "kb.source.update" | "kb.source.delete" | "kb_file.uploaded" | "kb_file.deleted" | "skill.created" | "skill.updated" | "skill.deleted" | "custom_tool.created" | "custom_tool.updated" | "custom_tool.deleted" | "macro.applied" | "cost.budget_alert" | "runtime.budget_exceeded" | "lead.created" | "lead.stage_changed" | "lead.pipeline_changed" | "lead.assigned" | "lead.won" | "lead.lost" | "lead.unqualified" | "stock.synced" | "stock.source_retired" | "vehicle.published" | "vehicle.unpublished" | "vehicle.publish_failed" | "vehicle.created" | "vehicle.attachment.created" | "mercadolibre.order" | "mercadolibre.vis_lead" | "chileautos.lead" | "yapo.lead" | "website.lead" | "consignment.candidate.created" | "quote.issued" | "quote.voided" | "quote.extended" | "quote.archived" | "reservation.created" | "reservation.voided" | "reservation.abono_disposed" | "reservation.converted" | "sale_note.issued" | "sale_note.approved" | "sale_note.voided" | "purchase_note.issued" | "purchase_note.corrected" | "purchase_note.voided" | "payment.recorded" | "consignment.created" | "consignment.returned" | "consignment.sold" | "credit_application.recorded" | "credit_application.submitted" | "credit_application.decided" | "credit_application.withdrawn" | "price_approval.requested" | "price_approval.decided" | "contact.created" | "contact.updated" | "contact.merged" | "appointment.booked" | "appointment.rescheduled" | "appointment.cancelled" | "appointment.completed" | "appointment.no_show" | "appointment.reminded" | "appointment.imported" | "campaign.sent" | "campaign.paused" | "sending_domain.verified" | "coach.proposals_ready" | "coach.finding_ready" | "voice.autonomous_call" | "safety_hold.placed" | "safety_hold.ack_overdue" | "safety_hold.first_response_overdue" | "team.created" | "team.updated" | "team.deleted" | "custom_role.created" | "custom_role.updated" | "custom_role.deleted" | "macro.created" | "macro.updated" | "macro.deleted" | "assignment_rule.created" | "assignment_rule.updated" | "assignment_rule.deleted" | "sla_policy.created" | "sla_policy.updated" | "sla_policy.deleted" | "automation_trigger.created" | "automation_trigger.updated" | "automation_trigger.deleted" | "sending_domain.created" | "sending_domain.deleted" | "whatsapp_template.created" | "whatsapp_template.status_changed" | "whatsapp_template.deleted" | "whatsapp_flow.created" | "whatsapp_flow.published" | "whatsapp_flow.deprecated" | "whatsapp_flow.deleted" | "whatsapp_flow.completed" | "channel.connected" | "channel.updated" | "channel.disconnected" | "membership.created" | "membership.updated" | "membership.removed" | "clinic_professional.created" | "clinic_professional.updated" | "clinic_professional.deleted" | "clinic_service.created" | "clinic_service.updated" | "clinic_service.deleted" | "clinic_price_list.updated" | "clinic_pack_purchase.created" | "clinic_pack_purchase.session_consumed" | "clinic_pack_purchase.cancelled" | "clinic_budget.created" | "clinic_budget.sent" | "clinic_budget.accepted" | "clinic_budget.rejected" | "clinic_budget.voided" | "clinic_budget.mirror_changed" | "clinic_cash_session.opened" | "clinic_cash_session.closed" | "clinic_patient.created" | "clinic_patient.updated" | "clinic_patient.deleted" | "clinic_patient.merged" | "clinic_encounter.opened" | "clinic_encounter.closed" | "clinic_note.signed" | "clinic_note.amended" | "clinic_consent.signed" | "clinic_consent.revoked" | "clinic_document.uploaded" | "clinic_document.deleted" | "clinic_privacy_request.completed")[];
175663
+ events: ("*" | "ai_agent.publish" | "ai_agent_graph.publish" | "agent_scenario_run.completed" | "agent_scenario_suite.completed" | "conversation.created" | "conversation.assigned" | "conversation.resolved" | "message.received" | "message.sent" | "ticket.opened" | "ticket.reopened" | "ticket.resolved" | "ticket.closed" | "sla.breached" | "kb.source.create" | "kb.source.embed" | "kb.source.update" | "kb.source.delete" | "kb_file.uploaded" | "kb_file.deleted" | "skill.created" | "skill.updated" | "skill.deleted" | "custom_tool.created" | "custom_tool.updated" | "custom_tool.deleted" | "macro.applied" | "cost.budget_alert" | "runtime.budget_exceeded" | "lead.created" | "lead.stage_changed" | "lead.pipeline_changed" | "lead.assigned" | "lead.won" | "lead.lost" | "lead.unqualified" | "stock.synced" | "stock.source_retired" | "vehicle.published" | "vehicle.unpublished" | "vehicle.publish_failed" | "vehicle.created" | "vehicle.attachment.created" | "mercadolibre.order" | "mercadolibre.vis_lead" | "chileautos.lead" | "yapo.lead" | "website.lead" | "demo_lead.created" | "demo_lead.pending_scheduling" | "demo_lead.routed" | "demo_booking.booked" | "demo_booking.rescheduled" | "demo_booking.cancelled" | "consignment.candidate.created" | "quote.issued" | "quote.voided" | "quote.extended" | "quote.archived" | "reservation.created" | "reservation.voided" | "reservation.abono_disposed" | "reservation.converted" | "sale_note.issued" | "sale_note.approved" | "sale_note.voided" | "purchase_note.issued" | "purchase_note.corrected" | "purchase_note.voided" | "payment.recorded" | "consignment.created" | "consignment.returned" | "consignment.sold" | "credit_application.recorded" | "credit_application.submitted" | "credit_application.decided" | "credit_application.withdrawn" | "price_approval.requested" | "price_approval.decided" | "contact.created" | "contact.updated" | "contact.merged" | "appointment.booked" | "appointment.rescheduled" | "appointment.cancelled" | "appointment.completed" | "appointment.no_show" | "appointment.reminded" | "appointment.imported" | "campaign.sent" | "campaign.paused" | "sending_domain.verified" | "coach.proposals_ready" | "coach.finding_ready" | "voice.autonomous_call" | "safety_hold.placed" | "safety_hold.ack_overdue" | "safety_hold.first_response_overdue" | "team.created" | "team.updated" | "team.deleted" | "custom_role.created" | "custom_role.updated" | "custom_role.deleted" | "macro.created" | "macro.updated" | "macro.deleted" | "assignment_rule.created" | "assignment_rule.updated" | "assignment_rule.deleted" | "sla_policy.created" | "sla_policy.updated" | "sla_policy.deleted" | "automation_trigger.created" | "automation_trigger.updated" | "automation_trigger.deleted" | "sending_domain.created" | "sending_domain.deleted" | "whatsapp_template.created" | "whatsapp_template.status_changed" | "whatsapp_template.deleted" | "whatsapp_flow.created" | "whatsapp_flow.published" | "whatsapp_flow.deprecated" | "whatsapp_flow.deleted" | "whatsapp_flow.completed" | "channel.connected" | "channel.updated" | "channel.disconnected" | "membership.created" | "membership.updated" | "membership.removed" | "clinic_professional.created" | "clinic_professional.updated" | "clinic_professional.deleted" | "clinic_service.created" | "clinic_service.updated" | "clinic_service.deleted" | "clinic_price_list.updated" | "clinic_pack_purchase.created" | "clinic_pack_purchase.session_consumed" | "clinic_pack_purchase.cancelled" | "clinic_budget.created" | "clinic_budget.sent" | "clinic_budget.accepted" | "clinic_budget.rejected" | "clinic_budget.voided" | "clinic_budget.mirror_changed" | "clinic_cash_session.opened" | "clinic_cash_session.closed" | "clinic_patient.created" | "clinic_patient.updated" | "clinic_patient.deleted" | "clinic_patient.merged" | "clinic_encounter.opened" | "clinic_encounter.closed" | "clinic_note.signed" | "clinic_note.amended" | "clinic_consent.signed" | "clinic_consent.revoked" | "clinic_document.uploaded" | "clinic_document.deleted" | "clinic_privacy_request.completed")[];
175064
175664
  description?: string | null;
175065
175665
  /** @description «Incluir datos del recurso». `false` (the default) = every delivery is the notice: resource, changes, author, time and `url`, with `data_omitted: "not_requested"`. `true` = each delivery also carries `data` when, at dispatch time, this subscription's OWNER — whoever created it or last changed its url, events or this flag — holds the resource read scope (`read_scope` in the catalogue) and sees every record; otherwise `data_omitted` says why. An event about a dato sensible is always the notice. */
175066
175666
  include_data?: boolean;
@@ -176230,6 +176830,11 @@ interface components {
176230
176830
  location_id: string | null;
176231
176831
  /** Format: uuid */
176232
176832
  professional_id: string | null;
176833
+ /**
176834
+ * @description The Origen filter applied; `null` = everyone.
176835
+ * @enum {string|null}
176836
+ */
176837
+ origin: "meta" | "organic" | "unknown" | null;
176233
176838
  /** @enum {string} */
176234
176839
  state: "ready" | "unavailable";
176235
176840
  state_reason: string | null;
@@ -176273,6 +176878,24 @@ interface components {
176273
176878
  tratamiento_clp: number;
176274
176879
  pagos: number;
176275
176880
  } | null;
176881
+ /** @description Producción, presupuestado and recaudación by Origen (D77): `meta`, `organic`, `unknown` («Sin dato»). `recaudado_clp` is `null` with `professional_id`. The whole object is `null` when the Origen could not be read (never guessed as `unknown`). */
176882
+ by_origen: {
176883
+ meta?: {
176884
+ produccion_clp: number;
176885
+ presupuestado_clp: number;
176886
+ recaudado_clp: number | null;
176887
+ };
176888
+ organic?: {
176889
+ produccion_clp: number;
176890
+ presupuestado_clp: number;
176891
+ recaudado_clp: number | null;
176892
+ };
176893
+ unknown?: {
176894
+ produccion_clp: number;
176895
+ presupuestado_clp: number;
176896
+ recaudado_clp: number | null;
176897
+ };
176898
+ } | null;
176276
176899
  };
176277
176900
  days: {
176278
176901
  produccion: {
@@ -176297,6 +176920,24 @@ interface components {
176297
176920
  tratamiento_clp: number;
176298
176921
  pagos: number;
176299
176922
  } | null;
176923
+ /** @description Producción, presupuestado and recaudación by Origen (D77): `meta`, `organic`, `unknown` («Sin dato»). `recaudado_clp` is `null` with `professional_id`. The whole object is `null` when the Origen could not be read (never guessed as `unknown`). */
176924
+ by_origen: {
176925
+ meta?: {
176926
+ produccion_clp: number;
176927
+ presupuestado_clp: number;
176928
+ recaudado_clp: number | null;
176929
+ };
176930
+ organic?: {
176931
+ produccion_clp: number;
176932
+ presupuestado_clp: number;
176933
+ recaudado_clp: number | null;
176934
+ };
176935
+ unknown?: {
176936
+ produccion_clp: number;
176937
+ presupuestado_clp: number;
176938
+ recaudado_clp: number | null;
176939
+ };
176940
+ } | null;
176300
176941
  day: string;
176301
176942
  }[];
176302
176943
  clinic: {
@@ -176374,7 +177015,7 @@ interface components {
176374
177015
  plans: {
176375
177016
  /** Format: uuid */
176376
177017
  plan_id: string;
176377
- /** @description `name` only for a caller allowed to see patient identity (`contacts:read` + `clinic:read`, plus `clinic_patients:read` for an API credential). */
177018
+ /** @description `name` only for a caller allowed to see patient identity (`contacts:read` + `clinic:read`, plus `clinic_patients:read` for an API credential). A caller on `clinic_insights:read` alone gets `id` and `name` both `null`. */
176378
177019
  patient: {
176379
177020
  /** Format: uuid */
176380
177021
  id: string | null;
@@ -176388,6 +177029,8 @@ interface components {
176388
177029
  deuda_clp: number;
176389
177030
  /** @enum {string} */
176390
177031
  tipo: "nuevo" | "tratamiento";
177032
+ /** @enum {string|null} */
177033
+ origen: "meta" | "organic" | "unknown" | null;
176391
177034
  /** @description Números comerciales' verdict; `null` for a $0 or evaluación-only plan. */
176392
177035
  aceptado: boolean | null;
176393
177036
  }[];
@@ -176395,7 +177038,7 @@ interface components {
176395
177038
  /** Format: uuid */
176396
177039
  payment_id: string;
176397
177040
  time: string | null;
176398
- /** @description `name` only for a caller allowed to see patient identity (`contacts:read` + `clinic:read`, plus `clinic_patients:read` for an API credential). */
177041
+ /** @description `name` only for a caller allowed to see patient identity (`contacts:read` + `clinic:read`, plus `clinic_patients:read` for an API credential). A caller on `clinic_insights:read` alone gets `id` and `name` both `null`. */
176399
177042
  patient: {
176400
177043
  /** Format: uuid */
176401
177044
  id: string | null;
@@ -176404,6 +177047,8 @@ interface components {
176404
177047
  amount_clp: number;
176405
177048
  /** @enum {string} */
176406
177049
  tipo: "nuevo" | "tratamiento";
177050
+ /** @enum {string|null} */
177051
+ origen: "meta" | "organic" | "unknown" | null;
176407
177052
  }[];
176408
177053
  produccion: {
176409
177054
  /** Format: uuid */
@@ -177036,7 +177681,7 @@ interface components {
177036
177681
  vertical: string | null;
177037
177682
  rules: {
177038
177683
  /** @enum {string} */
177039
- stage: "lead_created" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177684
+ stage: "lead_created" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177040
177685
  /**
177041
177686
  * @description `unchanged` = the rule already held this body; nothing was written.
177042
177687
  * @enum {string}
@@ -177110,7 +177755,7 @@ interface components {
177110
177755
  } | null;
177111
177756
  stages: {
177112
177757
  /** @enum {string} */
177113
- stage: "lead_created" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177758
+ stage: "lead_created" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177114
177759
  /** @description The stage in the workspace’s words. */
177115
177760
  label: string;
177116
177761
  /** @description What Meta receives. */
@@ -177270,7 +177915,7 @@ interface components {
177270
177915
  /** @description Advice only — Vitrina never changes an ad set’s goal: the earliest stage reached by 1–40 % of new contacts over 28 days, once there are ≥ 50 (what Meta learns best from with this volume); `default` = not enough data yet, the usual answer for the business type. Never a standard event on a health-restricted dataset. */
177271
177916
  recommended_optimization_stage: {
177272
177917
  /** @enum {string} */
177273
- stage: "lead_created" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177918
+ stage: "lead_created" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177274
177919
  /** @enum {string} */
177275
177920
  reason: "rate_band" | "default";
177276
177921
  rate: number | null;
@@ -177309,7 +177954,7 @@ interface components {
177309
177954
  };
177310
177955
  AdsSendPreviewEvent: {
177311
177956
  /** @enum {string} */
177312
- stage: "lead_created" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177957
+ stage: "lead_created" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
177313
177958
  /**
177314
177959
  * @description `example` when the workspace has no event of this stage yet.
177315
177960
  * @enum {string}
@@ -177367,7 +178012,7 @@ interface components {
177367
178012
  /** @description Search for it in Events Manager → Test Events. */
177368
178013
  event_id: string | null;
177369
178014
  /** @enum {string|null} */
177370
- stage: "lead_created" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received" | null;
178015
+ stage: "lead_created" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received" | null;
177371
178016
  meta_event: string | null;
177372
178017
  quality_warning: boolean;
177373
178018
  test_events_link: string | null;
@@ -178942,10 +179587,10 @@ interface components {
178942
179587
  };
178943
179588
  coverage: components["schemas"]["AdsCoverage"] & (Record<string, never> | null);
178944
179589
  /**
178945
- * @description What the ranking sorts by first: the accepted-quote return, or cash once the window holds `cash_evidence.min_payments` payments.
179590
+ * @description What the ranking sorts by first: `expected` for a clinic with its economics known (each ad on its expected return, or its cash once it has 5 payments of its own — D63); otherwise the accepted-quote return, or cash once the window holds `cash_evidence.min_payments` payments.
178946
179591
  * @enum {string}
178947
179592
  */
178948
- basis: "accepted" | "cash";
179593
+ basis: "accepted" | "cash" | "expected";
178949
179594
  cash_evidence: {
178950
179595
  payments: number;
178951
179596
  min_payments: number;
@@ -178956,6 +179601,27 @@ interface components {
178956
179601
  days: number;
178957
179602
  min_days: number;
178958
179603
  };
179604
+ /** @description The account’s booking rate from ads. */
179605
+ funnel?: {
179606
+ people: number;
179607
+ booked: number;
179608
+ rate: number;
179609
+ interval: {
179610
+ low: number;
179611
+ high: number;
179612
+ };
179613
+ /** @description Surely under the 10 % clinic floor (D66). */
179614
+ leaking: boolean;
179615
+ } | null;
179616
+ /** @description The clinic economics behind the expected values: cash per evaluated new patient (per Línea and overall) and the show rate. */
179617
+ economics?: {
179618
+ show_rate: number | null;
179619
+ account_value: number | null;
179620
+ by_linea: {
179621
+ linea_id: string;
179622
+ value: number;
179623
+ }[];
179624
+ } | null;
178959
179625
  rows: {
178960
179626
  ad_external_id: string;
178961
179627
  ad_name: string | null;
@@ -179002,11 +179668,80 @@ interface components {
179002
179668
  first_payment_return: number | null;
179003
179669
  /** @description The spend of the people window ÷ `people` (CLP) — the same division as a campaign’s «por persona». */
179004
179670
  cost_per_person: number | null;
179005
- };
179671
+ /** @description The expected value of the ad’s bookings ÷ spend (×, D63): bookings × its Línea’s cash per evaluated new patient × the clinic’s show rate. */
179672
+ expected_return?: number | null;
179673
+ /** @description Spend ÷ bookings (CLP, «costo por cita agendada»). */
179674
+ cost_per_booking?: number | null;
179675
+ };
179676
+ /** @description The Línea the clinic’s rules place the ad in (D53). */
179677
+ linea_id?: string | null;
179678
+ /** @description How sure Vitrina is about the ad and what its bookings are worth (D63/D64): bookings first, cash once the ad has 5 payments of its own. */
179679
+ judgement?: {
179680
+ /** @description booked ÷ people (0–1). */
179681
+ booking_rate: number | null;
179682
+ /** @description 95 % Wilson interval of the booking rate. */
179683
+ booking_interval: {
179684
+ low: number;
179685
+ high: number;
179686
+ } | null;
179687
+ /** @description The other ads of its Línea (or of the account when the Línea has too few people) the ad is judged against. */
179688
+ comparator: {
179689
+ rate: number;
179690
+ people: number;
179691
+ booked: number;
179692
+ median: number | null;
179693
+ /** @enum {string} */
179694
+ source: "linea" | "account";
179695
+ } | null;
179696
+ /** @description people × the comparator’s booking rate. */
179697
+ expected_bookings: number | null;
179698
+ /** @description Zero bookings: how sure a pause is. */
179699
+ pause: {
179700
+ /**
179701
+ * @description `seguro` · `probable` · `falta_data` (with ≈ `people_needed` more people) — D64, never a fixed floor.
179702
+ * @enum {string}
179703
+ */
179704
+ confidence: "seguro" | "probable" | "falta_data";
179705
+ people_needed: number | null;
179706
+ } | null;
179707
+ /** @description Bookings: how sure a scale is. */
179708
+ scale: {
179709
+ /**
179710
+ * @description `seguro` · `probable` · `falta_data` (with ≈ `people_needed` more people) — D64, never a fixed floor.
179711
+ * @enum {string}
179712
+ */
179713
+ confidence: "seguro" | "probable" | "falta_data";
179714
+ people_needed: number | null;
179715
+ } | null;
179716
+ cost_per_booking: number | null;
179717
+ expected_value: number | null;
179718
+ /** @description The Línea’s cash per evaluated new patient used (CLP). */
179719
+ value_per_patient: number | null;
179720
+ /** @enum {string|null} */
179721
+ judged_on: "cash" | "expected" | null;
179722
+ } | null;
179723
+ /** @description D67: the creative’s own signals (the engine’s feature store) — context for the verdict, never part of it. */
179724
+ signals?: {
179725
+ frequency: number | null;
179726
+ days_active: number | null;
179727
+ /** @description % (null for an image ad). */
179728
+ hook_rate: number | null;
179729
+ /** @description % (null for an image ad). */
179730
+ thumb_stop_rate: number | null;
179731
+ /** @description Link CTR, %. */
179732
+ ctr: number | null;
179733
+ } | null;
179734
+ /** @description D67: where the ad loses people, read from its signals against the account’s median. */
179735
+ explanation?: {
179736
+ /** @enum {string|null} */
179737
+ story: "after_click" | "filters_well" | "creative_first" | "tired" | null;
179738
+ /** @description One Spanish sentence. */
179739
+ text: string | null;
179740
+ } | null;
179006
179741
  /** @description The metric that RANKED the ad — the accepted-quote return, or (with `cash_evidence.used_for_ranking`) the better of it and the cash return. A surface naming the winner displays exactly this metric. */
179007
179742
  lead: {
179008
179743
  /** @enum {string} */
179009
- metric: "accepted" | "cash";
179744
+ metric: "accepted" | "cash" | "expected";
179010
179745
  value: number | null;
179011
179746
  };
179012
179747
  /** @description 1 = the best ad; null = not ranked (too little spend or people). */
@@ -179020,6 +179755,133 @@ interface components {
179020
179755
  }[];
179021
179756
  best_ad_external_id: string | null;
179022
179757
  };
179758
+ AdsByLinea: {
179759
+ window: {
179760
+ from: string;
179761
+ to: string;
179762
+ days: number;
179763
+ };
179764
+ coverage: components["schemas"]["AdsCoverage"] & (Record<string, never> | null);
179765
+ /** @description Every live Línea (even with no ads), then «Sin línea» when it holds any. */
179766
+ lineas: {
179767
+ /**
179768
+ * Format: uuid
179769
+ * @description `null` = «Sin línea»: ads no rule places.
179770
+ */
179771
+ linea_id: string | null;
179772
+ nombre: string | null;
179773
+ /** @description Ads of the window that belong here. */
179774
+ ads: number;
179775
+ /** @description Spend (CLP); null = unread. */
179776
+ spend: number | null;
179777
+ /** @description People whose first message came from these ads. */
179778
+ people: number | null;
179779
+ booked: number | null;
179780
+ attended: number | null;
179781
+ /** @description Accepted presupuestos / closed sales — pipeline, never cash. */
179782
+ accepted: {
179783
+ count: number;
179784
+ value: number;
179785
+ } | null;
179786
+ /** @description Attributed cash (CLP): first payment + later payments. */
179787
+ cash: {
179788
+ first: number;
179789
+ recurring: number;
179790
+ total: number;
179791
+ payments: number;
179792
+ } | null;
179793
+ ratios: {
179794
+ /** @description Accepted presupuestos / closed sales ÷ spend (×). */
179795
+ accepted_return: number | null;
179796
+ /** @description Cash (first + recurring payments) ÷ spend (×). */
179797
+ cash_return: number | null;
179798
+ /** @description First-payment cash ÷ spend (×). */
179799
+ first_payment_return: number | null;
179800
+ /** @description The spend of the people window ÷ `people` (CLP) — the same division as a campaign’s «por persona». */
179801
+ cost_per_person: number | null;
179802
+ /** @description The expected value of the ad’s bookings ÷ spend (×, D63): bookings × its Línea’s cash per evaluated new patient × the clinic’s show rate. */
179803
+ expected_return?: number | null;
179804
+ /** @description Spend ÷ bookings (CLP, «costo por cita agendada»). */
179805
+ cost_per_booking?: number | null;
179806
+ };
179807
+ }[];
179808
+ /** @description The scorecard’s own totals: the Líneas plus «Sin línea» add up to it. */
179809
+ totals: {
179810
+ /** @description Ads of the window that belong here. */
179811
+ ads: number;
179812
+ /** @description Spend (CLP); null = unread. */
179813
+ spend: number | null;
179814
+ /** @description People whose first message came from these ads. */
179815
+ people: number | null;
179816
+ booked: number | null;
179817
+ attended: number | null;
179818
+ /** @description Accepted presupuestos / closed sales — pipeline, never cash. */
179819
+ accepted: {
179820
+ count: number;
179821
+ value: number;
179822
+ } | null;
179823
+ /** @description Attributed cash (CLP): first payment + later payments. */
179824
+ cash: {
179825
+ first: number;
179826
+ recurring: number;
179827
+ total: number;
179828
+ payments: number;
179829
+ } | null;
179830
+ ratios: {
179831
+ /** @description Accepted presupuestos / closed sales ÷ spend (×). */
179832
+ accepted_return: number | null;
179833
+ /** @description Cash (first + recurring payments) ÷ spend (×). */
179834
+ cash_return: number | null;
179835
+ /** @description First-payment cash ÷ spend (×). */
179836
+ first_payment_return: number | null;
179837
+ /** @description The spend of the people window ÷ `people` (CLP) — the same division as a campaign’s «por persona». */
179838
+ cost_per_person: number | null;
179839
+ /** @description The expected value of the ad’s bookings ÷ spend (×, D63): bookings × its Línea’s cash per evaluated new patient × the clinic’s show rate. */
179840
+ expected_return?: number | null;
179841
+ /** @description Spend ÷ bookings (CLP, «costo por cita agendada»). */
179842
+ cost_per_booking?: number | null;
179843
+ };
179844
+ };
179845
+ /** @description D65 · the monthly and Monday split across Líneas against agenda capacity: best next peso first, each up to its current pace +20 % and never past what its free hours can take; a Línea with no hours gets $0. */
179846
+ plan?: {
179847
+ /** @description The account’s spend of the last 30 days (major units). */
179848
+ month_budget: number;
179849
+ week_budget: number;
179850
+ /** @description What no Línea can take this month (no hours, under 1×, capacity reached). */
179851
+ unallocated_month: number;
179852
+ lineas: {
179853
+ /** Format: uuid */
179854
+ linea_id: string;
179855
+ nombre: string;
179856
+ spend: number;
179857
+ /** @description That spend as a month. */
179858
+ pace_month: number;
179859
+ booked: number;
179860
+ cost_per_booking: number | null;
179861
+ /** @description Its ads’ cash (with 5 own payments) or expected value ÷ spend. */
179862
+ return: number | null;
179863
+ /** @description The return of its best ad with evidence — what the next peso earns; orders the split. */
179864
+ marginal_return: number | null;
179865
+ /** @description The agenda of the Línea’s professionals; `null` = unknown (never caps). */
179866
+ capacity: {
179867
+ free_minutes_14: number;
179868
+ visit_minutes: number;
179869
+ next_slot_day: string | null;
179870
+ slots_month: number;
179871
+ slots_week: number;
179872
+ bottleneck: boolean;
179873
+ } | null;
179874
+ /** @description Suggested budget for the month. */
179875
+ month: number;
179876
+ /** @description Suggested budget for this week (Monday). */
179877
+ week: number;
179878
+ /** @enum {string} */
179879
+ reason: "capacity" | "value" | "no_hours" | "low_return" | "no_data" | "no_ads";
179880
+ /** @description A usable hour within 7 days: the «reanudar» moment. */
179881
+ reopens_on: string | null;
179882
+ }[];
179883
+ } | null;
179884
+ };
179023
179885
  AdsPeopleFunnel: {
179024
179886
  window: {
179025
179887
  from: string;
@@ -179541,7 +180403,7 @@ interface components {
179541
180403
  /** @description `<kind>:<target external id>:<YYYY-MM-DD>` — a composite key, stable for a day. */
179542
180404
  key: string;
179543
180405
  /** @enum {string} */
179544
- kind: "pause_ad" | "campaign_pause" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "send_setup" | "send_stage" | "send_dataset" | "send_stop" | "send_protected_move" | "nav";
180406
+ kind: "pause_ad" | "campaign_pause" | "adset_pause" | "ad_resume" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "send_setup" | "send_stage" | "send_dataset" | "send_stop" | "send_protected_move" | "nav";
179545
180407
  screen: ("resumen" | "campanas" | "creativos" | "salud" | "envio")[];
179546
180408
  /** @description The one card the rail leads with. */
179547
180409
  primary: boolean;
@@ -179578,7 +180440,7 @@ interface components {
179578
180440
  campaign_name: string | null;
179579
180441
  }[];
179580
180442
  };
179581
- /** @description The engine’s own vocabulary, e.g. `{ budget_change_pct: 20 }`. `url_tags_fix`: `{ ads: [{ external_id, expected_url_tags, url_tags }] }` — each ad’s current parameters (null = none) and exactly what it gets. «Enviar a Meta»: `send_setup`/`send_dataset` `{ dataset_id }`, `send_stage` `{ stage, enabled, meta_event, active_ad_sets }`. `campaign_pause`: `{ period_spend, period_days, delivering_ads_count, avg_daily_spend_7d }` — the campaign’s spend in the listed period (the account currency’s major units), the period’s days and its delivering ads, what the card draws at rest (spend → 0, ~spend/days a day); `avg_daily_spend_7d` is the live 7-day daily mean the preview shows (`AdsMoney`: exact decimal + currency), `null` when the list could not know it (real mode reads it only at preview) — fall back to `period_spend / period_days`, labelled as the period. Agenda capacity (clinics): a `nav` card with `params.card = "capacity_bottleneck"` REPLACES an ad's «Pausar» (`variant: "pause"`) or a «Subir» (`variant: "budget"`) when the specialty the ad books has no usable hour for more than 7 days (or under 2 bookable hours in 14): `{ card, variant, especialidad, mapping_source: "map" | "booked" | "name", unmapped: false, next_slot_day, searched_through, free_minutes_14, booked_minutes_14, fill_14, visit_minutes, evaluation_price, price_above_median, people, booked, booking_rate, median_booking_rate, waitlist_30d }` — counts, minutes and dates, never a probability; `waitlist_30d` = people waiting now for that specialty (the clinic waitlist demand feed), `null` when the feed is absent or 0 — the card then carries no «N personas esperan hora con X hoy» sentence. A `pause_ad` whose ad books an unknown specialty carries `params.capacity = { unmapped: true }` (ask which specialty; `tenant.settings.ads.specialty_map`). */
180443
+ /** @description The engine’s own vocabulary, e.g. `{ budget_change_pct: 20 }`. `url_tags_fix`: `{ ads: [{ external_id, expected_url_tags, url_tags }] }` — each ad’s current parameters (null = none) and exactly what it gets. «Enviar a Meta»: `send_setup`/`send_dataset` `{ dataset_id }`, `send_stage` `{ stage, enabled, meta_event, active_ad_sets }`. `campaign_pause`: `{ period_spend, period_days, delivering_ads_count, avg_daily_spend_7d }` — the campaign’s spend in the listed period (the account currency’s major units), the period’s days and its delivering ads, what the card draws at rest (spend → 0, ~spend/days a day); `avg_daily_spend_7d` is the live 7-day daily mean the preview shows (`AdsMoney`: exact decimal + currency), `null` when the list could not know it (real mode reads it only at preview) — fall back to `period_spend / period_days`, labelled as the period. `adset_pause` (D62): `{ ad_ids, period_spend, share, booking_rate, sibling_ad_set, sibling_booking_rate, budget_level }` — the ad set’s delivering ads (bound into the approval: only those the preview read as showing), its share of the campaign’s spend and its booking rate vs its best sibling’s; with a campaign budget Meta moves the money to the sibling. A `nav` card with `params.card = "campaign_budget"` is a scale on a campaign that owns its budget: `{ campaign_external_id, daily_budget, new_daily_budget, step_pct }` — the change is made in Meta (`href`). `params.card = "funnel_leak"` (D66): the account books under 10 % of the people who write from ads — `{ people, booked, booking_rate, booking_interval, benchmark, by_ad }`. Agenda capacity (clinics): a `nav` card with `params.card = "capacity_bottleneck"` REPLACES an ad's «Pausar» (`variant: "pause"`) or a «Subir» (`variant: "budget"`) when the specialty the ad books has no usable hour for more than 7 days (or under 2 bookable hours in 14): `{ card, variant, especialidad, mapping_source: "map" | "booked" | "name", unmapped: false, next_slot_day, searched_through, free_minutes_14, booked_minutes_14, fill_14, visit_minutes, evaluation_price, price_above_median, people, booked, booking_rate, median_booking_rate, waitlist_30d }` — counts, minutes and dates, never a probability; `waitlist_30d` = people waiting now for that specialty (the clinic waitlist demand feed), `null` when the feed is absent or 0 — the card then carries no «N personas esperan hora con X hoy» sentence. A `pause_ad` whose ad books an unknown specialty carries `params.capacity = { unmapped: true }` (ask which specialty; `tenant.settings.ads.specialty_map`). */
179582
180444
  params: {
179583
180445
  [key: string]: unknown;
179584
180446
  };
@@ -179588,7 +180450,7 @@ interface components {
179588
180450
  /** @description Which operation executes it; `null` for `nav`. */
179589
180451
  engine_ref: {
179590
180452
  /** @enum {string} */
179591
- op: "recommendations.apply" | "ads.pause" | "campaigns.pause" | "campaigns.resume" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo" | "send.setup" | "send.dataset" | "send.stage" | "send.stop" | "send.restore";
180453
+ op: "recommendations.apply" | "ads.pause" | "ads.pause_set" | "ads.resume" | "ads.resume_set" | "adsets.budget" | "campaigns.pause" | "campaigns.resume" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo" | "send.setup" | "send.dataset" | "send.stage" | "send.stop" | "send.restore";
179592
180454
  recommendation_id?: string;
179593
180455
  } | null;
179594
180456
  /** @description `nav` only: a workspace-relative path (`/anuncios/atribuidos?c=…`, `/anuncios/activar?paso=tag`), or an absolute Meta Ads Manager URL built from Meta ids (`https://www.facebook.com/adsmanager/…`) — open it in a new tab; it changes nothing by itself. */
@@ -179596,6 +180458,12 @@ interface components {
179596
180458
  cta?: string;
179597
180459
  /** @description Fact keys the card is built from. */
179598
180460
  facts: string[];
180461
+ /** @description How sure the per-ad verdict behind a pause / scale card is (D64): «seguro», «probable», or «falta data» with ≈ `people_needed` more people. Absent on cards that rest on no per-ad verdict. */
180462
+ confidence?: {
180463
+ /** @enum {string} */
180464
+ level: "seguro" | "probable" | "falta_data";
180465
+ people_needed: number | null;
180466
+ };
179599
180467
  dismissed_until: string | null;
179600
180468
  /**
179601
180469
  * @description Set on a listed action that cannot run yet — show it disabled. `consent_pending`: its consent text is not published yet (`send_protected_move`, the move of the ad sets onto the protected dataset of a restricted clinic dataset).
@@ -179673,7 +180541,7 @@ interface components {
179673
180541
  } | null;
179674
180542
  reversible: boolean;
179675
180543
  /** @enum {string|null} */
179676
- engine_op: "recommendations.apply" | "ads.pause" | "campaigns.pause" | "campaigns.resume" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo" | "send.setup" | "send.dataset" | "send.stage" | "send.stop" | "send.restore" | null;
180544
+ engine_op: "recommendations.apply" | "ads.pause" | "ads.pause_set" | "ads.resume" | "ads.resume_set" | "adsets.budget" | "campaigns.pause" | "campaigns.resume" | "wiring.ad_sets" | "quality.utm_refresh" | "wiring.recheck" | "actions.rollback" | "quality.url_tags_apply" | "quality.url_tags_undo" | "send.setup" | "send.dataset" | "send.stage" | "send.stop" | "send.restore" | null;
179677
180545
  /** @description `campaign_pause` only: the line the sheet leads with — «Pausar «{campaign}» · detiene {n} anuncios · ~$X al día» (the count and the daily figure are dropped when unknown). */
179678
180546
  summary?: string;
179679
180547
  campaign?: components["schemas"]["AdsCampaignPauseSnapshot"];
@@ -179683,7 +180551,7 @@ interface components {
179683
180551
  id: string;
179684
180552
  action_key: string;
179685
180553
  /** @enum {string} */
179686
- kind: "pause_ad" | "campaign_pause" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "send_setup" | "send_stage" | "send_dataset" | "send_stop";
180554
+ kind: "pause_ad" | "campaign_pause" | "adset_pause" | "ad_resume" | "budget_change" | "adset_duplicate_swap" | "utm_refresh" | "wiring_recheck" | "url_tags_fix" | "send_setup" | "send_stage" | "send_dataset" | "send_stop";
179687
180555
  /** @enum {string} */
179688
180556
  status: "queued" | "running" | "succeeded" | "failed" | "refused" | "rolled_back";
179689
180557
  target: {
@@ -180025,7 +180893,7 @@ interface components {
180025
180893
  * @description The outcome stage. `first_payment` = a clinic’s first payment of an accepted plan («Primer pago»), the Purchase Meta receives after the switch. `web_form` = a landing-page form a connected CRM reported («Formulario web»); `checkout_started` = the person opened a Vitrina payment link («Abrió el link de pago»); `deposit_paid` = a deposit (booking, evaluation or reservation) fully paid («Abono pagado»).
180026
180894
  * @enum {string}
180027
180895
  */
180028
- stage: "lead_created" | "web_form" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
180896
+ stage: "lead_created" | "web_form" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "returning_first_payment" | "payment_received";
180029
180897
  /**
180030
180898
  * @description Which system recorded the outcome: `vitrina` — Vitrina itself (a conversation, a booking, a payment it registered); `gohighlevel` / `mercadopago` — the provider the workspace connected reported it to the attribution engine (a Website ad’s form, booking or payment), and Vitrina lists it. Such a row may have no contact (`contact.id` `""`): a healthcare workspace’s provider events never carry the person.
180031
180899
  * @enum {string}
@@ -180123,7 +180991,7 @@ interface components {
180123
180991
  * @description The outcome stage of a recorded step (the vocabulary key); `null` on a touch. `first_payment` is a plan’s first payment (shown once, in place of that payment’s `payment_received`).
180124
180992
  * @enum {string|null}
180125
180993
  */
180126
- stage: "lead_created" | "web_form" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received" | "first_payment" | "returning_first_payment" | null;
180994
+ stage: "lead_created" | "web_form" | "lead_qualified" | "appointment_booked" | "checkout_started" | "deposit_paid" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received" | "first_payment" | "returning_first_payment" | null;
180127
180995
  /** @description Ready to render, in the workspace’s own vocabulary. */
180128
180996
  label: string;
180129
180997
  detail: string | null;