Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/diarpicu2022-commits/backend-AgroPulse/llms.txt

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

The register endpoint creates a new user account using a username and password. Passwords are hashed with BCrypt before storage — the plain-text value is never persisted. If fullName is omitted it defaults to the provided username. All accounts created through this endpoint are assigned the OPERATOR role; role elevation must be performed separately by an admin.
Usernames must be unique across the system. If the username is already taken, the endpoint returns 409 Conflict.

Request body

username
string
required
Unique identifier for the account. Must be between 3 and 50 characters.
password
string
required
Plain-text password. Must be at least 6 characters. Stored as a BCrypt hash.
fullName
string
The user’s display name. Defaults to username when not supplied.
email
string
A valid email address. Optional, but must be a well-formed address if provided.

Response

A 200 OK response returns the newly created user object.
id
number
required
Auto-incremented integer primary key.
username
string
required
The username provided in the request.
fullName
string
required
The display name. Equals username if fullName was not supplied.
email
string
The email address provided in the request, or null if omitted.
phone
string
Always null for newly registered accounts.
avatar
string
Always null for newly registered accounts.
role
string
required
Always OPERATOR for self-registered accounts.
active
boolean
required
Always true for newly created accounts.
createdAt
string
required
ISO 8601 datetime when the account was created.
greenhouseIds
number[]
required
Always an empty array for newly registered accounts.

Error responses

Statuserror valueCause
409El usuario ya existeA user with the provided username already exists.

Example

curl --request POST \
  --url http://localhost:8080/api/auth/register \
  --header 'Content-Type: application/json' \
  --data '{
    "username": "jane_doe",
    "password": "mySecurePass1",
    "fullName": "Jane Doe",
    "email": "jane@example.com"
  }'

Success response

{
  "id": 7,
  "username": "jane_doe",
  "fullName": "Jane Doe",
  "email": "jane@example.com",
  "phone": null,
  "avatar": null,
  "role": "OPERATOR",
  "active": true,
  "createdAt": "2024-03-15T11:05:00",
  "greenhouseIds": []
}

Error response

{
  "error": "El usuario ya existe"
}

Build docs developers (and LLMs) love