Skip to main content
POST
/
secured
/
update_user
Update User
curl --request POST \
  --url https://api.example.com/secured/update_user \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": 123,
  "tipoUsuario": "<string>",
  "correo": "<string>",
  "nombre": "<string>",
  "apellido": "<string>"
}
'
{
  "msg": "<string>",
  "401 Unauthorized": {}
}

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header.

Request Body

id
number
required
User ID to update
tipoUsuario
string
required
User account type/level (e.g., “admin”, “user”)
correo
string
required
User’s email address
nombre
string
required
User’s first name
apellido
string
required
User’s last name
This endpoint does not update the user’s password. Password updates require a separate process.
curl --location 'http://localhost:8080/secured/update_user' \
--header 'Content-Type: application/json' \
--header 'Authorization: YOUR_JWT_TOKEN' \
--data-raw '{
  "id": 5,
  "tipoUsuario": "admin",
  "correo": "[email protected]",
  "nombre": "Carlos",
  "apellido": "Ramírez"
}'

Response

msg
string
Success or error message

Success Response (200)

{
  "msg": "Usuario actualizado con exito"
}

Error Responses

401 Unauthorized
object
Returned when the JWT token is invalid or missing
{
  "msg": "Token_invalido"
}
or
{
  "msg": "Sin autorización"
}

Implementation Details

The endpoint updates the following fields in the usuarios table:
  • tipoUsuario - User account type
  • correo - Email address
  • nombre - First name
  • apellido - Last name
The update is performed using the user’s id as the identifier:
UPDATE usuarios 
SET tipoUsuario = ?, correo = ?, nombre = ?, apellido = ? 
WHERE id = ?

Build docs developers (and LLMs) love