POST {{NEXT_PUBLIC_API_BASE_URL}}/api/register
Create User
Creates a new user, utilizing an email, password, and confirmation password. The email must be unique. The password and confirmation password must be equal to each other and must be at least 8 characters long. All fields need to be less than 255 characters.
Request Headers
- Content-Type: application/json
- X-CSRFToken: The CSRF token of the user
Request Body
-
email (string, required): The email of the user.
-
password (string, required): The password for the user account.
-
conf_password (string, required): The confirmation of the password.
Example:
{
"email": "[email protected]",
"password": "test1test1",
"conf_password": "test1test1"
}
Responses
201
Creates a new User object with the provided email and password. The password is encrypted with the SECRET_KEY in the web application’s environment variables.
Example
{
"email": "[email protected]",
"id": 2,
"message": "Registration successful!",
"password": "$2b$12$7yRCCe05m8q8se9qlyGVR.iY196Qj32FjhjWckOSBfRbmK67HOAOq"
}
401
An account with the email already exists, one field is not within 255 characters, or the provided password is not at least 8 characters long.
Example
{
"message": "Account already exists or invalid email or password"
}
500
An error occurred during User creation.
Example
{
"message": "Error registering user",
"error": "Some descriptive error message"
}