Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ytabeloved/ordervista/llms.txt

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

The Ordervista authentication API handles customer self-registration and session management for all user roles. Registration automatically assigns the customer role (id_rol: 3). Login returns a signed JWT that must be included as a Bearer token in the Authorization header for every protected endpoint. Logout is stateless — the server responds with a confirmation message and the client is responsible for discarding the token.

POST /api/auth/register

Creates a new customer account. The new user is automatically assigned the customer role (id_rol: 3). Passwords are stored as bcrypt hashes. Auth required: No

Request body

nombre
string
required
First name of the user.
apellido
string
required
Last name (surname) of the user.
email
string
required
Email address. Must be unique across all accounts. Used as the login identifier.
password
string
required
Plain-text password. Hashed with bcrypt (salt rounds: 10) before storage.
telefono
string
Optional phone number. Stored as a string up to 20 characters.

Response 201 Created

mensaje
string
Confirmation message: "Usuario registrado correctamente".
id_usuario
integer
The auto-generated primary key of the newly created user.
curl -X POST https://api.ordervista.com/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Ana",
    "apellido": "García",
    "email": "ana.garcia@example.com",
    "password": "SecurePass123",
    "telefono": "+56912345678"
  }'
{
  "mensaje": "Usuario registrado correctamente",
  "id_usuario": 42
}

Error responses

StatusmensajeCause
400"Debe completar los datos obligatorios"One or more required fields are missing.
400"El correo ya se encuentra registrado"The email address already exists in the system.
500"Error al registrar usuario"Unexpected server-side error.

POST /api/auth/login

Authenticates a user and returns a signed JWT. The token encodes id_usuario, nombre, apellido, email, and id_rol, and must be sent as Authorization: Bearer <token> on all protected requests. Auth required: No

Request body

email
string
required
Registered email address of the user.
password
string
required
Plain-text password. Compared against the stored bcrypt hash.

Response 200 OK

mensaje
string
Confirmation message: "Inicio de sesión correcto".
token
string
Signed JWT for use in subsequent Authorization: Bearer headers.
usuario
object
Authenticated user summary object.
curl -X POST https://api.ordervista.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ana.garcia@example.com",
    "password": "SecurePass123"
  }'
{
  "mensaje": "Inicio de sesión correcto",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "usuario": {
    "id_usuario": 42,
    "nombre": "Ana",
    "apellido": "García",
    "email": "ana.garcia@example.com",
    "id_rol": 3
  }
}

Error responses

StatusmensajeCause
400"Debe ingresar correo y contraseña"email or password field is missing.
401"Credenciales inválidas"Email not found or password does not match.
500"Error al iniciar sesión"Unexpected server-side error.

POST /api/auth/logout

Ends the current session. Because Ordervista uses stateless JWTs, the server simply returns a confirmation message. The client is responsible for deleting the stored token. Auth required: No

Request body

None.

Response 200 OK

mensaje
string
Confirmation message: "Sesión cerrada correctamente".
curl -X POST https://api.ordervista.com/api/auth/logout \
  -H "Authorization: Bearer <token>"
{
  "mensaje": "Sesión cerrada correctamente"
}

Error responses

This endpoint has no documented error states. It always returns 200 OK.

Build docs developers (and LLMs) love