Skip to content
Support

Delete tenant data

client.tenants.deleteData(stringtenantID, RequestOptionsoptions?): TenantDeleteDataResponse { deleted_embeddings, deleted_feedback_records, deleted_webhooks, 2 more }
DELETE/v1/tenants/{tenant_id}/data

Permanently deletes Hub-owned data for the specified tenant_id. This endpoint is intended for tenant/account offboarding after the tenant has been deprovisioned and upstream writes for that tenant have stopped. This includes feedback records, derived embeddings, taxonomy data, and webhooks for the tenant. This operation is synchronous and idempotent; repeated calls return zero counts after the tenant data has already been deleted.

The purge is serialized against tenant-owned writes: while it runs, Hub-owned writes for the same tenant_id are rejected with HTTP 409 (code tenant_write_conflict); writes for other tenants are unaffected. If tenant-owned writes are in flight when the purge starts, the purge waits up to a configured lock timeout for them to drain and then returns a retryable 409.

No webhook events are published as part of this purge operation, and writes rejected during the purge publish no events. Webhook deliveries already in flight when the purge commits complete normally, and previously enqueued delivery jobs no-op after the purge (their queued payloads are removed by the job queue's retention pruning rather than by this endpoint).

ParametersExpand Collapse
tenantID: string
minLength1
maxLength255
ReturnsExpand Collapse
TenantDeleteDataResponse { deleted_embeddings, deleted_feedback_records, deleted_webhooks, 2 more }
deleted_embeddings: number

Number of embedding rows deleted

formatint64
deleted_feedback_records: number

Number of feedback records deleted

formatint64
deleted_webhooks: number

Number of webhooks deleted

formatint64
message: string

Human-readable status message

tenant_id: string

Tenant ID whose data was deleted

minLength1
maxLength255

Delete tenant data

import FormbricksHub from '@formbricks/hub';

const client = new FormbricksHub({
  apiKey: process.env['HUB_API_KEY'], // This is the default and can be omitted
});

const response = await client.tenants.deleteData('org-123');

console.log(response.tenant_id);
{
  "tenant_id": "org-123",
  "deleted_feedback_records": 42,
  "deleted_embeddings": 17,
  "deleted_webhooks": 3,
  "message": "Successfully deleted tenant data for org-123"
}
Returns Examples
{
  "tenant_id": "org-123",
  "deleted_feedback_records": 42,
  "deleted_embeddings": 17,
  "deleted_webhooks": 3,
  "message": "Successfully deleted tenant data for org-123"
}