Skip to main content
POST
/
api
/
Usuario
/
IniciarSesion
Login
curl --request POST \
  --url https://api.example.com/api/Usuario/IniciarSesion \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "Correo": "<string>",
  "Clave": "<string>"
}
'
{
  "status": true,
  "value": {
    "IdUsuario": 123,
    "NombreCompleto": "<string>",
    "Correo": "<string>",
    "RolDescripcion": "<string>"
  },
  "msg": "<string>",
  "status: false": {}
}

Overview

The login endpoint authenticates users by validating their credentials (email and password) and returns session information including user details and role.

Request

Endpoint

POST /api/Usuario/IniciarSesion

Headers

Content-Type
string
required
application/json

Body Parameters

Correo
string
required
User’s email address
Clave
string
required
User’s password

Response

Success Response (200 OK)

Returns a response wrapper containing session information.
status
boolean
required
Indicates if the operation was successful
value
object
Session data object
msg
string
Error message (populated when status is false)

Examples

curl -X POST https://api.example.com/api/Usuario/IniciarSesion \
  -H "Content-Type: application/json" \
  -d '{
    "Correo": "[email protected]",
    "Clave": "password123"
  }'

Success Response Example

{
  "status": true,
  "value": {
    "IdUsuario": 1,
    "NombreCompleto": "Juan Pérez",
    "Correo": "[email protected]",
    "RolDescripcion": "Administrador"
  },
  "msg": null
}

Error Response Example

{
  "status": false,
  "value": null,
  "msg": "Credenciales inválidas"
}

Error Codes

status: false
error
Authentication failureCommon error messages:
  • “Credenciales inválidas” - Invalid email or password
  • “Usuario no encontrado” - User account does not exist
  • “Usuario inactivo” - User account is disabled

Notes

  • The endpoint always returns HTTP 200 OK status code. Check the status field in the response body to determine success or failure.
  • Invalid credentials will return status: false with an error message in the msg field.
  • Store the session information (particularly IdUsuario and RolDescripcion) for subsequent authenticated requests.
  • Passwords are validated securely on the server side.

Build docs developers (and LLMs) love