Introduction
The Compack API provides programmatic access to read and post data into Compack warehouse management system.
To use this API, you need an API key. Please contact us at info@compack.dk to get your own API key.
getdeliverylist
API Endpoint https://api2.compack.dk/getdeliverylist/
To get a deliverylist you need to make a POST call to the following url :
https://api2.compack.dk/getdeliverylist/
Result example :
{
"Carriers": [
{
"Carrier": "GLSDK",
"carrier_code": "GLSDK_BP",
"Type": "BP",
"Name": "GLS Erhvervslevering",
"ServicePointType": "0",
"Country": "PL",
"Image": "https://api2.compack.dk/images/gls.png"
},
{
"Carrier": "pdk",
"carrier_code": "PDK_BP",
"Type": "BP",
"Name": "Postnord Erhvervslevering",
"ServicePointType": "0",
"Country": "DK",
"Image": "https://api2.compack.dk/images/PostNord.png"
},
{
"Carrier": "pdk",
"carrier_code": "PDK_MH",
"Type": "MH",
"Name": "Postnord levering til privat adresse",
"ServicePointType": "1",
"Country": "LV",
"Image": "https://api2.compack.dk/images/PostNord.png"
},
{
"Carrier": "pdk",
"carrier_code": "PDK_MC",
"Type": "MC",
"Name": "Postnord levering pakkeshop",
"ServicePointType": "2",
"Country": "LV",
"Image": "https://api2.compack.dk/images/PostNord.png"
}
]
}
QUERY PARAMETERS
Field | Type | Description |
---|---|---|
api_key | String | Your API key. |
pickup_points
To get a get a list of pickup points you need to make a GET call to the following url :
https://api2.compack.dk/pickup_points/
Result example (Http status 200) :
[
{
"number": "DE33623",
"id": "DE33623",
"agent_no": "DE33623",
"company_name": "Edeka Nolda",
"company": "Edeka Nolda",
"type": "agent",
"carrier": "postnord",
"name": "Edeka Nolda",
"address": "Straßburger Straße 34",
"address_line1": "Straßburger Straße 34",
"address2": "",
"zipcode": "22049",
"postal_code": "22049",
"city": "Hamburg",
"country": "DE",
"distance": 599,
"longitude": 10.0637257,
"latitude": 53.5813138,
"agent": "pdk",
"carrier_code": "pdk",
"routing_code": "",
"opening_hours": []
},
{
"number": "DE27971",
"id": "DE27971",
"agent_no": "DE27971",
"company_name": "Godbless Travel Trade",
"company": "Godbless Travel Trade",
"type": "agent",
"carrier": "postnord",
"name": "Godbless Travel Trade",
"address": "Dithmarscher Straße 25",
"address_line1": "Dithmarscher Straße 25",
"address2": "",
"zipcode": "22049",
"postal_code": "22049",
"city": "Hamburg",
"country": "DE",
"distance": 1039,
"longitude": 10.060044,
"latitude": 53.578154,
"agent": "pdk",
"carrier_code": "pdk",
"routing_code": "",
"opening_hours": []
}
]
QUERY PARAMETERS
Field | Type | Description |
---|---|---|
api_key | String | Your API key. |
carrier_code | String | (mandatory) which carrier to use for search (PDK,GLSDK,DAO) |
country_code | String | (mandatory) country code used for search (A2) : List_of_ISO_3166_country_codes |
city | String | (optional) name of city used for search |
address | String | (mandatory) address used for search |
zipcode | string | (mandatory) Zipcode used for search |
id | string | (optional) The id is needed when a specific pickup-store is required. |
quantity | string | (optional - default: 5) The quantity is the number of pickup-store returns with the request |
getlabel
To get a get a shippinglabel you need to make a POST call to the following url :
https://api2.compack.dk/getlabel/
All parameters must be part of the body request, formatted as json:
Request example:
{
"api_key": "XXXXXX",
"test_mode": 0,
"label_format": "A4",
"Carrier_code": "PDK",
"ShopDeliveryId": "",
"service_code": "MH",
"automatic_select_service_point": false,
"orderId": 4201710059716,
"sender": {
"city": "Brande",
"name": "festbyen.dk",
"email": "info@festbyen.dk",
"mobile": null,
"zipcode": "7330",
"address1": "Ny Sandfeldvej 102",
"address2": null,
"telephone": "42428066",
"country_code": "DK"
},
"receiver": {
"name": "Mette Caspersen",
"address1": "Skovagervej 9",
"address2": "",
"zipcode": "4343",
"city": "Andeby",
"country_code": "DK",
"email": "MC@andeby.dk",
"mobile": "+4512345678",
"telephone": "+4512345678",
"instruction": null
},
"parcels": [
{
"order_number": "FRAGT-00001",
"weight": 9900,
"items": [
{
"itemname": "Julekalender - 24 dage med gode overraskelser",
"sku": "",
"weight": 50,
"price": "99.00",
"price_currency": "DKK",
"quantity": 1
}
]
},
{
"order_number": "FRAGT-00002",
"weight": 2900
},
{
"order_number": "FRAGT-00003",
"weight": 1900
}
]
}
Result example (Http status 200) :
{
"id": "27505658",
"created_at": "2021-11-15 07:43:44",
"carrier_code": "pdk",
"weight": 0.05,
"description": "Hjemmelevering 0 - 0,5 kg",
"product_code": "PDK_MH",
"price": 27.27,
"label": "xxx",
"reference": "festbyen 4201710059716",
"pkg_no": "00257059832526988586",
"receiver": {
"name": "Mette Caspersen",
"attention": null,
"address1": "Skovagervej 9",
"address2": "",
"zipcode": "4343",
"city": "Andeby",
"country_code": "DK",
"email": "mc@andeby.dk",
"mobile": "12345678",
"telephone": "12345678",
"instruction1": null,
"instruction2": null,
"instruction3": null
},
"sender": {
"name": "Festbyen.dk",
"attention": null,
"address1": "Ny Sandfeldvej 102",
"address2": null,
"zipcode": "7330",
"city": "Brande",
"country_code": "DK",
"email": "info@festbyen.dk",
"mobile": null,
"telephone": "42428066"
}
}
QUERY PARAMETERS
Field | Type | Description |
---|---|---|
api_key | String | Your API key. |
test_mode | Boolean |
(mandatory): indicates if testmode is enabled 1: testmode enabled 0: production mode |
own_agreement | String | (optional) a string with own shipping agreement number: |
label_format | String |
(mandatory): selected label format A4: A4 size 10x19: 100 mm x 190 mm |
Carrier_code | string |
(mandatory) The carrier to be used for the label: pdk: Postnord GLSDK: GLS |
ShopDeliveryId | String | (optional) Id for shop to use for pickup |
service_code | String | (mandatory) Type of needed service pdk: MH,MC,BP,RDO,PALLET gls: SD,HD,BP,RDO |
automatic_select_service_point | Boolean | (optional - default: 0) 0: use ShopDeliveryId provided earlier 1: select nearst pickup-store depending on address |
orderId | String | (mandatory) orderid used for identification of order |
orderref | String | (optional) orderref used for reference |
delivery_note1 | String | (optional) Deliverynote for carrier |
delivery_note2 | String | (optional) Deliverynote for carrier |
delivery_note3 | String | (optional) Deliverynote for carrier |
sender | object | |
name | String | (mandatory) name of sender |
address | String | (mandatory) address of sender |
address2 | String | (optional) address line 2 of sender |
zipcode | String | (mandatory) zip code of sender |
city | String | (optional) city of sender |
country_code | String |
(mandatory) country_code for sender List_of_ISO_3166_country_codes |
String | (mandatory) email for sender | |
telephone | String | (optional) telephone for sender |
receiver | object | |
name | String | (mandatory) name of receiver |
attention | String | (optional) attention name of receiver |
address | String | (mandatory) address of receiver |
address2 | String | (optional) address line 2 of receiver |
zipcode | String | (mandatory) zip code of receiver |
city | String | (optional) city of receiver |
country_code | String |
(mandatory) country_code for receiver List_of_ISO_3166_country_codes |
String | (mandatory) email for receiver | |
telephone | String | (optional) telephone for receiver |
instruction | String | (optional) instruction for delivery |
parcel | array of objects | |
order_number | String | (mandatory) ordernumber for parcel |
shipping_reference | String | (optional) shipping reference for delivery |
content | String | (optional) content of delivery (for custom) |
weight | Integer | (mandatory) weight of parcel in gram |
items | array of objects | (optional) |
itemname | String | (mandatory) name of item |
ean | String | (optional) ean13 of item |
sku | String | (option) sku of item |
weight | Integer | (mandatory) weight of (one) item in gram |
price | Integer | (mandatory) price of (one) item |
quantity | Integer | (mandatory) quantity of item |
price_currency | String | (mandatory if price is given) currency of the price |
hs_code | String | (optional) HS code of item |
country_of_origin | String |
(optional) Country of origin of item List_of_ISO_3166_country_codes |
Http status
The Compack API uses the following http status codes:
error example (Http status <> 200) :
error example (Http status 400) :
{
"error": {
"status_code": 400,
"status": "Error",
"description": "Receiver mobile number not 8 digits"
}
}
error example (Http status 403) :
{"error":"API key is missing or not valid."}
error example (Http status 500) :
{"error":"Something went wrong. Please try again later."}
Status Code | Meaning |
---|---|
200 | Everything is OK. |
4xx |
Some parameters are missing. This error appears when you don't pass every mandatory parameters.
Unknown or unvalid secret_key . This error appears if you use an unknow API key or if your API key expired.
|
500 | Internal server error, try again |
501 | Not implemented |
503 | Service unavailable |