Documentation
CRM Data

Trash & Permanent Deletion

Deleting a dialog, lead, contact or company in LDM is a two-step process: a regular DELETE moves the record to the trash (soft delete), from where it can be restored. Purge and empty-trash endpoints remove records permanently.

Lifecycle

active ──DELETE /:id──▶ trash ──POST /:id/restore──▶ active
                          │
                          ├─DELETE /:id/purge────────▶ gone forever
                          └─POST /settings/trash/empty▶ gone forever (bulk)

Dialogs use status=DELETED as their trash marker; leads, contacts and companies use isDeleted=true. A purge is only allowed for records that are already in the trash — purging an active record returns 400.


Endpoints

MethodPathDescription
DELETE/api/dialogs/:idSoft-delete a dialog (status → DELETED, goes to trash).
DELETE/api/leads/:idSoft-delete a lead (isDeleted=true).
DELETE/api/contacts/:idSoft-delete a contact (isDeleted=true).
DELETE/api/companies/:idSoft-delete a company (isDeleted=true).
GET/api/dialogs?status=DELETEDList trashed dialogs.
GET/api/leads?onlyDeleted=trueList trashed leads (same for contacts / companies).
POST/api/dialogs/:id/restoreRestore a trashed dialog (same shape for leads / contacts / companies).
GET/api/settings/trashTrash counters across all entities.
DELETE/api/dialogs/:id/purgePermanently delete one trashed dialog (same for leads / contacts / companies).
POST/api/settings/trash/emptyPermanently delete everything in the trash (or selected entities).

Inspect the trash

curl https://api.live-direct-marketing.online/api/settings/trash \
  -H "Authorization: Bearer $API_KEY"

{
  "dialogs": 12,
  "leads": 3,
  "contacts": 41,
  "companies": 7,
  "total": 63
}

Permanently delete one record

Works for dialogs, leads, contacts and companies. The record must already be in the trash.

curl -X DELETE https://api.live-direct-marketing.online/api/dialogs/<id>/purge \
  -H "Authorization: Bearer $API_KEY"

{ "purged": true, "id": "<id>" }

Empty the trash

Requires the literal confirmation string. Optionally limit the purge to specific entities; when entities is omitted, everything in the trash is deleted.

curl -X POST https://api.live-direct-marketing.online/api/settings/trash/empty \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "confirmation": "EMPTY TRASH", "entities": ["dialogs", "contacts"] }'

{ "purged": { "dialogs": 12, "contacts": 41 }, "total": 53 }
Irreversible. Purged records and their dependent data (attachments, activities, tags, custom-field values, list memberships) are physically deleted and cannot be restored. Related records that merely referenced the purged one (e.g. a dialog pointing at a purged contact) are kept — the reference is set to null.

Required scopes

  • settings:read — trash counters.
  • settings:write — empty trash.
  • dialogs:write / leads:write / crm:write — per-record purge, same scope as regular delete.