Skip to main content

Get User Profile

GET /api/users/:id
Retrieves a user’s profile information by their ID.

Path Parameters

id
number
required
The unique identifier of the user

Response

success
boolean
required
Indicates if the request was successful
data
object
required
User profile data
id
number
User ID
email
string
User’s email address
nombre
string
User’s first name
apellido
string
User’s last name
telefono
string
User’s phone number (optional)
rol
string
User’s role (e.g., “USER”, “ADMIN”)
error
string
Error message if the request failed
{
  "success": true,
  "data": {
    "id": 42,
    "email": "[email protected]",
    "nombre": "Juan",
    "apellido": "Pérez",
    "telefono": "+54 11 1234-5678",
    "rol": "USER"
  }
}

Error Responses

{
  "success": false,
  "error": "Usuario no encontrado"
}

Update User Profile

PUT /api/users/:id
Updates a user’s profile information.

Path Parameters

id
number
required
The unique identifier of the user to update

Request Body

nombre
string
required
User’s first name (minimum 2 characters)
apellido
string
required
User’s last name (minimum 2 characters)
telefono
string
User’s phone number (optional)
{
  "nombre": "Juan",
  "apellido": "Pérez",
  "telefono": "+54 11 1234-5678"
}

Response

success
boolean
required
Indicates if the request was successful
data
object
Updated user profile data
message
string
Success message
error
string
Error message if the request failed
{
  "success": true,
  "data": {
    "id": 42,
    "email": "[email protected]",
    "nombre": "Juan",
    "apellido": "Pérez",
    "telefono": "+54 11 1234-5678",
    "rol": "USER"
  },
  "message": "Perfil actualizado correctamente"
}

Validation Errors

{
  "success": false,
  "error": "El nombre es muy corto, El apellido es muy corto"
}

Build docs developers (and LLMs) love