Create your first label

You can create your first Label in two steps only.

To create your first Label, you will need to follow these 2 steps:

  • Get the token
  • Generate the label

🚧

Be careful, be sure to select the staging environment for your tests, otherwise you will be charged for the label

STEP 1 : Get the token

You will now get the token to authenticate your next requests

To get the token you have to make a POST request to the endpoint /authenticate with your credentials

curl --request POST \
     --url {baseUrl}/authenticate \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
     --data '
      {
        "email": "[email protected]",
        "password": "password"
      }
      '

The response will provide you the token to access the API.

{
  "auth_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI"
}

STEP 2 : Generate the label

You will now generate the label

All information about the payload field are described in the API Reference

POST "{baseUrl}/labels/generate_label"

application/json

{
   "weight": "3000",
   "width": "44",
   "height": "26",
   "length": "22",
   "carrier_name":"Dhl",
   "carrier_service_name":"n", // GET the carrier service name 
   "custom_reference":"20201218-013",
   "description":"Book",
   "cn23_data":{
      "category":"3",
     	"shipping_price": "10,26",
      "products":[
         {
            "unit_price":"59,90",
            "quantity":1,
            "description":"book 1",
            "weight":"1000",
            "country_code":"FR",
            "currency_code":"EUR"
         },
         {
            "unit_price":"13,95",
            "quantity":1,
            "description":"book 2",
            "weight":"1000",
            "country_code":"FR",
            "currency_code":"EUR"
         }
      ]
   },
   "sender":{
      "lastname":"Doe",
      "firstname":"John",
      "address_line1":"1 rue du rempart villeneuve",
      "address_line2":"",
      "country":"FR",
      "city":"Toulouse",
      "zip":"31000",
      "phone1":"+33768836843",
      "email":"[email protected]",
      "company_name":"My company name",
      "labelType":"PDF_A4_300dpi"
   },
   "recipient":{
		  "lastname":"Jim",
      "firstname":"Carrey",
      "address_line1":"57 Rue de Rivoli",
      "country":"FR",
      "city":"Paris",
      "zip":"75001",
      "email":"[email protected]"
   }
}

If everything went well, you’ll receive a HTTP 200 status code and a response back with some important information like the tracking Number.

{
  "message": "Etiquette imprimée avec succès",
  "reference": "JD011100003640582624",
  "label_url": "https://labelUrl.pdf",
  "id": "123456",
  "tracking_url": "http://dhl.com/tracking/JD011100003640582624"
}

📘

Some examples with each carrier are available at this link : Examples