@vitrina/api 15.12.2 → 15.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.cts +1932 -223
  2. package/dist/index.d.ts +1932 -223
  3. 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_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_insights: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" | "orders:read" | "orders:write" | "orders:checkout" | "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" | "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_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_insights: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" | "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. */
@@ -121002,7 +121002,7 @@ interface paths {
121002
121002
  */
121003
121003
  "application/json": {
121004
121004
  name: string;
121005
- 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_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_insights: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" | "orders:read" | "orders:write" | "orders:checkout" | "price_approval:read" | "price_approval:request" | "price_approval:approve" | "cotizacion_discount:approve" | "legal:read" | "legal:write")[];
121005
+ 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_patients:read" | "clinic_patients:write" | "clinic_record:read" | "clinic_record:write" | "clinic_money:read" | "clinic_money:write" | "clinic_admin:write" | "clinic_insights: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" | "orders:read" | "orders:write" | "orders:checkout" | "orders:refund" | "price_approval:read" | "price_approval:request" | "price_approval:approve" | "cotizacion_discount:approve" | "legal:read" | "legal:write")[];
121006
121006
  /** Format: date-time */
121007
121007
  expires_at?: string | null;
121008
121008
  };
@@ -212434,13 +212434,13 @@ interface paths {
212434
212434
  put?: never;
212435
212435
  /**
212436
212436
  * Open a storefront guest checkout
212437
- * @description A tenant’s own website (server side) sells with one call: the buyer (name, RUT, phone and/or email), the variants and the delivery method in; an order and its Mercado Pago link out. The buyer is found by email, then phone, or created; their RUT fills the contact’s empty one; an opt-in is recorded; the visit’s ad touch is kept for the Purchase. **Prices come from the catalog** (no price field); only native products.
212437
+ * @description A tenant’s own website (server side) sells with one call: the buyer (name, RUT, phone and/or email), the variants, the delivery method and optionally the payment provider in; an order and its payment link out (Mercado Pago by default, or Webpay with `payment_provider: "webpay"` when the tenant connected it: see `GET /orders/checkout/payment-providers`). The buyer is found by email, then phone, or created; their RUT fills the contact’s empty one; an opt-in is recorded; the visit’s ad touch is kept for the Purchase. **Prices come from the catalog** (no price field); only native products.
212438
212438
  *
212439
212439
  * **Holds.** A variant with inventory policy `deny` («Solo con stock») holds the requested units for 15 minutes: available = on hand − active holds, and the link stops taking money when the hold ends. With fewer units available the call is refused with 409 `insufficient_stock` (`details.available`). Two checkouts for the last unit: exactly one succeeds. A `continue` variant (made to order) never refuses and holds nothing. The hold ends when the payment settles (the sale: on hand goes down by the units), when the order is cancelled, or when it expires (the order is then cancelled and `order.status_changed` fires).
212440
212440
  *
212441
212441
  * **event_id** is the browser InitiateCheckout `eventID`: the server InitiateCheckout (when the buyer opens `checkout_url`) and the Purchase ship under it, so Meta deduplicates. It is also the idempotency key (200 + `replayed: true`).
212442
212442
  *
212443
- * Refusals (`error.details.reason`): 400 `buyer_contact_required` · `invalid_phone` · `invalid_rut` · `delivery_method_unavailable` · `unknown_item` · `inactive_item` · `no_price` · `variant_required`; 409 `insufficient_stock` · `store_item` · `event_id_reused` · `checkout_closed` · `already_paid` · `payment_not_connected`; 502 `payment_provider_unavailable`. Fires `order.created`. Requires `orders:checkout`.
212443
+ * Refusals (`error.details.reason`): 400 `buyer_contact_required` · `invalid_phone` · `invalid_rut` · `shipping_quote_required` · `shipping_address_required` · `shipping_phone_required` · `shipping_quote_unknown` · `shipping_service_required` · `shipping_service_unavailable` · `unknown_item` · `inactive_item` · `no_price` · `variant_required`; 409 `insufficient_stock` · `store_item` · `event_id_reused` · `checkout_closed` · `already_paid` · `payment_not_connected` · `shipping_quote_expired` · `shipping_quote_used` · `shipping_quote_items_mismatch` · `shipping_quote_destination_mismatch`; 502 `payment_provider_unavailable`. Fires `order.created`. Requires `orders:checkout`.
212444
212444
  */
212445
212445
  post: {
212446
212446
  parameters: {
@@ -212517,10 +212517,36 @@ interface paths {
212517
212517
  }[];
212518
212518
  delivery: {
212519
212519
  /**
212520
- * @description `pickup` (the buyer collects it at the store). `shipping` is refused with `delivery_method_unavailable` until the courier integration ships; it will then take a `quote_id` and the address fields additively.
212520
+ * @description `pickup` (the buyer collects it at the store) or `shipping` (courier delivery: needs `quote_id` and `address`).
212521
212521
  * @enum {string}
212522
212522
  */
212523
212523
  method: "pickup" | "shipping";
212524
+ /**
212525
+ * Format: uuid
212526
+ * @description `shipping`: a quote from `POST /orders/checkout/shipping-quotes` for exactly these items, not expired (30 minutes) and not used. Its price is the order’s `shipping_clp`, charged in the same payment.
212527
+ */
212528
+ quote_id?: string;
212529
+ /** @description `shipping`: which of the quote’s `options` (its `service_code`). Required when the quote has more than one. */
212530
+ service_code?: number;
212531
+ /** @description `shipping`: who receives the parcel. Each field defaults to the buyer’s. A phone is required (the buyer’s or this one). */
212532
+ recipient?: {
212533
+ name?: string | null;
212534
+ phone?: string | null;
212535
+ /** Format: email */
212536
+ email?: string | null;
212537
+ };
212538
+ /** @description `shipping`: street and number in the quote’s commune. */
212539
+ address?: {
212540
+ street: string;
212541
+ number: string;
212542
+ /** @description Depto, oficina, casa, block… */
212543
+ apartment?: string | null;
212544
+ };
212545
+ /** @description `shipping`, optional: the commune the buyer picked (name or code). Refused with `shipping_quote_destination_mismatch` when it is not the quote’s. */
212546
+ commune?: string;
212547
+ region?: string;
212548
+ /** @description `shipping`: instructions for the courier. */
212549
+ notes?: string;
212524
212550
  };
212525
212551
  /** @description The buyer’s opt-in to marketing messages as the site recorded it (Ley 21.719). Omit when the site asked nothing. */
212526
212552
  consent?: {
@@ -212546,7 +212572,7 @@ interface paths {
212546
212572
  /** @description Meta’s `_fbc` cookie, as read on the site. */
212547
212573
  fbc?: string | null;
212548
212574
  };
212549
- /** @description The site’s own pages Mercado Pago returns the buyer to (`pending` defaults to `success`). Mercado Pago appends its own query (`collection_status`, `payment_id`, `external_reference` = the checkout id). Show the result from `GET /orders/checkout/{id}`, never from the query string. */
212575
+ /** @description The site’s own pages the buyer returns to (`pending` defaults to `success`). Mercado Pago appends its own query (`collection_status`, `payment_id`, `external_reference` = the checkout id); Webpay returns through Vitrina, which commits the payment and then redirects here with `webpay_result=paid|rejected|cancelled|error` (`paid` → success, `rejected`/`cancelled` → failure, `error` → pending). Show the result from `GET /orders/checkout/{id}`, never from the query string. */
212550
212576
  return_urls: {
212551
212577
  /** Format: uri */
212552
212578
  success: string;
@@ -212555,6 +212581,11 @@ interface paths {
212555
212581
  /** Format: uri */
212556
212582
  pending?: string;
212557
212583
  };
212584
+ /**
212585
+ * @description The provider the buyer chose, one the tenant connected (`GET /orders/checkout/payment-providers`). Absent = Mercado Pago (or the only one connected). Another one is refused with 409 `payment_provider_not_connected`. On a replay of the same `event_id`, a different provider points the same checkout at it.
212586
+ * @enum {string}
212587
+ */
212588
+ payment_provider?: "mercadopago" | "webpay";
212558
212589
  notes?: string;
212559
212590
  };
212560
212591
  };
@@ -212592,6 +212623,8 @@ interface paths {
212592
212623
  * }
212593
212624
  * ],
212594
212625
  * "delivery_method": "pickup",
212626
+ * "shipping_clp": 0,
212627
+ * "shipping": null,
212595
212628
  * "paid_at": null,
212596
212629
  * "cancelled_at": null,
212597
212630
  * "hold_expires_at": "2026-10-29T15:15:00.000Z",
@@ -212600,6 +212633,7 @@ interface paths {
212600
212633
  * "checkout": {
212601
212634
  * "checkout_id": "0199e3b0-0000-7000-8000-0000000000b1",
212602
212635
  * "checkout_url": "https://api.vitrinadev.com/p/0199e3b0-0000-7000-8000-0000000000b1",
212636
+ * "provider": "mercadopago",
212603
212637
  * "amount_clp": 459990,
212604
212638
  * "expires_at": "2026-10-29T15:15:00.000Z"
212605
212639
  * },
@@ -212651,6 +212685,8 @@ interface paths {
212651
212685
  * }
212652
212686
  * ],
212653
212687
  * "delivery_method": "pickup",
212688
+ * "shipping_clp": 0,
212689
+ * "shipping": null,
212654
212690
  * "paid_at": null,
212655
212691
  * "cancelled_at": null,
212656
212692
  * "hold_expires_at": "2026-10-29T15:15:00.000Z",
@@ -212659,6 +212695,7 @@ interface paths {
212659
212695
  * "checkout": {
212660
212696
  * "checkout_id": "0199e3b0-0000-7000-8000-0000000000b1",
212661
212697
  * "checkout_url": "https://api.vitrinadev.com/p/0199e3b0-0000-7000-8000-0000000000b1",
212698
+ * "provider": "mercadopago",
212662
212699
  * "amount_clp": 459990,
212663
212700
  * "expires_at": "2026-10-29T15:15:00.000Z"
212664
212701
  * },
@@ -212740,6 +212777,118 @@ interface paths {
212740
212777
  patch?: never;
212741
212778
  trace?: never;
212742
212779
  };
212780
+ "/orders/checkout/payment-providers": {
212781
+ parameters: {
212782
+ query?: never;
212783
+ header?: never;
212784
+ path?: never;
212785
+ cookie?: never;
212786
+ };
212787
+ /**
212788
+ * List the payment providers a storefront may offer
212789
+ * @description The providers the tenant connected that a storefront checkout can charge through (`mercadopago`, `webpay`), in the order to offer them, and the `default` used when `POST /orders/checkout` names none. Offer a choice only when there are two; pass the buyer’s pick as `payment_provider`. Requires `orders:checkout`.
212790
+ */
212791
+ get: {
212792
+ parameters: {
212793
+ query?: never;
212794
+ header?: never;
212795
+ path?: never;
212796
+ cookie?: never;
212797
+ };
212798
+ requestBody?: never;
212799
+ responses: {
212800
+ /** @description The connected providers */
212801
+ 200: {
212802
+ headers: {
212803
+ [name: string]: unknown;
212804
+ };
212805
+ content: {
212806
+ /**
212807
+ * @example {
212808
+ * "data": {
212809
+ * "default": "mercadopago",
212810
+ * "providers": [
212811
+ * {
212812
+ * "provider": "mercadopago",
212813
+ * "name": "Mercado Pago"
212814
+ * },
212815
+ * {
212816
+ * "provider": "webpay",
212817
+ * "name": "Webpay"
212818
+ * }
212819
+ * ]
212820
+ * }
212821
+ * }
212822
+ */
212823
+ "application/json": {
212824
+ data: components["schemas"]["StorefrontPaymentProviders"];
212825
+ };
212826
+ };
212827
+ };
212828
+ /** @description Validation error */
212829
+ 400: {
212830
+ headers: {
212831
+ [name: string]: unknown;
212832
+ };
212833
+ content: {
212834
+ "application/json": components["schemas"]["Error"];
212835
+ };
212836
+ };
212837
+ /** @description Unauthorized */
212838
+ 401: {
212839
+ headers: {
212840
+ [name: string]: unknown;
212841
+ };
212842
+ content: {
212843
+ "application/json": components["schemas"]["Error"];
212844
+ };
212845
+ };
212846
+ /** @description Forbidden */
212847
+ 403: {
212848
+ headers: {
212849
+ [name: string]: unknown;
212850
+ };
212851
+ content: {
212852
+ "application/json": components["schemas"]["Error"];
212853
+ };
212854
+ };
212855
+ /** @description Not found */
212856
+ 404: {
212857
+ headers: {
212858
+ [name: string]: unknown;
212859
+ };
212860
+ content: {
212861
+ "application/json": components["schemas"]["Error"];
212862
+ };
212863
+ };
212864
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
212865
+ 409: {
212866
+ headers: {
212867
+ [name: string]: unknown;
212868
+ };
212869
+ content: {
212870
+ "application/json": components["schemas"]["Error"];
212871
+ };
212872
+ };
212873
+ /** @description Rate limited */
212874
+ 429: {
212875
+ headers: {
212876
+ [name: string]: unknown;
212877
+ };
212878
+ content: {
212879
+ "application/json": components["schemas"]["Error"];
212880
+ };
212881
+ };
212882
+ };
212883
+ };
212884
+ put?: never;
212885
+ post?: never;
212886
+ delete?: never;
212887
+ options?: never;
212888
+ head?: never;
212889
+ patch?: never;
212890
+ trace?: never;
212891
+ };
212743
212892
  "/orders/checkout/{id}": {
212744
212893
  parameters: {
212745
212894
  query?: never;
@@ -212793,6 +212942,8 @@ interface paths {
212793
212942
  * }
212794
212943
  * ],
212795
212944
  * "delivery_method": "pickup",
212945
+ * "shipping_clp": 0,
212946
+ * "shipping": null,
212796
212947
  * "paid_at": null,
212797
212948
  * "cancelled_at": null,
212798
212949
  * "hold_expires_at": "2026-10-29T15:15:00.000Z",
@@ -212883,7 +213034,7 @@ interface paths {
212883
213034
  get: {
212884
213035
  parameters: {
212885
213036
  query?: {
212886
- status?: ("draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled")[];
213037
+ status?: ("draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled" | "refunded")[];
212887
213038
  source?: ("native" | "shopify" | "woocommerce")[];
212888
213039
  contact_id?: string;
212889
213040
  conversation_id?: string;
@@ -212925,6 +213076,7 @@ interface paths {
212925
213076
  * "region": "Metropolitana"
212926
213077
  * },
212927
213078
  * "notes": null,
213079
+ * "shipping_clp": 0,
212928
213080
  * "total_clp": 39980,
212929
213081
  * "item_count": 2,
212930
213082
  * "stock_decremented_at": null,
@@ -212933,6 +213085,9 @@ interface paths {
212933
213085
  * "delivered_at": null,
212934
213086
  * "cancelled_at": null,
212935
213087
  * "cancelled_reason": null,
213088
+ * "refunded_at": null,
213089
+ * "refund_reason": null,
213090
+ * "refund_reference": null,
212936
213091
  * "buyer": {},
212937
213092
  * "attribution": {},
212938
213093
  * "client_event_id": null,
@@ -213180,6 +213335,7 @@ interface paths {
213180
213335
  * "region": "Metropolitana"
213181
213336
  * },
213182
213337
  * "notes": null,
213338
+ * "shipping_clp": 0,
213183
213339
  * "total_clp": 39980,
213184
213340
  * "item_count": 2,
213185
213341
  * "stock_decremented_at": null,
@@ -213188,6 +213344,9 @@ interface paths {
213188
213344
  * "delivered_at": null,
213189
213345
  * "cancelled_at": null,
213190
213346
  * "cancelled_reason": null,
213347
+ * "refunded_at": null,
213348
+ * "refund_reason": null,
213349
+ * "refund_reference": null,
213191
213350
  * "buyer": {},
213192
213351
  * "attribution": {},
213193
213352
  * "client_event_id": null,
@@ -213362,6 +213521,7 @@ interface paths {
213362
213521
  * "region": "Metropolitana"
213363
213522
  * },
213364
213523
  * "notes": null,
213524
+ * "shipping_clp": 0,
213365
213525
  * "total_clp": 39980,
213366
213526
  * "item_count": 2,
213367
213527
  * "stock_decremented_at": null,
@@ -213370,6 +213530,9 @@ interface paths {
213370
213530
  * "delivered_at": null,
213371
213531
  * "cancelled_at": null,
213372
213532
  * "cancelled_reason": null,
213533
+ * "refunded_at": null,
213534
+ * "refund_reason": null,
213535
+ * "refund_reference": null,
213373
213536
  * "buyer": {},
213374
213537
  * "attribution": {},
213375
213538
  * "client_event_id": null,
@@ -213551,6 +213714,7 @@ interface paths {
213551
213714
  * "region": "Metropolitana"
213552
213715
  * },
213553
213716
  * "notes": null,
213717
+ * "shipping_clp": 0,
213554
213718
  * "total_clp": 39980,
213555
213719
  * "item_count": 2,
213556
213720
  * "stock_decremented_at": null,
@@ -213559,6 +213723,9 @@ interface paths {
213559
213723
  * "delivered_at": null,
213560
213724
  * "cancelled_at": null,
213561
213725
  * "cancelled_reason": null,
213726
+ * "refunded_at": null,
213727
+ * "refund_reason": null,
213728
+ * "refund_reference": null,
213562
213729
  * "buyer": {},
213563
213730
  * "attribution": {},
213564
213731
  * "client_event_id": null,
@@ -213802,55 +213969,1507 @@ interface paths {
213802
213969
  };
213803
213970
  };
213804
213971
  };
213805
- delete?: never;
213806
- options?: never;
213807
- head?: never;
213808
- patch?: never;
213809
- trace?: never;
213810
- };
213811
- "/orders/{id}/fulfilment": {
213812
- parameters: {
213813
- query?: never;
213814
- header?: never;
213815
- path?: never;
213816
- cookie?: never;
213817
- };
213818
- get?: never;
213819
- put?: never;
213972
+ delete?: never;
213973
+ options?: never;
213974
+ head?: never;
213975
+ patch?: never;
213976
+ trace?: never;
213977
+ };
213978
+ "/orders/{id}/fulfilment": {
213979
+ parameters: {
213980
+ query?: never;
213981
+ header?: never;
213982
+ path?: never;
213983
+ cookie?: never;
213984
+ };
213985
+ get?: never;
213986
+ put?: never;
213987
+ /**
213988
+ * Move a paid order along fulfilment
213989
+ * @description `paid → preparing → shipped → delivered`; a step may be skipped (paid → shipped). An unpaid order answers 409 `invalid_transition`. The lead follows on an `ecommerce_orders` board (Despachado, Postventa). Fires `order.status_changed`. Requires `orders:write`.
213990
+ */
213991
+ post: {
213992
+ parameters: {
213993
+ query?: never;
213994
+ header?: {
213995
+ /** @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. */
213996
+ "Idempotency-Key"?: string;
213997
+ };
213998
+ path: {
213999
+ id: string;
214000
+ };
214001
+ cookie?: never;
214002
+ };
214003
+ requestBody?: {
214004
+ content: {
214005
+ /**
214006
+ * @example {
214007
+ * "status": "shipped"
214008
+ * }
214009
+ */
214010
+ "application/json": {
214011
+ /**
214012
+ * @description The next fulfilment step. A paid order may skip steps (paid → shipped).
214013
+ * @enum {string}
214014
+ */
214015
+ status: "preparing" | "shipped" | "delivered";
214016
+ };
214017
+ };
214018
+ };
214019
+ responses: {
214020
+ /** @description The order */
214021
+ 200: {
214022
+ headers: {
214023
+ [name: string]: unknown;
214024
+ };
214025
+ content: {
214026
+ /**
214027
+ * @example {
214028
+ * "data": {
214029
+ * "id": "0199e3b0-0000-7000-8000-000000000001",
214030
+ * "tenant_id": "0199e3b0-0000-7000-8000-0000000000aa",
214031
+ * "display_id": "O-42",
214032
+ * "source": "native",
214033
+ * "external_id": null,
214034
+ * "status": "shipped",
214035
+ * "contact_id": "0199e3b0-0000-7000-8000-0000000000c1",
214036
+ * "conversation_id": "0199e3b0-0000-7000-8000-0000000000c2",
214037
+ * "lead_id": "0199e3b0-0000-7000-8000-0000000000c3",
214038
+ * "obligation_group_id": "0199e3b0-0000-7000-8000-000000000002",
214039
+ * "currency": "CLP",
214040
+ * "delivery": {
214041
+ * "recipient_name": "Cliente de ejemplo",
214042
+ * "address": "Av. Ejemplo 123, depto 45",
214043
+ * "comuna": "Providencia",
214044
+ * "region": "Metropolitana"
214045
+ * },
214046
+ * "notes": null,
214047
+ * "shipping_clp": 0,
214048
+ * "total_clp": 39980,
214049
+ * "item_count": 2,
214050
+ * "stock_decremented_at": null,
214051
+ * "paid_at": null,
214052
+ * "shipped_at": null,
214053
+ * "delivered_at": null,
214054
+ * "cancelled_at": null,
214055
+ * "cancelled_reason": null,
214056
+ * "refunded_at": null,
214057
+ * "refund_reason": null,
214058
+ * "refund_reference": null,
214059
+ * "buyer": {},
214060
+ * "attribution": {},
214061
+ * "client_event_id": null,
214062
+ * "return_urls": null,
214063
+ * "created_by": "0199e3b0-0000-7000-8000-0000000000bb",
214064
+ * "created_at": "2026-10-15T12:00:00.000Z",
214065
+ * "updated_at": "2026-10-15T12:00:00.000Z",
214066
+ * "lines": [
214067
+ * {
214068
+ * "id": "0199e3b0-0000-7000-8000-0000000000d1",
214069
+ * "position": 0,
214070
+ * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214071
+ * "variant_id": "0199e3b0-0000-7000-8000-0000000000f1",
214072
+ * "title": "Polera básica",
214073
+ * "variant_title": "M / Negro",
214074
+ * "variant_options": [
214075
+ * {
214076
+ * "name": "Talla",
214077
+ * "value": "M"
214078
+ * },
214079
+ * {
214080
+ * "name": "Color",
214081
+ * "value": "Negro"
214082
+ * }
214083
+ * ],
214084
+ * "sku": "POL-M-NEG",
214085
+ * "unit_price_clp": 9990,
214086
+ * "quantity": 2,
214087
+ * "line_total_clp": 19980,
214088
+ * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a1"
214089
+ * },
214090
+ * {
214091
+ * "id": "0199e3b0-0000-7000-8000-0000000000d2",
214092
+ * "position": 1,
214093
+ * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214094
+ * "variant_id": "0199e3b0-0000-7000-8000-0000000000f2",
214095
+ * "title": "Polera básica",
214096
+ * "variant_title": "L / Blanco",
214097
+ * "variant_options": [
214098
+ * {
214099
+ * "name": "Talla",
214100
+ * "value": "L"
214101
+ * },
214102
+ * {
214103
+ * "name": "Color",
214104
+ * "value": "Blanco"
214105
+ * }
214106
+ * ],
214107
+ * "sku": "POL-L-BLA",
214108
+ * "unit_price_clp": 20000,
214109
+ * "quantity": 1,
214110
+ * "line_total_clp": 20000,
214111
+ * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a2"
214112
+ * }
214113
+ * ]
214114
+ * }
214115
+ * }
214116
+ */
214117
+ "application/json": {
214118
+ data: components["schemas"]["CommerceOrder"];
214119
+ };
214120
+ };
214121
+ };
214122
+ /** @description Validation error */
214123
+ 400: {
214124
+ headers: {
214125
+ [name: string]: unknown;
214126
+ };
214127
+ content: {
214128
+ "application/json": components["schemas"]["Error"];
214129
+ };
214130
+ };
214131
+ /** @description Unauthorized */
214132
+ 401: {
214133
+ headers: {
214134
+ [name: string]: unknown;
214135
+ };
214136
+ content: {
214137
+ "application/json": components["schemas"]["Error"];
214138
+ };
214139
+ };
214140
+ /** @description Forbidden */
214141
+ 403: {
214142
+ headers: {
214143
+ [name: string]: unknown;
214144
+ };
214145
+ content: {
214146
+ "application/json": components["schemas"]["Error"];
214147
+ };
214148
+ };
214149
+ /** @description Not found */
214150
+ 404: {
214151
+ headers: {
214152
+ [name: string]: unknown;
214153
+ };
214154
+ content: {
214155
+ "application/json": components["schemas"]["Error"];
214156
+ };
214157
+ };
214158
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
214159
+ 409: {
214160
+ headers: {
214161
+ [name: string]: unknown;
214162
+ };
214163
+ content: {
214164
+ "application/json": components["schemas"]["Error"];
214165
+ };
214166
+ };
214167
+ /** @description Rate limited */
214168
+ 429: {
214169
+ headers: {
214170
+ [name: string]: unknown;
214171
+ };
214172
+ content: {
214173
+ "application/json": components["schemas"]["Error"];
214174
+ };
214175
+ };
214176
+ };
214177
+ };
214178
+ delete?: never;
214179
+ options?: never;
214180
+ head?: never;
214181
+ patch?: never;
214182
+ trace?: never;
214183
+ };
214184
+ "/orders/{id}/cancel": {
214185
+ parameters: {
214186
+ query?: never;
214187
+ header?: never;
214188
+ path?: never;
214189
+ cookie?: never;
214190
+ };
214191
+ get?: never;
214192
+ put?: never;
214193
+ /**
214194
+ * Cancel an unpaid order
214195
+ * @description Cancels a `draft` or `pending_payment` order: its obligations and its group are cancelled and its Mercado Pago link stops taking money (a payment already in flight is credited to the customer, applied to nothing). An order that already received money answers 409 `order_has_payments`, a paid one 409 `order_paid`: giving money back is a refund on the payments ledger. Cancelling twice returns the cancelled order. Fires `order.status_changed`. Requires `orders:write`.
214196
+ */
214197
+ post: {
214198
+ parameters: {
214199
+ query?: never;
214200
+ header?: {
214201
+ /** @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. */
214202
+ "Idempotency-Key"?: string;
214203
+ };
214204
+ path: {
214205
+ id: string;
214206
+ };
214207
+ cookie?: never;
214208
+ };
214209
+ requestBody?: {
214210
+ content: {
214211
+ /**
214212
+ * @example {
214213
+ * "reason": "El cliente se arrepintió antes de pagar"
214214
+ * }
214215
+ */
214216
+ "application/json": {
214217
+ /** @example El cliente se arrepintió antes de pagar */
214218
+ reason: string;
214219
+ };
214220
+ };
214221
+ };
214222
+ responses: {
214223
+ /** @description The cancelled order */
214224
+ 200: {
214225
+ headers: {
214226
+ [name: string]: unknown;
214227
+ };
214228
+ content: {
214229
+ /**
214230
+ * @example {
214231
+ * "data": {
214232
+ * "id": "0199e3b0-0000-7000-8000-000000000001",
214233
+ * "tenant_id": "0199e3b0-0000-7000-8000-0000000000aa",
214234
+ * "display_id": "O-42",
214235
+ * "source": "native",
214236
+ * "external_id": null,
214237
+ * "status": "cancelled",
214238
+ * "contact_id": "0199e3b0-0000-7000-8000-0000000000c1",
214239
+ * "conversation_id": "0199e3b0-0000-7000-8000-0000000000c2",
214240
+ * "lead_id": "0199e3b0-0000-7000-8000-0000000000c3",
214241
+ * "obligation_group_id": "0199e3b0-0000-7000-8000-000000000002",
214242
+ * "currency": "CLP",
214243
+ * "delivery": {
214244
+ * "recipient_name": "Cliente de ejemplo",
214245
+ * "address": "Av. Ejemplo 123, depto 45",
214246
+ * "comuna": "Providencia",
214247
+ * "region": "Metropolitana"
214248
+ * },
214249
+ * "notes": null,
214250
+ * "shipping_clp": 0,
214251
+ * "total_clp": 39980,
214252
+ * "item_count": 2,
214253
+ * "stock_decremented_at": null,
214254
+ * "paid_at": null,
214255
+ * "shipped_at": null,
214256
+ * "delivered_at": null,
214257
+ * "cancelled_at": "2026-10-15T12:30:00.000Z",
214258
+ * "cancelled_reason": "El cliente se arrepintió antes de pagar",
214259
+ * "refunded_at": null,
214260
+ * "refund_reason": null,
214261
+ * "refund_reference": null,
214262
+ * "buyer": {},
214263
+ * "attribution": {},
214264
+ * "client_event_id": null,
214265
+ * "return_urls": null,
214266
+ * "created_by": "0199e3b0-0000-7000-8000-0000000000bb",
214267
+ * "created_at": "2026-10-15T12:00:00.000Z",
214268
+ * "updated_at": "2026-10-15T12:00:00.000Z",
214269
+ * "lines": [
214270
+ * {
214271
+ * "id": "0199e3b0-0000-7000-8000-0000000000d1",
214272
+ * "position": 0,
214273
+ * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214274
+ * "variant_id": "0199e3b0-0000-7000-8000-0000000000f1",
214275
+ * "title": "Polera básica",
214276
+ * "variant_title": "M / Negro",
214277
+ * "variant_options": [
214278
+ * {
214279
+ * "name": "Talla",
214280
+ * "value": "M"
214281
+ * },
214282
+ * {
214283
+ * "name": "Color",
214284
+ * "value": "Negro"
214285
+ * }
214286
+ * ],
214287
+ * "sku": "POL-M-NEG",
214288
+ * "unit_price_clp": 9990,
214289
+ * "quantity": 2,
214290
+ * "line_total_clp": 19980,
214291
+ * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a1"
214292
+ * },
214293
+ * {
214294
+ * "id": "0199e3b0-0000-7000-8000-0000000000d2",
214295
+ * "position": 1,
214296
+ * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214297
+ * "variant_id": "0199e3b0-0000-7000-8000-0000000000f2",
214298
+ * "title": "Polera básica",
214299
+ * "variant_title": "L / Blanco",
214300
+ * "variant_options": [
214301
+ * {
214302
+ * "name": "Talla",
214303
+ * "value": "L"
214304
+ * },
214305
+ * {
214306
+ * "name": "Color",
214307
+ * "value": "Blanco"
214308
+ * }
214309
+ * ],
214310
+ * "sku": "POL-L-BLA",
214311
+ * "unit_price_clp": 20000,
214312
+ * "quantity": 1,
214313
+ * "line_total_clp": 20000,
214314
+ * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a2"
214315
+ * }
214316
+ * ]
214317
+ * }
214318
+ * }
214319
+ */
214320
+ "application/json": {
214321
+ data: components["schemas"]["CommerceOrder"];
214322
+ };
214323
+ };
214324
+ };
214325
+ /** @description Validation error */
214326
+ 400: {
214327
+ headers: {
214328
+ [name: string]: unknown;
214329
+ };
214330
+ content: {
214331
+ "application/json": components["schemas"]["Error"];
214332
+ };
214333
+ };
214334
+ /** @description Unauthorized */
214335
+ 401: {
214336
+ headers: {
214337
+ [name: string]: unknown;
214338
+ };
214339
+ content: {
214340
+ "application/json": components["schemas"]["Error"];
214341
+ };
214342
+ };
214343
+ /** @description Forbidden */
214344
+ 403: {
214345
+ headers: {
214346
+ [name: string]: unknown;
214347
+ };
214348
+ content: {
214349
+ "application/json": components["schemas"]["Error"];
214350
+ };
214351
+ };
214352
+ /** @description Not found */
214353
+ 404: {
214354
+ headers: {
214355
+ [name: string]: unknown;
214356
+ };
214357
+ content: {
214358
+ "application/json": components["schemas"]["Error"];
214359
+ };
214360
+ };
214361
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
214362
+ 409: {
214363
+ headers: {
214364
+ [name: string]: unknown;
214365
+ };
214366
+ content: {
214367
+ "application/json": components["schemas"]["Error"];
214368
+ };
214369
+ };
214370
+ /** @description Rate limited */
214371
+ 429: {
214372
+ headers: {
214373
+ [name: string]: unknown;
214374
+ };
214375
+ content: {
214376
+ "application/json": components["schemas"]["Error"];
214377
+ };
214378
+ };
214379
+ };
214380
+ };
214381
+ delete?: never;
214382
+ options?: never;
214383
+ head?: never;
214384
+ patch?: never;
214385
+ trace?: never;
214386
+ };
214387
+ "/orders/{id}/refund": {
214388
+ parameters: {
214389
+ query?: never;
214390
+ header?: never;
214391
+ path?: never;
214392
+ cookie?: never;
214393
+ };
214394
+ get?: never;
214395
+ put?: never;
214396
+ /**
214397
+ * Refund a paid order in full
214398
+ * @description Gives a paid native order back in full (`paid`, `preparing`, `shipped` or `delivered`): retracto, a defect, a unit that could not be delivered. The refund runs at the provider the order was paid with, the workspace's own Mercado Pago or Webpay Plus (Webpay: a reversal the same day, an annulment later), against the order's payment (idempotent per order: a retry never refunds twice), the payment is reversed in the ledger and the ads engine nets the Purchase, the order becomes `refunded` and `order.status_changed` fires with `changes.status.to = refunded` (its `data.payment` names the refunded payment and its provider; `data.refunded_at` and `data.refund_reason` are set). The sold units go back on hand only when the workspace's own stock is Vitrina-managed (`restored_units`); when another system writes on-hand counts (a back office syncing absolute stock) nothing is added: that system reacts to the event. Refunding a refunded order answers 200 with `refunded: false`. Errors: 409 `order_not_paid` (draft, pending payment or cancelled), 409 `payment_not_refundable` (not paid through Mercado Pago or Webpay, e.g. a recorded transfer), 409 `refund_not_supported`, 409 `payment_not_connected`, 409 `store_order`; 502 `refund_refused` (the provider said no: past the refund window, a transaction not committed) or `payment_provider_unavailable`. On a 502 the order is unchanged and the call may be retried. Requires `orders:refund` (staff only; it is not part of any agent or storefront key).
214399
+ */
214400
+ post: {
214401
+ parameters: {
214402
+ query?: never;
214403
+ header?: {
214404
+ /** @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. */
214405
+ "Idempotency-Key"?: string;
214406
+ };
214407
+ path: {
214408
+ id: string;
214409
+ };
214410
+ cookie?: never;
214411
+ };
214412
+ requestBody?: {
214413
+ content: {
214414
+ /**
214415
+ * @example {
214416
+ * "reason": "Retracto: el cliente se arrepintió dentro de los 10 días"
214417
+ * }
214418
+ */
214419
+ "application/json": {
214420
+ /**
214421
+ * @description Why the order is given back (retracto, defect, unit not deliverable). Kept on the order and in the audit log.
214422
+ * @example Retracto: el cliente se arrepintió dentro de los 10 días
214423
+ */
214424
+ reason: string;
214425
+ };
214426
+ };
214427
+ };
214428
+ responses: {
214429
+ /** @description The refunded order */
214430
+ 200: {
214431
+ headers: {
214432
+ [name: string]: unknown;
214433
+ };
214434
+ content: {
214435
+ /**
214436
+ * @example {
214437
+ * "data": {
214438
+ * "order": {
214439
+ * "id": "0199e3b0-0000-7000-8000-000000000001",
214440
+ * "tenant_id": "0199e3b0-0000-7000-8000-0000000000aa",
214441
+ * "display_id": "O-42",
214442
+ * "source": "native",
214443
+ * "external_id": null,
214444
+ * "status": "refunded",
214445
+ * "contact_id": "0199e3b0-0000-7000-8000-0000000000c1",
214446
+ * "conversation_id": "0199e3b0-0000-7000-8000-0000000000c2",
214447
+ * "lead_id": "0199e3b0-0000-7000-8000-0000000000c3",
214448
+ * "obligation_group_id": "0199e3b0-0000-7000-8000-000000000002",
214449
+ * "currency": "CLP",
214450
+ * "delivery": {
214451
+ * "recipient_name": "Cliente de ejemplo",
214452
+ * "address": "Av. Ejemplo 123, depto 45",
214453
+ * "comuna": "Providencia",
214454
+ * "region": "Metropolitana"
214455
+ * },
214456
+ * "notes": null,
214457
+ * "shipping_clp": 0,
214458
+ * "total_clp": 39980,
214459
+ * "item_count": 2,
214460
+ * "stock_decremented_at": null,
214461
+ * "paid_at": "2026-10-15T12:05:00.000Z",
214462
+ * "shipped_at": null,
214463
+ * "delivered_at": null,
214464
+ * "cancelled_at": null,
214465
+ * "cancelled_reason": null,
214466
+ * "refunded_at": "2026-10-16T09:00:00.000Z",
214467
+ * "refund_reason": "Retracto: el cliente se arrepintió dentro de los 10 días",
214468
+ * "refund_reference": "1318847654",
214469
+ * "buyer": {},
214470
+ * "attribution": {},
214471
+ * "client_event_id": null,
214472
+ * "return_urls": null,
214473
+ * "created_by": "0199e3b0-0000-7000-8000-0000000000bb",
214474
+ * "created_at": "2026-10-15T12:00:00.000Z",
214475
+ * "updated_at": "2026-10-15T12:00:00.000Z",
214476
+ * "lines": [
214477
+ * {
214478
+ * "id": "0199e3b0-0000-7000-8000-0000000000d1",
214479
+ * "position": 0,
214480
+ * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214481
+ * "variant_id": "0199e3b0-0000-7000-8000-0000000000f1",
214482
+ * "title": "Polera básica",
214483
+ * "variant_title": "M / Negro",
214484
+ * "variant_options": [
214485
+ * {
214486
+ * "name": "Talla",
214487
+ * "value": "M"
214488
+ * },
214489
+ * {
214490
+ * "name": "Color",
214491
+ * "value": "Negro"
214492
+ * }
214493
+ * ],
214494
+ * "sku": "POL-M-NEG",
214495
+ * "unit_price_clp": 9990,
214496
+ * "quantity": 2,
214497
+ * "line_total_clp": 19980,
214498
+ * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a1"
214499
+ * },
214500
+ * {
214501
+ * "id": "0199e3b0-0000-7000-8000-0000000000d2",
214502
+ * "position": 1,
214503
+ * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214504
+ * "variant_id": "0199e3b0-0000-7000-8000-0000000000f2",
214505
+ * "title": "Polera básica",
214506
+ * "variant_title": "L / Blanco",
214507
+ * "variant_options": [
214508
+ * {
214509
+ * "name": "Talla",
214510
+ * "value": "L"
214511
+ * },
214512
+ * {
214513
+ * "name": "Color",
214514
+ * "value": "Blanco"
214515
+ * }
214516
+ * ],
214517
+ * "sku": "POL-L-BLA",
214518
+ * "unit_price_clp": 20000,
214519
+ * "quantity": 1,
214520
+ * "line_total_clp": 20000,
214521
+ * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a2"
214522
+ * }
214523
+ * ]
214524
+ * },
214525
+ * "refunded": true,
214526
+ * "restored_units": 1
214527
+ * }
214528
+ * }
214529
+ */
214530
+ "application/json": {
214531
+ data: components["schemas"]["OrderRefundResult"];
214532
+ };
214533
+ };
214534
+ };
214535
+ /** @description Validation error */
214536
+ 400: {
214537
+ headers: {
214538
+ [name: string]: unknown;
214539
+ };
214540
+ content: {
214541
+ "application/json": components["schemas"]["Error"];
214542
+ };
214543
+ };
214544
+ /** @description Unauthorized */
214545
+ 401: {
214546
+ headers: {
214547
+ [name: string]: unknown;
214548
+ };
214549
+ content: {
214550
+ "application/json": components["schemas"]["Error"];
214551
+ };
214552
+ };
214553
+ /** @description Forbidden */
214554
+ 403: {
214555
+ headers: {
214556
+ [name: string]: unknown;
214557
+ };
214558
+ content: {
214559
+ "application/json": components["schemas"]["Error"];
214560
+ };
214561
+ };
214562
+ /** @description Not found */
214563
+ 404: {
214564
+ headers: {
214565
+ [name: string]: unknown;
214566
+ };
214567
+ content: {
214568
+ "application/json": components["schemas"]["Error"];
214569
+ };
214570
+ };
214571
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
214572
+ 409: {
214573
+ headers: {
214574
+ [name: string]: unknown;
214575
+ };
214576
+ content: {
214577
+ "application/json": components["schemas"]["Error"];
214578
+ };
214579
+ };
214580
+ /** @description Rate limited */
214581
+ 429: {
214582
+ headers: {
214583
+ [name: string]: unknown;
214584
+ };
214585
+ content: {
214586
+ "application/json": components["schemas"]["Error"];
214587
+ };
214588
+ };
214589
+ };
214590
+ };
214591
+ delete?: never;
214592
+ options?: never;
214593
+ head?: never;
214594
+ patch?: never;
214595
+ trace?: never;
214596
+ };
214597
+ "/orders/checkout/shipping-communes": {
214598
+ parameters: {
214599
+ query?: never;
214600
+ header?: never;
214601
+ path?: never;
214602
+ cookie?: never;
214603
+ };
214604
+ /**
214605
+ * List the communes the store ships to
214606
+ * @description Every commune (and locality) the store’s courier (Chilexpress) delivers to, with the `coverage_code` a quote takes. Cached 12 hours. 409 `shipping_not_connected` when the store has no courier connected. Requires `orders:checkout` (a storefront’s key) or `orders:read`.
214607
+ */
214608
+ get: {
214609
+ parameters: {
214610
+ query?: never;
214611
+ header?: never;
214612
+ path?: never;
214613
+ cookie?: never;
214614
+ };
214615
+ requestBody?: never;
214616
+ responses: {
214617
+ /** @description The communes, by region then name */
214618
+ 200: {
214619
+ headers: {
214620
+ [name: string]: unknown;
214621
+ };
214622
+ content: {
214623
+ /**
214624
+ * @example {
214625
+ * "data": [
214626
+ * {
214627
+ * "coverage_code": "CONC",
214628
+ * "name": "Concepcion",
214629
+ * "commune": "Concepcion",
214630
+ * "region_code": "R8",
214631
+ * "region": "Biobio",
214632
+ * "kind": "commune"
214633
+ * }
214634
+ * ]
214635
+ * }
214636
+ */
214637
+ "application/json": {
214638
+ data: components["schemas"]["ShippingCommune"][];
214639
+ };
214640
+ };
214641
+ };
214642
+ /** @description Validation error */
214643
+ 400: {
214644
+ headers: {
214645
+ [name: string]: unknown;
214646
+ };
214647
+ content: {
214648
+ "application/json": components["schemas"]["Error"];
214649
+ };
214650
+ };
214651
+ /** @description Unauthorized */
214652
+ 401: {
214653
+ headers: {
214654
+ [name: string]: unknown;
214655
+ };
214656
+ content: {
214657
+ "application/json": components["schemas"]["Error"];
214658
+ };
214659
+ };
214660
+ /** @description Forbidden */
214661
+ 403: {
214662
+ headers: {
214663
+ [name: string]: unknown;
214664
+ };
214665
+ content: {
214666
+ "application/json": components["schemas"]["Error"];
214667
+ };
214668
+ };
214669
+ /** @description Not found */
214670
+ 404: {
214671
+ headers: {
214672
+ [name: string]: unknown;
214673
+ };
214674
+ content: {
214675
+ "application/json": components["schemas"]["Error"];
214676
+ };
214677
+ };
214678
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
214679
+ 409: {
214680
+ headers: {
214681
+ [name: string]: unknown;
214682
+ };
214683
+ content: {
214684
+ "application/json": components["schemas"]["Error"];
214685
+ };
214686
+ };
214687
+ /** @description Rate limited */
214688
+ 429: {
214689
+ headers: {
214690
+ [name: string]: unknown;
214691
+ };
214692
+ content: {
214693
+ "application/json": components["schemas"]["Error"];
214694
+ };
214695
+ };
214696
+ };
214697
+ };
214698
+ put?: never;
214699
+ post?: never;
214700
+ delete?: never;
214701
+ options?: never;
214702
+ head?: never;
214703
+ patch?: never;
214704
+ trace?: never;
214705
+ };
214706
+ "/orders/checkout/shipping-quotes": {
214707
+ parameters: {
214708
+ query?: never;
214709
+ header?: never;
214710
+ path?: never;
214711
+ cookie?: never;
214712
+ };
214713
+ get?: never;
214714
+ put?: never;
214715
+ /**
214716
+ * Quote courier delivery for a checkout
214717
+ * @description The price (and an estimated transit in business days) of delivering these items to a commune, per service the store offers, cheapest first. The package is the store’s unit box × the quantity; the declared value is the items’ catalog price. The quote is kept **30 minutes**: send its `quote_id` (and a `service_code` when there are several options) in `POST /orders/checkout` with `delivery.method = shipping`; the price is charged with the products in the same payment. The caller never states a price.
214718
+ *
214719
+ * Refusals (`error.details.reason`): 400 `unknown_commune` · `commune_required` · `unknown_item` · `inactive_item` · `no_price`; 409 `shipping_not_connected` · `no_shipping_service` · `insufficient_stock` · `shipping_key_rejected`; 502 `shipping_provider_unavailable`. Requires `orders:checkout` (a storefront’s key) or `orders:read`.
214720
+ */
214721
+ post: {
214722
+ parameters: {
214723
+ query?: never;
214724
+ header?: {
214725
+ /** @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. */
214726
+ "Idempotency-Key"?: string;
214727
+ };
214728
+ path?: never;
214729
+ cookie?: never;
214730
+ };
214731
+ requestBody?: {
214732
+ content: {
214733
+ /**
214734
+ * @example {
214735
+ * "items": [
214736
+ * {
214737
+ * "variant_id": "0199e3b0-0000-7000-8000-0000000000f1",
214738
+ * "quantity": 1
214739
+ * }
214740
+ * ],
214741
+ * "destination": {
214742
+ * "coverage_code": "CONC"
214743
+ * }
214744
+ * }
214745
+ */
214746
+ "application/json": {
214747
+ /** @description The items the buyer is about to check out (the same list the checkout will send). */
214748
+ items: {
214749
+ /** Format: uuid */
214750
+ variant_id: string;
214751
+ /** @default 1 */
214752
+ quantity?: number;
214753
+ }[];
214754
+ destination: {
214755
+ /** @description A code from `GET /orders/checkout/shipping-communes` (preferred). */
214756
+ coverage_code?: string;
214757
+ /** @description Or the commune name (accents ignored). */
214758
+ commune?: string;
214759
+ region_code?: string;
214760
+ };
214761
+ };
214762
+ };
214763
+ };
214764
+ responses: {
214765
+ /** @description The quote */
214766
+ 201: {
214767
+ headers: {
214768
+ [name: string]: unknown;
214769
+ };
214770
+ content: {
214771
+ /**
214772
+ * @example {
214773
+ * "data": {
214774
+ * "quote_id": "0199e3b0-0000-7000-8000-0000000000a9",
214775
+ * "carrier": "chilexpress",
214776
+ * "destination": {
214777
+ * "coverage_code": "CONC",
214778
+ * "commune": "Concepcion",
214779
+ * "region_code": "R8",
214780
+ * "region": "Biobio"
214781
+ * },
214782
+ * "options": [
214783
+ * {
214784
+ * "service_code": 3,
214785
+ * "service_name": "Express",
214786
+ * "price_clp": 6424,
214787
+ * "estimated_business_days": 2
214788
+ * }
214789
+ * ],
214790
+ * "expires_at": "2026-10-29T15:30:00.000Z"
214791
+ * }
214792
+ * }
214793
+ */
214794
+ "application/json": {
214795
+ data: components["schemas"]["ShippingQuote"];
214796
+ };
214797
+ };
214798
+ };
214799
+ /** @description Validation error */
214800
+ 400: {
214801
+ headers: {
214802
+ [name: string]: unknown;
214803
+ };
214804
+ content: {
214805
+ "application/json": components["schemas"]["Error"];
214806
+ };
214807
+ };
214808
+ /** @description Unauthorized */
214809
+ 401: {
214810
+ headers: {
214811
+ [name: string]: unknown;
214812
+ };
214813
+ content: {
214814
+ "application/json": components["schemas"]["Error"];
214815
+ };
214816
+ };
214817
+ /** @description Forbidden */
214818
+ 403: {
214819
+ headers: {
214820
+ [name: string]: unknown;
214821
+ };
214822
+ content: {
214823
+ "application/json": components["schemas"]["Error"];
214824
+ };
214825
+ };
214826
+ /** @description Not found */
214827
+ 404: {
214828
+ headers: {
214829
+ [name: string]: unknown;
214830
+ };
214831
+ content: {
214832
+ "application/json": components["schemas"]["Error"];
214833
+ };
214834
+ };
214835
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
214836
+ 409: {
214837
+ headers: {
214838
+ [name: string]: unknown;
214839
+ };
214840
+ content: {
214841
+ "application/json": components["schemas"]["Error"];
214842
+ };
214843
+ };
214844
+ /** @description Rate limited */
214845
+ 429: {
214846
+ headers: {
214847
+ [name: string]: unknown;
214848
+ };
214849
+ content: {
214850
+ "application/json": components["schemas"]["Error"];
214851
+ };
214852
+ };
214853
+ };
214854
+ };
214855
+ delete?: never;
214856
+ options?: never;
214857
+ head?: never;
214858
+ patch?: never;
214859
+ trace?: never;
214860
+ };
214861
+ "/orders/{id}/shipment": {
214862
+ parameters: {
214863
+ query?: never;
214864
+ header?: never;
214865
+ path?: never;
214866
+ cookie?: never;
214867
+ };
214868
+ /**
214869
+ * Get an order’s shipment and label
214870
+ * @description The courier shipment of an order: number, public tracking link, service, and the label to print (`label.base64`, a JPEG), or null once erased. 404 before dispatch. Requires `orders:read`.
214871
+ */
214872
+ get: {
214873
+ parameters: {
214874
+ query?: never;
214875
+ header?: never;
214876
+ path: {
214877
+ id: string;
214878
+ };
214879
+ cookie?: never;
214880
+ };
214881
+ requestBody?: never;
214882
+ responses: {
214883
+ /** @description The shipment */
214884
+ 200: {
214885
+ headers: {
214886
+ [name: string]: unknown;
214887
+ };
214888
+ content: {
214889
+ /**
214890
+ * @example {
214891
+ * "data": {
214892
+ * "carrier": "chilexpress",
214893
+ * "environment": "test",
214894
+ * "shipment_number": "712678918615",
214895
+ * "tracking_url": "https://centrodeayuda.chilexpress.cl/seguimiento/712678918615",
214896
+ * "service_code": 3,
214897
+ * "service_name": "EXPRESS",
214898
+ * "reference": "O-42",
214899
+ * "has_label": true,
214900
+ * "created_at": "2026-10-30T12:00:00.000Z",
214901
+ * "label": {
214902
+ * "content_type": "image/jpeg",
214903
+ * "base64": "/9j/4AAQSkZJRgABAQ…"
214904
+ * }
214905
+ * }
214906
+ * }
214907
+ */
214908
+ "application/json": {
214909
+ data: components["schemas"]["CommerceShipment"] & {
214910
+ label: {
214911
+ /** @enum {string} */
214912
+ content_type: "image/jpeg";
214913
+ base64: string;
214914
+ } | null;
214915
+ };
214916
+ };
214917
+ };
214918
+ };
214919
+ /** @description Validation error */
214920
+ 400: {
214921
+ headers: {
214922
+ [name: string]: unknown;
214923
+ };
214924
+ content: {
214925
+ "application/json": components["schemas"]["Error"];
214926
+ };
214927
+ };
214928
+ /** @description Unauthorized */
214929
+ 401: {
214930
+ headers: {
214931
+ [name: string]: unknown;
214932
+ };
214933
+ content: {
214934
+ "application/json": components["schemas"]["Error"];
214935
+ };
214936
+ };
214937
+ /** @description Forbidden */
214938
+ 403: {
214939
+ headers: {
214940
+ [name: string]: unknown;
214941
+ };
214942
+ content: {
214943
+ "application/json": components["schemas"]["Error"];
214944
+ };
214945
+ };
214946
+ /** @description Not found */
214947
+ 404: {
214948
+ headers: {
214949
+ [name: string]: unknown;
214950
+ };
214951
+ content: {
214952
+ "application/json": components["schemas"]["Error"];
214953
+ };
214954
+ };
214955
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
214956
+ 409: {
214957
+ headers: {
214958
+ [name: string]: unknown;
214959
+ };
214960
+ content: {
214961
+ "application/json": components["schemas"]["Error"];
214962
+ };
214963
+ };
214964
+ /** @description Rate limited */
214965
+ 429: {
214966
+ headers: {
214967
+ [name: string]: unknown;
214968
+ };
214969
+ content: {
214970
+ "application/json": components["schemas"]["Error"];
214971
+ };
214972
+ };
214973
+ };
214974
+ };
214975
+ put?: never;
214976
+ /**
214977
+ * Dispatch an order by courier
214978
+ * @description «Despachar»: creates the shipment (transport order) at Chilexpress for a paid order with `delivery.method = shipping`, stores its number, its public tracking link and its label (`GET /orders/{id}/shipment`), writes `delivery.shipment` on the order and moves it to `shipped` (fires `order.status_changed`). Dispatching again returns the existing shipment (200, `created: false`).
214979
+ *
214980
+ * Refusals (`error.details.reason`): 409 `not_a_shipping_order` · `order_not_dispatchable` · `shipping_address_incomplete` · `shipping_not_connected` · `shipping_dispatch_not_configured` · `shipping_key_rejected` · `store_order`; 400 `shipping_rejected` (Chilexpress refused the data; `details.provider_errors`); 502 `shipping_provider_unavailable`. Requires `orders:write`.
214981
+ */
214982
+ post: {
214983
+ parameters: {
214984
+ query?: never;
214985
+ header?: {
214986
+ /** @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. */
214987
+ "Idempotency-Key"?: string;
214988
+ };
214989
+ path: {
214990
+ id: string;
214991
+ };
214992
+ cookie?: never;
214993
+ };
214994
+ requestBody?: {
214995
+ content: {
214996
+ /** @example {} */
214997
+ "application/json": {
214998
+ /** @description Override the service the buyer chose (default: the order’s). */
214999
+ service_code?: number;
215000
+ };
215001
+ };
215002
+ };
215003
+ responses: {
215004
+ /** @description Already dispatched: the existing shipment */
215005
+ 200: {
215006
+ headers: {
215007
+ [name: string]: unknown;
215008
+ };
215009
+ content: {
215010
+ /**
215011
+ * @example {
215012
+ * "data": {
215013
+ * "shipment": {
215014
+ * "carrier": "chilexpress",
215015
+ * "environment": "test",
215016
+ * "shipment_number": "712678918615",
215017
+ * "tracking_url": "https://centrodeayuda.chilexpress.cl/seguimiento/712678918615",
215018
+ * "service_code": 3,
215019
+ * "service_name": "EXPRESS",
215020
+ * "reference": "O-42",
215021
+ * "has_label": true,
215022
+ * "created_at": "2026-10-30T12:00:00.000Z"
215023
+ * },
215024
+ * "created": false
215025
+ * }
215026
+ * }
215027
+ */
215028
+ "application/json": {
215029
+ data: {
215030
+ order: components["schemas"]["CommerceOrder"];
215031
+ shipment: components["schemas"]["CommerceShipment"];
215032
+ created: boolean;
215033
+ };
215034
+ };
215035
+ };
215036
+ };
215037
+ /** @description Dispatched */
215038
+ 201: {
215039
+ headers: {
215040
+ [name: string]: unknown;
215041
+ };
215042
+ content: {
215043
+ /**
215044
+ * @example {
215045
+ * "data": {
215046
+ * "shipment": {
215047
+ * "carrier": "chilexpress",
215048
+ * "environment": "test",
215049
+ * "shipment_number": "712678918615",
215050
+ * "tracking_url": "https://centrodeayuda.chilexpress.cl/seguimiento/712678918615",
215051
+ * "service_code": 3,
215052
+ * "service_name": "EXPRESS",
215053
+ * "reference": "O-42",
215054
+ * "has_label": true,
215055
+ * "created_at": "2026-10-30T12:00:00.000Z"
215056
+ * },
215057
+ * "created": true
215058
+ * }
215059
+ * }
215060
+ */
215061
+ "application/json": {
215062
+ data: {
215063
+ order: components["schemas"]["CommerceOrder"];
215064
+ shipment: components["schemas"]["CommerceShipment"];
215065
+ created: boolean;
215066
+ };
215067
+ };
215068
+ };
215069
+ };
215070
+ /** @description Validation error */
215071
+ 400: {
215072
+ headers: {
215073
+ [name: string]: unknown;
215074
+ };
215075
+ content: {
215076
+ "application/json": components["schemas"]["Error"];
215077
+ };
215078
+ };
215079
+ /** @description Unauthorized */
215080
+ 401: {
215081
+ headers: {
215082
+ [name: string]: unknown;
215083
+ };
215084
+ content: {
215085
+ "application/json": components["schemas"]["Error"];
215086
+ };
215087
+ };
215088
+ /** @description Forbidden */
215089
+ 403: {
215090
+ headers: {
215091
+ [name: string]: unknown;
215092
+ };
215093
+ content: {
215094
+ "application/json": components["schemas"]["Error"];
215095
+ };
215096
+ };
215097
+ /** @description Not found */
215098
+ 404: {
215099
+ headers: {
215100
+ [name: string]: unknown;
215101
+ };
215102
+ content: {
215103
+ "application/json": components["schemas"]["Error"];
215104
+ };
215105
+ };
215106
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
215107
+ 409: {
215108
+ headers: {
215109
+ [name: string]: unknown;
215110
+ };
215111
+ content: {
215112
+ "application/json": components["schemas"]["Error"];
215113
+ };
215114
+ };
215115
+ /** @description Rate limited */
215116
+ 429: {
215117
+ headers: {
215118
+ [name: string]: unknown;
215119
+ };
215120
+ content: {
215121
+ "application/json": components["schemas"]["Error"];
215122
+ };
215123
+ };
215124
+ };
215125
+ };
215126
+ delete?: never;
215127
+ options?: never;
215128
+ head?: never;
215129
+ patch?: never;
215130
+ trace?: never;
215131
+ };
215132
+ "/shipping/chilexpress": {
215133
+ parameters: {
215134
+ query?: never;
215135
+ header?: never;
215136
+ path?: never;
215137
+ cookie?: never;
215138
+ };
215139
+ /**
215140
+ * Get the store’s Chilexpress connection
215141
+ * @description The store’s own Chilexpress account as connected: environment, origin commune, TCC, sender, return address, default package, offered services, and masked key previews (never the keys). `connected: false` when none. Requires `tenant:read`.
215142
+ */
215143
+ get: {
215144
+ parameters: {
215145
+ query?: never;
215146
+ header?: never;
215147
+ path?: never;
215148
+ cookie?: never;
215149
+ };
215150
+ requestBody?: never;
215151
+ responses: {
215152
+ /** @description The connection */
215153
+ 200: {
215154
+ headers: {
215155
+ [name: string]: unknown;
215156
+ };
215157
+ content: {
215158
+ /**
215159
+ * @example {
215160
+ * "data": {
215161
+ * "connected": true,
215162
+ * "environment": "test",
215163
+ * "origin_coverage_code": "PROV",
215164
+ * "origin_commune": "Providencia",
215165
+ * "origin_region_code": "RM",
215166
+ * "customer_card_number": "18578680",
215167
+ * "keys": {
215168
+ * "rating": "a1b2••••9f",
215169
+ * "shipments": "c3d4••••0e",
215170
+ * "coverage": null
215171
+ * },
215172
+ * "can_dispatch": true,
215173
+ * "sender": {
215174
+ * "name": "Tienda Ejemplo",
215175
+ * "phone": "+56912345678",
215176
+ * "email": "ventas@tienda.example.cl"
215177
+ * },
215178
+ * "return_address": {
215179
+ * "street": "Av. Ejemplo",
215180
+ * "number": "123",
215181
+ * "supplement": "Oficina 5"
215182
+ * },
215183
+ * "package": {
215184
+ * "weight_kg": 0.6,
215185
+ * "height_cm": 8,
215186
+ * "width_cm": 12,
215187
+ * "length_cm": 20
215188
+ * },
215189
+ * "services": [
215190
+ * 3
215191
+ * ],
215192
+ * "declared_content": "celular",
215193
+ * "seller_rut": null,
215194
+ * "connected_at": "2026-10-29T15:00:00.000Z"
215195
+ * }
215196
+ * }
215197
+ */
215198
+ "application/json": {
215199
+ data: components["schemas"]["ChilexpressConnection"];
215200
+ };
215201
+ };
215202
+ };
215203
+ /** @description Validation error */
215204
+ 400: {
215205
+ headers: {
215206
+ [name: string]: unknown;
215207
+ };
215208
+ content: {
215209
+ "application/json": components["schemas"]["Error"];
215210
+ };
215211
+ };
215212
+ /** @description Unauthorized */
215213
+ 401: {
215214
+ headers: {
215215
+ [name: string]: unknown;
215216
+ };
215217
+ content: {
215218
+ "application/json": components["schemas"]["Error"];
215219
+ };
215220
+ };
215221
+ /** @description Forbidden */
215222
+ 403: {
215223
+ headers: {
215224
+ [name: string]: unknown;
215225
+ };
215226
+ content: {
215227
+ "application/json": components["schemas"]["Error"];
215228
+ };
215229
+ };
215230
+ /** @description Not found */
215231
+ 404: {
215232
+ headers: {
215233
+ [name: string]: unknown;
215234
+ };
215235
+ content: {
215236
+ "application/json": components["schemas"]["Error"];
215237
+ };
215238
+ };
215239
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
215240
+ 409: {
215241
+ headers: {
215242
+ [name: string]: unknown;
215243
+ };
215244
+ content: {
215245
+ "application/json": components["schemas"]["Error"];
215246
+ };
215247
+ };
215248
+ /** @description Rate limited */
215249
+ 429: {
215250
+ headers: {
215251
+ [name: string]: unknown;
215252
+ };
215253
+ content: {
215254
+ "application/json": components["schemas"]["Error"];
215255
+ };
215256
+ };
215257
+ };
215258
+ };
215259
+ /**
215260
+ * Connect or update the store’s Chilexpress account
215261
+ * @description Saves the store’s own Chilexpress account (developers.wschilexpress.com subscription keys, Tarjeta Cliente Chilexpress, origin commune, sender, return address, default package). The Cotizador key is verified with a real quote first; keys are stored encrypted and never returned. Keys not sent are kept. The Envíos key is proven on the first dispatch. Production keys may need a commercial agreement with Chilexpress.
215262
+ *
215263
+ * Refusals (`error.details.reason`): 400 `invalid_chilexpress_settings` (`details.field`) · `chilexpress_key_rejected` · `unknown_commune`; 502 `shipping_provider_unavailable`. Requires `tenant:write`.
215264
+ */
215265
+ put: {
215266
+ parameters: {
215267
+ query?: never;
215268
+ header?: never;
215269
+ path?: never;
215270
+ cookie?: never;
215271
+ };
215272
+ requestBody?: {
215273
+ content: {
215274
+ /**
215275
+ * @example {
215276
+ * "environment": "test",
215277
+ * "rating_key": "<Cotizador primary key>",
215278
+ * "shipments_key": "<Envíos primary key>",
215279
+ * "customer_card_number": "18578680",
215280
+ * "origin_commune": "Providencia",
215281
+ * "sender": {
215282
+ * "name": "Tienda Ejemplo",
215283
+ * "phone": "+56912345678",
215284
+ * "email": "ventas@tienda.example.cl"
215285
+ * },
215286
+ * "return_address": {
215287
+ * "street": "Av. Ejemplo",
215288
+ * "number": "123",
215289
+ * "supplement": "Oficina 5"
215290
+ * },
215291
+ * "declared_content": "celular"
215292
+ * }
215293
+ */
215294
+ "application/json": {
215295
+ /**
215296
+ * @description `test` = testservices.wschilexpress.com (self-service keys), `production` = services.wschilexpress.com.
215297
+ * @enum {string}
215298
+ */
215299
+ environment: "test" | "production";
215300
+ /** @description Primary key of the «Cotizador» subscription (developers.wschilexpress.com → Perfil). Required on the first connect; omit to keep the stored one. */
215301
+ rating_key?: string;
215302
+ /** @description Primary key of the «Envíos» subscription: needed to dispatch. Omit to keep; null or "" clears it. */
215303
+ shipments_key?: string | null;
215304
+ /** @description Primary key of the «Coberturas» subscription. Optional: the Cotizador key is used when absent. */
215305
+ coverage_key?: string | null;
215306
+ /**
215307
+ * @description Tarjeta Cliente Chilexpress (TCC): the account shipments are billed to. Needed to dispatch. Test: 18578680.
215308
+ * @example 18578680
215309
+ */
215310
+ customer_card_number?: string | null;
215311
+ /**
215312
+ * @description The commune the store ships from: a name (`Providencia`) or a Chilexpress coverage code (`PROV`).
215313
+ * @example Providencia
215314
+ */
215315
+ origin_commune: string;
215316
+ /** @description Narrows a commune name to a region (`RM`, `R8`…) when the name exists in two. */
215317
+ origin_region_code?: string;
215318
+ /** @description Printed on the label as the sender. */
215319
+ sender: {
215320
+ name: string;
215321
+ phone: string;
215322
+ /** Format: email */
215323
+ email: string;
215324
+ };
215325
+ /** @description Where Chilexpress returns an undeliverable parcel (in the origin commune). */
215326
+ return_address: {
215327
+ street: string;
215328
+ number: string;
215329
+ supplement?: string | null;
215330
+ };
215331
+ /** @description One unit in its shipping box (default an iPhone box in a mailer: 0.6 kg, 20×12×8 cm). N units stack: weight and height × N. */
215332
+ package?: {
215333
+ weight_kg?: number;
215334
+ height_cm?: number;
215335
+ width_cm?: number;
215336
+ length_cm?: number;
215337
+ };
215338
+ /** @description Services offered to buyers (default `[3]`, Express). Quotes show only these. */
215339
+ services?: number[];
215340
+ /**
215341
+ * @description What the parcel contains, as Chilexpress declares it on the label.
215342
+ * @enum {string}
215343
+ */
215344
+ declared_content?: "celular" | "tecnologia" | "articulos_personales" | "educacion" | "vestuario" | "otros";
215345
+ /** @description The company RUT without dots or check digit, when Chilexpress asks for it on the account. */
215346
+ seller_rut?: string | null;
215347
+ };
215348
+ };
215349
+ };
215350
+ responses: {
215351
+ /** @description The connection */
215352
+ 200: {
215353
+ headers: {
215354
+ [name: string]: unknown;
215355
+ };
215356
+ content: {
215357
+ /**
215358
+ * @example {
215359
+ * "data": {
215360
+ * "connected": true,
215361
+ * "environment": "test",
215362
+ * "origin_coverage_code": "PROV",
215363
+ * "origin_commune": "Providencia",
215364
+ * "origin_region_code": "RM",
215365
+ * "customer_card_number": "18578680",
215366
+ * "keys": {
215367
+ * "rating": "a1b2••••9f",
215368
+ * "shipments": "c3d4••••0e",
215369
+ * "coverage": null
215370
+ * },
215371
+ * "can_dispatch": true,
215372
+ * "sender": {
215373
+ * "name": "Tienda Ejemplo",
215374
+ * "phone": "+56912345678",
215375
+ * "email": "ventas@tienda.example.cl"
215376
+ * },
215377
+ * "return_address": {
215378
+ * "street": "Av. Ejemplo",
215379
+ * "number": "123",
215380
+ * "supplement": "Oficina 5"
215381
+ * },
215382
+ * "package": {
215383
+ * "weight_kg": 0.6,
215384
+ * "height_cm": 8,
215385
+ * "width_cm": 12,
215386
+ * "length_cm": 20
215387
+ * },
215388
+ * "services": [
215389
+ * 3
215390
+ * ],
215391
+ * "declared_content": "celular",
215392
+ * "seller_rut": null,
215393
+ * "connected_at": "2026-10-29T15:00:00.000Z"
215394
+ * }
215395
+ * }
215396
+ */
215397
+ "application/json": {
215398
+ data: components["schemas"]["ChilexpressConnection"];
215399
+ };
215400
+ };
215401
+ };
215402
+ /** @description Validation error */
215403
+ 400: {
215404
+ headers: {
215405
+ [name: string]: unknown;
215406
+ };
215407
+ content: {
215408
+ "application/json": components["schemas"]["Error"];
215409
+ };
215410
+ };
215411
+ /** @description Unauthorized */
215412
+ 401: {
215413
+ headers: {
215414
+ [name: string]: unknown;
215415
+ };
215416
+ content: {
215417
+ "application/json": components["schemas"]["Error"];
215418
+ };
215419
+ };
215420
+ /** @description Forbidden */
215421
+ 403: {
215422
+ headers: {
215423
+ [name: string]: unknown;
215424
+ };
215425
+ content: {
215426
+ "application/json": components["schemas"]["Error"];
215427
+ };
215428
+ };
215429
+ /** @description Not found */
215430
+ 404: {
215431
+ headers: {
215432
+ [name: string]: unknown;
215433
+ };
215434
+ content: {
215435
+ "application/json": components["schemas"]["Error"];
215436
+ };
215437
+ };
215438
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
215439
+ 409: {
215440
+ headers: {
215441
+ [name: string]: unknown;
215442
+ };
215443
+ content: {
215444
+ "application/json": components["schemas"]["Error"];
215445
+ };
215446
+ };
215447
+ /** @description Rate limited */
215448
+ 429: {
215449
+ headers: {
215450
+ [name: string]: unknown;
215451
+ };
215452
+ content: {
215453
+ "application/json": components["schemas"]["Error"];
215454
+ };
215455
+ };
215456
+ };
215457
+ };
215458
+ post?: never;
213820
215459
  /**
213821
- * Move a paid order along fulfilment
213822
- * @description `paid → preparing → shipped → delivered`; a step may be skipped (paid → shipped). An unpaid order answers 409 `invalid_transition`. The lead follows on an `ecommerce_orders` board (Despachado, Postventa). Fires `order.status_changed`. Requires `orders:write`.
215460
+ * Disconnect the store’s Chilexpress account
215461
+ * @description Disables the connection (reversible: connecting again re-enables it). Quotes and dispatches answer 409 `shipping_not_connected` until then; shipments already created keep their tracking links. Requires `tenant:write`.
213823
215462
  */
213824
- post: {
215463
+ delete: {
213825
215464
  parameters: {
213826
215465
  query?: never;
213827
- header?: {
213828
- /** @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. */
213829
- "Idempotency-Key"?: string;
213830
- };
213831
- path: {
213832
- id: string;
213833
- };
215466
+ header?: never;
215467
+ path?: never;
213834
215468
  cookie?: never;
213835
215469
  };
213836
- requestBody?: {
213837
- content: {
213838
- /**
213839
- * @example {
213840
- * "status": "shipped"
213841
- * }
213842
- */
213843
- "application/json": {
213844
- /**
213845
- * @description The next fulfilment step. A paid order may skip steps (paid → shipped).
213846
- * @enum {string}
213847
- */
213848
- status: "preparing" | "shipped" | "delivered";
213849
- };
213850
- };
213851
- };
215470
+ requestBody?: never;
213852
215471
  responses: {
213853
- /** @description The order */
215472
+ /** @description The connection, now `connected: false` */
213854
215473
  200: {
213855
215474
  headers: {
213856
215475
  [name: string]: unknown;
@@ -213859,92 +215478,45 @@ interface paths {
213859
215478
  /**
213860
215479
  * @example {
213861
215480
  * "data": {
213862
- * "id": "0199e3b0-0000-7000-8000-000000000001",
213863
- * "tenant_id": "0199e3b0-0000-7000-8000-0000000000aa",
213864
- * "display_id": "O-42",
213865
- * "source": "native",
213866
- * "external_id": null,
213867
- * "status": "shipped",
213868
- * "contact_id": "0199e3b0-0000-7000-8000-0000000000c1",
213869
- * "conversation_id": "0199e3b0-0000-7000-8000-0000000000c2",
213870
- * "lead_id": "0199e3b0-0000-7000-8000-0000000000c3",
213871
- * "obligation_group_id": "0199e3b0-0000-7000-8000-000000000002",
213872
- * "currency": "CLP",
213873
- * "delivery": {
213874
- * "recipient_name": "Cliente de ejemplo",
213875
- * "address": "Av. Ejemplo 123, depto 45",
213876
- * "comuna": "Providencia",
213877
- * "region": "Metropolitana"
215481
+ * "connected": false,
215482
+ * "environment": "test",
215483
+ * "origin_coverage_code": "PROV",
215484
+ * "origin_commune": "Providencia",
215485
+ * "origin_region_code": "RM",
215486
+ * "customer_card_number": "18578680",
215487
+ * "keys": {
215488
+ * "rating": "a1b2••••9f",
215489
+ * "shipments": "c3d4••••0e",
215490
+ * "coverage": null
215491
+ * },
215492
+ * "can_dispatch": true,
215493
+ * "sender": {
215494
+ * "name": "Tienda Ejemplo",
215495
+ * "phone": "+56912345678",
215496
+ * "email": "ventas@tienda.example.cl"
213878
215497
  * },
213879
- * "notes": null,
213880
- * "total_clp": 39980,
213881
- * "item_count": 2,
213882
- * "stock_decremented_at": null,
213883
- * "paid_at": null,
213884
- * "shipped_at": null,
213885
- * "delivered_at": null,
213886
- * "cancelled_at": null,
213887
- * "cancelled_reason": null,
213888
- * "buyer": {},
213889
- * "attribution": {},
213890
- * "client_event_id": null,
213891
- * "return_urls": null,
213892
- * "created_by": "0199e3b0-0000-7000-8000-0000000000bb",
213893
- * "created_at": "2026-10-15T12:00:00.000Z",
213894
- * "updated_at": "2026-10-15T12:00:00.000Z",
213895
- * "lines": [
213896
- * {
213897
- * "id": "0199e3b0-0000-7000-8000-0000000000d1",
213898
- * "position": 0,
213899
- * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
213900
- * "variant_id": "0199e3b0-0000-7000-8000-0000000000f1",
213901
- * "title": "Polera básica",
213902
- * "variant_title": "M / Negro",
213903
- * "variant_options": [
213904
- * {
213905
- * "name": "Talla",
213906
- * "value": "M"
213907
- * },
213908
- * {
213909
- * "name": "Color",
213910
- * "value": "Negro"
213911
- * }
213912
- * ],
213913
- * "sku": "POL-M-NEG",
213914
- * "unit_price_clp": 9990,
213915
- * "quantity": 2,
213916
- * "line_total_clp": 19980,
213917
- * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a1"
213918
- * },
213919
- * {
213920
- * "id": "0199e3b0-0000-7000-8000-0000000000d2",
213921
- * "position": 1,
213922
- * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
213923
- * "variant_id": "0199e3b0-0000-7000-8000-0000000000f2",
213924
- * "title": "Polera básica",
213925
- * "variant_title": "L / Blanco",
213926
- * "variant_options": [
213927
- * {
213928
- * "name": "Talla",
213929
- * "value": "L"
213930
- * },
213931
- * {
213932
- * "name": "Color",
213933
- * "value": "Blanco"
213934
- * }
213935
- * ],
213936
- * "sku": "POL-L-BLA",
213937
- * "unit_price_clp": 20000,
213938
- * "quantity": 1,
213939
- * "line_total_clp": 20000,
213940
- * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a2"
213941
- * }
213942
- * ]
215498
+ * "return_address": {
215499
+ * "street": "Av. Ejemplo",
215500
+ * "number": "123",
215501
+ * "supplement": "Oficina 5"
215502
+ * },
215503
+ * "package": {
215504
+ * "weight_kg": 0.6,
215505
+ * "height_cm": 8,
215506
+ * "width_cm": 12,
215507
+ * "length_cm": 20
215508
+ * },
215509
+ * "services": [
215510
+ * 3
215511
+ * ],
215512
+ * "declared_content": "celular",
215513
+ * "seller_rut": null,
215514
+ * "connected_at": "2026-10-29T15:00:00.000Z"
213943
215515
  * }
213944
215516
  * }
213945
215517
  */
213946
215518
  "application/json": {
213947
- data: components["schemas"]["CommerceOrder"];
215519
+ data: components["schemas"]["ChilexpressConnection"];
213948
215520
  };
213949
215521
  };
213950
215522
  };
@@ -214004,13 +215576,12 @@ interface paths {
214004
215576
  };
214005
215577
  };
214006
215578
  };
214007
- delete?: never;
214008
215579
  options?: never;
214009
215580
  head?: never;
214010
215581
  patch?: never;
214011
215582
  trace?: never;
214012
215583
  };
214013
- "/orders/{id}/cancel": {
215584
+ "/shipping/estimates": {
214014
215585
  parameters: {
214015
215586
  query?: never;
214016
215587
  header?: never;
@@ -214020,8 +215591,8 @@ interface paths {
214020
215591
  get?: never;
214021
215592
  put?: never;
214022
215593
  /**
214023
- * Cancel an unpaid order
214024
- * @description Cancels a `draft` or `pending_payment` order: its obligations and its group are cancelled and its Mercado Pago link stops taking money (a payment already in flight is credited to the customer, applied to nothing). An order that already received money answers 409 `order_has_payments`, a paid one 409 `order_paid`: giving money back is a refund on the payments ledger. Cancelling twice returns the cancelled order. Fires `order.status_changed`. Requires `orders:write`.
215594
+ * Estimate a delivery to where a buyer said
215595
+ * @description Prices a Chilexpress delivery from the store’s connection (its origin, the services it offers, its default box times `quantity`) to a destination as a buyer wrote it: a commune («Ñuñoa», «Stgo centro»), an address («Av. Alemania 0450, Temuco») and/or a region. Stores nothing: there is no quote id, and a checkout still needs `POST /orders/checkout/shipping-quotes`. Never creates a shipment. `status`: `quoted` (destination + options), `needs_commune` (`reason` missing / ambiguous / region_mismatch / not_found, with `candidates` to ask about; send the chosen `coverage_code` back), `not_covered` (no offered service reaches it), `unknown_item`. The same answer the AI agent’s `quote_shipping` tool gives. 409 `shipping_not_connected` without a courier. Requires `orders:read`.
214025
215596
  */
214026
215597
  post: {
214027
215598
  parameters: {
@@ -214030,26 +215601,33 @@ interface paths {
214030
215601
  /** @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. */
214031
215602
  "Idempotency-Key"?: string;
214032
215603
  };
214033
- path: {
214034
- id: string;
214035
- };
215604
+ path?: never;
214036
215605
  cookie?: never;
214037
215606
  };
214038
215607
  requestBody?: {
214039
215608
  content: {
214040
215609
  /**
214041
215610
  * @example {
214042
- * "reason": "El cliente se arrepintió antes de pagar"
215611
+ * "address": "Av. Alemania 0450, Temuco"
214043
215612
  * }
214044
215613
  */
214045
215614
  "application/json": {
214046
- /** @example El cliente se arrepintió antes de pagar */
214047
- reason: string;
215615
+ /** @description The commune as the buyer wrote it («Ñuñoa», «Stgo centro»). Accents and case are ignored. */
215616
+ commune?: string;
215617
+ /** @description The address as the buyer wrote it («Av. Alemania 0450, Temuco»); the commune is found in it. */
215618
+ address?: string;
215619
+ /** @description The region as the buyer wrote it («Araucanía», «RM», «IX»); narrows the commune. */
215620
+ region?: string;
215621
+ /** @description A `coverage_code` from an earlier answer’s `candidates`, once the buyer picked one. */
215622
+ coverage_code?: string;
215623
+ /** @description Optional: a variant id or product id from the catalog, or a SKU. Its catalog price is the declared value; omitted = one standard box, nothing declared. */
215624
+ item?: string;
215625
+ quantity?: number;
214048
215626
  };
214049
215627
  };
214050
215628
  };
214051
215629
  responses: {
214052
- /** @description The cancelled order */
215630
+ /** @description The estimate, or what is missing to make one */
214053
215631
  200: {
214054
215632
  headers: {
214055
215633
  [name: string]: unknown;
@@ -214058,92 +215636,35 @@ interface paths {
214058
215636
  /**
214059
215637
  * @example {
214060
215638
  * "data": {
214061
- * "id": "0199e3b0-0000-7000-8000-000000000001",
214062
- * "tenant_id": "0199e3b0-0000-7000-8000-0000000000aa",
214063
- * "display_id": "O-42",
214064
- * "source": "native",
214065
- * "external_id": null,
214066
- * "status": "cancelled",
214067
- * "contact_id": "0199e3b0-0000-7000-8000-0000000000c1",
214068
- * "conversation_id": "0199e3b0-0000-7000-8000-0000000000c2",
214069
- * "lead_id": "0199e3b0-0000-7000-8000-0000000000c3",
214070
- * "obligation_group_id": "0199e3b0-0000-7000-8000-000000000002",
214071
- * "currency": "CLP",
214072
- * "delivery": {
214073
- * "recipient_name": "Cliente de ejemplo",
214074
- * "address": "Av. Ejemplo 123, depto 45",
214075
- * "comuna": "Providencia",
214076
- * "region": "Metropolitana"
215639
+ * "status": "quoted",
215640
+ * "carrier": "chilexpress",
215641
+ * "destination": {
215642
+ * "coverage_code": "TEMU",
215643
+ * "commune": "Temuco",
215644
+ * "region_code": "R9",
215645
+ * "region": "Araucania"
214077
215646
  * },
214078
- * "notes": null,
214079
- * "total_clp": 39980,
214080
- * "item_count": 2,
214081
- * "stock_decremented_at": null,
214082
- * "paid_at": null,
214083
- * "shipped_at": null,
214084
- * "delivered_at": null,
214085
- * "cancelled_at": "2026-10-15T12:30:00.000Z",
214086
- * "cancelled_reason": "El cliente se arrepintió antes de pagar",
214087
- * "buyer": {},
214088
- * "attribution": {},
214089
- * "client_event_id": null,
214090
- * "return_urls": null,
214091
- * "created_by": "0199e3b0-0000-7000-8000-0000000000bb",
214092
- * "created_at": "2026-10-15T12:00:00.000Z",
214093
- * "updated_at": "2026-10-15T12:00:00.000Z",
214094
- * "lines": [
214095
- * {
214096
- * "id": "0199e3b0-0000-7000-8000-0000000000d1",
214097
- * "position": 0,
214098
- * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214099
- * "variant_id": "0199e3b0-0000-7000-8000-0000000000f1",
214100
- * "title": "Polera básica",
214101
- * "variant_title": "M / Negro",
214102
- * "variant_options": [
214103
- * {
214104
- * "name": "Talla",
214105
- * "value": "M"
214106
- * },
214107
- * {
214108
- * "name": "Color",
214109
- * "value": "Negro"
214110
- * }
214111
- * ],
214112
- * "sku": "POL-M-NEG",
214113
- * "unit_price_clp": 9990,
214114
- * "quantity": 2,
214115
- * "line_total_clp": 19980,
214116
- * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a1"
214117
- * },
215647
+ * "options": [
214118
215648
  * {
214119
- * "id": "0199e3b0-0000-7000-8000-0000000000d2",
214120
- * "position": 1,
214121
- * "product_id": "0199e3b0-0000-7000-8000-0000000000e1",
214122
- * "variant_id": "0199e3b0-0000-7000-8000-0000000000f2",
214123
- * "title": "Polera básica",
214124
- * "variant_title": "L / Blanco",
214125
- * "variant_options": [
214126
- * {
214127
- * "name": "Talla",
214128
- * "value": "L"
214129
- * },
214130
- * {
214131
- * "name": "Color",
214132
- * "value": "Blanco"
214133
- * }
214134
- * ],
214135
- * "sku": "POL-L-BLA",
214136
- * "unit_price_clp": 20000,
214137
- * "quantity": 1,
214138
- * "line_total_clp": 20000,
214139
- * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a2"
215649
+ * "service_code": 3,
215650
+ * "service_name": "Express",
215651
+ * "price_clp": 6965,
215652
+ * "estimated_business_days": 2
214140
215653
  * }
214141
- * ]
215654
+ * ],
215655
+ * "item": null,
215656
+ * "package": {
215657
+ * "weight_kg": 0.6,
215658
+ * "height_cm": 8,
215659
+ * "width_cm": 12,
215660
+ * "length_cm": 20
215661
+ * },
215662
+ * "units": 1
214142
215663
  * }
214143
215664
  * }
214144
215665
  */
214145
215666
  "application/json": {
214146
- data: components["schemas"]["CommerceOrder"];
215667
+ data: components["schemas"]["ShippingEstimate"];
214147
215668
  };
214148
215669
  };
214149
215670
  };
@@ -236357,6 +237878,8 @@ interface components {
236357
237878
  date_format?: "latam" | "us" | "iso";
236358
237879
  /** @description The workspace's declared public website. */
236359
237880
  website?: string;
237881
+ /** @description Where the store's own product pages live, e.g. `https://macphones.cl/iphone/{slug}`. Placeholders (the product's fields): `{slug}` (title as a URL slug), `{sku}`, `{id}`, `{brand}`. The agent's stock search returns each product's page link when this is set; a product can override it with `attributes.public_url`. Send `null` or an empty string to clear. */
237882
+ product_url_template?: string | null;
236360
237883
  /** @description Vitrina Ads workspace choices; absent until first answered. */
236361
237884
  ads?: {
236362
237885
  /**
@@ -246805,7 +248328,7 @@ interface components {
246805
248328
  order_id: string;
246806
248329
  display_id: string;
246807
248330
  /** @enum {string} */
246808
- status: "draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled";
248331
+ status: "draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled" | "refunded";
246809
248332
  total_clp: number;
246810
248333
  currency: string;
246811
248334
  lines: {
@@ -246822,6 +248345,20 @@ interface components {
246822
248345
  unit_price_clp: number;
246823
248346
  }[];
246824
248347
  delivery_method: string | null;
248348
+ /** @description The delivery charge inside `total_clp` (a courier quote’s price). 0 for pickup. */
248349
+ shipping_clp: number;
248350
+ /** @description Courier delivery facts the buyer may see. Null for pickup. */
248351
+ shipping: {
248352
+ carrier: string;
248353
+ service_name: string | null;
248354
+ commune: string | null;
248355
+ region: string | null;
248356
+ estimated_business_days: number | null;
248357
+ /** @description The courier’s tracking number, once dispatched. */
248358
+ shipment_number: string | null;
248359
+ /** @description The courier’s public tracking page, once dispatched. Link the buyer to it. */
248360
+ tracking_url: string | null;
248361
+ } | null;
246825
248362
  paid_at: string | null;
246826
248363
  cancelled_at: string | null;
246827
248364
  /** @description While unpaid: when the held units are released and the link stops taking money. */
@@ -246833,8 +248370,13 @@ interface components {
246833
248370
  checkout: {
246834
248371
  /** Format: uuid */
246835
248372
  checkout_id: string;
246836
- /** @description Send the buyer here: Vitrina’s tracked redirect to the Mercado Pago checkout (records the server-side InitiateCheckout). */
248373
+ /** @description Send the buyer here (a plain redirect, whatever the provider): Vitrina’s tracked link, which records the server-side InitiateCheckout and then redirects to the Mercado Pago checkout or posts the buyer to the Webpay form. */
246837
248374
  checkout_url: string;
248375
+ /**
248376
+ * @description The provider the link charges through.
248377
+ * @enum {string}
248378
+ */
248379
+ provider: "mercadopago" | "webpay";
246838
248380
  amount_clp: number;
246839
248381
  expires_at: string | null;
246840
248382
  };
@@ -246846,6 +248388,20 @@ interface components {
246846
248388
  contact_id: string | null;
246847
248389
  replayed: boolean;
246848
248390
  };
248391
+ StorefrontPaymentProviders: {
248392
+ /**
248393
+ * @description The provider a checkout without `payment_provider` uses; null when none is connected (checkout answers 409 `payment_not_connected`).
248394
+ * @enum {string|null}
248395
+ */
248396
+ default: "mercadopago" | "webpay" | null;
248397
+ /** @description The providers the tenant connected, in the order to offer them. */
248398
+ providers: {
248399
+ /** @enum {string} */
248400
+ provider: "mercadopago" | "webpay";
248401
+ /** @example Webpay */
248402
+ name: string;
248403
+ }[];
248404
+ };
246849
248405
  CommerceOrder: {
246850
248406
  /** Format: uuid */
246851
248407
  id: string;
@@ -246862,7 +248418,7 @@ interface components {
246862
248418
  /** @description A store order: the store's modification time as of the last applied store event. */
246863
248419
  external_updated_at: string | null;
246864
248420
  /** @enum {string} */
246865
- status: "draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled";
248421
+ status: "draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled" | "refunded";
246866
248422
  /** Format: uuid */
246867
248423
  contact_id: string | null;
246868
248424
  /** Format: uuid */
@@ -246876,6 +248432,9 @@ interface components {
246876
248432
  [key: string]: unknown;
246877
248433
  };
246878
248434
  notes: string | null;
248435
+ /** @description What the order charges for delivery (a courier quote frozen at checkout, `delivery.method = shipping`). Included in `total_clp`. */
248436
+ shipping_clp: number;
248437
+ /** @description Σ of the lines + `shipping_clp`. */
246879
248438
  total_clp: number;
246880
248439
  item_count: number;
246881
248440
  stock_decremented_at: string | null;
@@ -246884,6 +248443,11 @@ interface components {
246884
248443
  delivered_at: string | null;
246885
248444
  cancelled_at: string | null;
246886
248445
  cancelled_reason: string | null;
248446
+ /** @description When a paid order was refunded in full (`status: refunded`). */
248447
+ refunded_at: string | null;
248448
+ refund_reason: string | null;
248449
+ /** @description The payment provider refund id (Mercado Pago refund id, or the Webpay refund authorization code), when returned. */
248450
+ refund_reference: string | null;
246887
248451
  /** @description A storefront checkout’s buyer as declared at purchase (`POST /orders/checkout`). `{}` for orders created by staff or the agent: the contact is the buyer. */
246888
248452
  buyer: {
246889
248453
  name?: string | null;
@@ -246930,6 +248494,151 @@ interface components {
246930
248494
  obligation_id: string | null;
246931
248495
  }[];
246932
248496
  };
248497
+ OrderRefundResult: {
248498
+ order: components["schemas"]["CommerceOrder"];
248499
+ /** @description `true` when this call refunded the order, `false` when it was already refunded (a replay changes nothing). */
248500
+ refunded: boolean;
248501
+ /** @description Units put back on hand by this refund. 0 when another system owns the workspace on-hand count (it receives `order.status_changed` and writes the count itself) or on a replay. */
248502
+ restored_units: number;
248503
+ };
248504
+ ShippingCommune: {
248505
+ /** @example CONC */
248506
+ coverage_code: string;
248507
+ /** @example Concepcion */
248508
+ name: string;
248509
+ commune: string;
248510
+ /** @example R8 */
248511
+ region_code: string;
248512
+ region: string | null;
248513
+ /** @enum {string} */
248514
+ kind: "commune" | "locality";
248515
+ };
248516
+ ShippingQuote: {
248517
+ /** Format: uuid */
248518
+ quote_id: string;
248519
+ /** @enum {string} */
248520
+ carrier: "chilexpress";
248521
+ destination: {
248522
+ coverage_code: string;
248523
+ commune: string;
248524
+ region_code: string;
248525
+ region: string | null;
248526
+ };
248527
+ /** @description Cheapest first. */
248528
+ options: {
248529
+ /** @description Chilexpress service type: 2 Prioritario, 3 Express (día hábil siguiente), 4 Extendido, 5 Extremos, 41/42 encomiendas grandes. */
248530
+ service_code: number;
248531
+ service_name: string;
248532
+ price_clp: number;
248533
+ /** @description An estimate implied by the service and the region (Chilexpress gives no transit time). */
248534
+ estimated_business_days: number | null;
248535
+ }[];
248536
+ /** @description Send `quote_id` to `POST /orders/checkout` before this. */
248537
+ expires_at: string;
248538
+ };
248539
+ CommerceShipment: {
248540
+ /** @enum {string} */
248541
+ carrier: "chilexpress";
248542
+ environment: string;
248543
+ /**
248544
+ * @description Chilexpress transport order (OT) number.
248545
+ * @example 712678918615
248546
+ */
248547
+ shipment_number: string;
248548
+ /** @description Chilexpress’s public tracking page for this shipment. */
248549
+ tracking_url: string;
248550
+ service_code: number;
248551
+ service_name: string | null;
248552
+ /** @description The order’s display id, printed as the reference. */
248553
+ reference: string;
248554
+ has_label: boolean;
248555
+ created_at: string;
248556
+ };
248557
+ ChilexpressConnection: {
248558
+ connected: boolean;
248559
+ /** @enum {string|null} */
248560
+ environment: "test" | "production" | null;
248561
+ origin_coverage_code: string | null;
248562
+ origin_commune: string | null;
248563
+ origin_region_code: string | null;
248564
+ customer_card_number: string | null;
248565
+ /** @description Masked previews of the stored keys (never the keys). */
248566
+ keys: {
248567
+ rating: string | null;
248568
+ shipments: string | null;
248569
+ coverage: string | null;
248570
+ };
248571
+ /** @description True once a TCC and the Envíos key are stored. */
248572
+ can_dispatch: boolean;
248573
+ sender: {
248574
+ name: string;
248575
+ phone: string;
248576
+ email: string;
248577
+ } | null;
248578
+ return_address: {
248579
+ street: string;
248580
+ number: string;
248581
+ supplement: string | null;
248582
+ } | null;
248583
+ package: {
248584
+ weight_kg: number;
248585
+ height_cm: number;
248586
+ width_cm: number;
248587
+ length_cm: number;
248588
+ };
248589
+ services: number[];
248590
+ /**
248591
+ * @description What the parcel contains, as Chilexpress declares it on the label.
248592
+ * @enum {string}
248593
+ */
248594
+ declared_content: "celular" | "tecnologia" | "articulos_personales" | "educacion" | "vestuario" | "otros";
248595
+ seller_rut: string | null;
248596
+ connected_at: string | null;
248597
+ };
248598
+ ShippingEstimate: {
248599
+ /** @enum {string} */
248600
+ status: "quoted" | "needs_commune" | "not_covered" | "unknown_item";
248601
+ /** @enum {string} */
248602
+ carrier?: "chilexpress";
248603
+ destination?: {
248604
+ coverage_code: string;
248605
+ commune: string;
248606
+ region_code: string;
248607
+ region: string | null;
248608
+ };
248609
+ /** @description `quoted`: cheapest first. */
248610
+ options?: {
248611
+ /** @description Chilexpress service type: 2 Prioritario, 3 Express (día hábil siguiente), 4 Extendido, 5 Extremos, 41/42 encomiendas grandes. */
248612
+ service_code: number;
248613
+ service_name: string;
248614
+ price_clp: number;
248615
+ estimated_business_days: number | null;
248616
+ }[];
248617
+ item?: {
248618
+ title: string | null;
248619
+ quantity: number;
248620
+ declared_value_clp: number | null;
248621
+ } | null;
248622
+ package?: {
248623
+ weight_kg: number;
248624
+ height_cm: number;
248625
+ width_cm: number;
248626
+ length_cm: number;
248627
+ };
248628
+ units?: number;
248629
+ /**
248630
+ * @description `needs_commune`: why no commune was chosen.
248631
+ * @enum {string}
248632
+ */
248633
+ reason?: "missing" | "ambiguous" | "region_mismatch" | "not_found";
248634
+ /** @description `needs_commune`: the areas that fit (or close names); ask the buyer, then send the chosen `coverage_code`. */
248635
+ candidates?: {
248636
+ coverage_code: string;
248637
+ commune: string;
248638
+ region_code: string;
248639
+ region: string | null;
248640
+ }[];
248641
+ };
246933
248642
  WhatsappTemplateAnalytics: {
246934
248643
  template: {
246935
248644
  /** Format: uuid */