Skip to main content

Add a driver to a carrier

POST 

/company/my_carriers/driver/:carrierId

Register a new driver associated with a specific carrier. Requires JWT authentication.

Use cases:

  • Register drivers for existing carriers
  • Maintain a directory of available drivers
  • Associate drivers with logistics operations

Notes:

  • The carrier must already exist
  • Basic driver data is required
  • Driver reuse: If a driver with the same taxid already exists, the endpoint will reuse the existing driver instead of creating a duplicate
  • Automatic password: If no password is provided, one is automatically generated as 123456 and hashed with bcrypt before saving

Request

Responses

Driver added successfully.

IMPORTANT NOTE: The endpoint returns the complete Carrier object with the updated drivers array, NOT just the created driver. The new driver will be in the last element of the drivers array.

ID structure in drivers:

  • _id: ID of the subdocument within the carrier's drivers array
  • associated: ID of the trucker_user in the truckers_users collection (reference to the real user)
Response Headers