Skip to Content
API ReferenceCreate Shipping Label

Create Shipping Label

Create a shipping label for a specific carrier and contract. The response includes the label in base64-encoded PDF and/or ZPL format, along with shipment details.

POST /shipping/create

Request

Headers

HeaderValue
AuthorizationBearer <your_api_token>
Content-Typeapplication/json

Body Parameters

FieldTypeRequiredDescription
carrierCodestringYesCarrier identifier (from /shipping/rates)
contractCodestringYesContract code (from /shipping/rates)
packagesPackage[]YesArray of package dimensions and weight
shipFromAddressYesSender address
shipToAddressYesRecipient address
notesstringYesShipment notes
insuranceValuenumberYesInsurance value (use 0 for none)
codValuenumberYesCash-on-delivery value (use 0 for none)
accessoriServicesobject[]YesAdditional services (use [] for none)
label_formatstringNoLabel format: "PDF" or "ZPL" (default: "PDF")

Package Object

FieldTypeRequiredDescription
lengthnumberYesLength in cm
widthnumberYesWidth in cm
heightnumberYesHeight in cm
weightnumberYesWeight in kg

Address Object

FieldTypeRequiredDescription
namestringYesFull name
companystringYesCompany name
street1stringYesPrimary address line
street2stringYesSecondary address line (can be empty string)
citystringYesCity
statestringYesState/Province code
postalCodestringYesPostal/ZIP code
countrystringYes2-letter ISO country code (e.g. IT)
phoneanyNoPhone number
emailstringYesEmail address

Example

{ "carrierCode": "brt", "contractCode": "brt-Test", "label_format": "PDF", "packages": [ { "length": 17, "width": 25, "height": 26, "weight": 3 } ], "shipFrom": { "name": "Antonio Esposito", "company": "Spedisci.Online", "street1": "via guglielmo sanfelice 8", "street2": "", "city": "Napoli", "state": "NA", "postalCode": "80134", "country": "IT", "phone": null, "email": "email@example.com" }, "shipTo": { "name": "Mario Rossi", "company": "", "street1": "Via Roma 2", "street2": "", "city": "Telese Terme", "state": "BN", "postalCode": "82037", "country": "IT", "phone": null, "email": "email@example.com" }, "notes": "test api", "insuranceValue": 0, "codValue": 0, "accessoriServices": [] }

Response Fields

FieldTypeDescription
shipmentIdintegerInternal shipment identifier
trackingNumberstringCarrier tracking number
shipmentCoststringTotal cost charged for the shipment
packagesobject[]Array of package details
packages[].pack_numberintegerPackage sequence number
packages[].referencestring|nullPackage reference (nullable)
labelDatastringBase64-encoded PDF label
labelZPLstringZPL-format label string (for thermal printers)

Using the Label

const fs = require('fs') // labelData is the base64 string from the API response const pdfBuffer = Buffer.from(labelData, 'base64') fs.writeFileSync('label.pdf', pdfBuffer)

Use the carrierCode and contractCode values returned by Get Shipping Rates to select the desired carrier. Save the shipmentId — it is required to delete a label if needed.

Error Codes

CodeDescription
200Successful operation — label created
400Invalid order / bad request
Last updated on