Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Nyverie/reservafacil/llms.txt

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

Creates a new user account with the default role of USUARIO. The submitted password is hashed with bcrypt at 10 rounds before being stored — the plain-text value is never persisted. On success, the server signs a JWT and writes it to an HTTP-only token cookie, logging the user in immediately without a separate login step.

Request

POST /api/auth/register
nombre
string
required
The user’s display name. Stored as-is and returned in all session payloads.
email
string
required
The user’s email address. Must be unique across all accounts — the server queries the database before inserting.
password
string
required
The user’s chosen password. Must be at least 6 characters long. Validated before hashing.

Response

200 — Success

Returns the newly created user’s public profile and sets the token cookie.
ok
boolean
Always true on a successful response.
usuario
object
Public profile of the newly registered user.
The response also sets a Set-Cookie header with the following attributes: httpOnly: true, sameSite: lax, maxAge: 604800 (7 days), path: /. In production the secure flag is also added so the cookie is only sent over HTTPS.

Error Responses

Statuserror valueCause
400"Todos los campos son requeridos"One or more of nombre, email, or password are absent from the request body.
400"La contraseña debe tener al menos 6 caracteres"The supplied password is fewer than 6 characters long.
409"El email ya está registrado"An account with the provided email already exists.
500"Error interno del servidor"An unexpected server-side error occurred.
Email uniqueness is checked at the application layer via a findUnique query before the insert. For high-concurrency scenarios, the database-level unique constraint on the email column acts as the final guard — a race condition will surface as a 500 rather than a 409.

Examples

curl -X POST https://your-app.vercel.app/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"nombre": "Ana García", "email": "ana@reservafacil.com", "password": "segura123"}'

Success response body

{
  "ok": true,
  "usuario": {
    "id": "clx9z8y7x0000abcd5678efgh",
    "nombre": "Ana García",
    "email": "ana@reservafacil.com",
    "rol": "USUARIO"
  }
}

Build docs developers (and LLMs) love