Soft Delete API Resource

Implement soft delete in API endpoints using deletedAt or isArchived flags.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/bytetalent/docs --skill soft-delete-api-resource
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Soft Delete API Resource
Source: https://github.com/bytetalent/docs/tree/main/skills/paths/soft-delete-api-resource
Command: npx skills add https://github.com/bytetalent/docs --skill soft-delete-api-resource

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a pattern for implementing soft delete functionality in your API, ensuring that data is not permanently deleted and can be recovered if needed.

Core Features & Use Cases

  • Soft Delete Pattern: Implement soft delete by setting a deletedAt timestamp or isArchived boolean instead of hard deleting records.
  • Database Queries: Utilize the notDeleted() helper to filter out soft-deleted rows in SELECT queries.
  • Use Case: When you want to delete a record but still keep the data for auditing or other purposes, use this Skill to soft delete the record instead of hard deleting it.

Quick Start

Soft delete the record with ID '123' by running the following command: deleteRecord --id 123.

Frequently Asked Questions about Soft Delete API Resource

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is a soft delete pattern in an API and when should I use it?

A soft delete pattern in an API preserves data by setting a deletedAt timestamp or isArchived boolean instead of permanently removing records. Use this approach when you need to retain database rows for auditing or potential data recovery.

How do I implement soft delete functionality in my API endpoints?

You implement soft delete functionality by running the deleteRecord command with the target ID, which sets a deletion timestamp instead of executing a hard database delete. This ensures the record remains in the database while being marked as deleted.

How do I filter out soft-deleted records from my database SELECT queries?

You filter out soft-deleted records from database SELECT queries by applying the notDeleted helper function. This ensures your query logic automatically excludes rows that have a deletedAt timestamp or isArchived boolean set.

Does this soft delete pattern work for retaining data for auditing purposes?

Yes, the soft delete pattern works for auditing by keeping the data in the database while marking it as deleted. This allows you to maintain historical records and perform potential data recovery without losing the original information.

What is the difference between a soft delete and a hard delete in database management?

A soft delete marks records as archived using a boolean or timestamp, keeping the database data intact for recovery. A hard delete permanently removes the row and its data from the database, making it unrecoverable without backups.

When should I not use a soft delete approach for my API resources?

You should not use a soft delete approach when you need to permanently erase data from the database for compliance or storage optimization. Soft delete retains the full row data, which means the records remain queryable and consume storage space.