Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Luisangelebp/SCO_Autolavados/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Vehicles API is split into two resource groups:
  • Vehicle Types (/typecars) — Category definitions such as Sedán, Camioneta, or Moto. Each car and each service is linked to a vehicle type.
  • Cars (/cars) — Individual vehicles registered in the system, linked to an owner (User) and a vehicle type.
When a CUSTOMER role creates a car via POST /api/cars, the server automatically forces ownerId to match the authenticated user’s own ID, regardless of what value is sent in the request body. Only an ADMIN can assign a car to an arbitrary owner.

Car Object

{
  "id": "uuid",
  "plate": "ABC12D",
  "mark": "Toyota",
  "model": "Corolla",
  "color": "Blanco",
  "year": 2020,
  "comment": null,
  "createdAt": "2026-06-01T10:00:00.000Z",
  "ownerId": "uuid",
  "owner": {
    "id": "uuid",
    "name": "Juan",
    "lastName": "Pérez"
  },
  "typeCarId": "uuid",
  "typeCar": { "id": "uuid", "name": "Sedán" }
}
id
string
UUID primary key.
plate
string
License plate — unique across the system (e.g. ABC12D).
mark
string
Vehicle brand / manufacturer (e.g. Toyota, Ford).
model
string
Vehicle model name (e.g. Corolla, Ranger).
color
string
Vehicle color.
year
number | null
Model year. Optional — may be null if not provided.
comment
string | null
Free-text notes about the vehicle (e.g. special instructions for the wash crew).
createdAt
string (ISO 8601)
Timestamp of when the vehicle was registered.
ownerId
string
UUID of the owning User.
owner
object
Embedded subset of the owner User object: { id, name, lastName, ... }.
typeCarId
string
UUID of the associated TypeCar category.
typeCar
object
Embedded TypeCar object: { id, name }.

Vehicle Types (TypeCars)

GET /api/typecars

Returns the full list of registered vehicle type categories. No authentication required.
curl http://localhost:3000/api/typecars
Response 200 OK:
[
  { "id": "uuid-sedan", "name": "Sedán" },
  { "id": "uuid-truck", "name": "Camioneta" },
  { "id": "uuid-moto",  "name": "Moto" }
]
id
string
UUID of the vehicle type. Use this as typeCarId when registering a car or creating a service.
name
string
Human-readable category name. Unique across the system.

POST /api/typecars ADMIN

Creates a new vehicle type category.
curl -X POST http://localhost:3000/api/typecars \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Sedán" }'
Request body:
name
string
required
Name of the new vehicle type. Must be unique (e.g. Sedán, Camioneta, SUV, Moto).
Response 201 Created:
{ "id": "uuid-sedan", "name": "Sedán" }

PUT /api/typecars/:id ADMIN

Updates the name of an existing vehicle type.
curl -X PUT http://localhost:3000/api/typecars/uuid-sedan \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Sedán / Coupé" }'
Path parameters:
id
string
required
UUID of the vehicle type to update.
Request body:
name
string
required
New name for the vehicle type.
Response 200 OK:
{ "id": "uuid-sedan", "name": "Sedán / Coupé" }

DELETE /api/typecars/:id ADMIN

Permanently deletes a vehicle type. The deletion is blocked if any cars or services are currently linked to this type.
curl -X DELETE http://localhost:3000/api/typecars/uuid-sedan \
  -H "Authorization: Bearer <admin_token>"
Path parameters:
id
string
required
UUID of the vehicle type to delete.
Response 200 OK:
{ "message": "Tipo de vehículo eliminado exitosamente" }
Error 400 Bad Request — Type is still in use:
{
  "error": "No se puede eliminar el tipo de vehículo porque hay vehículos registrados con este tipo"
}
{
  "error": "No se puede eliminar el tipo de vehículo porque hay servicios asociados a este tipo"
}
Always reassign or remove all Cars and Services linked to a TypeCar before attempting to delete it. The API performs both checks before proceeding with the deletion.

Cars

GET /api/cars

Returns all registered vehicles, ordered by most recently created. Each car includes its full owner and type details. No authentication required.
curl http://localhost:3000/api/cars
Response 200 OK:
[
  {
    "id": "uuid",
    "plate": "ABC12D",
    "mark": "Toyota",
    "model": "Corolla",
    "color": "Blanco",
    "year": 2020,
    "comment": null,
    "createdAt": "2026-06-01T10:00:00.000Z",
    "ownerId": "uuid",
    "owner": {
      "id": "uuid",
      "name": "Juan",
      "lastName": "Pérez"
    },
    "typeCarId": "uuid",
    "typeCar": { "id": "uuid", "name": "Sedán" }
  }
]

GET /api/cars/:plate

Looks up a single vehicle by its license plate. Useful for the reception desk auto-fill flow when a returning customer arrives.
curl http://localhost:3000/api/cars/ABC12D
Path parameters:
plate
string
required
Exact license plate string to look up (e.g. ABC12D). The lookup is exact-match — case and formatting must match what was used at registration.
Response 200 OK:
{
  "id": "uuid",
  "plate": "ABC12D",
  "mark": "Toyota",
  "model": "Corolla",
  "color": "Blanco",
  "year": 2020,
  "comment": null,
  "createdAt": "2026-06-01T10:00:00.000Z",
  "ownerId": "uuid",
  "owner": {
    "id": "uuid",
    "name": "Juan",
    "lastName": "Pérez"
  },
  "typeCarId": "uuid",
  "typeCar": { "id": "uuid", "name": "Sedán" }
}
Response 404 Not Found:
{ "error": "Vehículo no encontrado" }

POST /api/cars Any authenticated user

Registers a new vehicle. Requires a valid JWT token from any role.
curl -X POST http://localhost:3000/api/cars \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "plate": "ABC12D",
    "mark": "Toyota",
    "model": "Corolla",
    "color": "Blanco",
    "year": 2020,
    "ownerId": "uuid-del-usuario",
    "typeCarId": "uuid-del-tipo",
    "comment": "Especial atención en los rines"
  }'
Request body:
plate
string
required
License plate string. Must be unique across the system. Any duplicate will be rejected with a 400 error.
mark
string
required
Vehicle brand / manufacturer name.
model
string
required
Vehicle model name.
color
string
required
Vehicle color.
year
number
Model year as an integer (e.g. 2020). Optional.
ownerId
string
required
UUID of the user who owns this vehicle. Ignored for CUSTOMER role — the server substitutes their own authenticated user ID automatically.
typeCarId
string
required
UUID of the vehicle type category. Obtain valid UUIDs from GET /api/typecars.
comment
string
Optional free-text note (e.g. special wash instructions). Optional.
Response 201 Created:
{
  "id": "uuid",
  "plate": "ABC12D",
  "mark": "Toyota",
  "model": "Corolla",
  "color": "Blanco",
  "year": 2020,
  "comment": "Especial atención en los rines",
  "createdAt": "2026-06-01T10:00:00.000Z",
  "ownerId": "uuid-del-usuario",
  "typeCarId": "uuid-del-tipo"
}
Error 400 Bad Request — Plate already exists:
{ "error": "Ya existe un vehículo registrado con esta placa" }
Before registering a new vehicle at the reception desk, call GET /api/cars/:plate first to check whether it already exists in the system and avoid duplicate registration errors.

PUT /api/cars/:id

Updates one or more fields of an existing vehicle record. This endpoint has no authentication requirement — any caller can submit an update.
curl -X PUT http://localhost:3000/api/cars/uuid-del-vehiculo \
  -H "Content-Type: application/json" \
  -d '{
    "color": "Negro",
    "comment": "Llantas recién pintadas — no usar presión alta"
  }'
Path parameters:
id
string
required
UUID of the vehicle to update.
Request body (all fields optional — send only those you want to change):
plate
string
New license plate (must remain unique).
mark
string
New brand / manufacturer.
model
string
New model name.
color
string
New color.
year
number
New model year.
comment
string
Updated notes.
ownerId
string
UUID of the new owner (transfer ownership).
typeCarId
string
UUID of the new vehicle type category.
Response 200 OK: Updated Car object.

Build docs developers (and LLMs) love