Endpoint
curl --request GET \
--url 'https://api.example.com/flota/vehiculos?empresa_id=1&operacion_id=2' \
--header 'Authorization: Bearer <access_token>'
Authentication
Bearer token for authentication. Format: Bearer <access_token>
Query Parameters
Filter vehicles by company ID. Returns only vehicles belonging to the specified company.
Filter vehicles by operation area ID. Returns only vehicles assigned to the specified operation area.
Search vehicles by license plate. Performs a case-insensitive partial match (e.g., searching “ABC” will match “ABC123”, “XABC”, etc.).
Response
Returns an array of vehicle objects with related information.
Array of vehicle objects
Unique vehicle identifier
Operation area identifier
License plate information
Operation area information
Vehicle characteristics
Vehicle class details
Class name (e.g., “Camión”, “Camioneta”)
Brand details
Brand name (e.g., “Toyota”, “Chevrolet”)
Response Example
[
{
"id": 1,
"placa_id": 45,
"empresa_id": 1,
"operacion_id": 2,
"areas_placas": {
"placa": "ABC123"
},
"empresas": {
"empresa": "Transportes S.A."
},
"areas_operacion": {
"nombre": "Zona Norte"
},
"vehiculo_caracteristicas": {
"clase_vehiculo_id": 3,
"cat_clase_vehiculo": {
"nombre": "Camión"
},
"marca_id": 7,
"cat_marca": {
"nombre": "Chevrolet"
},
"anio": "2020"
}
},
{
"id": 2,
"placa_id": 46,
"empresa_id": 1,
"operacion_id": 2,
"areas_placas": {
"placa": "XYZ789"
},
"empresas": {
"empresa": "Transportes S.A."
},
"areas_operacion": {
"nombre": "Zona Norte"
},
"vehiculo_caracteristicas": {
"clase_vehiculo_id": 2,
"cat_clase_vehiculo": {
"nombre": "Camioneta"
},
"marca_id": 12,
"cat_marca": {
"nombre": "Toyota"
},
"anio": "2019"
}
}
]
Examples
Get all vehicles
curl --request GET \
--url 'https://api.example.com/flota/vehiculos' \
--header 'Authorization: Bearer <access_token>'
Filter by company
curl --request GET \
--url 'https://api.example.com/flota/vehiculos?empresa_id=1' \
--header 'Authorization: Bearer <access_token>'
Filter by operation area
curl --request GET \
--url 'https://api.example.com/flota/vehiculos?operacion_id=2' \
--header 'Authorization: Bearer <access_token>'
Search by license plate
curl --request GET \
--url 'https://api.example.com/flota/vehiculos?placa=ABC' \
--header 'Authorization: Bearer <access_token>'
Combine multiple filters
curl --request GET \
--url 'https://api.example.com/flota/vehiculos?empresa_id=1&operacion_id=2&placa=ABC' \
--header 'Authorization: Bearer <access_token>'
Error Responses
401 Unauthorized
{
"error": "Unauthorized",
"details": "Invalid or missing access token"
}
500 Internal Server Error
{
"error": "Internal Server Error",
"details": "Supabase client not initialized in request"
}
Notes
- The
placa parameter performs a case-insensitive partial match using SQL’s ILIKE operator
- When filtering by
placa, an inner join is performed on the areas_placas table to ensure only vehicles with matching plates are returned
- All filters can be combined to narrow down results
- The endpoint returns an empty array
[] if no vehicles match the criteria