Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DavidCevallos15/Crucidrive---APP/llms.txt

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

After OTP verification, a Supabase Auth user exists but has no application profile yet. Calling this endpoint creates a row in public.perfiles and assigns the user one of two roles — pasajero or conductor. Driver registrations also create a linked row in public.tricimotos in the same request; if that second insert fails, the profile is deleted automatically so no orphaned records are left behind.

Request

Authorization
string
required
Bearer JWT obtained from Supabase Auth after OTP verification. Example: Bearer eyJhbGci...
rol
string
required
The role to assign to this profile. Must be exactly "pasajero" or "conductor". Any other value returns a 400.
nombre
string
required
The user’s full name as it will appear in the app and to ride participants.
telefono
string
required
The user’s phone number in E.164 format (e.g. +593987654321). Must be unique across public.perfiles — duplicate values return a 400.
placa
string
Vehicle plate number for the tricimoto unit. Required when rol is "conductor"; ignored for passengers. Example: "MBD-1234".

Example request bodies

// Passenger
{ "rol": "pasajero", "nombre": "Ana Mendoza", "telefono": "+593987654321" }
// Driver
{ "rol": "conductor", "nombre": "Carlos Vera", "telefono": "+593991234567", "placa": "MBD-1234" }

Response 201

A successful registration returns a status: "success" envelope with the following data payload:
perfil
object
The newly created profile record from public.perfiles.
tricimoto
object | null
Only present (non-null) when rol is "conductor". Contains the newly created record from public.tricimotos.

Error cases

HTTP statusCause
400One or more of rol, nombre, or telefono is missing from the request body
400rol is not "pasajero" or "conductor"
400rol is "conductor" but placa was not provided
400Profile insert failed — most commonly a duplicate telefono violating the unique constraint
400Tricimoto insert failed (conductor only) — profile is automatically deleted before this error is returned

Full curl example — driver registration

curl -X POST https://api.crucidrive.local/api/auth/registro \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "rol": "conductor",
    "nombre": "Carlos Vera",
    "telefono": "+593991234567",
    "placa": "MBD-1234"
  }'
{
  "status": "success",
  "message": "Perfil registrado correctamente.",
  "data": {
    "perfil": {
      "id": "a1b2c3d4-0000-0000-0000-111122223333",
      "rol": "conductor",
      "nombre": "Carlos Vera",
      "telefono": "+593991234567",
      "activo": true
    },
    "tricimoto": {
      "id": "f9e8d7c6-0000-0000-0000-aabbccddeeff",
      "conductor_id": "a1b2c3d4-0000-0000-0000-111122223333",
      "placa": "MBD-1234",
      "estado": "inactivo"
    }
  }
}
If the tricimoto insert fails (step 2), the server automatically deletes the profile row it just inserted before returning the error. This means there are no orphaned perfiles records — the client can safely retry the full registration once the issue is resolved (e.g. duplicate plate number).

Build docs developers (and LLMs) love