curl --request GET \
--url https://api.example.com/api/users{
"users": [
{
"user_id": "<string>",
"email": "<string>",
"name": "<string>",
"surname": "<string>",
"phone": "<string>",
"address": "<string>",
"city": "<string>",
"country": "<string>",
"postal_code": "<string>",
"gender": "<string>",
"birth_date": "<string>",
"role": {},
"status": {},
"avatar": "<string>",
"document_type": {},
"document_number": "<string>",
"refresh_token": {},
"created_at": "<string>",
"updated_at": "<string>"
}
]
}Retrieve a list of all users in the system
curl --request GET \
--url https://api.example.com/api/users{
"users": [
{
"user_id": "<string>",
"email": "<string>",
"name": "<string>",
"surname": "<string>",
"phone": "<string>",
"address": "<string>",
"city": "<string>",
"country": "<string>",
"postal_code": "<string>",
"gender": "<string>",
"birth_date": "<string>",
"role": {},
"status": {},
"avatar": "<string>",
"document_type": {},
"document_number": "<string>",
"refresh_token": {},
"created_at": "<string>",
"updated_at": "<string>"
}
]
}Authorization: Bearer <token>auth_token=<token>userId: The authenticated user’s IDemail: The authenticated user’s emailrole: The user’s role (ADMIN or USER)curl -X GET https://your-domain.com/api/users \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
password field is excluded from all responses for security.
Show User Object
ADMIN: Administrator with full accessUSER: Regular user with limited accessON: Active accountOFF: Inactive/disabled accountDNI: National Identity Document (Spain)PASSPORT: PassportNIE: Foreign Identity Number (Spain)[
{
"user_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"email": "[email protected]",
"name": "María",
"surname": "García",
"phone": "+34612345678",
"address": "Calle Mayor 123",
"city": "Madrid",
"country": "España",
"postal_code": "28013",
"gender": "Femenino",
"birth_date": "1990-05-15T00:00:00.000Z",
"role": "USER",
"status": "ON",
"avatar": "https://ui-avatars.com/api/?name=María&background=random",
"document_type": "DNI",
"document_number": "12345678A",
"refresh_token": null,
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z"
},
{
"user_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"email": "[email protected]",
"name": "Admin",
"surname": "Beils",
"phone": "+34622334455",
"address": "Avenida Principal 45",
"city": "Barcelona",
"country": "España",
"postal_code": "08001",
"gender": "Otro",
"birth_date": "1985-03-20T00:00:00.000Z",
"role": "ADMIN",
"status": "ON",
"avatar": "https://ui-avatars.com/api/?name=Admin&background=random",
"document_type": "DNI",
"document_number": "87654321B",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"created_at": "2024-01-01T08:00:00.000Z",
"updated_at": "2024-01-10T14:20:00.000Z"
}
]
{
"statusCode": 401,
"statusMessage": "Unauthorized: Token is missing or invalid"
}
{
"statusCode": 500,
"statusMessage": "Error al obtener usuarios"
}
password field is always excluded from responses using destructuringcreated_at in descending order (newest first)server/middleware/auth.ts