Skip to main content
POST
/
api
/
Auth
/
register
curl --request POST \
  --url https://your-api-host/api/Auth/register \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "UserName": "jdoe",
    "Password": "P@ssw0rd!",
    "IdPerfil": 2,
    "Activo": true
  }'
"Usuario Creado"
Creates a new user account and assigns it to a profile. The caller must be authenticated and must hold the usuario.agregar permission.
This endpoint is intended for administrators managing user accounts, not for self-registration flows.

Authentication

Requires a valid Bearer token with the usuario.agregar permission.
Authorization: Bearer <token>

Request body

UserName
string
required
Unique username for the new user. Must not already exist in the system. Corresponds to the UserName field on the ASP.NET Identity user record.
Password
string
required
Password for the new account. ASP.NET Identity defaults apply: minimum 6 characters, at least one uppercase letter, one digit, and one non-alphanumeric character.
IdPerfil
integer
required
ID of the profile to assign to the new user. The profile determines which permissions the user inherits.
Activo
boolean
required
Whether the user account starts active. Set to false to create a disabled account. Inactive users cannot log in.
Imagen
string
Optional Base64-encoded profile image string. Must be in the format data:image/...;base64,.... The decoded image must not exceed 2 MB. If provided, the image is uploaded to Cloudinary and the resulting URL is stored on the user record.Supported MIME types: image/png, image/jpeg, image/gif, image/webp.

Responses

(body)
string
On success, returns the plain string "Usuario Creado".

Examples

curl --request POST \
  --url https://your-api-host/api/Auth/register \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "UserName": "jdoe",
    "Password": "P@ssw0rd!",
    "IdPerfil": 2,
    "Activo": true
  }'
"Usuario Creado"

Error reference

Identity errors (400)

If the ASP.NET Identity registration fails, the response body is an array of IdentityError objects:
FieldTypeDescription
codestringMachine-readable error code (e.g., DuplicateUserName, PasswordTooShort).
descriptionstringHuman-readable error message.

Image validation errors (400)

If an Imagen value is provided but invalid, the response body is a plain string describing the issue:
MessageCause
Formato de imagen inválidoThe data: URI prefix or MIME type is not recognised.
La imagen es demasiado grande (máx 2MB)The full Base64 string exceeds the size limit before decoding.
Imagen base64 inválidaThe Base64 payload cannot be parsed.
Error al decodificar la imagenAn unexpected error occurred while decoding the Base64 data.
La imagen no debe superar los 2MBThe decoded image exceeds 2 MB.

Permission error (403)

Returned when the caller’s token does not include the usuario.agregar permission. Obtain a token for an account that holds this permission and retry.
A 403 Forbidden response does not indicate an authentication failure — the token itself is valid. The caller’s profile simply lacks the required permission. Contact an administrator to update the profile’s permissions.

Password requirements

ASP.NET Identity enforces the following password policy by default:
  • Minimum 6 characters
  • At least one uppercase letter (A–Z)
  • At least one digit (0–9)
  • At least one non-alphanumeric character (e.g., !, @, #)
These defaults may be overridden in the application’s Identity configuration. Check with your API administrator if you receive unexpected PasswordRequires* errors.

Build docs developers (and LLMs) love