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#
DHLDHL supports standard
and returns
services.
#
DHL ExpressDHL Express supports only one_day
service.
#
GLSGLS supports standard
and one_day
services.
#
DPDDPD supports standard
, returns
, one_day
and one_day_early
services.
Additionally, DPD supports advance_notice
, drop_authorization
and saturday_delivery
additional services where:
advance_notice
has one of these properties:email
andlanguage
sms
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:
#
UPSUPS supports only standard
service.
#
SieberSieber supports:
standard
service withassembly
additional servicestandard
service withdelivery
additional servicestandard
service withpickup
additional service2MH
service withassembly
additional service2MH
service withdelivery
additional service2MH
service withpickup
additional 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:
2MH
service withassembly
additional service2MH
service withdelivery
additional 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:
2MH
service withassembly
additional service2MH
service withdelivery
additional 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 CodeptTo 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:
#
UnitsThe following units are used for the Shipment Orders endpoint:
- weight of a parcel: kilograms;
- dimensions of a parcel (length, width, height): centimeters.
#
Label specificationCodept 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 parcelsCodept 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 validationsThese 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 validationsThese validations only apply if you are using a specific carrier.
#
DHL validations- Recipient address validation
- Validate that
companyName
text length is in range 2-50 (inclusive) - Validate that
lastName
text length is in range 1-35 (inclusive) - Validate that
name
andlastName
combined text length is in range 0-35 (inclusive) - Validate that
street
text length is in range 1-35 (inclusive) - Validate that
street2
text length is in range 1-35 (inclusive) - Validate that
houseNumber
text length is in range 1-5 (inclusive) - Validate that
zip
text length is in range 1-10 (inclusive) - Validate that
city
text length is in range 1-35 (inclusive) - Validate that
state
text length is in range 0-30 (inclusive) - Validate that
telephoneNumber
text 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
companyName
text length is in range 2-35 (inclusive) - Validate that
name
andlastNam
e combined text length is in range 1-45 (inclusive) - Validate that
street
text length is in range 1-35 (inclusive) - Validate that
street2
text length is in range 1-35 (inclusive) - Validate that
houseNumber
text length is in range 0-15 (inclusive) - Validate that
street
andhouseNumber
combined text length is in range 0-35 (inclusive) - Validate that
zip
text length is in range 1-12 (inclusive) - Validate that
city
text length is in range 1-35 (inclusive) - Validate that
state
text length is 2 characters long - Validate that
country
text length is 2 characters long - Validate that
telephoneNumber
text 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
companyName
text length is in range 2-40 (inclusive) - Validate that
lastName
text length is in range 2-40 (inclusive) - Validate that
name
andlastName
combined text length is in range 0-40 (inclusive) - Validate that
street
text length is in range 3-40 (inclusive) - Validate that
street2
text length is in range 3-40 (inclusive) - Validate that
houseNumber
text length is in range 1-10 (inclusive) - Validate that
zip
text length is in range 1-10 (inclusive) - Validate that
city
text length is in range 2-40 (inclusive) - Validate that
telephoneNumber
text 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
companyName
text length is in range 1-35 (inclusive) - Validate that
lastName
text length is in range 1-35 (inclusive) - Validate that
name
andlastName
combined text length is in range 0-35 (inclusive) - Validate that
street
text length is in range 1-35 (inclusive) - Validate that
street2
text length is in range 1-35 (inclusive) - Validate that
houseNumber
text length is in range 1-8 (inclusive) - Validate that
zip
text length is in range 1-9 (inclusive) - Validate that
city
text length is in range 1-35 (inclusive) - Validate that
telephoneNumber
text 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
email
is valid email orsms
is 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
companyName
text length is in range 1-35 (inclusive) - Validate that
lastName
text length is in range 1-35 (inclusive) - Validate that
name
andlastName
combined text length is in range 0-35 (inclusive) - If
street2
is not defined:- Validate that
street
andhouseNumber
combined text length is in range 1-34 (inclusive)
- Validate that
- If
street2
is defined:- Validate that
street
text length is in range 1-35 (inclusive) - Validate that
street2
andhouseNumber
combined text length is in range 1-34 (inclusive)
- Validate that
- Validate that
zip
text length is in range 1-9 (inclusive) - Validate that
city
text length is in range 1-30 (inclusive) - Validate that
state
text length is 2 characters long - Validate that
telephoneNumber
text 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
clientReferenceNumber
is in range 0-35 (inclusive) - Validate that
description
field 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 optimizationCodept 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.