New company registration
POST/company/auth/register
Endpoint for registering new companies and their initial administrator user.
Performs the following operations:
- Validates required data (Tax ID, name, matching passwords)
- Verifies uniqueness of Tax ID and email
- Creates fiscal address
- Creates company in the database
- Creates administrator user
- Sets up Stripe account
- Sends welcome email
- Creates initial free plan for 1 month
Detailed flow:
- Client sends company and user data in JSON format
- Server validates required fields (400 if missing)
- Verifies Tax ID according to Spanish tax regulations (400 if invalid)
- Checks uniqueness of Tax ID and email (409 if already exists)
- Creates fiscal address with provided data
- Registers company in the database
- Creates administrator user with hashed password
- Sets up Stripe account for future payments
- Sends activation email with unique token
- Creates initial free plan for 30 days
Data requirements:
- Valid Tax ID/CIF according to Spanish regulations
- Full legal name
- Unregistered corporate email
- Secure password (minimum 8 characters, uppercase, numbers, and special characters)
- Complete fiscal address
Example request:
{
email: admin@company.com,
password: SecurePassword123!,
password_confirm: SecurePassword123!,
invoice_data: {
taxid: B12345678,
socialName: Example Transport S.L.
},
address: {
street: Example Street 123,
city: Madrid,
zipcode: 28001,
country: ES
}
}
Error codes:
- 400: Missing data, invalid Tax ID, or passwords do not match
- 403: Company already registered with the same Tax ID
- 406: Data validation error
- 409: Email already registered
- 500: Internal server error
Request
Responses
- 200
- 400
- 409
Successful registration
Invalid request
Conflict