Skip to main content

Send CMR document by email.

POST 

/company/cmr/send

Send the CMR document (Digital Consignment Note) associated with a transport service to one or more recipients via email. The PDF document is generated and sent as an attachment.

Objective

Allow companies to distribute the eCMR document to interested parties (customers, carriers, authorities) without the need for manual download. The ecmr_back service manages the asynchronous sending of emails.

Use Cases

  • A company needs to send the CMR to its customer for accounting purposes
  • The CMR needs to be sent to the carrier for their records
  • Customs authorities request the CMR document via email
  • The company needs to distribute the CMR to multiple internal departments

Payment Validation

Middleware: mPlan.isPaymentUpdate This endpoint validates the company's payment status before processing the send:

  • Verifies that the JWT token is valid
  • Verifies that the company has updated payment permissions
  • Rejects the request if the company does not have an active payment or valid subscription If payment validation fails, a 401/403 error will be returned before processing the send.

Behavior

  1. Validates the service_code and emails parameters
  2. Verifies the user is authenticated and has a valid company
  3. Validates the payment status (via isPaymentUpdate middleware)
  4. Forwards the request to the ecmr_back service
  5. ecmr_back generates the PDF and sends the emails
  6. Returns a send confirmation (not a delivery confirmation)

Notes:

  • Email sending is asynchronous: confirmation indicates it was queued, not delivered
  • Each recipient will receive the CMR as a PDF attachment
  • Maximum of 10 email addresses per request
  • No tracking of email opening or delivery is performed
  • The service may take up to 10 seconds to respond

Preconditions

  • User must be authenticated and exist in database
  • User must belong to a valid company
  • Company must have valid payment status (validated by isPaymentUpdate)
  • A delivery with the given service_code must exist for the company
  • The delivery must have an associated eCMR document

Error Codes

Validation Errors (400):

  • SERVICE_CODE_REQUIRED: The service_code parameter is required
  • EMAILS_REQUIRED: The emails parameter is required and cannot be empty

**Authentication Errors (401

Request

Responses

The CMR has been successfully sent to the specified recipients. The response confirms that the email was sent to the ecmr_back queue, but it does NOT confirm the effective delivery to the recipients.