Welcome to the guide on creating dangerous goods (DG) consignments using the MachShip API. This document serves as a companion to our main guide on Creating Consignments and focuses specifically on the additional considerations and steps required when shipping dangerous goods.
Dangerous goods consignments are shipments that contain hazardous items requiring special care during transportation. It's crucial to fully declare all information related to the dangerous goods being sent to ensure compliance with local regulations.
In the context of MachShip, a dangerous goods consignment includes all the standard consignment information (pick-up location, delivery location, items) plus additional details specific to the hazardous nature of the goods.
When creating a DG consignment via the MachShip API, there are several key differences compared to standard consignments:
/apiv2/consignments/createConsignmentwithComplexItems
endpoint instead of the standard consignment creation endpoint. This endpoint is not limited for use with DG consignments and can be used to create any consignment.The process of creating a DG consignment is similar to creating a standard consignment, with some additional steps and parameters. We'll focus on the DG-specific aspects here.
For details on the remaining fields, please see our Creating Consignments guide.
When preparing your request to the /apiv2/consignments/createConsignmentwithComplexItems
endpoint for a DG consignment, you'll need to include additional information beyond what's required for standard consignments.
This is a required field for all consignments when a company has Dangerous Goods enabled. You must set this to true
for DG consignments:
{
"dgsDeclaration": true
}
For items that are classified as dangerous goods, you need to provide detailed information through the consignmentItemDgItems
object:
{
"items": [
{
"itemType": "Carton",
"name": "Test Carton",
"sku": "CART",
"quantity": 1,
"standardItem": {
"height": 25,
"weight": 5,
"length": 20,
"width": 20
},
"consignmentItemDgItems": [
{
"unNumber": 1263,
"packingGroup": 3,
"containerType": 1,
"aggregateQuantity": 20,
"isAggregateQuantityWeight": false,
"numberOfContainers": 1,
"isMarinePollutant": true,
"isTemperatureControlled": false,
"dgClassType": 5
}
]
}
]
}
Let's break down the consignmentItemDgItems
object:
Once you've prepared all the necessary information, including the DG-specific details, you're ready to send your request. Here's an example of what a complete request for a DG consignment might look like:
POST https://live.machship.com/apiv2/consignments/createConsignmentwithComplexItems HTTP/1.1
Host: live.machship.com
token: <api_token>
body:
{
"dgsDeclaration": true,
"items": [
{
"itemType": "Carton",
"name": "Test Carton",
"sku": "CART",
"quantity": 1,
"standardItem": {
"height": 25,
"weight": 5,
"length": 20,
"width": 20
},
"consignmentItemDgItems": [
{
"unNumber": 1263,
"packingGroup": 3,
"containerType": 1,
"aggregateQuantity": 20,
"isAggregateQuantityWeight": false,
"numberOfContainers": 1,
"isMarinePollutant": true,
"isTemperatureControlled": false,
"dgClassType": 5
}
]
}
],
"carrierId": 11,
"carrierServiceId": 123,
"carrierAccountId": 456,
"companyCarrierAccountId": 789,
"fromName": "Chemical Warehouse",
"fromContact": "John Doe",
"fromPhone": "1234567890",
"fromEmail": "john@chemicalwarehouse.com",
"fromAddressLine1": "123 Industrial St",
"fromLocation": {
"suburb": "Melbourne",
"postcode": "3000"
},
"toName": "Research Lab",
"toContact": "Jane Smith",
"toPhone": "9876543210",
"toEmail": "jane@researchlab.com",
"toAddressLine1": "456 Science Ave",
"toLocation": {
"suburb": "Sydney",
"postcode": "2000"
},
"specialInstructions": "Handle with care - Flammable"
}
The response for a DG consignment includes:
id
: Unique identifier for the consignmentcarrierConsignmentId
: Carrier's referencestatus
: Usually "Unmanifested" for new consignmentsconsignmentTotal
: Breakdown of pricing and surchargesitems
: Detailed item informationCommon DG-specific errors include:
dgsDeclaration
fieldFor more information on handling API errors, refer to our Common API Errors guide.
Creating DG consignments requires:
Always prioritize safety when shipping dangerous goods. When in doubt, consult shipping experts or regulatory authorities.