1. Layouts
  2. Delete Layouts

Layouts

Delete Layouts

Delete layout API provides flexible options for deleting layouts, supporting both single and bulk deletion operations. You can delete layouts using multiple request formats.

DANGER

Deleting a layout will automatically delete all of its nested children. This cascading deletion cannot be undone, so please review the layout's hierarchy before proceeding with deletion.

WARNING

Layout deletion requires appropriate permissions. Ensure layouts are not locked at either the dashboard or organization level (organization.settings.locations.layouts.locked).

Delete Multiple Layouts

DELETE
`/v1/locations/:location/layouts`

You can delete multiple layouts by providing their IDs through various methods:

  • Request Body Array Format
js
        const data = {
    layouts: ["lay_shelf_B", "lay_shelf_A"] // Will delete these shelves and all their nested bins
};

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

      
WARNING

The request body must contain a layouts array and must not be empty. Otherwise it will result in a 400 error with the message "You did not provide an array of layouts".

  • Query Parameter Format

When using query parameters, provide the layouts as a comma-separated list in the layouts parameter:

js
        await fetch(`https://api.packagex.io/v1/locations/${location_id}/layouts?layouts=lay_shelf_B,lay_shelf_A`, {
  method: "DELETE",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
});

      

Delete Single Layout

DELETE
`/v1/locations/:location/layouts/:layout`

For deleting a single layout, you can use the dedicated endpoint:

js
        await fetch(`https://api.packagex.io/v1/locations/${location_id}/layouts/lay_shelf_B`, {
  method: "DELETE",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
});

      

Important Notes

The deletion process includes several safeguards and behaviors:

  • Hierarchical Deletion: The system automatically identifies and deletes all nested layouts
  • Default Layout Protection: The system prevents deletion of the location's default layout
NOTE

The system automatically handles the deletion order. You do not need to delete child layouts separately.