Skip to main content
DELETE
/
v1
/
assets
/
{serialNumber}
Delete an asset
curl --request DELETE \
  --url https://api-eu.flexportal.io/v1/assets/{serialNumber} \
  --header 'Authorization: Bearer <token>' \
  --header 'Tenant-ID: <tenant-id>'
{
  "success": true,
  "message": "<string>",
  "serialNumber": "<string>"
}

Overview

Remove an asset from your inventory. This is a soft delete—the asset is marked as unavailable rather than permanently removed, preserving historical data for reporting and auditing.
Assets that are currently assigned to active subscriptions cannot be deleted. End or cancel the subscription first.

What Happens When You Delete

  1. Asset status changes to unavailable
  2. Asset removed from available inventory queries
  3. Historical records preserved (subscriptions, payments)
  4. Cannot be assigned to new subscriptions

Common Use Cases

  • Sold Assets: Device was sold to customer (buyout)
  • Retired Inventory: Device too old or damaged for reuse
  • Lost/Stolen: Device cannot be recovered
  • Inventory Cleanup: Remove test or duplicate entries

Prerequisites

Before deleting:
  1. No active subscriptions using this asset
  2. Asset returned (if previously rented)
async function canDeleteAsset(serialNumber) {
  const asset = await getAsset(serialNumber);

  if (asset.status === 'rented_out') {
    return {
      canDelete: false,
      reason: 'Asset is currently rented',
      currentSubscription: asset.rentalId,
      currentCustomer: asset.customerId
    };
  }

  return { canDelete: true };
}

Example: Delete with Reason

async function retireAsset(serialNumber, reason) {
  // First, update with reason for audit trail
  await updateAsset(serialNumber, {
    notes: `Retired: ${reason}`,
    status: 'unavailable'
  });

  // Then delete
  await deleteAsset(serialNumber);

  return { retired: true, serialNumber, reason };
}

// Usage
await retireAsset('SN123456789', 'End of life - 5 years old');
await retireAsset('SN987654321', 'Sold to customer via buyout');

Alternative: Mark Unavailable

If you want to preserve the asset record but remove from active inventory, consider updating status instead:
// Instead of deleting:
await updateAsset(serialNumber, {
  status: 'unavailable',
  condition: 'Retired - end of service life',
  notes: 'Removed from fleet January 2025'
});
This keeps the asset fully visible in reports while preventing new assignments.

Recovering Deleted Assets

Since deletion is a soft delete, you can reactivate assets:
PATCH /v1/assets/{serialNumber}
{
  "status": "available",
  "notes": "Reactivated after repair"
}

Error Handling

Error CodeCauseSolution
NOT_FOUNDSerial number doesn’t existVerify serial number
ASSET_IN_USEAsset has active subscriptionEnd subscription first

Authorizations

Authorization
string
header
required

API key obtained from FlexPortal dashboard

Headers

Tenant-ID
string
required

Your tenant identifier

Path Parameters

serialNumber
string
required

The asset serial number

Response

Asset deleted

success
enum<boolean>
required
Available options:
true,
false
message
string
required
serialNumber
string
required