Skip to content

Create new DeCA

This endpoint creates a new Administrative Control Document (DeCA), generates its PDF with QR code, and stores it in Azure Blob Storage. If recipient is provided, a notification is also sent.

Call

curl -X https://decatest.solmicrosdh.com/api/control-documents \
--request POST \
--cert /ruta/al/certificado.pfx \
--cert-type P12 \
--pass mypfxpassword \
-H "Content-Type: application/json" \
-H "CompanyId: guid-unico-empresa" \
-d '{
  "contractualCharger": {
    "businessName": "string",
    "taxIdentificationNumber": "string",
    "address": "string"
  },
  "actualCarrier": {
    "businessName": "string",
    "taxIdentificationNumber": "string"
  },
  "shipments": [
    {
      "origin": "string",
      "destination": "string",
      "goodsNature": "string",
      "packageCount": integer,
      "weightKg": decimal,
      "alternativeMagnitude": "string"
    }
  ],
  "vehicle": {
    "licensePlate": "string",
    "tractorLicensePlate": "string",
    "semitrailerLicensePlate": "string",
    "vehicleChange": "string"
  },
  "transportDate": "date",
  "specialCirculationPermit": "string",
  "remarks": "string",
  "logo": "string",
  "recipient": {
    "channel": integer,
    "address": "string",
    "name": "string"
  }
}'

Request fields

Property Data type Required Description
DeCAObject DeCA Yes DeCA data
recipient Recipient No DeCA Notification

Key validation rules:

  • contractualCharger.taxIdentificationNumber must be a valid Spanish NIF/NIE/CIF.
  • actualCarrier.taxIdentificationNumber accepts a valid Spanish NIF/NIE/CIF or a VIES-style foreign tax identifier (the actual carrier may be a foreign company carrying out domestic transport).
  • Each shipment must include weightKg or alternativeMagnitude.
  • If weightKg is included, it must be positive.
  • If packageCount is included, it must be positive.
  • For articulated vehicles, tractorLicensePlate and semitrailerLicensePlate must both be present or both absent.
  • vehicle.licensePlate is required unless both tractorLicensePlate and semitrailerLicensePlate are provided (complete articulated combination), in which case it is optional.

For full error details, see Error Handling.

Result

On success, returns 201 Created and a Location header with the resource path.

{
  "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "pdfUrl": "https://<storage>/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.pdf"
}

Response fields

Property Data type Description
id guid Unique DeCA identifier
pdfUrl string Public URL of the generated PDF