Skip to main content

Deleting an item

How to delete an item

You can delete an existing item in Alloy, providing its context is Customer and you have permission to do so.

To remove an item from day-to-day operations while retaining its data, consider archiving it instead. This involves editing the item and setting its collection property to Archive.

If the item being deleted/archived has any Link attributes, be aware that any items stored in them may also be affected (if the Link attribute's weakReference property is false).

For more information, see:

Caution

Deleting items is irreversible and data is unlikely to be recoverable. Therefore, please think carefully before doing so!

Example JavaScript

This example demonstrates how to delete an item. The item's ID is included in the endpoint URL, so no request body data is needed.

If deletion is successful, Alloy will respond with the 204 No Content HTTP status code.

// load a http request library
const axios = require('axios');

// enter your api key here!
const apiKey = 'e0e3a4ef-5ec8-4e05-ac25-a34adadf4a80';

// request to create an item
axios({
method: 'DELETE',
url: 'https://api.uk.alloyapp.io/api/item/5f6b9c0e8163400065eae35f',
headers: { Authorization: `Bearer ${apiKey}` },
})
.then((response) => {
// output the response to the console
console.log(response.status + ' ' + response.statusText);
})
.catch((error) => {
// output any error data to the console
console.log(error.response.data);
});