| title | Quick Start |
|---|---|
| description | Create your first GLS shipment in a few steps. |
This guide walks you through creating your first GLS shipment using the GLS Action. By the end, you will have a working flow that creates a parcel and retrieves a shipping label.
Follow the Installation Guide to deploy the GLS Action, then set the following configuration values in your Hercules admin panel (or .env file):
| Config | Value |
|---|---|
client_id |
Your GLS OAuth2 client ID |
client_secret |
Your GLS OAuth2 client secret |
ship_it_api_url |
GLS ShipIT endpoint (default: https://api.gls-group.net/shipit-farm/v1/backend/rs) |
auth_url |
GLS auth endpoint (default: https://api.gls-group.net/oauth2/v2/token) |
See Configuration for the full list of options and how to obtain credentials.
A basic "create a GLS parcel" flow looks like this:
[createAddress] β GLS_ADDRESS (recipient)
[createAddress] β GLS_ADDRESS (shipper)
[createShipmentUnit] β GLS_SHIPMENT_UNIT
[createPrintingOptions] β GLS_PRINTING_OPTIONS
[createShopDeliveryShipment] β GLS_CREATE_PARCELS_RESPONSE
START
β
ββ createAddress (recipient)
β Name1: "John Doe"
β CountryCode: "DE"
β City: "Munich"
β Street: "Musterstrasse"
β ZIPCode: "80331"
β β
β βΌ GLS_ADDRESS (recipient)
β
ββ createAddress (shipper)
β Name1: "My Company GmbH"
β CountryCode: "DE"
β City: "Berlin"
β Street: "Hauptstrasse"
β ZIPCode: "10115"
β β
β βΌ GLS_ADDRESS (shipper)
β
ββ createShipmentUnit
β weight: 2.5
β β
β βΌ GLS_SHIPMENT_UNIT
β
ββ createPrintingOptions
β returnLabels:
β TemplateSet: "NONE"
β LabelFormat: "PDF"
β β
β βΌ GLS_PRINTING_OPTIONS
β
ββ createShopDeliveryShipment
parcelShopId: "12345"
shipment:
Product: "PARCEL"
Consignee: { Address: <recipient address> }
Shipper: { Address: <shipper address> }
ShipmentUnit: [<shipment unit>]
printingOptions: <printing options>
β
βΌ GLS_CREATE_PARCELS_RESPONSE
{ CreatedShipment: { TrackID, PrintData, ... } }
The GLS_CREATE_PARCELS_RESPONSE contains everything you need:
{
"CreatedShipment": {
"ShipmentReference": ["REF-001"],
"ParcelData": [
{
"TrackID": "12345678",
"ParcelNumber": "00123456789",
"Barcodes": {
"Primary2D": "...",
"Secondary2D": "...",
"Primary1D": "..."
},
"RoutingInfo": {
"Tour": "MUC-01",
"FinalLocationCode": "MUC",
"HubLocation": "MUC-HUB"
}
}
],
"PrintData": [
{
"Data": "<base64-encoded-pdf>",
"LabelFormat": "PDF"
}
]
}
}TrackIDβ Use this to track the parcel or cancel the shipment laterPrintData[].Dataβ Base64-encoded shipping label, decode and print itRoutingInfoβ Routing information assigned by GLS
- Validate before creating β Call
validateShipmentfirst to catch errors before committing - Cancel a shipment β Use
cancelShipmentwith theTrackIDif something changes - Reprint a label β Use
reprintParcelif a label is lost or damaged - Common Use Cases β End-to-end examples for real-world scenarios