# Tenants ## Delete Data `client.tenants.deleteData(stringtenantID, RequestOptionsoptions?): TenantDeleteDataResponse` **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). ### Parameters - `tenantID: string` ### Returns - `TenantDeleteDataResponse` - `deleted_embeddings: number` Number of embedding rows deleted - `deleted_feedback_records: number` Number of feedback records deleted - `deleted_webhooks: number` Number of webhooks deleted - `message: string` Human-readable status message - `tenant_id: string` Tenant ID whose data was deleted ### Example ```typescript 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); ``` # Settings ## Retrieve `client.tenants.settings.retrieve(stringtenantID, RequestOptionsoptions?): SettingRetrieveResponse` **get** `/v1/tenants/{tenant_id}/settings` Returns the enrichment settings for the specified tenant_id. A tenant that has not configured any settings yet returns HTTP 200 with default (unset) values rather than 404; consumers decide the fallback behavior for unset values. Settings are tenant-scoped and never shared across tenants. ### Parameters - `tenantID: string` ### Returns - `SettingRetrieveResponse` - `settings: Settings` Tenant-scoped enrichment configuration. Fields are optional; absent fields use server defaults. - `target_language?: string` Normalized BCP-47 locale (e.g. "en-US") that language enrichment translates feedback records and topic labels into. Absent or empty means not configured. - `tenant_id: string` Tenant ID the settings belong to ### Example ```typescript import FormbricksHub from '@formbricks/hub'; const client = new FormbricksHub({ apiKey: process.env['HUB_API_KEY'], // This is the default and can be omitted }); const setting = await client.tenants.settings.retrieve('org-123'); console.log(setting.tenant_id); ``` ## Update `client.tenants.settings.update(stringtenantID, SettingUpdateParamsbody, RequestOptionsoptions?): SettingUpdateResponse` **patch** `/v1/tenants/{tenant_id}/settings` Partially updates the enrichment settings for the specified tenant_id using RFC 7396 JSON Merge Patch semantics (media type application/merge-patch+json; application/json is also accepted). For each member: a value sets that setting, JSON null removes it (e.g. `{"target_language": null}` clears the target language), and an omitted member is left unchanged. The tenant_id is taken from the path, so a request can only ever modify its own tenant's settings. target_language is normalized to a canonical BCP-47 locale (e.g. "en-us" becomes "en-US"); an empty string is rejected (send null to remove it). While a tenant data purge runs for the same tenant_id, this write is rejected with HTTP 409 (code `tenant_write_conflict`) and may be retried. ### Parameters - `tenantID: string` - `body: SettingUpdateParams` - `target_language?: string | null` Target BCP-47 locale to translate into; normalized to a canonical form (e.g. "en-us" becomes "en-US"). Send null to remove it; omit to leave it unchanged. An empty string is rejected. ### Returns - `SettingUpdateResponse` - `settings: Settings` Tenant-scoped enrichment configuration. Fields are optional; absent fields use server defaults. - `target_language?: string` Normalized BCP-47 locale (e.g. "en-US") that language enrichment translates feedback records and topic labels into. Absent or empty means not configured. - `tenant_id: string` Tenant ID the settings belong to ### Example ```typescript import FormbricksHub from '@formbricks/hub'; const client = new FormbricksHub({ apiKey: process.env['HUB_API_KEY'], // This is the default and can be omitted }); const setting = await client.tenants.settings.update('org-123'); console.log(setting.tenant_id); ```