Shipping Parcels with Codept
When shipping parcels, supporting each individual parcel provider is a challenge: the providers have different APIs that don’t necessarily adhere to a single standard. Some parcel providers only open up API access to select customers.
By using Codept you can use any parcel provider without needing to implement a custom API integration with each of them. Codept provides a standard interface for you to request a package pickup, specify the measurements of a parcel, and print a label.
Codept tracks the status of all packages you ship and notifies you of all changes in the status by using asynchronous messages.
Which shipping providers are supported?#
Codept currently supports the following shipping providers in Germany and abroad:
- DHL and DHL Express
- GLS
- DPD
- UPS
- Sieber
- DHL 2MH (two-man handling)
- VIR (two-man handling)
If you are interested in using Codept in other regions, please reach out to the Codept support team.
Supported services for each carrier#
DHL#
DHL supports standard and returns services.
DHL Express#
DHL Express supports only one_day service.
GLS#
GLS supports standard and one_day services.
DPD#
DPD supports standard, returns, one_day and one_day_early services.
Additionally, DPD supports advance_notice, drop_authorization and saturday_delivery additional services where:
advance_noticehas one of these properties:emailandlanguagesms
Example of (part of) shipment order for DPD carrier with advance_notice additional service with email:
Example of (part of) shipment order for DPD carrier with advance_notice additional service with sms:
UPS#
UPS supports only standard service.
Sieber#
Sieber supports:
standardservice withassemblyadditional servicestandardservice withdeliveryadditional servicestandardservice withpickupadditional service2MHservice withassemblyadditional service2MHservice withdeliveryadditional service2MHservice withpickupadditional service
Example of (part of) shipment order for Sieber carrier with assembly additional service where service is 2MH (two-man handling):
DHL 2MH (two-man handling)#
DHL 2MH supports:
2MHservice withassemblyadditional service2MHservice withdeliveryadditional service
Example of (part of) shipment order for DHL 2MH carrier with assembly additional service where service is 2MH (two-man handling):
VIR (two-man handling)#
VIR supports:
2MHservice withassemblyadditional service2MHservice withdeliveryadditional service
Example of (part of) shipment order for VIR carrier with assembly additional service where service is 2MH (two-man handling):
Getting started with parcel shipping in Codept#
To ship a parcel with Codept you must use the Shipment Order API endpoint:
POST /api/v1/shipment/orders
Example payload for this endpoint.
Note: clientReferenceNumber should be unique.
See the Merchant API doc for more details on how to access Codept Merchant API endpoints and for a full list of available endpoints.
Any validation errors will be surfaced at the time of the API call.
The result of the Shipment Order API call will then be delivered to you using the messages mechanism of the Merchant API. The following is an example of a Shipment Order message:
Units#
The following units are used for the Shipment Orders endpoint:
- weight of a parcel: kilograms;
- dimensions of a parcel (length, width, height): centimeters.
Label specification#
Codept offers a way to specify in which format it will return labels. It is done using order labelSpecification field.
Supported formats are:
- zpl (base64 encoded zpl label)
- standard ( base64 encoded PNG image)
Label data is returned in base64LabelImage field of parcel in
shipment order response message.
For now, we only support labelSpecification for UPS carrier.
Common error messages and validations for shipping parcels#
Codept validates each call to the Shipment Orders endpoint through a series of conditions. If a condition is not met, an error is returned. Below is the list of all the validations Codept applies with their respective error messages:
Top-level validations#
These validations are applied to all calls.
- Validate the carrier
- validate that carrier is one of "DHL", "DHL_EXPRESS", "GLS", "DPD" or "UPS"
- error if not met: "X carrier is not supported."
Carrier-specific validations#
These validations only apply if you are using a specific carrier.
DHL validations#
- Recipient address validation
- Validate that
companyNametext length is in range 2-50 (inclusive) - Validate that
lastNametext length is in range 1-35 (inclusive) - Validate that
nameandlastNamecombined text length is in range 0-35 (inclusive) - Validate that
streettext length is in range 1-35 (inclusive) - Validate that
street2text length is in range 1-35 (inclusive) - Validate that
houseNumbertext length is in range 1-5 (inclusive) - Validate that
ziptext length is in range 1-10 (inclusive) - Validate that
citytext length is in range 1-35 (inclusive) - Validate that
statetext length is in range 0-30 (inclusive) - Validate that
telephoneNumbertext length is in range 0-20 (inclusive)
- Validate that
- Carrier validation
- Carrier service
- validate that carrier service is "standard" or "returns"
- error if not met: "DHL supports only standard and returns services"
- validate that carrier service is "standard" or "returns"
- Notification email validation
- Validate that notificationEmail text length is in range 0-70 (inclusive)
- Carrier service
DHL Express Validations#
- Recipient address validation
- Validate that
companyNametext length is in range 2-35 (inclusive) - Validate that
nameandlastName combined text length is in range 1-45 (inclusive) - Validate that
streettext length is in range 1-35 (inclusive) - Validate that
street2text length is in range 1-35 (inclusive) - Validate that
houseNumbertext length is in range 0-15 (inclusive) - Validate that
streetandhouseNumbercombined text length is in range 0-35 (inclusive) - Validate that
ziptext length is in range 1-12 (inclusive) - Validate that
citytext length is in range 1-35 (inclusive) - Validate that
statetext length is 2 characters long - Validate that
countrytext length is 2 characters long - Validate that
telephoneNumbertext length is in range 1-25 (inclusive)
- Validate that
- Carrier validation
- Carrier service
- validate that carrier service is "one_day"
- error if not met: "DHL Express supports only one_day service"
- validate that carrier service is "one_day"
- Carrier service
GLS Validations#
- Recipient address validation
- Validate that
companyNametext length is in range 2-40 (inclusive) - Validate that
lastNametext length is in range 2-40 (inclusive) - Validate that
nameandlastNamecombined text length is in range 0-40 (inclusive) - Validate that
streettext length is in range 3-40 (inclusive) - Validate that
street2text length is in range 3-40 (inclusive) - Validate that
houseNumbertext length is in range 1-10 (inclusive) - Validate that
ziptext length is in range 1-10 (inclusive) - Validate that
citytext length is in range 2-40 (inclusive) - Validate that
telephoneNumbertext length is in range 0-40 (inclusive)
- Carrier validation
- Carrier service
- validate that carrier service is "standard" or "one_day"
- error if not met: "GLS supports only standard and one_day services"
- validate that carrier service is "standard" or "one_day"
- Carrier service
DPD Validations#
- Recipient address validation
- Validate that
companyNametext length is in range 1-35 (inclusive) - Validate that
lastNametext length is in range 1-35 (inclusive) - Validate that
nameandlastNamecombined text length is in range 0-35 (inclusive) - Validate that
streettext length is in range 1-35 (inclusive) - Validate that
street2text length is in range 1-35 (inclusive) - Validate that
houseNumbertext length is in range 1-8 (inclusive) - Validate that
ziptext length is in range 1-9 (inclusive) - Validate that
citytext length is in range 1-35 (inclusive) - Validate that
telephoneNumbertext length is in range 0-30 (inclusive)
- Carrier validation
- Carrier service
- validate that carrier service is "standard", "returns", "one_day" or "one_day_early"
- error if not met: "DPD supports only standard, returns, one_day and one_day_early services"
- validate that carrier service is "standard", "returns", "one_day" or "one_day_early"
- Carrier additional services
- validate that DPD's additional service is "advance_notice", "drop_authorization" or "saturday_delivery"
- error if not met: "unknown_service additional service is not allowed for DPD carrier"
- if "advance_notice" is chosen, validate that service is standard
- error if not met: "advance_notice expects service to be standard"
- if "advance_notice" is chosen, validate that
emailis valid email orsmsis valid telephone number- error if not met: "e2mail is not a valid email address" or "123 is not a valid telephone number"
- if "saturday_delivery" is chosen, validate that service is either "one_day" or "one_day_early"
- error if not met: "saturday_delivery expects service to be either one_day or one_day_early"
- validate that DPD's additional service is "advance_notice", "drop_authorization" or "saturday_delivery"
- Carrier service
UPS Validations#
- Recipient address validation
- Validate that
companyNametext length is in range 1-35 (inclusive) - Validate that
lastNametext length is in range 1-35 (inclusive) - Validate that
nameandlastNamecombined text length is in range 0-35 (inclusive) - If
street2is not defined:- Validate that
streetandhouseNumbercombined text length is in range 1-34 (inclusive)
- Validate that
- If
street2is defined:- Validate that
streettext length is in range 1-35 (inclusive) - Validate that
street2andhouseNumbercombined text length is in range 1-34 (inclusive)
- Validate that
- Validate that
ziptext length is in range 1-9 (inclusive) - Validate that
citytext length is in range 1-30 (inclusive) - Validate that
statetext length is 2 characters long - Validate that
telephoneNumbertext length is in range 0-15 (inclusive)
- Carrier validation
- Carrier service
- validate that carrier service is "standard"
- error if not met: "Only standard service is supported"
- validate that carrier service is "standard"
- Carrier service
- Parcel validation
- Validate that
clientReferenceNumberis in range 0-35 (inclusive) - Validate that
descriptionfield is mandatory if:- sender and recipient country are in EU
- Validate that
Note: all text range validation errors are of form:
"A.B is out of range. Valid range is x - y"
where A.B is the path to the field that produced the validation error and where x and y are the expected range bounds for that field.
For example:
"recipientAddress.companyName is out of range. Range 2 to 40"
This error message means that the "companyName" field of the "recipientAddress" object is out of range, and to pass the validation it needs to be between 2 and 40 characters long.
Note on parcel optimization#
Codept offers parcel optimization which is a mechanism for picking the optimal parcel provider for each shipment based on the location of the warehouse and the regional specifics. See the Parcel optimization document for more details.