API DOCUMENTATION

P4 Pack API
Reference

Integrate AI-powered 3D bin packing into your application with a single REST endpoint.

REST API <200ms
Modern warehouse logistics technology
POST /api/pack

Submit items and containers for AI-optimized 3D packing. Returns exact placement coordinates for each item.

Request Headers (commercial tier)

HeaderRequiredDescription
X-Api-KeyCommercial onlyAPI key issued by P4 Software. Required for commercial tier access.

Request Body

FieldTypeRequiredDescription
itemsarrayYesArray of item objects to pack
containersarrayYesArray of available container types
singleSkuPerContainerbooleanIf true, each container holds only one item type
maxContainerWeightnumberMaximum weight per container (uses weightUnit)
weightUnitstring"lb" or "kg" (default: "lb")

Item Object

FieldTypeDescription
namestringDescriptive label for the item
lengthnumberLength dimension
widthnumberWidth dimension
heightnumberHeight dimension
unitstring"in" or "cm"
quantityintegerNumber of this item to pack (default: 1)
uprightOnlybooleanIf true, item won't be rotated on its side
durabilityintegerStacking durability (1-10). Higher = can support more weight on top
weightnumberWeight per unit (uses weightUnit from request)
colorstringHex color for 3D visualization (e.g. "#FF6B35")
payloadstringCustom data passed through to the response

Container Object

FieldTypeDescription
namestringDescriptive label for the container
lengthnumberInterior length
widthnumberInterior width
heightnumberInterior height
unitstring"in", "cm", or "ft"
loadingModestring"topDown" (default), "frontLoad", "sideLoad"
payloadstringCustom data passed through to the response

Error Codes

CodeDescription
400Invalid request body — check required fields and types
401Invalid or missing API key (commercial tier)
408Packing timed out — reduce item count or complexity
429Rate limit exceeded — wait and retry
GET /api/pack/{id}

Retrieve a previously stored pack result by ID.

Response fields: id, createdAt, request, response
Error: 404 if the result does not exist or has expired
GET /api/pack/{id}/container/{index}/svg

Render a 2D SVG visualization of a specific container from a pack result.

Response: image/svg+xml
Error: 404 if result or container index not found

Ready to integrate AI packing?

Get a commercial API key or try the interactive sandbox.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.