Instructions & sharing

Turn a solved job into deliverables: step-by-step loading-instruction PDFs, and a read-only 3D viewer link to share with someone who has no API key.

When to use this

  • Your warehouse/driver needs printable, per-carrier loading instructions.
  • You want to share a read-only view of the packed load with someone who has no API key.

Walkthrough

Loading-instruction PDFs (a derived job)

Instructions render one PDF per carrier in the packed result; there is no single archive for the whole job. Because rendering takes work, requesting instructions is a derived job: it creates a new, separate job that you poll on its own, then you download PDFs from it one carrier at a time.

1. Start it. POST /v2/jobs/{id}/instructions (where {id} is your succeeded source job) creates the derived job and returns 202 with a Location header pointing at it:

curl -X POST https://api.loadoptimizer.ai/v2/jobs/01975cba-67b9-7b7c-a2f1-3d29e4a01c44/instructions \
  -H "X-Api-Key: ck_live_..."
{ "jobId": "01975e02-7c7c-7000-8000-00000000abcd", "status": "queued" }

That jobId is the instructions job, not the source job: the Location header already points at /v2/jobs/{newId}, so you never have to leave the /v2 surface to find it. If the source job hasn't succeeded, there's nothing to render: 409 (code job_not_succeeded).

2. Poll the new job, not the source. GET /v2/jobs/{newId}, exactly like any other job, until succeeded. See Async & validate.

An instructions job does not appear in GET /v2/jobs, which lists orders only, so keep the id this call returned.

3. Download a PDF, one carrier at a time. GET /v2/jobs/{newId}/instructions?carrier={n} (using the instructions job id) returns one application/pdf document. carrier is the 1-based position of the carrier in the carriers[] array of the source job's result: carrier=1 is carriers[0], carrier=2 is carriers[1], and so on. Omit it and you get the first one.

That array position is how you label a downloaded PDF: read the same position out of GET /v2/jobs/{id}/result and take that carrier's externalId and instance from it. For a carrier that referenced a library entry, the same position also gives you its libraryId, and its externalId is null when neither the job line nor the entry had a label: fall back to libraryId or name for that one. Don't try to derive n from instance: instance restarts at 1 for each carrier type, so as soon as a job uses more than one type the two numberings diverge. A result holding one of each of two types has two carriers whose instance is 1, and they are carrier=1 and carrier=2. Count positions in carriers[]; don't reason about types.

curl "https://api.loadoptimizer.ai/v2/jobs/01975e02-7c7c-7000-8000-00000000abcd/instructions?carrier=1" \
  -H "X-Api-Key: ck_live_..." \
  -o carrier-1.pdf

Download only once the instructions job has succeeded. Before that, this answers 404 (code artifact_not_ready). After it has succeeded, artifact_not_ready is final: there is no PDF at that position (a carrier past the last one), or retention has removed it, so request instructions again rather than polling. Any id that is not an instructions job, the source order's id included, answers 404 with code job_not_found.

Every page of the PDF is A4 landscape, the overview at the front included, whatever the carrier's shape, so the document prints as it is and a viewer or thumbnail generator can assume one page size throughout.

POST /v2/jobs/{id}/share, called on a succeeded job, mints a read-only link to a hosted, human-facing 3D viewer page, a URL you hand to people (warehouse, customer, planner) who have no API key. They open it in a browser and explore the packed load.

Minting a link is a paid feature, checked before anything else on this call, even the job lookup: an account whose plan does not include link sharing gets 403 (code: "link_sharing_not_entitled") instead of a link. Revoking is never gated this way: an account that loses the feature can still take down a link it already minted.

This is a page for people, not a component for your app. There is no embeddable widget and no programmable viewer SDK: the share link is not meant to be iframed into your product or driven by code. If you're building your own visualization, render it yourself from the result: read the placements geometry (positions, sizes, orientations, and original geometry) out of GET /v2/jobs/{id}/result. The share link and the viewer are strictly a no-code, human-facing convenience.

curl -X POST https://api.loadoptimizer.ai/v2/jobs/01975cba-67b9-7b7c-a2f1-3d29e4a01c44/share \
  -H "X-Api-Key: ck_live_..."

The response is 201 Created:

{
  "shareId": "YzIzaeQtWUysVuPJToFCCHvXpQKZx1ftQAjgFcAuqDI",
  "url": "https://viewer.loadoptimizer.ai/YzIzaeQtWUysVuPJToFCCHvXpQKZx1ftQAjgFcAuqDI",
  "createdAt": "2026-09-01T11:30:00+00:00",
  "createdBy": { "type": "apiKey", "id": "0192f3a4-7e8f-7a9b-8c0d-1e2f3a4b5c6d", "via": null },
  "expiresAt": "2027-03-01T12:00:00+00:00"
}

createdAt and createdBy say when the link was made and by whom, as an actor (see Users, API keys and who did what); a new link replaces the old one, so they describe the link you hold now.

url is null when the API has no viewer link to give out; the share exists all the same, and shareId names it. The link you hand out is url: it opens the read-only viewer in a browser and needs no API key, so you can send it to anyone. The 201 also carries a Location header. It is not a second copy of the link and not something to send on: it is not part of this API, and requesting it answers 401. Ignore it and use url.

How the link stays safe. The link carries an opaque, unguessable shareId, not your job id. Possessing the link is the only credential needed to open the viewer (so you can send it to anyone, no account required), and that's all it grants: a read-only view of this one job's result. It can't be used to call the API, poll job status, or reach any other job or account data. Your job id is never exposed by the link, and the authenticated API still requires your own API key (another account's job id just returns 404). Stop a link working at any time by revoking it, or let it lapse at expiresAt.

Revoke it with DELETE /v2/jobs/{id}/share, which answers 204 and is idempotent: a job with no active link still returns 204. Re-sharing a job rotates the token, and there is only ever one active link per job: minting a new one retires whichever link existed before, revoke or not.

curl -X DELETE https://api.loadoptimizer.ai/v2/jobs/01975cba-67b9-7b7c-a2f1-3d29e4a01c44/share \
  -H "X-Api-Key: ck_live_..."

Reading the link back. GET /v2/jobs/{id}/share returns the job's link, the same body the POST answered, as long as it has one: past its expiresAt too, so you can tell an expired link from none. A job without a link answers 404 share_not_found. A link minted before this API could show links again answers 409 share_link_not_retrievable: share the job again for a new link, or revoke the old one. Reading a link needs the shares.read permission.

The read-only 3D viewer opened from a share link

The read-only 3D viewer opened from a share link: colour-coded items in the loaded carrier.

What the recipient sees. The viewer shows the same plan GET /v2/jobs/{id}/result returns you: the same axis frame, the same min-corner positions and rotated sizes, the same colours and labels. Which shape it renders is fixed when the link is minted, so a link minted through this /v2 endpoint keeps showing the /v2 plan even if you later work against another surface. What it never shows is the job id, the request you submitted, any other job, or anything about your account.

Retention & expiry

A share link carries its own expiresAt: check it before you assume a link you minted is still live, and re-share if you need it to keep working past that window. A link never outlives its job: its expiresAt is never later than the job's, and when the job is deleted the link goes with it. See Retention for how long a link lasts.

Three things can stop a link working, and they are worth telling apart when someone reports that it does not open:

Situation What the recipient gets
You revoked it with DELETE .../share, or re-shared the job (which rotates the token) The viewer does not open: the link no longer exists. Indistinguishable from a made-up token, on purpose
The link is past its expiresAt The viewer does not open. Mint a fresh link with another POST .../share
The job is deleted at its own expiresAt The viewer does not open, and no fresh link is possible: the job is gone

Revoking is immediate and total: DELETE .../share answers 204 for any job of yours, whether or not it had a link (an id that is not one of your jobs is 404 job_not_found), and anyone still holding the old URL afterwards is in exactly the same position as someone who invented a token. Whoever still holds the old URL gets no signal that the link ever existed. You, the owner, can check with GET /v2/jobs/{id}/share whether the job has a link now. Re-sharing has the same effect on the old link.

A rendered instructions PDF has no expiry field of its own: once retention has cleaned an artifact up, fetching it reads as artifact_not_ready while the instructions job shows succeeded, which is how you tell it from a render that is still in progress. Re-request instructions from the source job if you need the PDF again.

Key fields

Field Where Notes
jobId instructions 202 body The derived instructions job: poll and download from this id, not the source.
carrier query, instructions download 1-based position of the carrier in the source job result's carriers[] array, not its instance number. Omitted → the first carrier.
shareId share 201 body and GET .../share Opaque token in the link: distinct from the job id; the only credential the link carries.
url share 201 body and GET .../share Public read-only 3D viewer link. null when the API has no link to give out.
createdAt / createdBy share 201 body and GET .../share When this link was made, and who made it, as an actor.
expiresAt share 201 body and GET .../share When the share link stops resolving.

Notes & caveats

  • Two different job ids. POST …/instructions creates a new job; poll and download using that job's id, not the source job's.
  • Source must have succeeded before you request instructions or a share, or you'll get 409 (code job_not_succeeded).
  • One PDF per carrier, not one archive per job. Fetch each carrier's PDF separately with ?carrier={n}.
  • artifact_not_ready vs job_not_found. Both are 404s on the instructions download. artifact_not_ready means keep polling only while the instructions job is still queued or running; job_not_found means the id is wrong, isn't yours, or is not an instructions job (for example the source order's id).
  • The share link is a hosted viewer for people. It opens a read-only 3D page meant for humans to look at; there's no embeddable widget or SDK. Integrators who want their own visualization render it themselves from the placements geometry in the result.
  • Async & validate: polling the derived instructions job; the closed error.code set for a render_error.
  • Errors & troubleshooting: artifact_not_ready, job_not_succeeded, and the other problem+json codes.