Register New User
POST/auth/register
Endpoint to create new user accounts with an associated company. Typical Flow:
- The client sends user and company data
- The server validates that the email and CIF (Tax ID) are unique
- Creates both the user and the company in a single operation
- Automatically assigns the user as the administrator of the new company
- Returns a JWT token and information of the created user Usage Examples:
- Registration of new companies on the platform
- Automatic user and company onboarding
- Creation of trial or demo accounts Applied Validations:
- Email must be unique in the system
- Company CIF/NIF (Tax ID) must be unique
- Password minimum 6 characters
- Email must have a valid format
- CIF must be between 6 and 15 characters Important Notes:
- Both user and company are created in an atomic transaction
- The user is automatically assigned as the company admin
- A verification email is automatically sent
- The company starts with the "default" plan
- The account type can be updated later Automatically Created Data:
- Unique ID for user and company
- Creation timestamps (createdAt, updatedAt)
- Active status by default
- Email verification token
Request
Responses
- 201
- 400
User and company created successfully
Validation error - Duplicate Email or CIF