Skip to content

[Feature New API] Sub-account/Location Deleted #147

@GoCSM

Description

@GoCSM

🌟 Describe the Feature

Provide a reliable signal when a Sub-account/Location is deleted (or archived) so partner apps can stay in sync.

Two acceptable paths (either or both):

  1. Webhook event fired in real time when an Agency deletes/archives a Location.
  2. Read API that returns Locations deleted/archived since a given timestamp for reconciliation.

Please surface clear semantics:

  • status: "active" | "archived" | "deleted"
  • deleted_at / archived_at timestamps
  • User who performed the action
  • Grace period end (if hard delete is delayed)
  • Whether the Location was transferred vs actually deleted (if such a flow exists)

🚀 Justification

Third-party platforms (like GoCSM) mirror GHL’s Agency → Location hierarchy. Without a deletion/archival signal:

  • We retain orphaned sub-accounts, skewing analytics, adoption, and seat counts
  • Licenses and billing become misaligned
  • Data-retention/compliance risks increase
  • Manual cleanups waste support time

A webhook avoids inefficient polling and keeps the ecosystem consistent in real time.

📝 Suggestions

{
"id": "evt_b1d9420f",
"event": "location.deleted", // or "subaccount.deleted"
"occurred_at": "2025-08-27T10:20:00Z",
"account_id": "agency_123",
"location": {
"id": "loc_456",
"name": "Northwest Dental",
"status": "deleted", // "archived" | "deleted"
"archived_at": null,
"deleted_at": "2025-08-27T10:19:58Z",
"grace_period_ends_at": null // if applicable
},
"deleted_by": {
"id": "user_321",
"email": "owner@example.com"
},
"notes": "Deleted from Agency dashboard"
}

Product Area

saas

📋 Use Case

Keeps a 1:1 mirror of GHL Agencies and their Locations.
When an Agency deletes or archives a Location, GoCSM must immediately:

  • Purge or archive that Location and related records in our DB
  • Recalculate health/product-adoption metrics and cohort reports
  • Free licenses/seat allocations and halt automations tied to that Location

Today there’s no authoritative delete/archival signal, which leads to stale structures and inaccurate reporting.

🚨 Why Should This Be Prioritized?

  • Data integrity: prevents orphaned sub-accounts from skewing analytics and automations
  • Compliance: enables timely data minimization and customer requests handling
  • Ecosystem leverage: one event helps every integration maintain correct hierarchies
  • Operational savings: fewer support tickets and manual reconciliation

🧠 Additional Context

  • Please differentiate archive vs hard delete (grace periods, restorability).
  • If a Location can be transferred between Agencies, consider a location.transferred event with from_account_id and to_account_id.
  • A backfill Read API with since + cursor ensures recovery from downtime and eventual consistency.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions