Quickstart

Submit a small job, poll it to completion, and read back exactly where each box landed. The whole round trip takes a few minutes. You'll need an API key (Authentication).

Prefer to start from working code? Example clients has these same three steps as one file you can run, in Python or Node, and two more that do the same for mixed palletizing.

Here is the whole shape of it before you write any code. At the top is an optional check of the body that creates no job (see Validate first). Steps 1 to 3 below run down the middle, and step 4 is the two optional branches hanging off the result.

Flowchart of the calls a client makes: optionally POST /v2/jobs/validate first, which creates no job and answers 400 validation_failed when the body is invalid, so you fix it and validate again; then POST /v2/jobs, then a loop polling GET /v2/jobs/{id} while the status is queued or running, with failed and cancelled as dead ends and succeeded continuing to GET /v2/jobs/{id}/result; from there two optional branches, POST /v2/jobs/{id}/share which returns a link right away, and POST /v2/jobs/{id}/instructions which starts a second job with its own id that you poll the same way before downloading one PDF per carrier

the one thing to notice early: requesting instructions does not hand you a document. It starts a second job with its own id, and you poll that one just like the first.

1. Submit a job

We'll define one carrier (a pallet, inline) and one cargo line, and let the solver place it.

carriers is the available supply and cargo is the demand. A carrier's quantity is how many instances of it the solver may use. It is omitted here, which means unlimited: the solver decides how many pallets it needs, and the result holds only the ones it actually used. Send an explicit number instead and the result holds exactly that many carriers, some of which may be empty (see Anatomy of a job). Each cargo line's externalId is your own label for that line: the API echoes it back, but the reliable way to match a result back to this line is the itemId the API assigns, which appears on its placements (see Core concepts).

curl -X POST https://api.loadoptimizer.ai/v2/jobs \
  -H "X-Api-Key: ck_live_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: quickstart-001" \
  -d '{
    "units": { "length": "m", "weight": "kg" },
    "carriers": [{ "externalId": "EUR-PALLET", "geometry": { "type": "box", "dimensionX": 1.2, "dimensionY": 0.8, "dimensionZ": 1.5 } }],
    "cargo": [{ "externalId": "SKU-123", "description": "Box A", "amount": 2, "weight": 5.0,
                "geometry": { "type": "box", "dimensionX": 0.3, "dimensionY": 0.4, "dimensionZ": 0.2 } }]
  }'

The response is 202 Accepted, with a Location header pointing at the new job:

{ "jobId": "01975cba-67b9-7b7c-a2f1-3d29e4a01c44", "status": "queued" }

The Idempotency-Key header is optional (max 200 characters) but worth sending on every submit: retry the exact same request with the same key and you get back the original job instead of a duplicate, for at least 24 hours after it was submitted, and for as long as it is queued or running (see Retention). In that window, reusing the key with a different body is rejected with an empty 409; after it, the same key can start a new job. See Errors & troubleshooting.

2. Poll until it's done

curl https://api.loadoptimizer.ai/v2/jobs/01975cba-67b9-7b7c-a2f1-3d29e4a01c44 \
  -H "X-Api-Key: ck_live_..."
{ "jobId": "01975cba-67b9-7b7c-a2f1-3d29e4a01c44", "status": "running", "percentage": 50, "queuePosition": null, "errorCategory": null, "error": null, "name": null, "createdAt": "2026-08-19T08:12:33.412+00:00", "createdBy": { "type": "apiKey", "id": "0192f3a4-7e8f-7a9b-8c0d-1e2f3a4b5c6d", "via": null }, "expiresAt": "2026-11-17T08:12:33.412+00:00", "problemType": "LoadPlanning", "saved": false }

Poll on a fixed interval (every couple of seconds is plenty; there's no benefit to polling faster) until status is succeeded (or a terminal failed/cancelled). Don't assume it's still queued right after submitting: once it leaves the queue and starts calculating, the status moves straight to running. If you hit a 429, back off on your own schedule and retry; see Errors & troubleshooting.

3. Get the result

Before the job succeeds, this returns 404 with code: "result_not_ready". Once status is succeeded:

curl https://api.loadoptimizer.ai/v2/jobs/01975cba-67b9-7b7c-a2f1-3d29e4a01c44/result \
  -H "X-Api-Key: ck_live_..."
{
  "jobId": "01975cba-67b9-7b7c-a2f1-3d29e4a01c44",
  "status": "succeeded",
  "summary": { "carriersUsed": 1, "itemsPlaced": 2, "itemsUnplaced": 0, "totalWeight": 10.0 },
  "carriers": [
    {
      "externalId": "EUR-PALLET",
      "name": null,
      "instance": 1,
      "geometry": { "type": "box", "dimensionX": 1.2, "dimensionY": 0.8, "dimensionZ": 1.5, "box": { "dimensionX": 1.2, "dimensionY": 0.8, "dimensionZ": 1.5 } },
      "kpis": { "volumeUtilization": 3.3, "loadedWeight": 10.0, "loadedVolume": 0.048, "itemCount": 2, "weightUtilization": null },
      "placements": [
        {
          "x": 0.0, "y": 0.0, "z": 0.0,
          "sizeX": 0.3, "sizeY": 0.4, "sizeZ": 0.2,
          "orientationRx": 0, "orientationRy": 0, "orientationRz": 0,
          "weight": 5.0,
          "geometry": { "type": "box", "dimensionX": 0.3, "dimensionY": 0.4, "dimensionZ": 0.2, "box": { "dimensionX": 0.3, "dimensionY": 0.4, "dimensionZ": 0.2 } },
          "description": "Box A", "color": null, "externalId": "SKU-123", "category": "box",
          "group": [], "groups": [], "itemId": "01975cba-6a1f-7c3d-9e04-5b71c8f2a613", "libraryId": null
        },
        {
          "x": 0.3, "y": 0.0, "z": 0.0,
          "sizeX": 0.4, "sizeY": 0.3, "sizeZ": 0.2,
          "orientationRx": 0, "orientationRy": 0, "orientationRz": 90,
          "weight": 5.0,
          "geometry": { "type": "box", "dimensionX": 0.3, "dimensionY": 0.4, "dimensionZ": 0.2, "box": { "dimensionX": 0.3, "dimensionY": 0.4, "dimensionZ": 0.2 } },
          "description": "Box A", "color": null, "externalId": "SKU-123", "category": "box",
          "group": [], "groups": [], "itemId": "01975cba-6a1f-7c3d-9e04-5b71c8f2a613", "libraryId": null
        }
      ],
      "category": "container",
      "libraryId": null
    }
  ],
  "unplacedItems": [],
  "units": { "length": "m", "weight": "kg", "volume": "m3", "area": "m2", "ldm": "m" },
  "name": null,
  "createdAt": "2026-08-19T08:12:33.412+00:00"
}

Both units of SKU-123 fit on the one pallet, so itemsUnplaced is 0 and both placements share the same itemId: it's the same cargo line. The second one is rotated 90° about Z: sizeX/sizeY swap relative to the first, and x/y/z is still the box's minimum corner, not a pre-rotation corner. See Reading a placement if that's not familiar yet.

The request sent no category, so the carrier comes back as the load-planning default, "container"; send "category": "pallet" to have it come back as a pallet.

4. (Optional) instructions & sharing

  • Loading-instruction PDFs: POST /v2/jobs/{id}/instructions queues a second, derived job: poll that job's id, then GET /v2/jobs/{newId}/instructions to download one carrier's PDF at a time.
  • Shareable 3D viewer: POST /v2/jobs/{id}/share mints a read-only link you can hand to anyone; no API key is needed to open it.

See Instructions & sharing.

Next steps