1. Assets
  2. Archive Asset

Assets

Archive Asset

An asset once created cannot be deleted, however, it can be archived.

js
        
const res = await fetch(`https://api.packagex.io/v1/assets/ast_1tH2ofoBcDbPnyZCYmrSX3`, {
  method: "DELETE",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());

const archived = res.data.archived; // True if successful.

      

Restore Asset

An archived asset can be restored in the future as follows

js
        
const res = await fetch(`https://api.packagex.io/v1/assets/ast_1tH2ofoBcDbPnyZCYmrSX3/restore`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: ``
}).then((res) => res.json());
const archived = res.data.archived; // False if successful