Skip to main content

Create new trucker

POST 

/company/truckers/

Create a new carrier associated with the authenticated user's company.

Creation Process:

  1. Validation of mandatory data (email, taxid)
  2. Uniqueness verification (unique email and taxid)
  3. Automatic password generation (if not provided)
  4. Secure password hashing
  5. Profile image upload to S3 (optional)
  6. Email sending with credentials
  7. Automatic association to the company

Automatic Validations:

  • Unique email in the system
  • Unique taxid (DNI/NIE/CIF) with valid format
  • Phone number with valid format
  • Valid role according to model

Password Management:

  • If sent: Secure hash is stored
  • If not sent: Automatically generated and sent via email

Image Management:

  • Support for multipart/form-data upload
  • Storage in AWS S3
  • image field contains the S3 key

Welcome Email:

  • Automatically sent to the carrier
  • Includes access credentials
  • Personalized with company name
  • Multi-language based on user i18n

Limits:

  • Subscription plan verification (middleware canCreateUser)
  • Requires multitenant permissions

Responses:

  • 200 OK: Carrier created successfully
  • 400 Bad Request: Invalid data or missing information
  • 401 Unauthorized: Company not found
  • 406 Not Acceptable: Email or taxid already exist
  • 503 Service Unavailable: Error saving to database

Request

Responses

Carrier created successfully