VitrinaAPI

Plantillas de documentos

El texto estándar de cada familia de documentos (nota de venta, reserva, cotización, consignación, nota de compra, ficha técnica), con las variables que usa.

Beta
Puede cambiar en cualquier momento, con una entrada en el changelog y aviso a quienes la llamaron recientemente — ver versionado.

Descarga la proyección completa de la API pública: openapi.json.

Vender una unidad explica este recurso en prosa, con ejemplos ejecutables.

MétodoRutaQué hace
GET/document-templates/{id}/preview-valuesPlaceholder values of the latest issued document of a template's type
POST/document-templates/clauses/checkCheck a body against its cláusulas esenciales and recomendadas
GET/document-templates/startersThe standard text of each document family

GET /document-templates/{id}/preview-values

Placeholder values of the latest issued document of a template's type

What the template preview renders against: the \{\{NAME\}\} values of the most recent documento emitido of the template's document type, built by the SAME code that prints that document, so the preview cannot drift from the print. Covers sale_note, compraventa, deal_settlement (Resumen del negocio), consignment (mandato), consignment_settlement (liquidación) and purchase_note (nota de compra); reserva, cotización and ficha técnica print fixed layouts and have no values source. The designed blocks (BLOQUE_PARTES, BLOQUE_VEHICULO, BLOQUE_PRECIO, BLOQUE_FIRMAS) are values too: each is the block's text form filled with the same document's values (a fact the document lacks reads «【PENDIENTE: …】»). source names the document (display_id: the folio such as V-12, or the patente for a consignment, and when it was issued); it is null — with an empty values — when none exists or the type has no values source; the caller then falls back to the vocabulary examples. A fact the document lacks is absent from values, never blank. The values carry buyer/owner identity and money, so this requires document_templates:read AND the read scope of that document (sale_notes:read for nota de venta and compraventa, consignments:read for the two consignment families, dealership_economics:read for the Resumen del negocio, purchase_notes:read for the nota de compra). Writes and issues nothing.

ParámetroEnTipoObligatorioRestricciones
idpathuuidsí
curl https://api.vitrinadev.com/api/v1/document-templates/<id>/preview-values \
  -H "Authorization: Bearer $VITRINA_KEY"

Ejemplo de respuesta (200)

{
  "data": {
    "document_kind": "sale_note",
    "source": {
      "document_kind": "sale_note",
      "id": "5c1a3f0e-8b7d-4e2a-9c61-2d4f6a8b0c13",
      "display_id": "V-12",
      "issued_at": "2026-09-29T15:20:00.000Z"
    },
    "values": {
      "FOLIO": "V-12",
      "FECHA": "29 de septiembre de 2026",
      "COMPRADOR_NOMBRE": "Persona Ejemplo",
      "VEHICULO_PATENTE": "AB-CD-12"
    }
  }
}

Responde: 200 · 400 · 401 · 403 · 404 · 409 · 429

POST /document-templates/clauses/check

Check a body against its cláusulas esenciales and recomendadas

The editor's checklist («Esenciales 5/5 · Recomendadas 5/6», ADR 0114 §6.1), computed by the same function the publish gate uses. Send the body being written plus template_id (it is that template's next version: its current version is the baseline for "removed") or document_kind (a new template: the standard text is the baseline). Returns each clause with present, a summary of counts, missing_esenciales (publishing is refused while non-empty) and removed_recomendadas (each needs a reason in recommended_clause_removals when publishing). A clause is detected by structural markers — the \{\{VARIABLES\}\} it needs (designed blocks count, through their text twins), a section heading, or a signature block — never by free-text search. Writes nothing. Requires document_templates:read.

Cuerpo

CampoTipoObligatorioRestricciones
bodystringsímáx. 100000
template_iduuid—
document_kindstring—máx. 60, patrón ^[a-z][a-z0-9_]*$
curl -X POST https://api.vitrinadev.com/api/v1/document-templates/clauses/check \
  -H "Authorization: Bearer $VITRINA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "3b1f8a52-9d34-4a7e-8f2c-1a2b3c4d5e6f",
    "body": "# Nota de venta N° {{FOLIO}}\n\n{{BLOQUE_PARTES}}\n\n{{BLOQUE_VEHICULO}}\n\n{{BLOQUE_PRECIO}}\n\n{{BLOQUE_FIRMAS}}"
  }'

Ejemplo de respuesta (200)

{
  "data": {
    "document_kind": "sale_note",
    "esenciales": [
      {
        "key": "partes",
        "label": "Partes con RUT y domicilio",
        "tier": "esencial",
        "present": true,
        "description": "Partes con RUT y domicilio."
      },
      {
        "key": "vehiculo",
        "label": "Identidad del vehículo",
        "tier": "esencial",
        "present": true,
        "description": "Identidad del vehículo."
      },
      {
        "key": "precio",
        "label": "Precio en cifras y palabras",
        "tier": "esencial",
        "present": true,
        "description": "Precio en cifras y palabras."
      },
      {
        "key": "pago",
        "label": "Forma de pago",
        "tier": "esencial",
        "present": true,
        "description": "Forma de pago."
      },
      {
        "key": "firmas",
        "label": "Firmas",
        "tier": "esencial",
        "present": true,
        "description": "Firmas."
      }
    ],
    "recomendadas": [
      {
        "key": "folio",
        "label": "Número de folio",
        "tier": "recomendada",
        "present": true,
        "description": "Número de folio."
      },
      {
        "key": "vendedor",
        "label": "Vendedor de la automotora",
        "tier": "recomendada",
        "present": true,
        "description": "Vendedor de la automotora."
      },
      {
        "key": "chasis",
        "label": "N° de chasis (VIN)",
        "tier": "recomendada",
        "present": true,
        "description": "N° de chasis (VIN)."
      },
      {
        "key": "kilometraje",
        "label": "Kilometraje",
        "tier": "recomendada",
        "present": true,
        "description": "Kilometraje."
      },
      {
        "key": "impuesto_transferencia",
        "label": "Impuesto a la transferencia",
        "tier": "recomendada",
        "present": true,
        "description": "Impuesto a la transferencia."
      },
      {
        "key": "condiciones",
        "label": "Condiciones",
        "tier": "recomendada",
        "present": false,
        "description": "Condiciones."
      }
    ],
    "summary": {
      "esenciales": {
        "present": 5,
        "total": 5
      },
      "recomendadas": {
        "present": 5,
        "total": 6
      }
    },
    "missing_esenciales": [],
    "removed_recomendadas": [
      {
        "key": "condiciones",
        "label": "Condiciones",
        "description": "La sección «Condiciones» con los términos del documento.",
        "tier": "recomendada",
        "present": false
      }
    ]
  }
}

Responde: 200 · 400 · 401 · 403 · 404 · 409 · 429

GET /document-templates/starters

The standard text of each document family

The starter Spanish body of every document family (nota de venta, comprobante de reserva, cotización, mandato de consignación, nota de compra, ficha técnica) — the text an authoring screen opens with when the dealer starts a template, and what «volver al texto estándar» appends as a new version (PUT /document-templates/\{id\}). Every body uses only variables the family’s vocabulary registers, so it saves as-is. Every automotive workspace is seeded with these as its default templates (one per family it had none for). kind narrows to one family; placeholders lists the \{\{NAMES\}\} the body uses. Requires document_templates:read.

ParámetroEnTipoObligatorioRestricciones
kindquerystringnomáx. 60, patrón ^[a-z][a-z0-9_]*$
curl https://api.vitrinadev.com/api/v1/document-templates/starters \
  -H "Authorization: Bearer $VITRINA_KEY"

Ejemplo de respuesta (200)

{
  "data": [
    {
      "document_kind": "quote",
      "label": "Cotización",
      "key": "cotizacion",
      "name": "Cotización",
      "body": "COTIZACIÓN N° {{FOLIO}}\n\n{{MANDATARIA_RAZON_SOCIAL}}\nRUT {{MANDATARIA_RUT}}\n\nCLIENTE\n{{CLIENTE_NOMBRE}}, RUT {{CLIENTE_RUT}}.\n\nPRECIO\nPrecio ofrecido: {{PRECIO_OFERTADO}}",
      "placeholders": [
        "FOLIO",
        "MANDATARIA_RAZON_SOCIAL",
        "MANDATARIA_RUT",
        "CLIENTE_NOMBRE",
        "CLIENTE_RUT",
        "PRECIO_OFERTADO"
      ]
    }
  ],
  "meta": {
    "total": 1
  }
}

Responde: 200 · 400 · 401 · 403 · 404 · 409 · 429

En esta página