Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Glemynart/SaaS/llms.txt

Use this file to discover all available pages before exploring further.

Invoices in La Oficina Nítida are Invoice records that capture a complete billing transaction: the customer’s identity, one or more line items with quantities and unit prices, and server-calculated totals. Every invoice is tenant-scoped and its line items are stored as immutable subtotal snapshots — if a product’s price changes after the invoice is issued, the invoice retains the original values. Status transitions (DRAFTISSUEDCANCELLED) are enforced server-side and only ADMIN users may change invoice status.

Products

Products and services available for invoicing are managed through the ProductService catalogue.

List Products

GET /billing/products
Returns all active products for the authenticated tenant, ordered by nombre ascending. Inactive products are excluded automatically. Query parameters
ParameterDescription
searchOptional free-text filter on nombre (case-insensitive)

Create a Product

POST /billing/products
Roles allowed: ADMIN only. Request body — CreateProductDto
FieldTypeRequiredDescription
nombrestringProduct or service name
descripcionstringOptional longer description
precionumberBase price in COP (must be ≥ 0)
impuestonumberDefault tax percentage (e.g. 19). Defaults to 19 in the database.

Get a Single Product

GET /billing/products/:id
Returns the product record for the given UUID. Returns 404 Not Found if the product does not belong to the authenticated tenant.

Update a Product

PATCH /billing/products/:id
Roles allowed: ADMIN only. Request body — UpdateProductDto (all fields optional)
FieldTypeDescription
nombrestringUpdated name
descripcionstringUpdated description
precionumberUpdated base price (must be ≥ 0)
impuestonumberUpdated tax percentage (must be ≥ 0)
activobooleanSet to false to deactivate the product

Creating an Invoice

POST /billing/invoices
Roles allowed: ADMIN, OPERADOR. The server validates that the referenced customerId exists within the tenant before creating the invoice. The subtotal, impuestos, and total fields are calculated server-side from the line items — do not send them in the request body.

Request Body — CreateInvoiceDto

FieldTypeRequiredDescription
customerIdstring (UUID)ID of the Customer record to invoice
numerostringInvoice number (e.g. "FV-0001"). Must be unique within the tenant.
itemsInvoiceItemDto[]Array of line items. Must contain at least one item.

Line Items — InvoiceItemDto

Each element in the items array represents a single product or service line on the invoice.
FieldTypeRequiredDescription
productServiceIdstring (UUID)Optional reference to a ProductService catalogue entry
descripcionstringText description of the product or service
cantidadnumberQuantity (minimum 0.001, up to three decimal places)
valorUnitarionumberUnit price in COP (must be ≥ 0)
The server calculates each line’s subtotal as cantidad × valorUnitario and derives the invoice-level subtotal, impuestos (19 %), and total automatically.

Example Request

curl -X POST "https://api.example.com/billing/invoices" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "c1d2e3f4-a1b2-4c3d-8e9f-0a1b2c3d4e5f",
    "numero": "FV-0001",
    "items": [
      {
        "productServiceId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "descripcion": "Servicio de matrícula – Grado 5°",
        "cantidad": 1,
        "valorUnitario": 850000
      },
      {
        "descripcion": "Material didáctico",
        "cantidad": 3,
        "valorUnitario": 45000
      }
    ]
  }'
A successful response returns the created Invoice object with status: "DRAFT", the server-calculated subtotal, impuestos, and total, and all line items including their computed subtotal values. The response also includes the customer’s razonSocial and nit.

Querying Invoices

List Invoices

GET /billing/invoices
Returns all invoices for the authenticated tenant, ordered by createdAt descending. Each result includes the customer’s razonSocial and nit, and a count of line items. Query parameters
ParameterDescription
statusFilter by invoice state: DRAFT, ISSUED, or CANCELLED

Get a Single Invoice

GET /billing/invoices/:id
Returns the full invoice record including all items and the complete customer record. Returns 404 Not Found if the invoice does not belong to the authenticated tenant.

Invoice State Management

PATCH /billing/invoices/:id/status
Roles allowed: ADMIN only. Updates the status of an invoice. The server enforces the state machine — a CANCELLED invoice cannot be modified and will return 400 Bad Request. Request body — UpdateInvoiceStatusDto
FieldTypeRequiredDescription
statusInvoiceStatusThe new status: DRAFT, ISSUED, or CANCELLED
Example — issue an invoice
{
  "status": "ISSUED"
}
Once an invoice is set to CANCELLED, it cannot be modified further. The server returns 400 Bad Request on any subsequent status update to a cancelled invoice.

Build docs developers (and LLMs) love