This endpoint registers a new lawyer account in the Despacho system. It accepts an email address and a plaintext password, validates that both fields are present and that the email is not already in use, then hashes the password with bcrypt (10 salt rounds) before persisting the record. Every account created through this endpoint is automatically assigned the Admin role (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/despacho-backend/llms.txt
Use this file to discover all available pages before exploring further.
value: "1"). On success the full Mongoose document — including the auto-generated _id, timestamps, and role array — is returned in the response body.
Request Body
The lawyer’s email address. Stored in the database as lowercase regardless of
the casing supplied in the request. Must be unique across all lawyer accounts.
The account password in plaintext. Hashed with bcrypt (10 salt rounds) before
being written to the database — the raw password is never persisted.
Example Request
Responses
200 — Account Created
The account was created successfully. The full user document is returned undernew_user.
Human-readable confirmation message. Value:
"Cuenta creada correctamente".true when the request succeeded.The newly created LawyerUser document returned directly from MongoDB.
203 — Email Already Registered
A lawyer account with the supplied email already exists. No new record is created.403 — Missing Required Fields
Eitheremail or password (or both) were absent from the request body.
500 — Internal Server Error
An unexpected error occurred — typically a database connection failure or a Mongoose validation error. The raw error object is returned in the response body.Error Handling
| HTTP Status | Cause | How to resolve |
|---|---|---|
203 | The email address is already associated with an existing account | Use a different email address or direct the user to the login endpoint |
403 | One or both required body fields (email, password) are missing | Ensure both fields are included and non-empty in the request body |
500 | Unexpected server-side or database error | Check server logs; retry after confirming the database connection is healthy |
The
role field is set automatically on every new account — it cannot be
overridden through this endpoint. All accounts start with the Admin role
({ "name": "Admin", "value": "1" }). A separate SuperAdmin role (value: "2")
exists in the system and must be assigned through a privileged operation.