Skip to main content
Staffify Docs
Updated
Docs/Workspace API/Recycle bin

Recycle bin

Most Workspace resources use a 30-day soft-delete recycle bin instead of hard-deleting rows. DELETE sets a deleted_at timestamp; the row stays queryable (via explicit filters) for 30 days, then a cron hard-deletes it. Restore anytime within that window.

How it works

  1. Default list queries exclude soft-deleted rows. A tenant that reads /contacts never sees the trash by accident.
  2. ?deleted=true — list only rows in the recycle bin. Useful for recovery UIs.
  3. ?deleted=any — list both live and deleted rows together. Useful for full exports / backups.
  4. POST /:resource/:id/restore — undelete a row. Requires the same .delete scope that performed the delete.
  5. 30-day hard-purge. A daily cron picks up rows where deleted_at < NOW() - INTERVAL 30 DAY and permanently removes them. After this point, restore is impossible.

Example flow

# 1. Soft-delete a contact
curl -X DELETE "https://app.staffifyai.com/api/workspace/v1/contacts/1893" \
  -H "Authorization: Bearer sfy_wsp_live_YOUR_KEY"

# 2. See it in the recycle bin
curl "https://app.staffifyai.com/api/workspace/v1/contacts?deleted=true" \
  -H "Authorization: Bearer sfy_wsp_live_YOUR_KEY"

# 3. Restore within 30 days
curl -X POST "https://app.staffifyai.com/api/workspace/v1/contacts/1893/restore" \
  -H "Authorization: Bearer sfy_wsp_live_YOUR_KEY"

Resources that support soft-delete

ResourcePathDelete scope
Contacts/contactscrm.contacts.delete
Companies/companiescrm.companies.delete
Deals/dealscrm.deals.delete
Tasks/taskscrm.tasks.delete
Notes/notescrm.notes.delete
Segments/segmentscrm.segments.delete
Quotes/quotessales.quotes.delete
Invoices/invoicessales.invoices.delete (drafts only)
Products/productssales.products.delete
Bookings/bookingsbookings.entries.delete
Booking customers/bookings/customersbookings.customers.delete
Booking links/bookings/linksbookings.links.delete
Work orders/workordersoperations.workorders.delete
Maintenance contracts/maintenance-contractsoperations.maintenance.delete
Certifications/certificationsoperations.certifications.delete

Resources without a recycle bin

A few resources use alternative semantics by design — DELETE on these is immediate or has a different meaning.

ResourceDelete behavior
Stock itemsStock is a sidecar on CRM products — turn tracking off with PATCH is_stock_tracked=false instead of deleting.
Time logsLedger rows (append-only semantics). DELETE performs a hard-delete; movement history for the parent work order is preserved by other logs.
Maintenance installationsChild entities of a maintenance contract. DELETE performs a hard-delete; soft-delete the parent contract if you need the whole set back.
AppointmentsCalendar entries use status=cancelled + cancelled_at (soft-cancel) instead of a recycle bin. The row stays in the table for history and reporting.
Webhook endpointsReversible via re-create. DELETE is immediate — the signing_secret is gone with the row.
Recycle bin - Workspace API - Staffify