Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JulietaEM/EdgeTimer/llms.txt

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

This endpoint authenticates both clients (clientes) and barbers (barberos) on the EdgeTimer platform. A successful login returns a JWT session containing an accessToken, refreshToken, and expiry time, along with the authenticated user’s profile. The role field is required to distinguish between account types — credentials that match the wrong role are rejected.

Base URL

https://edgetimer-backend.onrender.com

Request

POST /auth/login

Body parameters

role
string
required
The account type to authenticate as. Must be either "cliente" or "barbero".
email
string
required
Email address associated with the account. Normalized to lowercase before lookup.
password
string
required
Password for the account.

Examples

curl --request POST \
  --url https://edgetimer-backend.onrender.com/auth/login \
  --header 'Content-Type: application/json' \
  --data '{
    "role": "cliente",
    "email": "ana.lopez@example.com",
    "password": "mysecretpass"
  }'

Response

200 OK

message
string
Confirmation message indicating a successful login.
session
object
JWT session credentials. Use the accessToken to authenticate subsequent requests.
profile
object
Profile of the authenticated user.
Example response
{
  "message": "Inicio de sesion exitoso",
  "session": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refreshToken": "v1.refresh-token-value",
    "expiresAt": 1748300000
  },
  "profile": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "nombre": "Ana López",
    "usuario": "ana.lopez",
    "email": "ana.lopez@example.com",
    "role": "cliente",
    "foto": null,
    "createdAt": "2026-01-15T10:30:00.000Z"
  }
}

Using the access token

Include the accessToken from the session response in the Authorization header of all subsequent requests that require authentication:
Authorization: Bearer <accessToken>

Error responses

StatusDescription
401 UnauthorizedEmail or password is incorrect.
401 UnauthorizedThe provided role does not match the account type for these credentials.
400 Bad RequestThe role field contains a value other than "cliente" or "barbero".
401 example — wrong credentials
{
  "statusCode": 401,
  "message": "Usuario o contrasena incorrectos"
}
401 example — role mismatch
{
  "statusCode": 401,
  "message": "El rol no coincide con esta cuenta"
}
400 example — invalid role
{
  "statusCode": 400,
  "message": "El rol enviado no es valido"
}
Always pass the correct role for the account type you are authenticating. Providing the wrong role (for example, "barbero" with a client’s credentials) will result in a 401 error even if the email and password are correct.

Build docs developers (and LLMs) love