PacSortDevelopers
03 / JSON examples

A shipment you can build on

This synthetic example uses the actual request structure for POST /assignment/single. Replace the recipient and package details with appropriate test data. Availability depends on your account configuration.

JSON · PacSort Online request
{
  "serviceLevel": "economy",
  "distributionChannel": "package",
  "labelsSettings": {
    "layout": "a4_portrait",
    "mode": "separate",
    "positioning": "single"
  },
  "item": {
    "invoiceReference": "DEMO-DELIVERY-1001",
    "weight": 250,
    "height": 3,
    "length": 20,
    "width": 15,
    "recipient": {
      "firstName": "Alex",
      "lastName": "Example",
      "countryCode": "SE",
      "postalCode": "11122",
      "city": "Stockholm",
      "addressLine": "Exempelgatan 1",
      "email": "recipient@example.com"
    }
  }
}
Download request JSON ↓
cURL · create an assignment
curl -X POST 'https://api.pacsortonline.com/assignment/single' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  --data @pacsort-online-shipment.json
Before you send

Save the downloaded file as pacsort-online-shipment.json. Weight is in grams; height, length and width are in centimetres. The sample values describe one physical package. Executing this POST creates an assignment.

Mapping data from an order system

The source below is an illustrative external record, not a PacSort Online request. It contains no customer export or customer-specific configuration.

JSON · illustrative source record
{
  "deliveryId": "DEMO-DELIVERY-1001",
  "invoice": {
    "invoiceNumber": "DEMO-INVOICE-1001"
  },
  "deliveryMethod": {
    "methodName": "Standard delivery"
  },
  "customer": {
    "emailAddress": "recipient@example.com",
    "deliveryAddress": {
      "firstName": "Alex",
      "lastName": "Example",
      "countryCode": "SE",
      "zipcode": "11122",
      "city": "Stockholm",
      "addressLine1": "Exempelgatan 1"
    }
  }
}
Download source example ↓
Source fieldPacSort Online field / action
deliveryIdUse as item.invoiceReference if it is your chosen business reference. Keep a separate mapping to the returned assignment id.
customer.deliveryAddressMap to item.recipient: zipcode → postalCode, addressLine1 → addressLine. Copy the name, city and country fields.
customer.emailAddressitem.recipient.email
deliveryMethod.methodNameTranslate your business rule into supported serviceLevel and distributionChannel values. This endpoint uses optimised routing; it does not accept a carrier name in the create request.
Package measurementsSupply item.weight, height, length and width from your packing data. They are absent from this source example.

invoiceNumber, deliveryId and the returned PacSort Online id are different identifiers. Decide which external reference your warehouse scans and store its mapping explicitly.