POST/api/auth/register

Register

Create a new user account with email and password. A default organization is automatically created with the user as the owner.

Request

Body Parameters

ParameterTypeRequiredDescription
emailstringYesUser's email address (must be unique and valid)
passwordstringYesPassword (minimum 8 characters)
firstNamestringNoUser's first name
lastNamestringNoUser's last name

Example Request

curl -X POST https://api.storno.ro/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "SecurePass123!",
    "firstName": "John",
    "lastName": "Doe"
  }'

Response

Success Response (201 Created)

{
  "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "def50200a1b2c3d4e5f6..."
}
FieldTypeDescription
tokenstringJWT access token, valid for 1 hour
refresh_tokenstringRefresh token used to obtain new access tokens

Error Codes

CodeDescription
400Bad Request - Validation errors (invalid email, weak password, etc.)
409Conflict - Email address already registered
429Too Many Requests - Rate limit exceeded

Error Response Examples

Validation Error (400)

{
  "code": 400,
  "message": "Validation failed",
  "errors": {
    "email": ["This value is not a valid email address."],
    "password": ["Password must be at least 8 characters long."]
  }
}

Email Already Exists (409)

{
  "code": 409,
  "message": "An account with this email address already exists."
}

Automatic Setup

When you register a new account, the system automatically:

  1. Creates a User with the provided email and hashed password
  2. Creates a Default Organization named after the user's email
  3. Assigns Owner Role via an organization membership
  4. Issues JWT Tokens for immediate authenticated access

Password Requirements

Passwords must meet the following criteria:

  • Minimum 8 characters
  • At least one uppercase letter (recommended)
  • At least one lowercase letter (recommended)
  • At least one number (recommended)
  • Special characters are allowed and encouraged

Email Confirmation

Depending on configuration, the account may require email confirmation before full access is granted:

  • A confirmation email is sent to the provided address
  • The user may need to click the confirmation link before logging in
  • Check the Confirm Email documentation for details

Usage Notes

  • Email addresses are case-insensitive and stored in lowercase
  • The user is immediately authenticated after successful registration
  • Rate limiting applies: maximum 3 registration attempts per hour per IP address
  • The default organization can be renamed later via the organization settings
  • Users can create or join additional organizations after registration

Next Steps

After successful registration:

  1. Store the tokens securely
  2. Fetch user profile via GET /api/v1/me
  3. Set up company information for invoicing
  4. Configure ANAF e-Factura integration