Create a consignment and use shipping rules to allocate it

If you want to ensure that a consignment is packed well in advance of manifesting, you can create a consignment and allocate it as a single operation.

Note

The optimal carrier service will be selected only from the carrier services linked to your Metapack shipper account, not from the entire library of carrier services integrated with the Metapack Platform.

Create and allocate consignment request

You need the following to make a create and allocate consignment request.

Data Description
Carriers You cannot allocate a consignment if carriers, carrier services, and carrier costs are not configured for your Metapack shipper account.
Warehouses You cannot create consignments if warehouses are not configured for your Metapack shipper account. This is because the sender of a consignment is a warehouse (shipping location).

Using the Create a consignment operation, enter the following information:

  • Order details
  • Consignment dimensions and weight
  • Details about each parcel in the consignment
  • Either the code of a previously defined shipping rule or allocation parameters to define a new shipping rule for this consignment
Note

Adding dangerous goods to a consignment after it has been allocated might break the rules of the selected carrier or carrier service and cause delivery problems.

Example request

Copy
Copied
POST /shipping/v1/consignments HTTP/1.1
Host: api.metapack.com
API-Key: Basic Base64-encoded <username>:<password>
Content-Type: application/json

{
    "consignment": {
        "measurementUnits": {
            "weight": "kg",
            "measurement": "cm",
            "volume": "ml"
        },
        "orders": [
            {
                "orderRef": "help-centre-1",
                "value": {
                    "amount": 10,
                    "currencyCode": "GBP"
                }
            }
        ],
        "shipmentRef": "shipperRef1",
        "sender": {
            "code": "default",
            "addressLine1": "200 GRAY'S INN RD",
            "addressLine2": "4TH FLOOR",
            "postCode": "WC1X 8XZ",
            "countryCode": "GBR",
            "companyName": "test",
            "city": "London",
            "stateProvince": null,
            "contact": {
                "name" : "help test",
                "email": "help@metapack.com",
                "phone": "0612345678"
            }
        },
        "recipient": {
            "addressLine1": "200 Grays Inn",
            "addressLine2": "London",
            "postCode": "WC1X 8XC",
            "countryCode": "GBR",
            "companyName": "METAPACK LIMITED",
            "city": "London",
            "stateProvince": "",
            "timeZone": "Europe/London",
            "type": "business",
            "contact": {
                "name" : "help test",
                "email": "help@metapack.com",
                "phone": "0612345678"
            }
        },
        "supportingAgents": {
            "return": {
                "addressLine1": "200 Grays Inn",
                "addressLine2": " 4TH FLOOR",
                "city": "London",
                "postCode": "WC1 8XC",
                "countryCode": "GBR",
                "companyName": "return wh",
                "type": "business",
                "addressReference": "",
                "contact": {
                    "name": "test",
                    "email": "help@metapack.com",
                    "phone": "+23312345678"
                }
            }
        },
        "parcels": [
            {
                "shipperRef": "1213",
                "packagingType": "BAG",
                "weight": {
                    "value": 1
                },
                "dimensions": {
                    "height": 10,
                    "width": 12,
                    "depth": 10
                },
                "value": {
                    "amount": 12,
                    "currencyCode": "GBP"
                },
                "items": [
                    {
                        "itemRef": "prod1",
                        "harmonisedCode": "1",
                        "countryOfOrigin": "GBR",
                        "fabricContent": "1",
                        "description": "prod1",
                        "itemType": "1",
                        "quantity": 1,
                        "value": {
                            "amount": 10
                        },
                        "exportReferenceNumber": null,
                        "exportLicenseNumber": null,
                        "batteryChemCode": null,
                        "weight": {
                            "value": 1
                        },
                        "dangerousGoods": {
                            "unId": "11",
                            "shippingName": "ship",
                            "productClass": "dangerous",
                            "packagingGroup": "12",
                            "measurementUnit": "12",
                            "packagingInstructions": "instruction",
                            "packagingInstructionSection": "22222",
                            "quantity": 1,
                            "packagingType": "bag",
                            "amount": 1,
                            "regulationAuthority": "ra",
                            "regulationLevelCode": "1",
                            "transportationMeans": "12",
                            "reportableQuantity": true,
                            "radioActive": false,
                            "subRiskClass": "22",
                            "technicalName": "222",
                            "additionalInfo": "22222",
                            "overPack": "1111"
                        }
                    }
                ]
            }
        ],
        "type": "delivery",
        "tags": [
            "cust1",
            "cust2",
            "cust3",
            "cust4",
            "cust5",
            "cust6",
            "cust7",
            "cust8",
            "cust9",
            "cust10"
        ]
    },
    "shippingRules": {
        "carrierServices": [
            "RMFIRSTSTL"
        ]
    }
}

Create and allocate consignment response

201 (Created)

Significant parameters in a successful response are as follows.

Parameter Value Description
status ALLOCATED You can reallocate or delete the consignment, or add parcels to it. Modifying the consignment will require deleting its allocation, which will change the status to UNALLOCATED.

If a suitable subscribed carrier service is not found for the consignment, it will still be created but the status will be UNALLOCATED.

carrierConsignmentCode If the consignment has been allocated, the value of this parameter is not null.
consignmentCode This is the unique identifier of the consignment inside the Metapack Platform. You will need to use this parameter if you want to retrieve, updater, reallocate, or delete the consignment, or add parcels to it.

Example response

Copy
Copied
{
    "consignment": {
        "consignmentCode": "DMC4F923NZLS",
        "manifestGroupCode": null,
        "measurementUnits": {
            "weight": "kg",
            "measurement": "cm",
            "volume": "ml"
        },
        "orders": [
            {
                "orderRef": "help-centre-1",
                "orderDate": null,
                "value": {
                    "amount": 0
                },
                "shippingCharge": {
                    "value": 0,
                    "currencyCode": null
                }
            }
        ],
        "shipmentRef": null,
        "sender": {
            "addressLine1": "200 GRAY'S INN RD",
            "addressLine2": "4TH FLOOR",
            "city": "London",
            "postcode": "WC1X 8XZ",
            "countryCode": "GBR",
            "companyName": "test",
            "timeZone": "Europe/London",
            "contact": {
                "firstName": "test",
                "lastName": null,
                "title": null,
                "timeZone": "Europe/London",
                "email": "help@metapack.com",
                "phone": null
            }
        },
        "recipient": {
            "addressLine1": "200 Grays Inn",
            "addressLine2": "London",
            "city": "London",
            "postcode": "WC1 8XC",
            "countryCode": "GBR",
            "companyName": "METAPACK LIMITED",
            "timeZone": "Europe/London",
            "contact": {
                "firstName": "test recepient",
                "lastName": null,
                "title": null,
                "timeZone": "Europe/London",
                "language": "en",
                "email": "help@metapack.com",
                "phone": null
            }
        },
        "parcels": [
            {
                "parcelCode": "4F92CVC3H",
                "parcelIndex": 1,
                "shipperRef": "1213",
                "packagingType": "BAG",
                "weight": {
                    "value": 1
                },
                "dimensions": {
                    "height": 10,
                    "width": 12,
                    "depth": 10
                },
                "value": {
                    "amount": 12
                },
                "items": [
                    {
                        "itemRef": "prod1",
                        "harmonisedCode": "1",
                        "countryOfOrigin": "GBR",
                        "fabricContent": "1",
                        "description": "prod1",
                        "itemType": null,
                        "quantity": 1,
                        "value": {
                            "amount": 10
                        },
                        "exportReferenceNumber": null,
                        "exportLicenseNumber": null,
                        "batteryChemCode": null,
                        "weight": {
                            "value": 1
                        },
                        "dangerousGoods": {
                            "unId": "11",
                            "shippingName": "ship",
                            "productClass": "dangerous",
                            "packagingGroup": "12",
                            "measurementUnit": "12",
                            "packagingInstructions": "instruction",
                            "packagingInstructionSection": "22222",
                            "quantity": 1,
                            "packagingType": "bag",
                            "amount": 1,
                            "regulationAuthority": "ra",
                            "regulationLevelCode": null,
                            "transportationMeans": "12",
                            "reportableQuantity": true,
                            "radioActive": false,
                            "subRiskClass": "22",
                            "technicalName": "222",
                            "additionalInfo": "22222",
                            "overPack": "1111"
                        }
                    }
                ],
                "deliveryLegs": [
                    {
                        "trackIdentifier": "000000204",
                        "trackingLinks": null
                    }
                ]
            }
        ],
        "status": "Allocated",
        "attributes": {},
        "type": "Delivery",
        "tags": [
            "cust1",
            "cust2",
            "cust3",
            "cust4",
            "cust5",
            "cust6",
            "cust7",
            "cust8",
            "cust9",
            "cust10"
        ],
        "deliveryInformation": {
            "cutOffDate": "2021-08-03T17:00:00.000Z",
            "collectionWindow": {
                "from": "",
                "to": "2021-08-03T17:30:00.000Z"
            },
            "deliveryWindow": {
                "from": "2021-08-04T07:00:00.000Z",
                "to": "2021-08-04T16:00:59.999Z"
            }
        },
        "service": {
            "name": "",
            "code": "",
            "carrierService": {
                "code": "RMFIRSTSTL",
                "name": "1st Class Packet",
                "carrier": {
                    "code": "ROYALMAIL"
                }
            }
        },
        "supportingAgents": {
            "return": {
                "addressLine1": "200 Grays Inn",
                "addressLine2": " 4TH FLOOR",
                "city": "London",
                "postCode": "WC1 8XC",
                "countryCode": "GBR",
                "companyName": "return wh",
                "stateProvince": null,
                "addressReference": "",
                "contact": {
                    "name": null,
                    "timezone": "",
                    "language": "",
                    "email": null,
                    "phone": null
                }
            }
        },
        "carrierConsignmentCode": "000000204"
    },
    "links": [
        {
            "operation": "GET",
            "rel": "consignment",
            "href": "/consignments/DMC4F923NZLS"
        }
    ]
}

Related tasks