Skip to main content

Trash

Trash holds soft-deleted content items (blogs, pages, projects, CV entries, skills, media, documents, legal, social, menu items). Items can be restored or permanently deleted.

Endpoints

MethodPathPermissionDescription
GET/sites/{site_id}/trash?page&page_sizeAdminList soft-deleted items for a site (paginated, newest-deleted first)
GET/sites/{site_id}/trash/countAdminGet count of soft-deleted items (used for the sidebar badge)
POST/trash/{id}/restore?entity_typeAdminRestore a soft-deleted item
DELETE/trash/{id}?entity_typeAdminPermanently delete a soft-deleted item (cannot be undone)

Entity Types

The entity_type query parameter specifies which content type to act on. Supported values:

Entity TypeDescription
blogBlog post
pageStatic page
projectPortfolio project
cv_entryCV / résumé entry
skillSkill
mediaUploaded media file
documentDocument
legalLegal document
socialSocial link
menuNavigation menu
menu_itemNavigation menu item

Soft Delete Behaviour

When content is deleted through the normal delete endpoints, it is soft-deleted — the item is marked as deleted (deleted_at set, is_deleted = TRUE) but remains in the database. The trash listing returns only items scoped to the current site.

The list is paginated via page / page_size (default page 1, 10 per page, max 100), ordered newest-deleted first. The response is { items, total }, where total is the site-wide count across all entity types — not the length of the returned page.

Restore

POST /trash/{id}/restore reverses the soft-delete: deleted_at is cleared, is_deleted is set to FALSE, and the item reappears in normal listings. The request must include the correct entity_type so the system knows which table to update.

Permanent Delete

DELETE /trash/{id} with the correct entity_type physically removes the row from the database. This action cannot be undone. Use with care.

The GET /sites/{site_id}/trash/count endpoint returns a lightweight count that powers the trash badge in the admin sidebar:

{
"count": 12
}