Skip to main content

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:
userId
Long
Unique identifier for the user
role
UserRole
User role: TOURIST, GUIDE, or ADMIN
fullName
string
User’s full name
dateOfBirth
date
User’s date of birth in ISO 8601 format (YYYY-MM-DD)
email
string
User’s email address
passwordHash
string
Hashed password (never send plaintext passwords)
countryCode
string
ISO country code for the user’s location
phoneNumber
string
User’s phone number
phoneE164
string
Phone number in E.164 format
preferredLanguageCode
string
User’s preferred language code (references Language entity)
accountStatus
UserAccountStatus
Account status: PENDING, ACTIVE, SUSPENDED, or DELETED
emailVerifiedAt
datetime
Timestamp when email was verified (ISO 8601 format)
lastLoginAt
datetime
Timestamp of last login (ISO 8601 format)
createdAt
datetime
Timestamp when user was created (ISO 8601 format)
updatedAt
datetime
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"
  }'
role
UserRole
required
User role: TOURIST, GUIDE, or ADMIN
fullName
string
required
User’s full name
dateOfBirth
date
User’s date of birth
email
string
required
User’s email address
passwordHash
string
required
Hashed password
countryCode
string
ISO country code
phoneNumber
string
Phone number
phoneE164
string
Phone number in E.164 format
preferredLanguageCode
string
Preferred language code
accountStatus
UserAccountStatus
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"
}

Build docs developers (and LLMs) love