Skip to main content

Endpoint

curl --request GET \
  --url 'https://api.example.com/flota/vehiculos/1' \
  --header 'Authorization: Bearer <access_token>'

Authentication

Authorization
string
required
Bearer token for authentication. Format: Bearer <access_token>

Path Parameters

id
number
required
The unique identifier of the vehicle to retrieve

Response

Returns a single vehicle object with complete details including all related catalog information.
id
number
Unique vehicle identifier
placa_id
number
License plate identifier
empresa_id
number
Company identifier
operacion_id
number
Operation area identifier
created_at
string
Timestamp when the vehicle was created (ISO 8601 format)
areas_placas
object
License plate information
empresas
object
Company information
areas_operacion
object
Operation area information
vehiculo_caracteristicas
object
Complete vehicle characteristics and specifications

Response Example

{
  "id": 1,
  "placa_id": 45,
  "empresa_id": 1,
  "operacion_id": 2,
  "created_at": "2024-01-15T10:30:00Z",
  "areas_placas": {
    "placa": "ABC123"
  },
  "empresas": {
    "empresa": "Transportes S.A."
  },
  "areas_operacion": {
    "nombre": "Zona Norte"
  },
  "vehiculo_caracteristicas": {
    "vehiculo_id": 1,
    "marca_id": 7,
    "cat_marca": {
      "nombre": "Chevrolet"
    },
    "tipo_vehiculo_id": 1,
    "cat_tipo_vehiculo": {
      "nombre": "Carga"
    },
    "clase_vehiculo_id": 3,
    "cat_clase_vehiculo": {
      "nombre": "Camión"
    },
    "combustible_id": 1,
    "cat_combustible": {
      "nombre": "Diesel"
    },
    "marca_compactadora_id": null,
    "cat_marca_compactadora": null,
    "anio": "2020",
    "linea": "NPR 75",
    "nro_serie": "1HTWDAZR1BH123456",
    "nro_ejes": "2",
    "nro_llantas": "6"
  }
}

Example with Compactor Vehicle

{
  "id": 15,
  "placa_id": 89,
  "empresa_id": 1,
  "operacion_id": 3,
  "created_at": "2024-02-20T14:15:00Z",
  "areas_placas": {
    "placa": "COM456"
  },
  "empresas": {
    "empresa": "Transportes S.A."
  },
  "areas_operacion": {
    "nombre": "Zona Centro"
  },
  "vehiculo_caracteristicas": {
    "vehiculo_id": 15,
    "marca_id": 12,
    "cat_marca": {
      "nombre": "Kenworth"
    },
    "tipo_vehiculo_id": 3,
    "cat_tipo_vehiculo": {
      "nombre": "Especial"
    },
    "clase_vehiculo_id": 5,
    "cat_clase_vehiculo": {
      "nombre": "Compactadora"
    },
    "combustible_id": 1,
    "cat_combustible": {
      "nombre": "Diesel"
    },
    "marca_compactadora_id": 4,
    "cat_marca_compactadora": {
      "nombre": "Heil"
    },
    "anio": "2021",
    "linea": "T370",
    "nro_serie": "1NKDL40X9MJ123456",
    "nro_ejes": "2",
    "nro_llantas": "6"
  }
}

Examples

Get vehicle details by ID

curl --request GET \
  --url 'https://api.example.com/flota/vehiculos/1' \
  --header 'Authorization: Bearer <access_token>'

Error Responses

401 Unauthorized

{
  "error": "Unauthorized",
  "details": "Invalid or missing access token"
}

404 Not Found

When no vehicle exists with the specified ID, the Supabase client returns an error:
{
  "error": "Not Found",
  "details": "No vehicle found with the specified ID"
}

500 Internal Server Error

{
  "error": "Internal Server Error",
  "details": "Supabase client not initialized in request"
}

Notes

  • This endpoint returns all available vehicle information in a single request
  • The response includes all catalog relations (brand, type, class, fuel, compactor brand)
  • The .single() method is used internally to ensure only one record is returned
  • Compactor-specific fields (marca_compactadora_id, cat_marca_compactadora) will be null for non-compactor vehicles
  • The anio field is stored as text in the database to support non-standard year formats

Build docs developers (and LLMs) love