> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Retention

> Manage retention policies, legal holds, and view data lifecycle events for the organisation at /settings/data-retention.

The Data Retention page (`/settings/data-retention`) provides controls for defining how long different data types are kept, placing legal holds to prevent data deletion, and reviewing the history of lifecycle events across the organisation.

## Overview

The page is gated at the route level by `pf.data-retention.manage`. It renders three tabs: **Retention Policies**, **Legal Holds**, and **Lifecycle Events**. The Retention Policies tab uses `useRetentionPolicies` and shows each policy's entity type, scope (`global` or organisation), retention period in human-readable form, action (`archive` or `delete`), and active status. The Legal Holds tab uses `useLegalHolds` and supports scope at the organisation, entity-type, or specific record level. The Lifecycle Events tab uses `useLifecycleEvents` to display an immutable audit trail of `archived`, `deleted`, `hold_placed`, and `hold_removed` events. CRUD operations on policies and holds require `pf.data-retention.manage` and `pf.legal-holds.manage` respectively, enforced by inner `PermissionGate` guards around the action buttons.

## Who it's for

Requires permission `pf.data-retention.manage`. Legal hold mutations also require `pf.legal-holds.manage`.

## Before you start

* You must hold `pf.data-retention.manage` to access this page.
* Consult legal and compliance teams before creating, modifying, or removing policies or holds.

## Steps

<Steps>
  <Step title="Open Data Retention">
    Navigate to `/settings/data-retention`. The **Retention Policies** tab is active by default.
  </Step>

  <Step title="Add or edit a retention policy">
    On the **Retention Policies** tab, click **Add Policy** (requires `pf.data-retention.manage`). Fill in the entity type, scope, retention period, and action in the `RetentionPolicyDialog`.
  </Step>

  <Step title="Manage legal holds">
    Switch to the **Legal Holds** tab. Click **Place Legal Hold** to open `LegalHoldDialog` and specify the scope. To release an active hold, click **Remove** on the hold row.
  </Step>

  <Step title="Review lifecycle events">
    Switch to the **Lifecycle Events** tab to see a read-only audit trail of archival, deletion, and hold events with timestamps and reasons.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Retention policy scope">
    A `global` scope applies the policy across all organisations (platform-wide). An organisation-scoped policy applies only to the current organisation.
  </Accordion>

  <Accordion title="Legal hold scope">
    Holds can target the entire organisation (`org-wide`), a specific entity type, or a single record (`record_id` set). Holds with no `entity_type` are shown as "Organisation-wide".
  </Accordion>

  <Accordion title="Lifecycle events">
    Events are written by platform processes when retention actions execute or holds change. This tab is read-only and cannot be edited.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Platform Foundation" icon="layer-group" href="/pf/overview">
    Platform Foundation overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/platform.tsx
  * src/platform/data-retention/pages/DataRetentionPage.tsx
  * src/platform/data-retention/index.ts
</Accordion>
