Creating a B2B shipment

API reference ShipmentListAPIV3

B2B shipments

To create a B2B shipment a B2B template object needs to be added to all the other fields of the create shipment request.

B2B config object

These are the fields that have to be sent under the b2b_config object

FieldTypeDescriptionRequired
template_keystringThe template key of the template to be used.
See: Listing B2B config templates.
always
template_idstringThe template id of the template to be used.
See: Listing B2B config templates.
always
customer_inputcustomer input objectThe fields needed in the selected template with its data.always
is_palletstringIf the shipment has to be sent as pallets or as parcels.
It accepts: true, false
optional

From the returned data the following fields are needed to be sent in the shipment request:

  • key: this is the templateKey in the code below
  • customerInputSchema: contains the structure to create the data in customerInput

Request body example

{
  "b2b_config": {
    "template_key": "byrd",
    "template_id": "the_template_id",
    "customer_input": {
     "reference_number": "123456",
     "insurance_value": 20.0,
     "container_type": "pallet",
     "fragile_goods": true
    }
  "destination_address": {
    "name": "William Byrd",
    "company_name": "",
    "email": "[email protected]",
    "street_name": "The name of the street",
    "street_number": "15",
    "address_addition": "1st floor",
    "city": "City",
    "postal_code": "458ABC",
    "country_code": "DE",
    "phone": "+421111111111"
  },
  "items": [
    {
      "sku": "AB-1234",
      "name": "Dog food",
      "quantity": 2,
      "lot_number": "2/23",
      "price": {
        "value": 20,
        "currency": "EUR"
      },
      "customs": {
        "hs_tariff_number": "910121",
        "origin_country_code": "CN"
      }
    }
  ],
  "service": "economy",
  "options": {
    "auto_release": true,
    "preferred_carrier": "DHL",
    "incoterm": "ABC"
  },
  "shop": {
    "order_number": "OW-18940",
    "order_id": "123456"
  },
  "documents": [
    {
      "type": "delivery_note",
      "url": "https://urltodocument/OW-18940.pdf",
      "print_copies": 1,
      "format": "document",
      "data_type": "pdf",
      "name": "Delivery note"
    }
  ],
  "notes": {
    "customer_note": "This is an internal note",
    "packaging_instructions": "Please put the flyer on top of the items."
  },
  "insurance": {
    "value": "20.45",
    "currency": "EUR"
  },
  "customs": {
    "invoice_number": "2023-12894091",
    "goods_type": "other"
  }
}

Successful response example

{
    "data": {
        "b2b_config": {
            "template_id": "b2b_template_id",
            "id": "b2b_config_id",
            "customer_input": {
                "fragile_goods": true,
                "container_type": "pallet",
                "insurance_value": 20.0,
                "reference_number": "123456"
            },
            "updated_at": "2023-03-23T15:18:01.557541+00:00",
            "created_at": "2023-03-23T15:18:01.557531+00:00",
            "is_pallet": false,
            "template_key": "byrd"
        },
        "errors": [],
        "metrics": {
            "total_packaging_units": 0,
            "total_picks": 0,
            "total_skus": 0,
            "total_items": 2
        },
        "notes": {
            "label_error_note": null,
            "packaging_instructions": null,
            "customer_note": "This is an internal note"
        },
        "items": [
            {
                "name": "Dog food",
                "type": "product",
                "dangerous_goods": null,
                "children": [],
                "price": {
                    "value": 20.00,
                    "currency": "EUR",
                    "tax_factor": 1.0
                },
                "product_id": null,
                "description": null,
                "dimensions": {
                    "height": null,
                    "length": null,
                    "weight": null,
                    "width": null
                },
                "quantity": 2,
                "customs": {
                    "hs_tariff_number": "910121",
                    "origin_country_code": "CN"
                },
                "created_at": "2023-03-23T11:47:56.077055+00:00",
                "sku": "AB-1234",
                "fragile": false,
                "updated_at": "2023-03-23T11:47:56.077061+00:00",
                "serial_number_tracked": false,
                "id": "the_item_line_id",
                "lot_number": "2/23"
            }
        ],
        "destination_address": {
            "name": "William Byrd",
            "email": "[email protected]",
            "street_number": "15",
            "postal_code": "458ABC",
            "city": "City",
            "street_name": "The name of the street",
            "created_at": "2023-03-23T11:47:56.068145+00:00",
            "phone": "+421111111111",
            "company_name": "",
            "address_addition": "1st floor",
            "updated_at": "2023-03-23T11:47:56.068152+00:00",
            "country_code": "DE",
            "id": "the_address_id",
            "validated": false,
            "state": null
        },
        "return_address": null,
        "dangerous_goods": {
            "limited_quantity_weight": 0.0
        },
        "warehouse": {
            "id": null,
            "picked_by": null
        },
        "warnings": [],
        "units": [],
        "container_code": null,
        "options": {
            "has_dangerous_goods": false,
            "preferred_carrier": "DHL",
            "partial_fulfillment": false,
            "charge": true,
            "skip_barcode": true,
            "custom_handled": false,
            "packaging": true,
            "custom_handling": false,
            "not_later_date": null,
            "international": null,
            "pickup_date": null,
            "v3_packaging": false,
            "auto_release": true,
            "direct_complete": true,
            "fragile": false,
            "remunerate": true,
            "branding": false,
            "incoterm": "ABC",
            "return_label": false
        },
        "insurance": {
            "value": 20.45,
            "currency": "EUR"
        },
        "cash_on_delivery": null,
        "customs": {
            "goods_type": "other",
            "invoice_number": "2023-12894091"
        },
        "created_at": "2023-03-23T11:47:56.070212+00:00",
        "byrd_id": "HXB2ZDF9NP",
        "checkpoints": {
            "returned_at": null,
            "accepted_at": null,
            "packaged_at": null,
            "sent_at": null,
            "released_at": null,
            "delivered_at": null
        },
        "shop": {
            "order_id": "123456",
            "type": null,
            "order_number": "OW-18940",
            "id": null
        },
        "updated_at": "2023-03-23T11:47:56.070217+00:00",
        "sub_status": null,
        "id": "the_shipment_id",
        "priority": null,
        "status": "releasing",
        "service": "economy"
    }
}

Request body example

{
  "b2bConfig": {
    "isPallet": boolean,
    "templateKey": "byrd",
    "customerInput": {
      "reference_id": "string",
      "insurance_value": integer
  },
  "destination_address": {
    "postal_code": "string",
    "phone": "string",
    "street_number": "string",
    "country_code": "2 digits country code",
    "address_addition": "string",
    "company_name": "string",
    "state": "string",
    "city": "string",
    "email": "string",
    "name": "string",
    "street_name": "string"
  },
  "shop": {
    "type": "string",
    "order_number": "string",
    "order_id": "optional string",
  },
  "service": "express/standard/economy",
  "items": [
    {
      "quantity": 1,
      "fragile": false,
      "sku": "string"
    }
  ]
}