List All Budgets
Returns paginated budgets with summary statistics including total approved, draft amounts, and categories used.
Endpoint
Authentication
Requires valid JWT Bearer token.
Authorization: Bearer YOUR_ACCESS_TOKEN
Query Parameters
Page number for pagination
Number of records per page
Filter by company name (e.g., “SERVIASEO”)
Filter by vehicle license plate (e.g., “ABC123”)
Filter by operational area/department name
Filter by fiscal year (e.g., 2024)
Filter by category group name
Filter by subcategory name
Field to sort by (e.g., “id”, “anio”, “created_at”)
Sort order: “asc” or “desc”
Response
Array of budget objects with relationsVehicle ID (null for department-wide budgets)
Status: “BORRADOR” or “APROBADO”
Summary statistics for filtered resultsTotal amount of approved budgets
Total amount of draft budgets
Number of unique subcategories used
Fiscal year in effect (from filter or current year)
Example Request
curl -X GET "https://api.example.com/api/presupuestos?anio=2024&area_operacion=Recolección&page=1&limit=10" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Response
{
"data": [
{
"id": 1,
"empresa_id": 1,
"vehiculo_id": 42,
"area_operacion_id": 5,
"grupo_rubro_id": 10,
"rubro_id": 25,
"anio": 2024,
"estado": "APROBADO",
"empleado_id": 100,
"created_at": "2024-01-15T10:30:00Z",
"control_flota": {
"id": 42,
"placa_id": 101,
"clase_vehiculo": "Recolector",
"areas_placas": {
"placa": "ABC123"
}
},
"areas_operacion": {
"id": 5,
"nombre": "Recolección Norte"
},
"empresas": {
"id": 1,
"empresa": "SERVIASEO"
},
"grupo": {
"id": 10,
"codigo": "MANT",
"nombre": "Mantenimiento"
},
"rubro": {
"id": 25,
"codigo": "PREV",
"nombre": "Preventivo"
},
"personal": {
"id": 100,
"tipo": "Supervisor"
}
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 156,
"totalPages": 16
},
"summary": {
"totalAprobado": 45000000,
"totalBorrador": 12500000,
"rubrosUtilizados": 8,
"anioVigencia": 2024
}
}
Get Budget by ID
Retrieve a single budget with all its items and complete relationship details.
Endpoint
GET /api/presupuestos/:id
Authentication
Requires valid JWT Bearer token.
Path Parameters
Response
Status: “BORRADOR” or “APROBADO”
Budget line itemsArray of applicable months (1-12)
Example Request
curl -X GET "https://api.example.com/api/presupuestos/1" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Response
{
"id": 1,
"empresa_id": 1,
"vehiculo_id": 42,
"area_operacion_id": 5,
"grupo_rubro_id": 10,
"rubro_id": 25,
"anio": 2024,
"estado": "APROBADO",
"empleado_id": 100,
"created_at": "2024-01-15T10:30:00Z",
"vehiculo": {
"id": 42,
"placa_id": 101,
"clase_vehiculo": "Recolector",
"areas_placas": {
"placa": "ABC123"
}
},
"area": {
"id": 5,
"nombre": "Recolección Norte"
},
"grupo": {
"id": 10,
"codigo": "MANT",
"nombre": "Mantenimiento",
"rubro_padre_id": null
},
"rubro": {
"id": 25,
"codigo": "PREV",
"nombre": "Preventivo"
},
"items": [
{
"id": 1,
"presupuesto_id": 1,
"tipo_presupuesto_id": 3,
"concepto_presupuesto_id": 15,
"frecuencia_mes": 1,
"meses_aplicables": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"valor_unitario": 250000,
"valor_total": 3000000,
"tipo": {
"id": 3,
"nombre": "Mantenimiento Preventivo"
},
"concepto": {
"id": 15,
"nombre": "Cambio de Aceite",
"unidad": "Servicio"
}
},
{
"id": 2,
"presupuesto_id": 1,
"tipo_presupuesto_id": 3,
"concepto_presupuesto_id": 16,
"frecuencia_mes": 2,
"meses_aplicables": [3, 6, 9, 12],
"valor_unitario": 180000,
"valor_total": 1440000,
"tipo": {
"id": 3,
"nombre": "Mantenimiento Preventivo"
},
"concepto": {
"id": 16,
"nombre": "Revisión de Frenos",
"unidad": "Servicio"
}
}
]
}
Get Filter Options
Retrieve all available filter options for budgets including years, areas, companies, vehicles, categories, and staff.
Endpoint
GET /api/presupuestos/filters
Authentication
Requires valid JWT Bearer token.
Response
Available fiscal years (numbers)
Category groups (top-level)
Example Request
curl -X GET "https://api.example.com/api/presupuestos/filters" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Response
{
"anios": [2024, 2023, 2022],
"areas": [
{ "id": 5, "nombre": "Recolección Norte" },
{ "id": 6, "nombre": "Recolección Sur" }
],
"empresas": [
{ "id": 1, "empresa": "SERVIASEO" },
{ "id": 2, "empresa": "TRANSPORTES LTDA" }
],
"vehiculos": [
{ "id": 42, "placa": "ABC123", "clase_vehiculo": "Recolector" },
{ "id": 43, "placa": "DEF456", "clase_vehiculo": "Compactador" }
],
"grupos_rubro": [
{ "id": 10, "nombre": "Mantenimiento" },
{ "id": 11, "nombre": "Combustible" }
],
"sub_rubros": [
{ "id": 25, "nombre": "Preventivo" },
{ "id": 26, "nombre": "Correctivo" }
],
"personal": [
{ "id": 100, "tipo": "Supervisor" },
{ "id": 101, "tipo": "Coordinador" }
]
}
Error Responses
400 Bad Request
{
"error": "Invalid parameter: anio must be a number"
}
401 Unauthorized
{
"error": "Invalid or expired token"
}
404 Not Found
{
"error": "Presupuesto no encontrado"
}
500 Internal Server Error
{
"error": "Error en el servidor"
}