Skip to main content
POST
/
api
/
auth
/
register
Register User
curl --request POST \
  --url https://api.example.com/api/auth/register \
  --header 'Content-Type: application/json' \
  --data '
{
  "NombreUsuario": "<string>",
  "password": "<string>",
  "Rol": "<string>"
}
'
{
  "message": "<string>"
}

Description

Creates a new user account in the system. Passwords are automatically hashed using ASP.NET Core Identity’s PasswordHasher before storage.

Authentication

No authentication required (public endpoint).

Request Body

NombreUsuario
string
required
Username for the new account. Maximum length: 100 characters. Must be unique.
password
string
required
User’s password. Will be securely hashed before storage.
Rol
string
required
Role assigned to the user (e.g., “Admin”, “User”, “Manager”).

Response

Success Response (200 OK)

message
string
Success message: “Usuario creado con éxito”

Error Response (400 Bad Request)

message
string
Error message: “Error al crear el usuario”

Examples

Successful Registration

curl -X POST https://api.example.com/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "NombreUsuario": "johndoe",
    "password": "SecurePassword123",
    "Rol": "User"
  }'

Failed Registration

curl -X POST https://api.example.com/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "NombreUsuario": "",
    "password": "password123",
    "Rol": "User"
  }'

Security Notes

  • Passwords are hashed using PasswordHasher<Usuario> from ASP.NET Core Identity
  • Original passwords are never stored in plain text
  • Password verification uses secure comparison algorithms

Validation Rules

  • NombreUsuario: Required, maximum 100 characters
  • password: Required
  • Rol: Required

Build docs developers (and LLMs) love