Skip to main content
POST
/
users
curl --location 'https://api.maytravel.com/users' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "username": "johndoe",
    "email": "[email protected]",
    "password": "securepassword123",
    "role": "user"
  }'
{
  "mssg": "Created succesfully"
}

Request

username
string
required
The username for the new user. Will be converted to lowercase.
email
string
required
The email address for the new user. Will be converted to lowercase.
password
string
required
The password for the new user
role
string
default:"user"
The role to assign to the user. Defaults to “user” if not specified.
curl --location 'https://api.maytravel.com/users' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "username": "johndoe",
    "email": "[email protected]",
    "password": "securepassword123",
    "role": "user"
  }'

Response

mssg
string
Success message confirming user creation
{
  "mssg": "Created succesfully"
}

Error Responses

error
string
Error message describing what went wrong

Status Codes

  • 201 - Created: User successfully created
  • 500 - Server Error: Internal server error occurred (e.g., duplicate username/email, database error)

Notes

  • Both username and email are automatically converted to lowercase before storage
  • The role field defaults to “user” if not provided
  • Ensure passwords are securely hashed on the client side or implement server-side hashing

Build docs developers (and LLMs) love