Skip to main content

New company registration

POST 

/company/auth/register

Endpoint for registering new companies and their initial administrator user.
Performs the following operations:

  1. Validates required data (Tax ID, name, matching passwords)
  2. Verifies uniqueness of Tax ID and email
  3. Creates fiscal address
  4. Creates company in the database
  5. Creates administrator user
  6. Sets up Stripe account
  7. Sends welcome email
  8. Creates initial free plan for 1 month

Detailed flow:

  1. Client sends company and user data in JSON format
  2. Server validates required fields (400 if missing)
  3. Verifies Tax ID according to Spanish tax regulations (400 if invalid)
  4. Checks uniqueness of Tax ID and email (409 if already exists)
  5. Creates fiscal address with provided data
  6. Registers company in the database
  7. Creates administrator user with hashed password
  8. Sets up Stripe account for future payments
  9. Sends activation email with unique token
  10. 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

Successful registration