1. Layouts
  2. Add Layouts

Layouts

Add Layouts

You can create and manage layouts from the PackageX dashboard or via the API. Layouts are meant to organize your location.

WARNING

Layout modifications require appropriate permissions. Ensure layouts are not locked at either:

  • Dashboard layout settings
  • Organization settings organization.settings.locations.layouts.locked

Layout Hierarchy

Layouts support nested hierarchies through either parent_id or parent_path properties. When creating nested layouts:

  • Create parent layouts before their children.
  • Ensure unique layout codes within a location.
  • Provide names for new layouts.

Example hierarchy structure:

        Aisle 1
└─ Shelf A
   ├─ Bin Alpha
   ├─ Bin Bravo
   ├─ Bin Charlie
└─ Shelf B
   ├─ Bin Delta
   ├─ Bin Echo
   ├─ Bin Foxtrot

      

Limitations

  • Limit of 1,000 layouts per nesting level
  • Layout names are required when creating new layouts.
  • Layout codes must be unique within a location
NOTE

For consistency in batch operations, all layouts created or updated in a single request will share the same timestamp.

Create Parent Layout

POST
`/v1/locations/:location/layouts`

Parent layouts can be created using several formats:

js
        // Single layout format
{
    "name": "Aisle 1",
    "parent_path": "/",  // Optional for root layouts
    "metadata": {},      // Optional custom metadata
    "code": "A1"        // Optional unique identifier
}

// Array format
[
    {
        "name": "Aisle 1",
        "parent_path": "/"
    }
]

      

Example Request

js
        const data = [
  {
    name: "Aisle 1",
    parent_path: "/", // Optional for root layouts
  },
];

fetch(`https://api.packagex.io/v1/locations/${location_id}/layouts`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());

      

Add Child Layouts (Shelves)

POST
`/v1/locations/:location/layouts`

Child layouts can reference their parent using either parent_id or parent_path:

js
        const data = [
    {
        "name": "Shelf A",
        "parent_path": "/lay_aisle_1",  // Using parent_path
        "code": "SA"
    },
    {
        "name": "Shelf B",
        "parent_id": "lay_aisle_1",     // Using parent_id
        "code": "SB"
    }
];

fetch(`https://api.packagex.io/v1/locations/${location_id}/layouts`, {
    method: "POST",
    headers: {
        "PX-API-KEY": process.env.PX_API_KEY,
        "Content-Type": "application/json"
    },
    body: JSON.stringify(data)
}).then((res) => res.json());

      

Add Nested Layouts (Bins)

POST
`/v1/locations/:location/layouts`

Deeper nesting follows the same pattern, using full paths for clarity:

js
        const data = [
    {
        "name": "Bin Alpha",
        "parent_path": "/lay_aisle_1/lay_shelf_A",
        "code": "BA",
        "metadata": {
            "capacity": 50,
            "type": "small"
        }
    },
    {
        "name": "Bin Bravo",
        "parent_id": "lay_shelf_A",  // Alternative to parent_path
        "code": "BB"
    }
];

fetch(`https://api.packagex.io/v1/locations/${location_id}/layouts`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());

      

Update Parent Layout

Parent layouts can be updated using several formats:

  • By giving id property in payload
POST
`/v1/locations/:location/layouts`
js
        {
    "id": "lay_aisle_1",
    "name": "Aisle 1"
}

fetch(`https://api.packagex.io/v1/locations/${location_id}/layouts`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());

      
  • By giving layout_id in the url
POST
`/v1/locations/:location/layouts/:layout`
js
        {
    "name": "Aisle 1"
}

fetch(`https://api.packagex.io/v1/locations/${location_id}/layouts/${layout_id}`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());

      

Layout Properties

Each layout supports the following properties:

  • id (optional): Unique identifier starting with lay_. Auto-generated if not provided. You can give the id in a 22 characters alpha-numeric string.
  • name (required): Display name for the layout.
  • parent_id (optional): Direct reference to parent layout.
  • parent_path (optional): Full path to parent layout.
  • code (optional): Unique identifier within the location.
  • metadata (optional): Custom JSON object for additional data.