Overview
The Users API provides endpoints for managing user accounts in the Kin Conecta platform. Users can have different roles (TOURIST, GUIDE, or ADMIN) and contain core account information including authentication details, contact information, and preferences.
User Object
The User object represents a platform user account with the following structure:
Unique identifier for the user
User role: TOURIST, GUIDE, or ADMIN
User’s date of birth in ISO 8601 format (YYYY-MM-DD)
Hashed password (never send plaintext passwords)
ISO country code for the user’s location
Phone number in E.164 format
User’s preferred language code (references Language entity)
Account status: PENDING, ACTIVE, SUSPENDED, or DELETED
Timestamp when email was verified (ISO 8601 format)
Timestamp of last login (ISO 8601 format)
Timestamp when user was created (ISO 8601 format)
Timestamp when user was last updated (ISO 8601 format)
Create User
curl -X POST http://localhost:8080/api/users \
-H "Content-Type: application/json" \
-d '{
"role": "TOURIST",
"fullName": "Maria Garcia",
"dateOfBirth": "1995-06-15",
"email": "[email protected]",
"passwordHash": "$2a$10$N9qo8uLOickgx2ZMRZoMye",
"countryCode": "MX",
"phoneNumber": "+52 55 1234 5678",
"phoneE164": "+525512345678",
"preferredLanguageCode": "es",
"accountStatus": "PENDING",
"createdAt": "2024-03-11T10:30:00Z"
}'
User role: TOURIST, GUIDE, or ADMIN
Phone number in E.164 format
Account status (default: PENDING)
Response
{
"userId": 1,
"role": "TOURIST",
"fullName": "Maria Garcia",
"dateOfBirth": "1995-06-15",
"email": "[email protected]",
"passwordHash": "$2a$10$N9qo8uLOickgx2ZMRZoMye",
"countryCode": "MX",
"phoneNumber": "+52 55 1234 5678",
"phoneE164": "+525512345678",
"preferredLanguageCode": "es",
"accountStatus": "PENDING",
"emailVerifiedAt": null,
"lastLoginAt": null,
"createdAt": "2024-03-11T10:30:00Z",
"updatedAt": null
}
Get All Users
curl -X GET http://localhost:8080/api/users
Retrieves a list of all users in the system.
Response
[
{
"userId": 1,
"role": "TOURIST",
"fullName": "Maria Garcia",
"email": "[email protected]",
"accountStatus": "ACTIVE",
"createdAt": "2024-03-11T10:30:00Z"
},
{
"userId": 2,
"role": "GUIDE",
"fullName": "Carlos Rodriguez",
"email": "[email protected]",
"accountStatus": "ACTIVE",
"createdAt": "2024-03-10T14:20:00Z"
}
]
Get User by ID
curl -X GET http://localhost:8080/api/users/1
Retrieves a specific user by their ID.
Response
{
"userId": 1,
"role": "TOURIST",
"fullName": "Maria Garcia",
"dateOfBirth": "1995-06-15",
"email": "[email protected]",
"passwordHash": "$2a$10$N9qo8uLOickgx2ZMRZoMye",
"countryCode": "MX",
"phoneNumber": "+52 55 1234 5678",
"phoneE164": "+525512345678",
"preferredLanguageCode": "es",
"accountStatus": "ACTIVE",
"emailVerifiedAt": "2024-03-11T11:00:00Z",
"lastLoginAt": "2024-03-15T09:30:00Z",
"createdAt": "2024-03-11T10:30:00Z",
"updatedAt": "2024-03-15T09:30:00Z"
}
Update User
curl -X PUT http://localhost:8080/api/users/1 \
-H "Content-Type: application/json" \
-d '{
"role": "TOURIST",
"fullName": "Maria Isabel Garcia",
"dateOfBirth": "1995-06-15",
"email": "[email protected]",
"countryCode": "MX",
"phoneNumber": "+52 55 9876 5432",
"phoneE164": "+525598765432",
"preferredLanguageCode": "es",
"accountStatus": "ACTIVE",
"updatedAt": "2024-03-15T10:00:00Z"
}'
Updates an existing user’s information. All fields from the create request can be updated.
Response
{
"userId": 1,
"role": "TOURIST",
"fullName": "Maria Isabel Garcia",
"dateOfBirth": "1995-06-15",
"email": "[email protected]",
"countryCode": "MX",
"phoneNumber": "+52 55 9876 5432",
"phoneE164": "+525598765432",
"preferredLanguageCode": "es",
"accountStatus": "ACTIVE",
"emailVerifiedAt": "2024-03-11T11:00:00Z",
"lastLoginAt": "2024-03-15T09:30:00Z",
"createdAt": "2024-03-11T10:30:00Z",
"updatedAt": "2024-03-15T10:00:00Z"
}
Delete User
curl -X DELETE http://localhost:8080/api/users/1
Deletes a user from the system. This is typically a soft delete that updates the accountStatus to DELETED.
Response
{
"message": "User deleted successfully"
}