Skip to main content
GET
/
api
/
usuarios
/
{id}
Get User by ID
curl --request GET \
  --url https://api.example.com/api/usuarios/{id}
{
  "200": {},
  "401": {},
  "403": {},
  "404": {},
  "usuario_id": 123,
  "username": "<string>",
  "email": {},
  "nombre": "<string>",
  "apellidos": "<string>",
  "rol": {},
  "direccion_envio": "<string>",
  "fecha_nacimiento": "<string>",
  "activo": true
}

Authentication

Required: Authenticated user This endpoint requires authentication. Users can retrieve their own information, while administrators can retrieve any user’s information.

Path Parameters

id
long
required
The unique identifier of the user to retrieve

Request

curl -X GET https://api.iquea.com/api/usuarios/1 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response

Returns a single user object.
usuario_id
long
Unique identifier for the user
username
string
User’s unique username (max 100 characters)
email
object
User’s email address (unique across the system)
nombre
string
User’s first name (max 100 characters)
apellidos
string
User’s last name(s) (max 150 characters)
rol
enum
User role. Possible values:
  • ADMIN - Administrator with full access
  • CLIENTE - Regular customer (default)
direccion_envio
string
User’s shipping address
fecha_nacimiento
date
User’s date of birth (ISO 8601 format: YYYY-MM-DD)
activo
boolean
Whether the user account is active

Example Response

{
  "usuario_id": 1,
  "username": "johndoe",
  "email": {
    "value": "[email protected]"
  },
  "nombre": "John",
  "apellidos": "Doe Smith",
  "rol": "CLIENTE",
  "direccion_envio": "123 Main St, Madrid, Spain",
  "fecha_nacimiento": "1990-05-15",
  "activo": true
}

Status Codes

200
OK
Successfully retrieved user information
401
Unauthorized
Missing or invalid authentication token
403
Forbidden
User attempting to access another user’s information without admin privileges
404
Not Found
User with the specified ID does not exist

Security Notes

Password Protection: User passwords are never included in API responses. The password field is stored securely in the database but excluded from all DTO responses.
Access Control: Regular users (CLIENTE role) can only retrieve their own user information. Only administrators (ADMIN role) can retrieve information about other users.

Build docs developers (and LLMs) love