Skip to main content

Introduction

Quotations in the Construction Backend API allow you to manage detailed cost estimates for construction projects. Each quotation includes factory information, cost breakdowns, and nested sections with itemized pricing.

Data Structure

The quotation model uses a hierarchical structure with three levels:
1

Quotation Level

Contains factory details, fix reference, description, and overall cost calculations
2

Sections Level

Groups related items together with section descriptions and subtotals
3

Items Level

Individual line items with quantities, units, and pricing details

Schema Reference

Based on the Mongoose schema defined in src/models/quotation.js:8:

Root Fields

FieldTypeRequiredDescription
factoryStringYesFactory or project identifier
fixStringYesFix reference number
description_quotationStringYesOverall quotation description
subtotalNumberYesSubtotal before additional costs
unexpectedNumberYesUnexpected costs or contingency
ivaNumberYesVAT/IVA tax amount
administratitiveNumberYesAdministrative costs
utilityNumberYesUtility or profit margin
total_priceNumberYesFinal total price
sectionsArrayYesArray of section objects

Section Object

Each section in the sections array contains:
FieldTypeRequiredDescription
description_sectionsStringYesDescription of the section
section_priceNumberYesTotal price for this section
itemsArrayYesArray of item objects

Item Object

Each item in the items array contains:
FieldTypeRequiredDescription
item_nameStringYesName of the item
item_descriptionStringYesDetailed item description
item_totalNumberYesTotal cost for this item
quantityNumberYesQuantity of items
unityStringYesUnit of measurement (e.g., “m2”, “units”, “kg”)
item_valueNumberYesUnit price per item

Complete Schema Example

Cost Calculation

The total_price should represent the sum of subtotal + unexpected + iva + administratitive + utility. Ensure your calculations are accurate before submitting.

Validation Rules

As seen in src/controllers/quotationController.js:18-24, the API validates:
  • All root-level fields must be present
  • sections must be an array
  • Numeric fields cannot be undefined (but can be 0)
  • All nested section and item fields must meet schema requirements
Missing any required field will result in a 400 Bad Request error with the message “Formato de JSON inválido”.

Next Steps

Create Quotation

Learn how to create a new quotation

Retrieve Quotations

Learn how to fetch quotations

Build docs developers (and LLMs) love