API documentation – Pallet99
API documentation
- Overview
- Try it with the demo key
- Authentication
- Endpoints
- Input: what you send
- Output: what you receive
- Example
- Errors
- Limits and tips
- Code samples
- OpenAPI (Swagger)
API integration
API documentation
Everything you need to send boxes to the packing engine and read the pallet layout.
Overview
The API calculates how many pallets a list of boxes needs and where each box goes. It is a REST API: you send JSON and receive JSON.
Base URL
https://api.pallet99.com
- Requests and responses are JSON (Content-Type: application/json).
- Choose the units with units: lengths in mm, cm, m or in, weights in kg or lb (default cm and kg). The response uses the same units.
- The interactive OpenAPI (Swagger) documentation is available at /docs on the same base URL.
Try it with the demo key
Try the API without an account: send the demo key in the X-Api-Key header instead of a token.
Demo key:
demo-key-123
curl -X POST https://api.pallet99.com/v1/pack \
-H "X-Api-Key: demo-key-123" \
-H "Content-Type: application/json" \
-d '{"items": [{"length": 60, "width": 40, "height": 30, "weight": 12, "quantity": 8}]}'
# -> always the same example response, with "demo": true
- Requests are validated as usual (422 for an invalid body, 400 for an unknown pallet type), but no calculation is performed: the response is always the same example, with "demo": true. To pack your own boxes, use a token.
Authentication
Requests to /pack need a Bearer token, obtained by exchanging an access key:
An administrator of your company creates an access key in API settings (company menu of the reserved area).
Exchange the access key for a session token. Tokens expire: repeat the exchange when you get a 401.
Send the token in the Authorization header: Bearer <token>.
# 1. Exchange your access key for a session token
curl -X POST https://api.descope.com/v1/auth/accesskey/exchange \
-H "Authorization: Bearer P3LavP658kVedAvSMQ5TTVOwU0Nz:$ACCESS_KEY" \
-d '{}'
# -> {"sessionJwt": "eyJhbGciOi...", ...}
# 2. Send the token with every request
curl https://api.pallet99.com/v1/pallet/types -H "Authorization: Bearer $TOKEN"
- The access key is a secret: use it only on your server, never in a browser or mobile app.
API access is included in the Business and Enterprise plans.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /health | — | Health check: returns status ok. |
| GET | /v1/pallet/types | — | Available pallet types with their dimensions, and the default type. |
| POST | /v1/pack | ✓ | Calculates the pallets needed and the position of every box. |
Input: what you send
- INPUT · request body of POST /v1/pack
You send a JSON object with the list of boxes and, optionally, the pallet to use. Without a pallet, EUR is used. Sizes are the ones you measure: the packer may rotate the boxes, and the output tells you how.
Top level
| Field | Type | Required | Description |
|---|---|---|---|
| units | object | No | Units of all values in the request and in the response (default cm and kg). |
| items | array | Yes | List of boxes (at least one). |
| pallet | object | No | Pallet to use: one of type, types or dimensions. |
| bigger_first | boolean | No | Place bigger boxes first (default true). |
| references | array | No | Reference codes of the shipment (order, load…), returned on every pallet; up to 20. |
| require_weight | boolean | No | true: reject the request (422) if the weights are missing (default false). |
| engine | string | No | "standard" (default) or "smartfit": the SmartFit engine turns the boxes to fit them better, usually fewer pallets (Business, Business AI and Enterprise; 402 on other plans). |
| images | boolean | No | Add an SVG drawing of each pallet to the response (pallets[].image): fixed view from the front right corner, box colors in loading order, caption and pallet99.com at the bottom. Default false. |
units
| Field | Type | Required | Description |
|---|---|---|---|
| length | mm · cm · m · in | No | Unit of all lengths: mm, cm (default), m or in. |
| weight | kg · lb | No | Unit of all weights: kg (default) or lb. |
references[]
| Field | Type | Required | Description |
|---|---|---|---|
| label | string (1–50) | Yes | What the code is, e.g. Order or Load. |
| value | string (≤ 200) | Yes | The code itself, e.g. ORD-123. |
items[]
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | No | Your reference for the box, returned unchanged in the output; ITEM_<n> if missing (n = line number, from 1). |
| length · width · height | number | Yes | Box dimensions, greater than 0. |
| weight | number | No | Box weight, greater than 0. Optional, but for every box or for none: without weights the pallet max load is not checked and the output weights are null. |
| quantity | integer ≥ 1 | No | Number of identical boxes (default 1). |
| code | string (≤ 50) | No | Article code (SKU). Optional, returned unchanged on every box of the line. |
| description | string (≤ 200) | No | Article description. Optional, returned unchanged on every box of the line. |
| uom_code | string (≤ 10) | No | Unit of measure code of the article (e.g. PZ, CT, KG), free text. Optional, returned unchanged; it is not the unit of the sizes (see units). |
pallet
| Field | Type | Required | Description |
|---|---|---|---|
| type | string | No | Pallet type: EUR, EUR2, HALF (see GET /v1/pallet/types) or the name of a pallet saved by your company in the dashboard. |
| types | array of strings | No | Several pallet types (standard or saved), used in rotation when more pallets are needed. |
| dimensions | object | No | Custom pallet: length, width, height and max_weight. |
pallet.dimensions
| Field | Type | Required | Description |
|---|---|---|---|
| length · width | number | Yes | Pallet length and width. |
| height | number | Yes | Maximum load height, pallet base excluded. |
| max_weight | number | Yes | Maximum load. |
| base_height | number | No | Height of the pallet itself; optional, without it load.total_height is null. |
// units of the whole request and response (default cm and kg)
{"units": {"length": "in", "weight": "lb"}, "items": [...]}
// a standard pallet type
{"pallet": {"type": "EUR2"}, "items": [...]}
// your own pallet
{"pallet": {"dimensions": {"length": 110, "width": 110, "height": 160, "max_weight": 1000}},
"items": [...]}
// several pallet types, used in rotation
{"pallet": {"types": ["EUR", "HALF"]}, "items": [...]}
Output: what you receive
- OUTPUT · response body
You receive the units used, a summary, one entry per pallet used and the boxes that did not fit. Every value is in the units of the request, and every box points back to the request line it comes from (input_index, copy).
- Input and output never share a name with a different meaning: the size you send is items[].length · width · height, the size after rotation is placed_size; the pallet used is pallets[].pallet, the space taken by the boxes is pallets[].load.
Top level
| Field | Type | Description |
|---|---|---|
| units | object | Units of all values in the response: the ones you sent. |
| summary | object | Totals of the whole calculation. |
| pallets | array | One entry per pallet used. |
| unplaced_items | array | Boxes that do not fit on the chosen pallets (empty if all fit). |
| engine | string | Engine used: standard or smartfit. |
| demo | boolean | true only for the fixed response of the demo key. |
units
| Field | Type | Description |
|---|---|---|
| length · weight · volume | string | For example cm, kg and cm3 (volumes in the length unit cubed). |
summary
| Field | Type | Description |
|---|---|---|
| pallet_count | integer | Number of pallets used. |
| placed_count | integer | Boxes placed on the pallets. |
| unplaced_count | integer | Boxes that do not fit. |
| total_weight | number | Weight of the placed boxes. |
| total_volume | number | Volume of the placed boxes, in the length unit cubed. |
pallets[]
| Field | Type | Description |
|---|---|---|
| name | string | PALLET1, PALLET2, … |
| references | array | The references you sent, as label/value pairs. |
| pallet | object | The pallet used: values of the standard type, or your custom dimensions. |
| load | object | What was calculated for this pallet: the space and weight taken by the boxes. |
| items | array | Boxes on this pallet, in loading order. |
| image | string | SVG drawing of the loaded pallet (an SVG document as text), only with images: true; otherwise null. |
pallets[].pallet
| Field | Type | Description |
|---|---|---|
| type | string | Standard type (EUR, EUR2, HALF), name of a saved company pallet, or CUSTOM. |
| length · width | number | Pallet length and width. |
| max_height | number | Maximum load height, pallet base excluded. |
| max_weight | number | Maximum load. |
| base_height | number | Height of the pallet itself: EPAL values for the standard types (EUR 14.4 cm, EUR2 16.2 cm, HALF 14.4 cm), the saved value for company pallets; null if unknown. |
| volume | number | Pallet volume: length × width × max_height. |
pallets[].load
| Field | Type | Description |
|---|---|---|
| length · width | number | Length and width actually used by the boxes. |
| height | number | Height of the load, pallet base excluded. |
| total_height | number | Total height: load plus pallet base, what carriers measure; null if the base height is unknown. |
| weight | number | Weight loaded on the pallet. |
| volume | number | Sum of the volumes of the boxes on the pallet. |
| occupancy_percent | number | load volume / pallet volume × 100. |
| item_count | integer | Number of boxes on the pallet. |
pallets[].items[]
| Field | Type | Description |
|---|---|---|
| name | string | Name of the request line (as sent, or ITEM_<n>). |
| input_index | integer | Position of the line in the request's items, from 0. |
| copy | integer | Which of the quantity boxes of that line, from 1: a label of identical boxes, its order is not meaningful. |
| position.x · y · z | number | Position of the box corner closest to the pallet origin. |
| placed_size.length · width · height | number | Size as placed, after any rotation. |
| rotated | boolean | true if placed_size differs from the size you sent. |
| weight | number | Weight of the box. |
| code · description · uom_code | string | Article data of the request line, as sent; null if not sent. |
unplaced_items[]
| Field | Type | Description |
|---|---|---|
| name · input_index · copy | string · integer | Same references as the placed boxes: name, request line, copy. |
| size.length · width · height | number | Size as you sent it. |
| weight | number | Weight of the box. |
| code · description · uom_code | string | Article data of the request line, as sent; null if not sent. |
- Coordinates start at a corner of the pallet: x runs along the length, y along the width and z upwards. The packer may rotate boxes: placed_size is the size as placed and rotated tells you whether it differs from the size you sent.
Example
Request
{
"pallet": {"type": "EUR"},
"references": [{"label": "Order", "value": "ORD-123"}],
"items": [
{"name": "CARTON", "code": "ART-1042", "description": "Screws M8, box of 500", "uom_code": "CT",
"length": 60, "width": 40, "height": 30, "weight": 12, "quantity": 2},
{"name": "DRUM", "length": 50, "width": 50, "height": 90, "weight": 80}
]
}
Response
{
"units": {"length": "cm", "weight": "kg", "volume": "cm3"},
"summary": {
"pallet_count": 1, "placed_count": 3, "unplaced_count": 0,
"total_weight": 104.0, "total_volume": 369000.0
},
"pallets": [
{
"name": "PALLET_1",
"references": [{"label": "Order", "value": "ORD-123"}],
"pallet": {
"type": "EUR", "length": 120.0, "width": 80.0,
"max_height": 180.0, "max_weight": 1500.0, "base_height": 14.4, "volume": 1728000.0
},
"load": {
"length": 110.0, "width": 80.0, "height": 90.0, "total_height": 104.4, "weight": 104.0,
"volume": 369000.0, "occupancy_percent": 21.35, "item_count": 3
},
"items": [
{"name": "DRUM", "input_index": 1, "copy": 1,
"position": {"x": 0.0, "y": 0.0, "z": 0.0},
"placed_size": {"length": 50.0, "width": 50.0, "height": 90.0},
"rotated": false, "weight": 80.0, "code": null, "description": null, "uom_code": null},
{"name": "CARTON", "input_index": 0, "copy": 1,
"position": {"x": 50.0, "y": 0.0, "z": 0.0},
"placed_size": {"length": 60.0, "width": 40.0, "height": 30.0},
"rotated": false, "weight": 12.0,
"code": "ART-1042", "description": "Screws M8, box of 500", "uom_code": "CT"},
{"name": "CARTON", "input_index": 0, "copy": 2,
"position": {"x": 0.0, "y": 50.0, "z": 0.0},
"placed_size": {"length": 40.0, "width": 30.0, "height": 60.0},
"rotated": true, "weight": 12.0,
"code": "ART-1042", "description": "Screws M8, box of 500", "uom_code": "CT"}
],
"image": null
}
],
"unplaced_items": [],
"engine": "standard",
"demo": false
}
Errors
Errors return an HTTP status code and a JSON body with a detail field.
| Status | Description |
|---|---|
| 400 | Invalid request, for example an unknown pallet type. |
| 401 | Missing, invalid or expired token. |
| 402 | Your plan does not include the API (Business or Enterprise needed). |
| 403 | The token is valid but not allowed to use this resource. |
| 413 | Too many boxes in one request (sum of the quantities): split them into several requests. |
| 422 | The body does not match the schema (missing fields, negative values…); detail lists the problems. |
| 429 | Too many requests per minute, or the monthly quota of your plan is used up: wait the seconds in the Retry-After header. |
| 500 | Unexpected server error: retry later. |
{"detail": "Unknown pallet type 'XYZ'. Available: ['EUR', 'EUR2', 'HALF']"}
Limits and tips
- Calculation time grows quickly with the number of boxes: about 100 boxes take under a second, 300 boxes around 10 seconds. Split very large orders into several requests.
- Wait for the response before sending the same request again.
- Use quantity for identical boxes instead of repeating them.
- Check unplaced_items: boxes larger than the pallet or over its weight limit are listed there.
Code samples
cURL
curl -X POST https://api.pallet99.com/v1/pack \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"pallet": {"type": "EUR"}, "items": [{"length": 60, "width": 40, "height": 30, "weight": 12, "quantity": 8}]}'
Python
import requests
PROJECT_ID = "P3LavP658kVedAvSMQ5TTVOwU0Nz"
ACCESS_KEY = "your-access-key" # keep it secret: call the API from your backend
# 1. Exchange the access key for a session token
token = requests.post(
"https://api.descope.com/v1/auth/accesskey/exchange",
headers={"Authorization": f"Bearer {PROJECT_ID}:{ACCESS_KEY}"},
json={},
).json()["sessionJwt"]
# 2. Pack the boxes
response = requests.post(
"https://api.pallet99.com/v1/pack",
headers={"Authorization": f"Bearer {token}"},
json={
"pallet": {"type": "EUR"},
"items": [{"length": 60, "width": 40, "height": 30, "weight": 12, "quantity": 8}],
},
)
response.raise_for_status()
print(response.json()["summary"]["pallet_count"])
Node.js
const PROJECT_ID = "P3LavP658kVedAvSMQ5TTVOwU0Nz";
const ACCESS_KEY = process.env.ACCESS_KEY;
// 1. Exchange the access key for a session token
const exchange = await fetch("https://api.descope.com/v1/auth/accesskey/exchange", {
method: "POST",
headers: { Authorization: `Bearer ${PROJECT_ID}:${ACCESS_KEY}` },
body: "{}",
});
const { sessionJwt } = await exchange.json();
// 2. Pack the boxes
const response = await fetch("https://api.pallet99.com/v1/pack", {
method: "POST",
headers: { Authorization: `Bearer ${sessionJwt}`, "Content-Type": "application/json" },
body: JSON.stringify({
pallet: { type: "EUR" },
items: [{ length: 60, width: 40, height: 30, weight: 12, quantity: 8 }],
}),
});
const result = await response.json();
console.log(result.summary.pallet_count);
PHP
<?php
$token = getenv("SESSION_TOKEN"); // from the access key exchange
$ch = curl_init("https://api.pallet99.com/v1/pack");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer $token", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"pallet" => ["type" => "EUR"],
"items" => [["length" => 60, "width" => 40, "height" => 30, "weight" => 12, "quantity" => 8]],
]),
]);
$result = json_decode(curl_exec($ch), true);
echo $result["summary"]["pallet_count"];
C#
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
var token = Environment.GetEnvironmentVariable("SESSION_TOKEN"); // from the access key exchange
var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var response = await http.PostAsJsonAsync("https://api.pallet99.com/v1/pack", new {
pallet = new { type = "EUR" },
items = new[] { new { length = 60, width = 40, height = 30, weight = 12, quantity = 8 } }
});
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine(result.GetProperty("summary").GetProperty("pallet_count"));
Ready to integrate?
- Pallet99
Pallet load planning in 3D for boxes of any size, in the browser or through the API.
Product
Free tools
API integration
Support
Legal
Cookies
© Pallet99 · Pallet99 · - · VAT no. IT01890610437