Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LENINMORENO13/OpsMind/llms.txt

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

The register endpoint creates a new OpsMind user account. It accepts an email and password in the request body, runs them through Zod schema validation, checks that no account with the same email already exists, hashes the password with bcryptjs, and persists the new user via Prisma. On success it returns the newly created user’s database ID and email. No authentication token is required to call this endpoint.

Endpoint

POST /api/v1/auth/registerNo authentication required

Request Body

email
string
required
A valid email address for the new account. Validated by Zod with z.string().email() — malformed addresses are rejected before the request reaches the controller.
password
string
required
The account password. Must be at least 6 characters long. Validated by Zod with z.string().min(6). The value is never stored in plain text — see the note below.

Example Request

curl -X POST https://opsmind-e07b.onrender.com/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email": "dev@example.com", "password": "Secure123!"}'

Success Response

HTTP 201 Created
{
  "success": true,
  "message": "User created successfully",
  "data": {
    "user": 1,
    "email": "dev@example.com"
  }
}
success
boolean
Always true on a successful registration.
message
string
Human-readable confirmation — "User created successfully".
data
object
Contains the new user record summary.

Error Responses

HTTP StatusCause
400An account with the supplied email is already in the database, or the request body failed Zod schema validation.
500An unexpected server-side error occurred (e.g. database unavailable).
Example 400 — duplicate email The controller returns this shape when the email is already registered:
{
  "success": false,
  "error": "User with this email already exists"
}
Example 400 — Zod validation failure The validation middleware intercepts malformed requests before the controller runs and returns a structured error listing every failing field:
{
  "message": "Validation error",
  "errors": [
    {
      "field": "email",
      "message": "Invalid email format"
    }
  ]
}
Example 500 — internal error
{
  "success": false,
  "error": "Failed to create user"
}
Passwords are never stored in plain text. Before the user record is written to the database, the password is hashed using bcryptjs with a freshly generated salt at 10 rounds (bcrypt.genSalt(10)). Only the resulting hash is persisted, so even a full database leak does not expose raw passwords.

Build docs developers (and LLMs) love