@vitrina/api 17.80.0 → 17.82.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 +905 -10
- package/dist/index.d.ts +905 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10496,7 +10496,7 @@ interface paths {
|
|
|
10496
10496
|
name: string;
|
|
10497
10497
|
/** Format: uuid */
|
|
10498
10498
|
tenant_id?: string;
|
|
10499
|
-
scopes: ("ai_agents:read" | "ai_agents:write" | "ai_agents:simulate" | "conversations:read" | "conversations:write" | "contacts:read" | "contacts:write" | "tickets:read" | "tickets:write" | "tickets:claim" | "leads:read" | "leads:write" | "leads:intake" | "pipelines:read" | "pipelines:write" | "stages:read" | "stages:write" | "functions:read" | "functions:write" | "kb:read" | "kb:write" | "messages:read" | "messages:write" | "messages:send" | "tools:read" | "tags:read" | "tags:write" | "api_keys:read" | "api_keys:write" | "personal_tokens:read" | "personal_tokens:write" | "notifications:read" | "notifications:write" | "audit:read" | "analytics:read" | "analytics:write" | "dealer_reports:read" | "tenant:read" | "tenant:write" | "tenant:delete" | "webhooks:read" | "webhooks:write" | "messaging_accounts:read" | "messaging_accounts:write" | "provisioning:read" | "provisioning:write" | "voice_drift:read" | "worker_failures:read" | "worker_failures:write" | "dealer_sites:read" | "dealer_sites:write" | "mcp_servers:read" | "mcp_servers:write" | "memberships:read" | "memberships:write" | "teams:read" | "teams:write" | "help_centers:read" | "help_centers:write" | "labels:read" | "labels:write" | "macros:read" | "macros:write" | "slas:read" | "slas:write" | "routing:read" | "routing:write" | "triggers:read" | "triggers:write" | "followups:read" | "followups:write" | "followups:manage" | "custom_attributes:read" | "custom_attributes:write" | "companies:read" | "companies:write" | "roles:read" | "roles:write" | "integrations:read" | "integrations:write" | "clinic:read" | "clinic:write" | "clinic:delete" | "clinic_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_consent:read" | "clinic_consent:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_price_override:write" | "clinic_commission_own:read" | "clinic_chair_money:write" | "clinic_patient_contact:read" | "clinic_insights:read" | "finanzas:read" | "finanzas:write" | "finanzas_reports:read" | "finanzas:export" | "finanzas_admin:write" | "finanzas_patients:read" | "finanzas_payroll:read" | "sandbox:read" | "sandbox:write" | "ads:read" | "ads:write" | "healthatom:read" | "healthatom:write" | "reservo:read" | "reservo:write" | "rexplus:read" | "rexplus:write" | "billing:read" | "billing:write" | "copilot:read" | "copilot:write" | "erp_copilot:use" | "tool_credentials:read" | "tool_credentials:write" | "tool_invocations:read" | "corrections:read" | "corrections:write" | "marketplace:read" | "marketplace:write" | "stock:read" | "storefront_events:write" | "pricing:read" | "pricing:write" | "roi:read" | "appointments:read" | "appointments:write" | "appointments:delete" | "schedule_config:write" | "appointments:intake" | "appointment_types:read" | "appointment_types:write" | "service_lifecycle:read" | "service_lifecycle:write" | "outbound_approvals:read" | "outbound_approvals:write" | "outbound_holds:read" | "outbound_holds:write" | "campaigns:read" | "campaigns:write" | "consignments:read" | "consignments:write" | "stock_dedup:read" | "stock_dedup:write" | "stock_photo_mirror:read" | "stock_photo_mirror:write" | "stock_retirement:read" | "stock_retirement:write" | "dealership_economics:read" | "dealership_economics:write" | "document_templates:read" | "document_templates:write" | "vehicle_registry:read" | "vehicle_registry:write" | "vehicle_pipeline:read" | "vehicle_pipeline:write" | "sale_notes:read" | "sale_notes:write" | "sale_notes:void" | "transfer_cases:read" | "transfer_cases:write" | "credit_applications:read" | "credit_applications:write" | "seller_compensation:read" | "seller_compensation:write" | "sales_leaderboard:read" | "quotes:read" | "quotes:write" | "quotes:void" | "reservations:read" | "reservations:write" | "reservations:void" | "reservations:dispose_abono" | "organization_legal:read" | "organization_legal:write" | "purchase_notes:read" | "purchase_notes:write" | "purchase_notes:void" | "document_payments:read" | "document_payments:write" | "tenant_bank_accounts:read" | "tenant_bank_accounts:write" | "bank_movements:read" | "bank_movements:write" | "payments:read" | "payments:write" | "payments:reverse" | "promo_codes:write" | "orders:read" | "orders:write" | "orders:checkout" | "orders:refund" | "price_approval:read" | "price_approval:request" | "price_approval:approve" | "cotizacion_discount:approve" | "legal:read" | "legal:write")[];
|
|
10499
|
+
scopes: ("ai_agents:read" | "ai_agents:write" | "ai_agents:simulate" | "conversations:read" | "conversations:write" | "contacts:read" | "contacts:write" | "tickets:read" | "tickets:write" | "tickets:claim" | "leads:read" | "leads:write" | "leads:intake" | "pipelines:read" | "pipelines:write" | "stages:read" | "stages:write" | "functions:read" | "functions:write" | "kb:read" | "kb:write" | "messages:read" | "messages:write" | "messages:send" | "tools:read" | "tags:read" | "tags:write" | "api_keys:read" | "api_keys:write" | "personal_tokens:read" | "personal_tokens:write" | "notifications:read" | "notifications:write" | "my_clinics:read" | "my_clinics:write" | "audit:read" | "analytics:read" | "analytics:write" | "dealer_reports:read" | "tenant:read" | "tenant:write" | "tenant:delete" | "webhooks:read" | "webhooks:write" | "messaging_accounts:read" | "messaging_accounts:write" | "provisioning:read" | "provisioning:write" | "voice_drift:read" | "worker_failures:read" | "worker_failures:write" | "dealer_sites:read" | "dealer_sites:write" | "mcp_servers:read" | "mcp_servers:write" | "memberships:read" | "memberships:write" | "teams:read" | "teams:write" | "help_centers:read" | "help_centers:write" | "labels:read" | "labels:write" | "macros:read" | "macros:write" | "slas:read" | "slas:write" | "routing:read" | "routing:write" | "triggers:read" | "triggers:write" | "followups:read" | "followups:write" | "followups:manage" | "custom_attributes:read" | "custom_attributes:write" | "companies:read" | "companies:write" | "roles:read" | "roles:write" | "integrations:read" | "integrations:write" | "clinic:read" | "clinic:write" | "clinic:delete" | "clinic_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_consent:read" | "clinic_consent:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_price_override:write" | "clinic_commission_own:read" | "clinic_chair_money:write" | "clinic_patient_contact:read" | "clinic_insights:read" | "finanzas:read" | "finanzas:write" | "finanzas_reports:read" | "finanzas:export" | "finanzas_admin:write" | "finanzas_patients:read" | "finanzas_payroll:read" | "sandbox:read" | "sandbox:write" | "ads:read" | "ads:write" | "healthatom:read" | "healthatom:write" | "reservo:read" | "reservo:write" | "rexplus:read" | "rexplus:write" | "billing:read" | "billing:write" | "copilot:read" | "copilot:write" | "erp_copilot:use" | "tool_credentials:read" | "tool_credentials:write" | "tool_invocations:read" | "corrections:read" | "corrections:write" | "marketplace:read" | "marketplace:write" | "stock:read" | "storefront_events:write" | "pricing:read" | "pricing:write" | "roi:read" | "appointments:read" | "appointments:write" | "appointments:delete" | "schedule_config:write" | "appointments:intake" | "appointment_types:read" | "appointment_types:write" | "service_lifecycle:read" | "service_lifecycle:write" | "outbound_approvals:read" | "outbound_approvals:write" | "outbound_holds:read" | "outbound_holds:write" | "campaigns:read" | "campaigns:write" | "consignments:read" | "consignments:write" | "stock_dedup:read" | "stock_dedup:write" | "stock_photo_mirror:read" | "stock_photo_mirror:write" | "stock_retirement:read" | "stock_retirement:write" | "dealership_economics:read" | "dealership_economics:write" | "document_templates:read" | "document_templates:write" | "vehicle_registry:read" | "vehicle_registry:write" | "vehicle_pipeline:read" | "vehicle_pipeline:write" | "sale_notes:read" | "sale_notes:write" | "sale_notes:void" | "transfer_cases:read" | "transfer_cases:write" | "credit_applications:read" | "credit_applications:write" | "seller_compensation:read" | "seller_compensation:write" | "sales_leaderboard:read" | "quotes:read" | "quotes:write" | "quotes:void" | "reservations:read" | "reservations:write" | "reservations:void" | "reservations:dispose_abono" | "organization_legal:read" | "organization_legal:write" | "purchase_notes:read" | "purchase_notes:write" | "purchase_notes:void" | "document_payments:read" | "document_payments:write" | "tenant_bank_accounts:read" | "tenant_bank_accounts:write" | "bank_movements:read" | "bank_movements:write" | "payments:read" | "payments:write" | "payments:reverse" | "promo_codes:write" | "orders:read" | "orders:write" | "orders:checkout" | "orders:refund" | "price_approval:read" | "price_approval:request" | "price_approval:approve" | "cotizacion_discount:approve" | "legal:read" | "legal:write")[];
|
|
10500
10500
|
/** Format: date-time */
|
|
10501
10501
|
expires_at?: string;
|
|
10502
10502
|
/** @description false mints an `sk_test_` key bound to this workspace's sandbox (409 SANDBOX_NOT_PROVISIONED when it has none yet). Default true. */
|
|
@@ -18707,6 +18707,8 @@ interface paths {
|
|
|
18707
18707
|
*
|
|
18708
18708
|
* **Publish in the same call (`publish_to`).** Optional. Name the marketplaces this vehicle should go to — portal slugs such as `chileautos` / `mercadolibre`, or integration ids from GET /marketplaces — and it is published right after it is saved, through the same path as POST /vehicles/{id}/publish. Omitted or `[]` saves only; there is no default. Every entry is validated first: a portal with no connected account, a slug matching several accounts, or an id from another workspace answers **422 and nothing is saved**. Once saved, the vehicle stays saved: a portal that fails to publish is an `error` entry in `publications`, never a failed request (still 201). The response then carries `publications`, one `PublishOutcome` per account (`published`, `pending` for queued transports such as `chileautos_panel`, `already_published`, or `error` with the reason). `publications` is absent when `publish_to` was not sent.
|
|
18709
18709
|
*
|
|
18710
|
+
* **Costo de compra in the same call (`purchase_cost_clp`).** Optional (vitrina-app#7719). The amount the dealership paid, recorded as the car’s Costo de compra exactly as `POST /vehicle-acquisitions` with `kind: "compra"` would; `invoice_includes_iva: true` says it includes IVA («Compra con factura»). Needs `dealership_economics:write`: without it the call is a **403 and nothing is saved**. The response then carries `acquisition` (the recorded row, the same shape `POST /vehicle-acquisitions` returns, shown only to callers holding `dealership_economics:read`); `acquisition: null` means the car was saved but its cost was not, and it can be typed on the car’s page. Both fields are create-only.
|
|
18711
|
+
*
|
|
18710
18712
|
* **Sanity range.** A price fans out to every connected portal, so a typo is stopped here. `price_amount` must be between 100.000 and 2.000.000.000 CLP (a UF price is bounded at the day's UF; other currencies are not bounded) and `odometer_value` between 0 and 2.000.000; `null` clears either and is always accepted. Outside the range: **422 `VEHICLE_VALUE_OUT_OF_RANGE`**, with a Spanish `message`, `field_errors.<field>` and `details.violations[]` (`field`, `reason` = `price_out_of_range` | `km_out_of_range`, `value`, `min`, `max`, `currency`). A price change beyond 10x up or down from the current price answers **422 `PRICE_CHANGE_CONFIRMATION_REQUIRED`** (`details.reason` = `large_price_change`, `current_price`, `requested_price`, `currency`, `factor`, `confirm_flag`) unless the body carries `confirm_large_price_change: true`; ask the user, then resend the same body with it. Nothing is written on either 422.
|
|
18711
18713
|
*
|
|
18712
18714
|
* **Normalization and `catalog_match`.** On create and update, `make` and `model` that equal an entry of GET /vehicles/catalog/brands and /catalog/models up to case, accents, spaces and hyphens are stored in the catalog's spelling ("toyota" → "Toyota", "mercedes benz" → "Mercedes-Benz", "rav 4" → "RAV4"); `fuel_type`, `gear_type` and `body_style` are stored as vocabulary codes ("Bencina" → `gasolina`, "Automática" → `automatica`, "Station Wagon" → `wagon`; codes: fuel `gasolina|diesel|hibrido|electrico|gnc|glp|otro`, gear `mecanica|automatica|otro`, body `sedan|hatchback|suv|camioneta|coupe|wagon|furgon|convertible|minivan|otro`; for `vehicle_type: moto` body_style is the «Tipo de moto» instead: `moto_calle|moto_deportiva|moto_touring|moto_trail|moto_enduro|moto_scooter|moto_custom|moto_cuatrimoto|moto_otro`, and "Trail" / "BODY.MOTORCYCLE.TRAIL" snap to `moto_trail`). Nothing is invented: a value with no match is stored exactly as sent. The response (and GET /vehicles/{id}) carries `catalog_match`: `make` / `model` are `matched` | `unmatched` | `missing` (`not_applicable` for a non-`auto` vehicle_type); `version` adds `approximate` (word overlap with a catalog version, same displacement) and `catalog_version` names the catalog version it matched or most resembles; `fuel_type` / `gear_type` / `body_style` are `matched` | `unmatched` | `missing`; `warnings[]` lists `{ field, code, message }` for everything not matched, with a Spanish `message` ready to show (codes: `make_missing`, `make_not_in_catalog`, `model_missing`, `model_not_in_catalog`, `version_approximate`, `version_not_in_catalog`, `fuel_type_not_recognized`, `gear_type_not_recognized`, `body_style_not_recognized`). A make or model that is not matched still saves, but Chileautos publishes it without a technical sheet (ficha). `catalog_match` is null only when the catalog could not be loaded. Example of an unmatched push: {"make":"matched","model":"unmatched","version":"unmatched","catalog_version":null,"fuel_type":"unmatched","gear_type":"matched","body_style":"missing","warnings":[{"field":"model","code":"model_not_in_catalog","message":"Modelo 'Rav-4 xx' no está en el catálogo de Toyota (GET /vehicles/catalog/models); Chileautos lo publicará sin ficha."},{"field":"fuel_type","code":"fuel_type_not_recognized","message":"Combustible 'Hidrógeno' no se reconoce; valores aceptados: gasolina, diesel, hibrido, electrico, gnc, glp, otro."}]}
|
|
@@ -18817,6 +18819,10 @@ interface paths {
|
|
|
18817
18819
|
* ]
|
|
18818
18820
|
*/
|
|
18819
18821
|
publish_to?: string[];
|
|
18822
|
+
/** @description Costo de compra del auto en pesos, opcional. Se registra en la misma llamada como el costo de compra del auto (lo mismo que `POST /vehicle-acquisitions` con `kind: "compra"`). Necesita el permiso `dealership_economics:write`; sin él la llamada responde 403 y no crea el auto. */
|
|
18823
|
+
purchase_cost_clp?: number;
|
|
18824
|
+
/** @description «Compra con factura (incluye IVA)» para `purchase_cost_clp`. Opcional, por defecto false. Con true el monto incluye IVA y el costo de compra queda sin IVA. */
|
|
18825
|
+
invoice_includes_iva?: boolean;
|
|
18820
18826
|
};
|
|
18821
18827
|
};
|
|
18822
18828
|
};
|
|
@@ -50154,7 +50160,7 @@ interface paths {
|
|
|
50154
50160
|
put?: never;
|
|
50155
50161
|
/**
|
|
50156
50162
|
* Record how a unit arrived, or its bare Costo de compra
|
|
50157
|
-
* @description Two shapes. (1) THE BARE COSTO DE COMPRA (vitrina-app#7612): `{ vehicle_id, kind: "compra", net_clp }` with no document link records what the dealership paid for a car of its own — the
|
|
50163
|
+
* @description Two shapes. (1) THE BARE COSTO DE COMPRA (vitrina-app#7612): `{ vehicle_id, kind: "compra", net_clp }` with no document link records what the dealership paid for a car of its own — the cost field of the profit report, of the car’s page and of the new-car form. `net_clp` is the amount typed: the total paid, unless `invoice_includes_iva: true` («Compra con factura (incluye IVA)», vitrina-app#7719) says it includes IVA; then the stored `net_clp` is the amount without IVA, `tax_clp` the IVA, `tax_treatment` afecto and `generates_fiscal_credit` true. A correction resends the tick; without it the cost is the whole amount again. Every response carries `invoice_includes_iva` and `amount_paid_clp` (what was typed) to prefill the field. Defaults: `acquired_on` = the day the car was created in Vitrina (dealership calendar), `tax_treatment` = the car’s IVA regime (the car’s, else the dealership default, else `exento`), `borne_by` = `automotora`, `generates_fiscal_credit` = false, `tax_clp` = null. The SAME call on a car that already has a bare cost replaces its amount and answers 200; a new cost answers 201. When the nota de compra the cost came from was VOIDED, the same call detaches the cost from it (same row, 200, defaults as above, the voided note’s retained cost lines withdrawn) and a later nota de compra can take it over again. 409 with `error.details.code`: `purchase_cost_on_purchase_note` (a live nota de compra: correct it there, `details.purchase_note_id`), `purchase_cost_on_trade_in` (the car came in as parte de pago, `details.sale_note_id`), `purchase_cost_consigned_vehicle` (a consigned car has no purchase cost). The profit report (`GET /margin`) counts the cost on the next read. (2) AN ACQUISITION UNDER ITS DOCUMENT: any kind naming its document (`purchase_note_id`, `consignment_contract_id`, `sale_note_id`); the same defaults and the same tick apply (nothing beyond the car, kind, document and amount is required since vitrina-app#7719), and a second acquisition for one unit is a 409.
|
|
50158
50164
|
*/
|
|
50159
50165
|
post: {
|
|
50160
50166
|
parameters: {
|
|
@@ -50182,7 +50188,7 @@ interface paths {
|
|
|
50182
50188
|
kind: "compra" | "consignacion" | "retoma";
|
|
50183
50189
|
/** Format: uuid */
|
|
50184
50190
|
counterparty_contact_id?: string | null;
|
|
50185
|
-
/** @description Fecha de adquisición.
|
|
50191
|
+
/** @description Fecha de adquisición. Opcional: por defecto el día en que el auto se creó en Vitrina (calendario de la automotora). */
|
|
50186
50192
|
acquired_on?: string;
|
|
50187
50193
|
/** Format: uuid */
|
|
50188
50194
|
purchase_note_id?: string | null;
|
|
@@ -50190,21 +50196,23 @@ interface paths {
|
|
|
50190
50196
|
consignment_contract_id?: string | null;
|
|
50191
50197
|
/** Format: uuid */
|
|
50192
50198
|
sale_note_id?: string | null;
|
|
50193
|
-
/** @description Costo de compra en pesos
|
|
50199
|
+
/** @description Costo de compra en pesos, el monto que escribe la automotora. Sin `invoice_includes_iva` es el costo completo. Con `invoice_includes_iva: true` el monto incluye IVA: se guarda sin IVA en `net_clp` y el IVA en `tax_clp`. */
|
|
50194
50200
|
net_clp: number;
|
|
50195
50201
|
tax_clp?: number | null;
|
|
50196
50202
|
/**
|
|
50197
|
-
* @description
|
|
50203
|
+
* @description Opcional. Por defecto el régimen de IVA del auto (el del auto, si no el de la automotora, si no exento); `afecto` con `invoice_includes_iva`.
|
|
50198
50204
|
* @enum {string}
|
|
50199
50205
|
*/
|
|
50200
50206
|
tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
50201
50207
|
/**
|
|
50202
|
-
* @description
|
|
50208
|
+
* @description Opcional. Por defecto automotora.
|
|
50203
50209
|
* @enum {string}
|
|
50204
50210
|
*/
|
|
50205
50211
|
borne_by?: "automotora" | "cliente";
|
|
50206
|
-
/** @description
|
|
50212
|
+
/** @description Opcional. Por defecto false; true con `invoice_includes_iva`. */
|
|
50207
50213
|
generates_fiscal_credit?: boolean;
|
|
50214
|
+
/** @description «Compra con factura (incluye IVA)». Opcional, por defecto false. Con true el monto de `net_clp` incluye IVA: el costo de compra queda sin IVA, el IVA se guarda aparte (`tax_clp`), la compra queda afecta y con crédito fiscal. Manda sobre `tax_clp`, `tax_treatment` y `generates_fiscal_credit`. Al corregir un costo se manda de nuevo: sin él, el costo vuelve a ser el monto completo. */
|
|
50215
|
+
invoice_includes_iva?: boolean;
|
|
50208
50216
|
};
|
|
50209
50217
|
};
|
|
50210
50218
|
};
|
|
@@ -50234,7 +50242,9 @@ interface paths {
|
|
|
50234
50242
|
* "generates_fiscal_credit": false,
|
|
50235
50243
|
* "created_at": "2026-11-19T15:02:00.000Z",
|
|
50236
50244
|
* "updated_at": "2026-11-19T15:10:00.000Z",
|
|
50237
|
-
* "derived_tenencia": "propio"
|
|
50245
|
+
* "derived_tenencia": "propio",
|
|
50246
|
+
* "invoice_includes_iva": false,
|
|
50247
|
+
* "amount_paid_clp": 8500000
|
|
50238
50248
|
* }
|
|
50239
50249
|
* }
|
|
50240
50250
|
*/
|
|
@@ -50271,7 +50281,9 @@ interface paths {
|
|
|
50271
50281
|
* "generates_fiscal_credit": false,
|
|
50272
50282
|
* "created_at": "2026-11-19T15:02:00.000Z",
|
|
50273
50283
|
* "updated_at": "2026-11-19T15:02:00.000Z",
|
|
50274
|
-
* "derived_tenencia": "propio"
|
|
50284
|
+
* "derived_tenencia": "propio",
|
|
50285
|
+
* "invoice_includes_iva": false,
|
|
50286
|
+
* "amount_paid_clp": 8500000
|
|
50275
50287
|
* }
|
|
50276
50288
|
* }
|
|
50277
50289
|
*/
|
|
@@ -72061,6 +72073,462 @@ interface paths {
|
|
|
72061
72073
|
patch?: never;
|
|
72062
72074
|
trace?: never;
|
|
72063
72075
|
};
|
|
72076
|
+
"/me/clinic-summaries": {
|
|
72077
|
+
parameters: {
|
|
72078
|
+
query?: never;
|
|
72079
|
+
header?: never;
|
|
72080
|
+
path?: never;
|
|
72081
|
+
cookie?: never;
|
|
72082
|
+
};
|
|
72083
|
+
/**
|
|
72084
|
+
* The operating summary of every clinic I belong to
|
|
72085
|
+
* @description vitrina-app#7471 («Mis clínicas»). One row per open, non-sandbox clinic workspace where the caller holds an ACTIVE membership, read from a summary a job stores every 15 minutes (the agenda section at most hourly): WhatsApp health (`whatsapp`), the clinic form first contact (`first_contact`), leads and the reply rate to the first contact (`leads`), and citas and attendance (`agenda`), for the windows `today`, `7d` and `30d` (agenda `7d` and `30d`) cut in each workspace’s own timezone. `agenda` stores two blocks — the clinic’s whole agenda (`clinic`) and the citas booked by the agent (`agent`) — and `agenda.shown` says which one the row displays: `agent` when the clinic has an active AI agent, `clinic` otherwise. Moved citas and citas nobody closed never count as attended. Each section is gated by the caller’s role IN THAT WORKSPACE: `whatsapp` needs `messaging_accounts:read`, `first_contact` `tenant:read`, `leads` `leads:read` and `agenda` `clinic:read` (both with record visibility `all`). A section the role may not read is absent and listed in `withheld`, never zeroed. `signals` («Necesitan atención», #7472) lists what a person must act on in the clinic (kind, severity `critical` / `warning` / `low`, since when, where it is fixed, and non-personal detail), ordered by severity then `since`, limited to the sections the role reads; `top_severity` is the highest severity present. A signal clears itself on the first refresh after it is fixed. A Consultor seat (aggregates only) reads `leads` and `agenda` through the minimum-count floor (`floored: true`). `status: pending` until the first computation; `stale` when older than 30 minutes. Counts only: no patient data and no money, and nothing is summed across clinics. Needs `my_clinics:read` (every built-in role holds it; a personal token without it gets 403). Credentials: a signed-in session reads every clinic it belongs to; a personal token or a connected app (MCP) reads ONLY the workspace it is bound to, within its own scopes (`clinics: []` when that workspace is not a clinic); an API key gets 403. Membership is read at request time with no cache: a removed member loses the row on the next call.
|
|
72086
|
+
*/
|
|
72087
|
+
get: {
|
|
72088
|
+
parameters: {
|
|
72089
|
+
query?: never;
|
|
72090
|
+
header?: never;
|
|
72091
|
+
path?: never;
|
|
72092
|
+
cookie?: never;
|
|
72093
|
+
};
|
|
72094
|
+
requestBody?: never;
|
|
72095
|
+
responses: {
|
|
72096
|
+
/** @description The caller’s clinic summaries */
|
|
72097
|
+
200: {
|
|
72098
|
+
headers: {
|
|
72099
|
+
[name: string]: unknown;
|
|
72100
|
+
};
|
|
72101
|
+
content: {
|
|
72102
|
+
/**
|
|
72103
|
+
* @example {
|
|
72104
|
+
* "data": {
|
|
72105
|
+
* "clinics": [
|
|
72106
|
+
* {
|
|
72107
|
+
* "tenant_id": "0192f1c4-1111-7000-8000-000000000001",
|
|
72108
|
+
* "tenant_name": "Clínica Ejemplo Providencia",
|
|
72109
|
+
* "tenant_slug": "clinica-ejemplo-providencia",
|
|
72110
|
+
* "tenant_logo_url": null,
|
|
72111
|
+
* "role": "admin",
|
|
72112
|
+
* "status": "ready",
|
|
72113
|
+
* "timezone": "America/Santiago",
|
|
72114
|
+
* "computed_at": "2026-11-18T13:15:00.000Z",
|
|
72115
|
+
* "stale": false,
|
|
72116
|
+
* "floored": false,
|
|
72117
|
+
* "compute_errors": [],
|
|
72118
|
+
* "whatsapp": {
|
|
72119
|
+
* "state": "connected",
|
|
72120
|
+
* "accounts": [
|
|
72121
|
+
* {
|
|
72122
|
+
* "messaging_account_id": "0192f1c4-2222-7000-8000-000000000002",
|
|
72123
|
+
* "name": "Recepción",
|
|
72124
|
+
* "enabled": true,
|
|
72125
|
+
* "clinic_form_sender": true,
|
|
72126
|
+
* "health": {
|
|
72127
|
+
* "status": "healthy",
|
|
72128
|
+
* "reason_code": null,
|
|
72129
|
+
* "unhealthy_since": null,
|
|
72130
|
+
* "last_checked_at": "2026-11-18T13:10:00.000Z"
|
|
72131
|
+
* },
|
|
72132
|
+
* "messaging_limit_tier": "TIER_1K",
|
|
72133
|
+
* "quality_rating": "GREEN"
|
|
72134
|
+
* }
|
|
72135
|
+
* ]
|
|
72136
|
+
* },
|
|
72137
|
+
* "first_contact": {
|
|
72138
|
+
* "state": "set_up",
|
|
72139
|
+
* "enabled": true,
|
|
72140
|
+
* "enabled_at": "2026-10-01T12:00:00.000Z",
|
|
72141
|
+
* "ready_in_hours": true,
|
|
72142
|
+
* "ready_out_of_hours": true,
|
|
72143
|
+
* "step2_templates": [
|
|
72144
|
+
* {
|
|
72145
|
+
* "name": "seguimiento_clinica",
|
|
72146
|
+
* "language": "es",
|
|
72147
|
+
* "status": "APPROVED"
|
|
72148
|
+
* }
|
|
72149
|
+
* ],
|
|
72150
|
+
* "step2_ready": true,
|
|
72151
|
+
* "daily_cap": 100,
|
|
72152
|
+
* "daily_cap_reached": false,
|
|
72153
|
+
* "windows": {
|
|
72154
|
+
* "today": {
|
|
72155
|
+
* "since": "2026-11-18T03:00:00.000Z",
|
|
72156
|
+
* "submissions": 4,
|
|
72157
|
+
* "outcomes": {
|
|
72158
|
+
* "scheduled": 3,
|
|
72159
|
+
* "repeat_noted": 1
|
|
72160
|
+
* },
|
|
72161
|
+
* "unmapped": 0,
|
|
72162
|
+
* "first_contacts_sent": 3,
|
|
72163
|
+
* "wait": {
|
|
72164
|
+
* "measured": 3,
|
|
72165
|
+
* "median_seconds": 42,
|
|
72166
|
+
* "p90_seconds": 75,
|
|
72167
|
+
* "in_hours": {
|
|
72168
|
+
* "measured": 3,
|
|
72169
|
+
* "median_seconds": 42,
|
|
72170
|
+
* "p90_seconds": 75
|
|
72171
|
+
* },
|
|
72172
|
+
* "out_of_hours_count": 0
|
|
72173
|
+
* }
|
|
72174
|
+
* },
|
|
72175
|
+
* "7d": {
|
|
72176
|
+
* "since": "2026-11-12T03:00:00.000Z",
|
|
72177
|
+
* "submissions": 31,
|
|
72178
|
+
* "outcomes": {
|
|
72179
|
+
* "scheduled": 26,
|
|
72180
|
+
* "repeat_noted": 4,
|
|
72181
|
+
* "no_phone": 1
|
|
72182
|
+
* },
|
|
72183
|
+
* "unmapped": 1,
|
|
72184
|
+
* "first_contacts_sent": 26,
|
|
72185
|
+
* "wait": {
|
|
72186
|
+
* "measured": 26,
|
|
72187
|
+
* "median_seconds": 48,
|
|
72188
|
+
* "p90_seconds": 160,
|
|
72189
|
+
* "in_hours": {
|
|
72190
|
+
* "measured": 19,
|
|
72191
|
+
* "median_seconds": 40,
|
|
72192
|
+
* "p90_seconds": 90
|
|
72193
|
+
* },
|
|
72194
|
+
* "out_of_hours_count": 7
|
|
72195
|
+
* }
|
|
72196
|
+
* },
|
|
72197
|
+
* "30d": {
|
|
72198
|
+
* "since": "2026-10-20T03:00:00.000Z",
|
|
72199
|
+
* "submissions": 122,
|
|
72200
|
+
* "outcomes": {
|
|
72201
|
+
* "scheduled": 104,
|
|
72202
|
+
* "repeat_noted": 15,
|
|
72203
|
+
* "no_phone": 3
|
|
72204
|
+
* },
|
|
72205
|
+
* "unmapped": 2,
|
|
72206
|
+
* "first_contacts_sent": 104,
|
|
72207
|
+
* "wait": {
|
|
72208
|
+
* "measured": 98,
|
|
72209
|
+
* "median_seconds": 51,
|
|
72210
|
+
* "p90_seconds": 210,
|
|
72211
|
+
* "in_hours": {
|
|
72212
|
+
* "measured": 70,
|
|
72213
|
+
* "median_seconds": 41,
|
|
72214
|
+
* "p90_seconds": 95
|
|
72215
|
+
* },
|
|
72216
|
+
* "out_of_hours_count": 28
|
|
72217
|
+
* }
|
|
72218
|
+
* }
|
|
72219
|
+
* }
|
|
72220
|
+
* },
|
|
72221
|
+
* "leads": {
|
|
72222
|
+
* "windows": {
|
|
72223
|
+
* "today": {
|
|
72224
|
+
* "since": "2026-11-18T03:00:00.000Z",
|
|
72225
|
+
* "new_leads": 5,
|
|
72226
|
+
* "first_contacts_sent": 3,
|
|
72227
|
+
* "replied": 1,
|
|
72228
|
+
* "reply_rate": 33.3
|
|
72229
|
+
* },
|
|
72230
|
+
* "7d": {
|
|
72231
|
+
* "since": "2026-11-12T03:00:00.000Z",
|
|
72232
|
+
* "new_leads": 38,
|
|
72233
|
+
* "first_contacts_sent": 26,
|
|
72234
|
+
* "replied": 15,
|
|
72235
|
+
* "reply_rate": 57.7
|
|
72236
|
+
* },
|
|
72237
|
+
* "30d": {
|
|
72238
|
+
* "since": "2026-10-20T03:00:00.000Z",
|
|
72239
|
+
* "new_leads": 140,
|
|
72240
|
+
* "first_contacts_sent": 104,
|
|
72241
|
+
* "replied": 66,
|
|
72242
|
+
* "reply_rate": 63.5
|
|
72243
|
+
* }
|
|
72244
|
+
* },
|
|
72245
|
+
* "rule": "Leads nuevos: leads creados en el período (sin los importados)."
|
|
72246
|
+
* },
|
|
72247
|
+
* "agenda": {
|
|
72248
|
+
* "computed_at": "2026-11-18T13:00:00.000Z",
|
|
72249
|
+
* "has_ai_agent": true,
|
|
72250
|
+
* "shown": "agent",
|
|
72251
|
+
* "windows": {
|
|
72252
|
+
* "7d": {
|
|
72253
|
+
* "from": "2026-11-12",
|
|
72254
|
+
* "to": "2026-11-18",
|
|
72255
|
+
* "clinic": {
|
|
72256
|
+
* "total": 210,
|
|
72257
|
+
* "attended": 160,
|
|
72258
|
+
* "no_show": 18,
|
|
72259
|
+
* "cancelled": 22,
|
|
72260
|
+
* "not_closed": 6,
|
|
72261
|
+
* "moved": 4,
|
|
72262
|
+
* "closed": 200,
|
|
72263
|
+
* "attendance_pct": 80,
|
|
72264
|
+
* "truncated": false
|
|
72265
|
+
* },
|
|
72266
|
+
* "agent": {
|
|
72267
|
+
* "booked": 24,
|
|
72268
|
+
* "attended": 15,
|
|
72269
|
+
* "missed": 3,
|
|
72270
|
+
* "no_show": null,
|
|
72271
|
+
* "cancelled": null,
|
|
72272
|
+
* "not_closed": null,
|
|
72273
|
+
* "moved": null,
|
|
72274
|
+
* "upcoming": 6,
|
|
72275
|
+
* "closed": 18,
|
|
72276
|
+
* "attendance_pct": 83.3,
|
|
72277
|
+
* "split": false
|
|
72278
|
+
* }
|
|
72279
|
+
* },
|
|
72280
|
+
* "30d": {
|
|
72281
|
+
* "from": "2026-10-20",
|
|
72282
|
+
* "to": "2026-11-18",
|
|
72283
|
+
* "clinic": {
|
|
72284
|
+
* "total": 902,
|
|
72285
|
+
* "attended": 690,
|
|
72286
|
+
* "no_show": 80,
|
|
72287
|
+
* "cancelled": 101,
|
|
72288
|
+
* "not_closed": 19,
|
|
72289
|
+
* "moved": 12,
|
|
72290
|
+
* "closed": 871,
|
|
72291
|
+
* "attendance_pct": 79,
|
|
72292
|
+
* "truncated": false
|
|
72293
|
+
* },
|
|
72294
|
+
* "agent": {
|
|
72295
|
+
* "booked": 97,
|
|
72296
|
+
* "attended": 70,
|
|
72297
|
+
* "missed": 15,
|
|
72298
|
+
* "no_show": null,
|
|
72299
|
+
* "cancelled": null,
|
|
72300
|
+
* "not_closed": null,
|
|
72301
|
+
* "moved": null,
|
|
72302
|
+
* "upcoming": 12,
|
|
72303
|
+
* "closed": 85,
|
|
72304
|
+
* "attendance_pct": 82.4,
|
|
72305
|
+
* "split": false
|
|
72306
|
+
* }
|
|
72307
|
+
* }
|
|
72308
|
+
* },
|
|
72309
|
+
* "rule": "Clínica: todas las citas pasadas del período en la agenda."
|
|
72310
|
+
* },
|
|
72311
|
+
* "withheld": [],
|
|
72312
|
+
* "signals": [
|
|
72313
|
+
* {
|
|
72314
|
+
* "kind": "first_contact_templates_not_approved",
|
|
72315
|
+
* "severity": "warning",
|
|
72316
|
+
* "since": "2026-11-17T09:30:00.000Z",
|
|
72317
|
+
* "first_seen_at": "2026-11-17T09:30:00.000Z",
|
|
72318
|
+
* "section": "first_contact",
|
|
72319
|
+
* "fix_target": "channel_templates",
|
|
72320
|
+
* "detail": {
|
|
72321
|
+
* "messaging_account_id": "0192f1c4-2222-7000-8000-000000000002",
|
|
72322
|
+
* "ready_in_hours": true,
|
|
72323
|
+
* "ready_out_of_hours": false,
|
|
72324
|
+
* "templates": [
|
|
72325
|
+
* {
|
|
72326
|
+
* "name": "seguimiento_clinica_fuera_horario",
|
|
72327
|
+
* "language": "es",
|
|
72328
|
+
* "status": "PENDING"
|
|
72329
|
+
* }
|
|
72330
|
+
* ]
|
|
72331
|
+
* }
|
|
72332
|
+
* }
|
|
72333
|
+
* ],
|
|
72334
|
+
* "top_severity": "warning"
|
|
72335
|
+
* },
|
|
72336
|
+
* {
|
|
72337
|
+
* "tenant_id": "0192f1c4-3333-7000-8000-000000000003",
|
|
72338
|
+
* "tenant_name": "Clínica Ejemplo Ñuñoa",
|
|
72339
|
+
* "tenant_slug": "clinica-ejemplo-nunoa",
|
|
72340
|
+
* "tenant_logo_url": null,
|
|
72341
|
+
* "role": "marketing",
|
|
72342
|
+
* "status": "pending",
|
|
72343
|
+
* "timezone": null,
|
|
72344
|
+
* "computed_at": null,
|
|
72345
|
+
* "stale": false,
|
|
72346
|
+
* "floored": false,
|
|
72347
|
+
* "compute_errors": [],
|
|
72348
|
+
* "withheld": [
|
|
72349
|
+
* "whatsapp",
|
|
72350
|
+
* "leads",
|
|
72351
|
+
* "agenda"
|
|
72352
|
+
* ],
|
|
72353
|
+
* "signals": [],
|
|
72354
|
+
* "top_severity": null
|
|
72355
|
+
* }
|
|
72356
|
+
* ]
|
|
72357
|
+
* }
|
|
72358
|
+
* }
|
|
72359
|
+
*/
|
|
72360
|
+
"application/json": components["schemas"]["ClinicSummariesResponse"];
|
|
72361
|
+
};
|
|
72362
|
+
};
|
|
72363
|
+
/** @description Validation error */
|
|
72364
|
+
400: {
|
|
72365
|
+
headers: {
|
|
72366
|
+
[name: string]: unknown;
|
|
72367
|
+
};
|
|
72368
|
+
content: {
|
|
72369
|
+
"application/json": components["schemas"]["Error"];
|
|
72370
|
+
};
|
|
72371
|
+
};
|
|
72372
|
+
/** @description Unauthorized */
|
|
72373
|
+
401: {
|
|
72374
|
+
headers: {
|
|
72375
|
+
[name: string]: unknown;
|
|
72376
|
+
};
|
|
72377
|
+
content: {
|
|
72378
|
+
"application/json": components["schemas"]["Error"];
|
|
72379
|
+
};
|
|
72380
|
+
};
|
|
72381
|
+
/** @description Forbidden */
|
|
72382
|
+
403: {
|
|
72383
|
+
headers: {
|
|
72384
|
+
[name: string]: unknown;
|
|
72385
|
+
};
|
|
72386
|
+
content: {
|
|
72387
|
+
"application/json": components["schemas"]["Error"];
|
|
72388
|
+
};
|
|
72389
|
+
};
|
|
72390
|
+
/** @description Not found */
|
|
72391
|
+
404: {
|
|
72392
|
+
headers: {
|
|
72393
|
+
[name: string]: unknown;
|
|
72394
|
+
};
|
|
72395
|
+
content: {
|
|
72396
|
+
"application/json": components["schemas"]["Error"];
|
|
72397
|
+
};
|
|
72398
|
+
};
|
|
72399
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
72400
|
+
409: {
|
|
72401
|
+
headers: {
|
|
72402
|
+
[name: string]: unknown;
|
|
72403
|
+
};
|
|
72404
|
+
content: {
|
|
72405
|
+
"application/json": components["schemas"]["Error"];
|
|
72406
|
+
};
|
|
72407
|
+
};
|
|
72408
|
+
/** @description Rate limited */
|
|
72409
|
+
429: {
|
|
72410
|
+
headers: {
|
|
72411
|
+
[name: string]: unknown;
|
|
72412
|
+
};
|
|
72413
|
+
content: {
|
|
72414
|
+
"application/json": components["schemas"]["Error"];
|
|
72415
|
+
};
|
|
72416
|
+
};
|
|
72417
|
+
};
|
|
72418
|
+
};
|
|
72419
|
+
put?: never;
|
|
72420
|
+
post?: never;
|
|
72421
|
+
delete?: never;
|
|
72422
|
+
options?: never;
|
|
72423
|
+
head?: never;
|
|
72424
|
+
patch?: never;
|
|
72425
|
+
trace?: never;
|
|
72426
|
+
};
|
|
72427
|
+
"/me/clinic-summaries/{tenant_id}/refresh": {
|
|
72428
|
+
parameters: {
|
|
72429
|
+
query?: never;
|
|
72430
|
+
header?: never;
|
|
72431
|
+
path?: never;
|
|
72432
|
+
cookie?: never;
|
|
72433
|
+
};
|
|
72434
|
+
get?: never;
|
|
72435
|
+
put?: never;
|
|
72436
|
+
/**
|
|
72437
|
+
* Recompute one clinic’s summary now
|
|
72438
|
+
* @description vitrina-app#7471. Needs `my_clinics:write` (every built-in role holds it; a connector never does). Enqueues the summary of one clinic workspace for recomputation (202); `GET /me/clinic-summaries` shows it once the job ran (usually seconds; the agenda section is recomputed at most hourly). A burst of requests collapses to one run. The caller must hold an ACTIVE membership in that workspace (403 otherwise); a personal token or a connected app only for the workspace it is bound to (403 for any other); 404 when the workspace is not an open clinic. Audited as `clinic_summary.refresh` in that workspace.
|
|
72439
|
+
*/
|
|
72440
|
+
post: {
|
|
72441
|
+
parameters: {
|
|
72442
|
+
query?: never;
|
|
72443
|
+
header?: {
|
|
72444
|
+
/** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
|
|
72445
|
+
"Idempotency-Key"?: string;
|
|
72446
|
+
};
|
|
72447
|
+
path: {
|
|
72448
|
+
tenant_id: string;
|
|
72449
|
+
};
|
|
72450
|
+
cookie?: never;
|
|
72451
|
+
};
|
|
72452
|
+
requestBody?: never;
|
|
72453
|
+
responses: {
|
|
72454
|
+
/** @description Refresh enqueued */
|
|
72455
|
+
202: {
|
|
72456
|
+
headers: {
|
|
72457
|
+
[name: string]: unknown;
|
|
72458
|
+
};
|
|
72459
|
+
content: {
|
|
72460
|
+
/**
|
|
72461
|
+
* @example {
|
|
72462
|
+
* "data": {
|
|
72463
|
+
* "enqueued": true
|
|
72464
|
+
* }
|
|
72465
|
+
* }
|
|
72466
|
+
*/
|
|
72467
|
+
"application/json": components["schemas"]["ClinicSummaryRefreshResponse"];
|
|
72468
|
+
};
|
|
72469
|
+
};
|
|
72470
|
+
/** @description Validation error */
|
|
72471
|
+
400: {
|
|
72472
|
+
headers: {
|
|
72473
|
+
[name: string]: unknown;
|
|
72474
|
+
};
|
|
72475
|
+
content: {
|
|
72476
|
+
"application/json": components["schemas"]["Error"];
|
|
72477
|
+
};
|
|
72478
|
+
};
|
|
72479
|
+
/** @description Unauthorized */
|
|
72480
|
+
401: {
|
|
72481
|
+
headers: {
|
|
72482
|
+
[name: string]: unknown;
|
|
72483
|
+
};
|
|
72484
|
+
content: {
|
|
72485
|
+
"application/json": components["schemas"]["Error"];
|
|
72486
|
+
};
|
|
72487
|
+
};
|
|
72488
|
+
/** @description Forbidden */
|
|
72489
|
+
403: {
|
|
72490
|
+
headers: {
|
|
72491
|
+
[name: string]: unknown;
|
|
72492
|
+
};
|
|
72493
|
+
content: {
|
|
72494
|
+
"application/json": components["schemas"]["Error"];
|
|
72495
|
+
};
|
|
72496
|
+
};
|
|
72497
|
+
/** @description Not found */
|
|
72498
|
+
404: {
|
|
72499
|
+
headers: {
|
|
72500
|
+
[name: string]: unknown;
|
|
72501
|
+
};
|
|
72502
|
+
content: {
|
|
72503
|
+
"application/json": components["schemas"]["Error"];
|
|
72504
|
+
};
|
|
72505
|
+
};
|
|
72506
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
72507
|
+
409: {
|
|
72508
|
+
headers: {
|
|
72509
|
+
[name: string]: unknown;
|
|
72510
|
+
};
|
|
72511
|
+
content: {
|
|
72512
|
+
"application/json": components["schemas"]["Error"];
|
|
72513
|
+
};
|
|
72514
|
+
};
|
|
72515
|
+
/** @description Rate limited */
|
|
72516
|
+
429: {
|
|
72517
|
+
headers: {
|
|
72518
|
+
[name: string]: unknown;
|
|
72519
|
+
};
|
|
72520
|
+
content: {
|
|
72521
|
+
"application/json": components["schemas"]["Error"];
|
|
72522
|
+
};
|
|
72523
|
+
};
|
|
72524
|
+
};
|
|
72525
|
+
};
|
|
72526
|
+
delete?: never;
|
|
72527
|
+
options?: never;
|
|
72528
|
+
head?: never;
|
|
72529
|
+
patch?: never;
|
|
72530
|
+
trace?: never;
|
|
72531
|
+
};
|
|
72064
72532
|
"/clinic/budget-followups/today": {
|
|
72065
72533
|
parameters: {
|
|
72066
72534
|
query?: never;
|
|
@@ -183585,7 +184053,7 @@ interface paths {
|
|
|
183585
184053
|
*/
|
|
183586
184054
|
"application/json": {
|
|
183587
184055
|
name: string;
|
|
183588
|
-
scopes?: ("ai_agents:read" | "ai_agents:write" | "ai_agents:simulate" | "conversations:read" | "conversations:write" | "contacts:read" | "contacts:write" | "tickets:read" | "tickets:write" | "tickets:claim" | "leads:read" | "leads:write" | "leads:intake" | "pipelines:read" | "pipelines:write" | "stages:read" | "stages:write" | "functions:read" | "functions:write" | "kb:read" | "kb:write" | "messages:read" | "messages:write" | "messages:send" | "tools:read" | "tags:read" | "tags:write" | "api_keys:read" | "api_keys:write" | "personal_tokens:read" | "personal_tokens:write" | "notifications:read" | "notifications:write" | "audit:read" | "analytics:read" | "analytics:write" | "dealer_reports:read" | "tenant:read" | "tenant:write" | "tenant:delete" | "webhooks:read" | "webhooks:write" | "messaging_accounts:read" | "messaging_accounts:write" | "provisioning:read" | "provisioning:write" | "voice_drift:read" | "worker_failures:read" | "worker_failures:write" | "dealer_sites:read" | "dealer_sites:write" | "mcp_servers:read" | "mcp_servers:write" | "memberships:read" | "memberships:write" | "teams:read" | "teams:write" | "help_centers:read" | "help_centers:write" | "labels:read" | "labels:write" | "macros:read" | "macros:write" | "slas:read" | "slas:write" | "routing:read" | "routing:write" | "triggers:read" | "triggers:write" | "followups:read" | "followups:write" | "followups:manage" | "custom_attributes:read" | "custom_attributes:write" | "companies:read" | "companies:write" | "roles:read" | "roles:write" | "integrations:read" | "integrations:write" | "clinic:read" | "clinic:write" | "clinic:delete" | "clinic_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_consent:read" | "clinic_consent:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_price_override:write" | "clinic_commission_own:read" | "clinic_chair_money:write" | "clinic_patient_contact:read" | "clinic_insights:read" | "finanzas:read" | "finanzas:write" | "finanzas_reports:read" | "finanzas:export" | "finanzas_admin:write" | "finanzas_patients:read" | "finanzas_payroll:read" | "sandbox:read" | "sandbox:write" | "ads:read" | "ads:write" | "healthatom:read" | "healthatom:write" | "reservo:read" | "reservo:write" | "rexplus:read" | "rexplus:write" | "billing:read" | "billing:write" | "copilot:read" | "copilot:write" | "erp_copilot:use" | "tool_credentials:read" | "tool_credentials:write" | "tool_invocations:read" | "corrections:read" | "corrections:write" | "marketplace:read" | "marketplace:write" | "stock:read" | "storefront_events:write" | "pricing:read" | "pricing:write" | "roi:read" | "appointments:read" | "appointments:write" | "appointments:delete" | "schedule_config:write" | "appointments:intake" | "appointment_types:read" | "appointment_types:write" | "service_lifecycle:read" | "service_lifecycle:write" | "outbound_approvals:read" | "outbound_approvals:write" | "outbound_holds:read" | "outbound_holds:write" | "campaigns:read" | "campaigns:write" | "consignments:read" | "consignments:write" | "stock_dedup:read" | "stock_dedup:write" | "stock_photo_mirror:read" | "stock_photo_mirror:write" | "stock_retirement:read" | "stock_retirement:write" | "dealership_economics:read" | "dealership_economics:write" | "document_templates:read" | "document_templates:write" | "vehicle_registry:read" | "vehicle_registry:write" | "vehicle_pipeline:read" | "vehicle_pipeline:write" | "sale_notes:read" | "sale_notes:write" | "sale_notes:void" | "transfer_cases:read" | "transfer_cases:write" | "credit_applications:read" | "credit_applications:write" | "seller_compensation:read" | "seller_compensation:write" | "sales_leaderboard:read" | "quotes:read" | "quotes:write" | "quotes:void" | "reservations:read" | "reservations:write" | "reservations:void" | "reservations:dispose_abono" | "organization_legal:read" | "organization_legal:write" | "purchase_notes:read" | "purchase_notes:write" | "purchase_notes:void" | "document_payments:read" | "document_payments:write" | "tenant_bank_accounts:read" | "tenant_bank_accounts:write" | "bank_movements:read" | "bank_movements:write" | "payments:read" | "payments:write" | "payments:reverse" | "promo_codes:write" | "orders:read" | "orders:write" | "orders:checkout" | "orders:refund" | "price_approval:read" | "price_approval:request" | "price_approval:approve" | "cotizacion_discount:approve" | "legal:read" | "legal:write")[];
|
|
184056
|
+
scopes?: ("ai_agents:read" | "ai_agents:write" | "ai_agents:simulate" | "conversations:read" | "conversations:write" | "contacts:read" | "contacts:write" | "tickets:read" | "tickets:write" | "tickets:claim" | "leads:read" | "leads:write" | "leads:intake" | "pipelines:read" | "pipelines:write" | "stages:read" | "stages:write" | "functions:read" | "functions:write" | "kb:read" | "kb:write" | "messages:read" | "messages:write" | "messages:send" | "tools:read" | "tags:read" | "tags:write" | "api_keys:read" | "api_keys:write" | "personal_tokens:read" | "personal_tokens:write" | "notifications:read" | "notifications:write" | "my_clinics:read" | "my_clinics:write" | "audit:read" | "analytics:read" | "analytics:write" | "dealer_reports:read" | "tenant:read" | "tenant:write" | "tenant:delete" | "webhooks:read" | "webhooks:write" | "messaging_accounts:read" | "messaging_accounts:write" | "provisioning:read" | "provisioning:write" | "voice_drift:read" | "worker_failures:read" | "worker_failures:write" | "dealer_sites:read" | "dealer_sites:write" | "mcp_servers:read" | "mcp_servers:write" | "memberships:read" | "memberships:write" | "teams:read" | "teams:write" | "help_centers:read" | "help_centers:write" | "labels:read" | "labels:write" | "macros:read" | "macros:write" | "slas:read" | "slas:write" | "routing:read" | "routing:write" | "triggers:read" | "triggers:write" | "followups:read" | "followups:write" | "followups:manage" | "custom_attributes:read" | "custom_attributes:write" | "companies:read" | "companies:write" | "roles:read" | "roles:write" | "integrations:read" | "integrations:write" | "clinic:read" | "clinic:write" | "clinic:delete" | "clinic_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_consent:read" | "clinic_consent:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_price_override:write" | "clinic_commission_own:read" | "clinic_chair_money:write" | "clinic_patient_contact:read" | "clinic_insights:read" | "finanzas:read" | "finanzas:write" | "finanzas_reports:read" | "finanzas:export" | "finanzas_admin:write" | "finanzas_patients:read" | "finanzas_payroll:read" | "sandbox:read" | "sandbox:write" | "ads:read" | "ads:write" | "healthatom:read" | "healthatom:write" | "reservo:read" | "reservo:write" | "rexplus:read" | "rexplus:write" | "billing:read" | "billing:write" | "copilot:read" | "copilot:write" | "erp_copilot:use" | "tool_credentials:read" | "tool_credentials:write" | "tool_invocations:read" | "corrections:read" | "corrections:write" | "marketplace:read" | "marketplace:write" | "stock:read" | "storefront_events:write" | "pricing:read" | "pricing:write" | "roi:read" | "appointments:read" | "appointments:write" | "appointments:delete" | "schedule_config:write" | "appointments:intake" | "appointment_types:read" | "appointment_types:write" | "service_lifecycle:read" | "service_lifecycle:write" | "outbound_approvals:read" | "outbound_approvals:write" | "outbound_holds:read" | "outbound_holds:write" | "campaigns:read" | "campaigns:write" | "consignments:read" | "consignments:write" | "stock_dedup:read" | "stock_dedup:write" | "stock_photo_mirror:read" | "stock_photo_mirror:write" | "stock_retirement:read" | "stock_retirement:write" | "dealership_economics:read" | "dealership_economics:write" | "document_templates:read" | "document_templates:write" | "vehicle_registry:read" | "vehicle_registry:write" | "vehicle_pipeline:read" | "vehicle_pipeline:write" | "sale_notes:read" | "sale_notes:write" | "sale_notes:void" | "transfer_cases:read" | "transfer_cases:write" | "credit_applications:read" | "credit_applications:write" | "seller_compensation:read" | "seller_compensation:write" | "sales_leaderboard:read" | "quotes:read" | "quotes:write" | "quotes:void" | "reservations:read" | "reservations:write" | "reservations:void" | "reservations:dispose_abono" | "organization_legal:read" | "organization_legal:write" | "purchase_notes:read" | "purchase_notes:write" | "purchase_notes:void" | "document_payments:read" | "document_payments:write" | "tenant_bank_accounts:read" | "tenant_bank_accounts:write" | "bank_movements:read" | "bank_movements:write" | "payments:read" | "payments:write" | "payments:reverse" | "promo_codes:write" | "orders:read" | "orders:write" | "orders:checkout" | "orders:refund" | "price_approval:read" | "price_approval:request" | "price_approval:approve" | "cotizacion_discount:approve" | "legal:read" | "legal:write")[];
|
|
183589
184057
|
/** Format: date-time */
|
|
183590
184058
|
expires_at?: string | null;
|
|
183591
184059
|
};
|
|
@@ -323587,6 +324055,433 @@ interface components {
|
|
|
323587
324055
|
min_count: number;
|
|
323588
324056
|
} | null;
|
|
323589
324057
|
};
|
|
324058
|
+
/**
|
|
324059
|
+
* @description `whatsapp_disconnected`: a WhatsApp number of the clinic is disconnected (critical; `detail`: `messaging_account_id`, `account_name`, `reason_code`, `is_first_contact_sender`). `whatsapp_attention`: a number needs attention (warning; same detail). `first_contact_templates_not_approved`: the clinic form first contact is on but its ladder cannot send (critical when step 1 or the in-hours step 2 has no approved template, warning when only the out-of-hours step 2 is missing; `detail`: `messaging_account_id`, `ready_in_hours`, `ready_out_of_hours`, `templates` [{name, language, status}]). `unmapped_forms`: submissions of the last 7 days came from a form that is not in the clinic’s current form map (warning; `detail`: `submissions_7d`, `forms` [{form_id, submissions}], `forms_total`, `without_form_id`). `first_contact_missed`: in the last 24 hours submissions ended without a first contact for a reason someone can fix, or a lead raised the first-contact-missing alarm (warning; `detail`: `outcomes` {outcome: count}, `missing_alarms`, `needs_form_setup`). `first_contact_off`: the clinic has a WhatsApp number and its clinic form first contact is switched off (low; `detail`: `submissions_7d` = forms that arrived while off). A value added later is a changelog entry.
|
|
324060
|
+
* @enum {string}
|
|
324061
|
+
*/
|
|
324062
|
+
ClinicSignalKind: "whatsapp_disconnected" | "whatsapp_attention" | "first_contact_templates_not_approved" | "unmapped_forms" | "first_contact_missed" | "first_contact_off";
|
|
324063
|
+
/**
|
|
324064
|
+
* @description `critical`: nothing can be sent or patients are being lost now. `warning`: something is wrong and needs a person. `low`: a deliberate setting worth a look, always sorted below real problems.
|
|
324065
|
+
* @enum {string}
|
|
324066
|
+
*/
|
|
324067
|
+
ClinicSignalSeverity: "critical" | "warning" | "low";
|
|
324068
|
+
/**
|
|
324069
|
+
* @description Where the signal is fixed, as a stable key (not a URL): `channels` = the workspace’s channel settings, `channel_templates` = the WhatsApp templates of the sending number, `clinic_first_contact` = the clinic form first contact settings.
|
|
324070
|
+
* @enum {string}
|
|
324071
|
+
*/
|
|
324072
|
+
ClinicSignalFixTarget: "channels" | "channel_templates" | "clinic_first_contact";
|
|
324073
|
+
ClinicSignal: {
|
|
324074
|
+
kind: components["schemas"]["ClinicSignalKind"];
|
|
324075
|
+
severity: components["schemas"]["ClinicSignalSeverity"];
|
|
324076
|
+
/** @description ISO instant the problem started: its own timestamp when one exists, else `first_seen_at`. */
|
|
324077
|
+
since: string;
|
|
324078
|
+
/** @description The first refresh that saw this signal; stable across refreshes. */
|
|
324079
|
+
first_seen_at: string;
|
|
324080
|
+
/**
|
|
324081
|
+
* @description The summary section whose scope gates reading this signal.
|
|
324082
|
+
* @enum {string}
|
|
324083
|
+
*/
|
|
324084
|
+
section: "whatsapp" | "first_contact";
|
|
324085
|
+
fix_target: components["schemas"]["ClinicSignalFixTarget"];
|
|
324086
|
+
/** @description Non-personal facts only (ids, states, template and form names, counts); the keys per kind are listed on `ClinicSignalKind`. */
|
|
324087
|
+
detail: {
|
|
324088
|
+
[key: string]: unknown;
|
|
324089
|
+
};
|
|
324090
|
+
};
|
|
324091
|
+
ClinicSummary: {
|
|
324092
|
+
/** Format: uuid */
|
|
324093
|
+
tenant_id: string;
|
|
324094
|
+
tenant_name: string | null;
|
|
324095
|
+
tenant_slug: string | null;
|
|
324096
|
+
tenant_logo_url: string | null;
|
|
324097
|
+
/** @description The caller’s built-in role tier in this workspace. */
|
|
324098
|
+
role: string;
|
|
324099
|
+
/**
|
|
324100
|
+
* @description `pending`: no summary computed yet (every section absent).
|
|
324101
|
+
* @enum {string}
|
|
324102
|
+
*/
|
|
324103
|
+
status: "ready" | "pending";
|
|
324104
|
+
/** @description The zone the windows were cut in. */
|
|
324105
|
+
timezone: string | null;
|
|
324106
|
+
computed_at: string | null;
|
|
324107
|
+
/** @description `computed_at` is older than two job ticks (30 min). */
|
|
324108
|
+
stale: boolean;
|
|
324109
|
+
/** @description `leads` and `agenda` went through the minimum-count floor (a Consultor seat): a count from 1 to 4 reads null. */
|
|
324110
|
+
floored: boolean;
|
|
324111
|
+
/** @description Readable sections that failed on the last run (each is null). */
|
|
324112
|
+
compute_errors: ("whatsapp" | "first_contact" | "leads" | "agenda")[];
|
|
324113
|
+
/** @description WhatsApp channel health. Needs `messaging_accounts:read`. */
|
|
324114
|
+
whatsapp?: {
|
|
324115
|
+
/**
|
|
324116
|
+
* @description `not_connected`: no WhatsApp number yet (a setup state).
|
|
324117
|
+
* @enum {string}
|
|
324118
|
+
*/
|
|
324119
|
+
state: "connected" | "not_connected";
|
|
324120
|
+
accounts: {
|
|
324121
|
+
/** Format: uuid */
|
|
324122
|
+
messaging_account_id: string;
|
|
324123
|
+
/** @description The number’s label in Vitrina. */
|
|
324124
|
+
name: string | null;
|
|
324125
|
+
enabled: boolean;
|
|
324126
|
+
/** @description The clinic form first contact sends from this number. */
|
|
324127
|
+
clinic_form_sender: boolean;
|
|
324128
|
+
/** @description The stored health verdict; null when never checked. */
|
|
324129
|
+
health: {
|
|
324130
|
+
/** @description `healthy`, `attention` or `disconnected`. */
|
|
324131
|
+
status: string;
|
|
324132
|
+
reason_code: string | null;
|
|
324133
|
+
unhealthy_since: string | null;
|
|
324134
|
+
last_checked_at: string | null;
|
|
324135
|
+
} | null;
|
|
324136
|
+
messaging_limit_tier: string | null;
|
|
324137
|
+
quality_rating: string | null;
|
|
324138
|
+
}[];
|
|
324139
|
+
} | null;
|
|
324140
|
+
/** @description Clinic form first contact readiness and outcomes. Needs `tenant:read`. */
|
|
324141
|
+
first_contact?: {
|
|
324142
|
+
/**
|
|
324143
|
+
* @description `not_set_up`: no clinic form source.
|
|
324144
|
+
* @enum {string}
|
|
324145
|
+
*/
|
|
324146
|
+
state: "set_up" | "not_set_up";
|
|
324147
|
+
enabled: boolean | null;
|
|
324148
|
+
enabled_at: string | null;
|
|
324149
|
+
ready_in_hours: boolean | null;
|
|
324150
|
+
ready_out_of_hours: boolean | null;
|
|
324151
|
+
step2_templates: {
|
|
324152
|
+
name: string;
|
|
324153
|
+
language: string;
|
|
324154
|
+
status: string | null;
|
|
324155
|
+
}[];
|
|
324156
|
+
step2_ready: boolean | null;
|
|
324157
|
+
daily_cap: number | null;
|
|
324158
|
+
daily_cap_reached: boolean | null;
|
|
324159
|
+
windows: {
|
|
324160
|
+
today: {
|
|
324161
|
+
/** @description Window start (local midnight, ISO instant). */
|
|
324162
|
+
since: string;
|
|
324163
|
+
submissions: number;
|
|
324164
|
+
/** @description Count per intake outcome (`scheduled`, `repeat_noted`, `daily_cap`, …; `received` = not finished yet). `scheduled` only means a first contact was QUEUED, not delivered: show `delivery`, never `outcomes.scheduled`, as «contacted». */
|
|
324165
|
+
outcomes: {
|
|
324166
|
+
[key: string]: number;
|
|
324167
|
+
};
|
|
324168
|
+
/** @description What happened to each submission’s first message, the same buckets as `GET /lead-outreach/status` `clinic_form.delivery` (#7680): `sent + failed + pending + skipped + not_queued = total`. Absent on a row stored before this field existed (until its next refresh, at most 15 minutes). */
|
|
324169
|
+
delivery?: {
|
|
324170
|
+
/** @description Settled submissions in the window. */
|
|
324171
|
+
total: number;
|
|
324172
|
+
/** @description Step 1 accepted by the provider. */
|
|
324173
|
+
sent: number;
|
|
324174
|
+
/** @description The send errored. */
|
|
324175
|
+
failed: number;
|
|
324176
|
+
failed_by_code: {
|
|
324177
|
+
[key: string]: number;
|
|
324178
|
+
};
|
|
324179
|
+
/** @description Queued or waiting (template review, billing block): goes out on its own. */
|
|
324180
|
+
pending: number;
|
|
324181
|
+
pending_by_reason: {
|
|
324182
|
+
[key: string]: number;
|
|
324183
|
+
};
|
|
324184
|
+
/** @description The first contact ran and skipped. */
|
|
324185
|
+
skipped: number;
|
|
324186
|
+
skipped_by_reason: {
|
|
324187
|
+
[key: string]: number;
|
|
324188
|
+
};
|
|
324189
|
+
/** @description The intake decided not to queue a first contact (repeat, upcoming cita, no phone, …). */
|
|
324190
|
+
not_queued: number;
|
|
324191
|
+
not_queued_by_outcome: {
|
|
324192
|
+
[key: string]: number;
|
|
324193
|
+
};
|
|
324194
|
+
};
|
|
324195
|
+
unmapped: number;
|
|
324196
|
+
first_contacts_sent: number;
|
|
324197
|
+
/** @description Form → first message over the first contacts sent in the window (#7468). */
|
|
324198
|
+
wait: {
|
|
324199
|
+
measured: number;
|
|
324200
|
+
median_seconds: number | null;
|
|
324201
|
+
p90_seconds: number | null;
|
|
324202
|
+
in_hours: {
|
|
324203
|
+
measured: number;
|
|
324204
|
+
median_seconds: number | null;
|
|
324205
|
+
p90_seconds: number | null;
|
|
324206
|
+
};
|
|
324207
|
+
out_of_hours_count: number;
|
|
324208
|
+
};
|
|
324209
|
+
};
|
|
324210
|
+
"7d": {
|
|
324211
|
+
/** @description Window start (local midnight, ISO instant). */
|
|
324212
|
+
since: string;
|
|
324213
|
+
submissions: number;
|
|
324214
|
+
/** @description Count per intake outcome (`scheduled`, `repeat_noted`, `daily_cap`, …; `received` = not finished yet). `scheduled` only means a first contact was QUEUED, not delivered: show `delivery`, never `outcomes.scheduled`, as «contacted». */
|
|
324215
|
+
outcomes: {
|
|
324216
|
+
[key: string]: number;
|
|
324217
|
+
};
|
|
324218
|
+
/** @description What happened to each submission’s first message, the same buckets as `GET /lead-outreach/status` `clinic_form.delivery` (#7680): `sent + failed + pending + skipped + not_queued = total`. Absent on a row stored before this field existed (until its next refresh, at most 15 minutes). */
|
|
324219
|
+
delivery?: {
|
|
324220
|
+
/** @description Settled submissions in the window. */
|
|
324221
|
+
total: number;
|
|
324222
|
+
/** @description Step 1 accepted by the provider. */
|
|
324223
|
+
sent: number;
|
|
324224
|
+
/** @description The send errored. */
|
|
324225
|
+
failed: number;
|
|
324226
|
+
failed_by_code: {
|
|
324227
|
+
[key: string]: number;
|
|
324228
|
+
};
|
|
324229
|
+
/** @description Queued or waiting (template review, billing block): goes out on its own. */
|
|
324230
|
+
pending: number;
|
|
324231
|
+
pending_by_reason: {
|
|
324232
|
+
[key: string]: number;
|
|
324233
|
+
};
|
|
324234
|
+
/** @description The first contact ran and skipped. */
|
|
324235
|
+
skipped: number;
|
|
324236
|
+
skipped_by_reason: {
|
|
324237
|
+
[key: string]: number;
|
|
324238
|
+
};
|
|
324239
|
+
/** @description The intake decided not to queue a first contact (repeat, upcoming cita, no phone, …). */
|
|
324240
|
+
not_queued: number;
|
|
324241
|
+
not_queued_by_outcome: {
|
|
324242
|
+
[key: string]: number;
|
|
324243
|
+
};
|
|
324244
|
+
};
|
|
324245
|
+
unmapped: number;
|
|
324246
|
+
first_contacts_sent: number;
|
|
324247
|
+
/** @description Form → first message over the first contacts sent in the window (#7468). */
|
|
324248
|
+
wait: {
|
|
324249
|
+
measured: number;
|
|
324250
|
+
median_seconds: number | null;
|
|
324251
|
+
p90_seconds: number | null;
|
|
324252
|
+
in_hours: {
|
|
324253
|
+
measured: number;
|
|
324254
|
+
median_seconds: number | null;
|
|
324255
|
+
p90_seconds: number | null;
|
|
324256
|
+
};
|
|
324257
|
+
out_of_hours_count: number;
|
|
324258
|
+
};
|
|
324259
|
+
};
|
|
324260
|
+
"30d": {
|
|
324261
|
+
/** @description Window start (local midnight, ISO instant). */
|
|
324262
|
+
since: string;
|
|
324263
|
+
submissions: number;
|
|
324264
|
+
/** @description Count per intake outcome (`scheduled`, `repeat_noted`, `daily_cap`, …; `received` = not finished yet). `scheduled` only means a first contact was QUEUED, not delivered: show `delivery`, never `outcomes.scheduled`, as «contacted». */
|
|
324265
|
+
outcomes: {
|
|
324266
|
+
[key: string]: number;
|
|
324267
|
+
};
|
|
324268
|
+
/** @description What happened to each submission’s first message, the same buckets as `GET /lead-outreach/status` `clinic_form.delivery` (#7680): `sent + failed + pending + skipped + not_queued = total`. Absent on a row stored before this field existed (until its next refresh, at most 15 minutes). */
|
|
324269
|
+
delivery?: {
|
|
324270
|
+
/** @description Settled submissions in the window. */
|
|
324271
|
+
total: number;
|
|
324272
|
+
/** @description Step 1 accepted by the provider. */
|
|
324273
|
+
sent: number;
|
|
324274
|
+
/** @description The send errored. */
|
|
324275
|
+
failed: number;
|
|
324276
|
+
failed_by_code: {
|
|
324277
|
+
[key: string]: number;
|
|
324278
|
+
};
|
|
324279
|
+
/** @description Queued or waiting (template review, billing block): goes out on its own. */
|
|
324280
|
+
pending: number;
|
|
324281
|
+
pending_by_reason: {
|
|
324282
|
+
[key: string]: number;
|
|
324283
|
+
};
|
|
324284
|
+
/** @description The first contact ran and skipped. */
|
|
324285
|
+
skipped: number;
|
|
324286
|
+
skipped_by_reason: {
|
|
324287
|
+
[key: string]: number;
|
|
324288
|
+
};
|
|
324289
|
+
/** @description The intake decided not to queue a first contact (repeat, upcoming cita, no phone, …). */
|
|
324290
|
+
not_queued: number;
|
|
324291
|
+
not_queued_by_outcome: {
|
|
324292
|
+
[key: string]: number;
|
|
324293
|
+
};
|
|
324294
|
+
};
|
|
324295
|
+
unmapped: number;
|
|
324296
|
+
first_contacts_sent: number;
|
|
324297
|
+
/** @description Form → first message over the first contacts sent in the window (#7468). */
|
|
324298
|
+
wait: {
|
|
324299
|
+
measured: number;
|
|
324300
|
+
median_seconds: number | null;
|
|
324301
|
+
p90_seconds: number | null;
|
|
324302
|
+
in_hours: {
|
|
324303
|
+
measured: number;
|
|
324304
|
+
median_seconds: number | null;
|
|
324305
|
+
p90_seconds: number | null;
|
|
324306
|
+
};
|
|
324307
|
+
out_of_hours_count: number;
|
|
324308
|
+
};
|
|
324309
|
+
};
|
|
324310
|
+
} | null;
|
|
324311
|
+
} | null;
|
|
324312
|
+
/** @description Leads and the reply rate to the first contact. Needs `leads:read` with record visibility `all`. */
|
|
324313
|
+
leads?: {
|
|
324314
|
+
windows: {
|
|
324315
|
+
today: {
|
|
324316
|
+
since: string;
|
|
324317
|
+
/** @description Leads created in the window (imports excluded). */
|
|
324318
|
+
new_leads: number | null;
|
|
324319
|
+
/** @description Clinic form first contacts sent. */
|
|
324320
|
+
first_contacts_sent: number | null;
|
|
324321
|
+
/** @description Of them, the patient wrote back afterwards (through the lead’s contact; a reply from a second, unmerged contact is not seen). */
|
|
324322
|
+
replied: number | null;
|
|
324323
|
+
/** @description replied ÷ first_contacts_sent, one decimal; null with no denominator. */
|
|
324324
|
+
reply_rate: number | null;
|
|
324325
|
+
};
|
|
324326
|
+
"7d": {
|
|
324327
|
+
since: string;
|
|
324328
|
+
/** @description Leads created in the window (imports excluded). */
|
|
324329
|
+
new_leads: number | null;
|
|
324330
|
+
/** @description Clinic form first contacts sent. */
|
|
324331
|
+
first_contacts_sent: number | null;
|
|
324332
|
+
/** @description Of them, the patient wrote back afterwards (through the lead’s contact; a reply from a second, unmerged contact is not seen). */
|
|
324333
|
+
replied: number | null;
|
|
324334
|
+
/** @description replied ÷ first_contacts_sent, one decimal; null with no denominator. */
|
|
324335
|
+
reply_rate: number | null;
|
|
324336
|
+
};
|
|
324337
|
+
"30d": {
|
|
324338
|
+
since: string;
|
|
324339
|
+
/** @description Leads created in the window (imports excluded). */
|
|
324340
|
+
new_leads: number | null;
|
|
324341
|
+
/** @description Clinic form first contacts sent. */
|
|
324342
|
+
first_contacts_sent: number | null;
|
|
324343
|
+
/** @description Of them, the patient wrote back afterwards (through the lead’s contact; a reply from a second, unmerged contact is not seen). */
|
|
324344
|
+
replied: number | null;
|
|
324345
|
+
/** @description replied ÷ first_contacts_sent, one decimal; null with no denominator. */
|
|
324346
|
+
reply_rate: number | null;
|
|
324347
|
+
};
|
|
324348
|
+
};
|
|
324349
|
+
rule: string;
|
|
324350
|
+
} | null;
|
|
324351
|
+
/** @description Citas and attendance. Needs `clinic:read` with record visibility `all`. */
|
|
324352
|
+
agenda?: {
|
|
324353
|
+
/** @description When the agenda blocks were computed (at most hourly). */
|
|
324354
|
+
computed_at: string;
|
|
324355
|
+
has_ai_agent: boolean;
|
|
324356
|
+
/**
|
|
324357
|
+
* @description Which block the row shows and labels: `agent` when the clinic has an active AI agent, `clinic` otherwise. Both are always present.
|
|
324358
|
+
* @enum {string}
|
|
324359
|
+
*/
|
|
324360
|
+
shown: "agent" | "clinic";
|
|
324361
|
+
windows: {
|
|
324362
|
+
"7d": {
|
|
324363
|
+
from: string;
|
|
324364
|
+
to: string;
|
|
324365
|
+
/** @description The clinic’s whole agenda. */
|
|
324366
|
+
clinic: {
|
|
324367
|
+
/** @description Past citas of the window, moved ones included. */
|
|
324368
|
+
total: number | null;
|
|
324369
|
+
/** @description Attended. */
|
|
324370
|
+
attended: number | null;
|
|
324371
|
+
/** @description No-show. */
|
|
324372
|
+
no_show: number | null;
|
|
324373
|
+
/** @description Cancelled, late ones included. */
|
|
324374
|
+
cancelled: number | null;
|
|
324375
|
+
/** @description Past citas nobody closed — never counted as attended. */
|
|
324376
|
+
not_closed: number | null;
|
|
324377
|
+
/** @description Moved by the clinic software — in no attendance count. */
|
|
324378
|
+
moved: number | null;
|
|
324379
|
+
/** @description attended + no_show + cancelled. */
|
|
324380
|
+
closed: number | null;
|
|
324381
|
+
/** @description attended ÷ closed, whole percent. */
|
|
324382
|
+
attendance_pct: number | null;
|
|
324383
|
+
/** @description The read hit its cap: counts are a floor. */
|
|
324384
|
+
truncated: boolean;
|
|
324385
|
+
};
|
|
324386
|
+
/** @description The citas booked by the agent. */
|
|
324387
|
+
agent: {
|
|
324388
|
+
/** @description Citas the agent booked in the window. */
|
|
324389
|
+
booked: number | null;
|
|
324390
|
+
/** @description Of them, attended. */
|
|
324391
|
+
attended: number | null;
|
|
324392
|
+
/** @description No-show + cancelled. */
|
|
324393
|
+
missed: number | null;
|
|
324394
|
+
/** @description Null until the split is available (`split`). */
|
|
324395
|
+
no_show: number | null;
|
|
324396
|
+
/** @description Null until the split is available (`split`). */
|
|
324397
|
+
cancelled: number | null;
|
|
324398
|
+
/** @description Null until the split is available (`split`). */
|
|
324399
|
+
not_closed: number | null;
|
|
324400
|
+
/** @description Null until the split is available (`split`). */
|
|
324401
|
+
moved: number | null;
|
|
324402
|
+
/** @description Agent bookings dated after the window. */
|
|
324403
|
+
upcoming: number | null;
|
|
324404
|
+
/** @description attended + missed. */
|
|
324405
|
+
closed: number | null;
|
|
324406
|
+
/** @description attended ÷ closed, one decimal. */
|
|
324407
|
+
attendance_pct: number | null;
|
|
324408
|
+
/** @description True once no-show, cancelled, not closed and moved are separate. */
|
|
324409
|
+
split: boolean;
|
|
324410
|
+
};
|
|
324411
|
+
};
|
|
324412
|
+
"30d": {
|
|
324413
|
+
from: string;
|
|
324414
|
+
to: string;
|
|
324415
|
+
/** @description The clinic’s whole agenda. */
|
|
324416
|
+
clinic: {
|
|
324417
|
+
/** @description Past citas of the window, moved ones included. */
|
|
324418
|
+
total: number | null;
|
|
324419
|
+
/** @description Attended. */
|
|
324420
|
+
attended: number | null;
|
|
324421
|
+
/** @description No-show. */
|
|
324422
|
+
no_show: number | null;
|
|
324423
|
+
/** @description Cancelled, late ones included. */
|
|
324424
|
+
cancelled: number | null;
|
|
324425
|
+
/** @description Past citas nobody closed — never counted as attended. */
|
|
324426
|
+
not_closed: number | null;
|
|
324427
|
+
/** @description Moved by the clinic software — in no attendance count. */
|
|
324428
|
+
moved: number | null;
|
|
324429
|
+
/** @description attended + no_show + cancelled. */
|
|
324430
|
+
closed: number | null;
|
|
324431
|
+
/** @description attended ÷ closed, whole percent. */
|
|
324432
|
+
attendance_pct: number | null;
|
|
324433
|
+
/** @description The read hit its cap: counts are a floor. */
|
|
324434
|
+
truncated: boolean;
|
|
324435
|
+
};
|
|
324436
|
+
/** @description The citas booked by the agent. */
|
|
324437
|
+
agent: {
|
|
324438
|
+
/** @description Citas the agent booked in the window. */
|
|
324439
|
+
booked: number | null;
|
|
324440
|
+
/** @description Of them, attended. */
|
|
324441
|
+
attended: number | null;
|
|
324442
|
+
/** @description No-show + cancelled. */
|
|
324443
|
+
missed: number | null;
|
|
324444
|
+
/** @description Null until the split is available (`split`). */
|
|
324445
|
+
no_show: number | null;
|
|
324446
|
+
/** @description Null until the split is available (`split`). */
|
|
324447
|
+
cancelled: number | null;
|
|
324448
|
+
/** @description Null until the split is available (`split`). */
|
|
324449
|
+
not_closed: number | null;
|
|
324450
|
+
/** @description Null until the split is available (`split`). */
|
|
324451
|
+
moved: number | null;
|
|
324452
|
+
/** @description Agent bookings dated after the window. */
|
|
324453
|
+
upcoming: number | null;
|
|
324454
|
+
/** @description attended + missed. */
|
|
324455
|
+
closed: number | null;
|
|
324456
|
+
/** @description attended ÷ closed, one decimal. */
|
|
324457
|
+
attendance_pct: number | null;
|
|
324458
|
+
/** @description True once no-show, cancelled, not closed and moved are separate. */
|
|
324459
|
+
split: boolean;
|
|
324460
|
+
};
|
|
324461
|
+
};
|
|
324462
|
+
};
|
|
324463
|
+
rule: string;
|
|
324464
|
+
} | null;
|
|
324465
|
+
/** @description Sections this membership may not read: absent above, never zeroed. */
|
|
324466
|
+
withheld: ("whatsapp" | "first_contact" | "leads" | "agenda")[];
|
|
324467
|
+
/** @description «Necesitan atención»: what a person must act on in this clinic, ordered by severity then `since` (oldest first), only for the sections this membership reads. Each clears itself on the first refresh after it is fixed. */
|
|
324468
|
+
signals: components["schemas"]["ClinicSignal"][];
|
|
324469
|
+
/**
|
|
324470
|
+
* @description The highest severity in `signals` (`critical` > `warning` > `low`); null when there is none.
|
|
324471
|
+
* @enum {string|null}
|
|
324472
|
+
*/
|
|
324473
|
+
top_severity: "critical" | "warning" | "low" | null;
|
|
324474
|
+
};
|
|
324475
|
+
ClinicSummariesResponse: {
|
|
324476
|
+
data: {
|
|
324477
|
+
clinics: components["schemas"]["ClinicSummary"][];
|
|
324478
|
+
};
|
|
324479
|
+
};
|
|
324480
|
+
ClinicSummaryRefreshResponse: {
|
|
324481
|
+
data: {
|
|
324482
|
+
enqueued: boolean;
|
|
324483
|
+
};
|
|
324484
|
+
};
|
|
323590
324485
|
TeamNote: {
|
|
323591
324486
|
/** Format: uuid */
|
|
323592
324487
|
id: string;
|