Introduction
The Budget (Presupuestos) API enables comprehensive budget planning and tracking for your fleet operations. Create and manage budgets organized by:- Vehicles: Allocate budgets to specific fleet vehicles
- Departments: Plan budgets by operational area (area_operacion)
- Categories: Organize expenses by grupos de rubro (category groups) and rubros (subcategories)
- Fiscal Year: Track budgets annually with support for multiple years
Key Concepts
Budget Structure
Each budget (Presupuesto) consists of:- Header: Main budget information including vehicle, department, category, and fiscal year
- Items: Individual budget line items with concepts, frequencies, and amounts
- Status: BORRADOR (draft) or APROBADO (approved)
Budget Hierarchy
Budget Items
Each budget item contains:- Tipo de Presupuesto: Budget type (e.g., maintenance, fuel, supplies)
- Concepto: Specific concept within the type (e.g., oil change, tire replacement)
- Frecuencia: Frequency per month
- Meses Aplicables: Array of months where this applies (1-12)
- Valor Unitario: Unit price
- Valor Total: Automatically calculated (unit price × frequency × months count)
Base URL
All budget endpoints are prefixed with:Authentication
All endpoints require authentication using JWT Bearer tokens.Available Endpoints
Budget Management
GET /api/presupuestos- List all budgets with pagination and filtersGET /api/presupuestos/:id- Get budget details with itemsPOST /api/presupuestos- Create new budget with itemsPUT /api/presupuestos/:id- Update budget headerDELETE /api/presupuestos/:id- Delete budget and all items
Budget Items
POST /api/presupuestos/:id/items- Add item to budgetPUT /api/presupuestos/items/:itemId- Update budget itemDELETE /api/presupuestos/items/:itemId- Delete budget item
Catalogs
GET /api/presupuestos/rubros- Get category master listGET /api/presupuestos/tipos- Get budget typesGET /api/presupuestos/conceptos- Get budget conceptsPOST /api/presupuestos/tipos- Create new budget type (ADMIN only)POST /api/presupuestos/conceptos- Create new concept (ADMIN only)GET /api/presupuestos/filters- Get filter options
Common Response Codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 204 | No Content (delete successful) |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing token |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found |
| 500 | Internal Server Error |
Data Types
Presupuesto
PresupuestoItem
Filtering and Pagination
Most list endpoints support:- Pagination:
page,limit - Filtering: By empresa, vehiculo_id, placa, area_operacion, anio, grupo_rubro, sub_rubro
- Sorting:
sort_by,sort_order(asc/desc)
Next Steps
List Budgets
Query and filter budgets with pagination
Create Budget
Create new budgets with line items
Manage Items
Add, update, and delete budget items