Skip to main content

Create new trucker

POST 

/company/truckers/

Creates a new trucker 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 company

Automatic validations:

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

Password management:

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

Image management:

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

Welcome email:

  • Automatically sent to trucker
  • Includes access credentials
  • Personalized with company name
  • Multilingual according to user's i18n

Limits:

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

Responses:

  • 200 OK: Trucker 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

Trucker created successfully