# TenantRetention

A tenant's run retention: how long a run that has ended is kept before Maitento deletes it, where that period comes from, and how many runs the tenant is keeping with retention leases.

**Kind:** an object, used in responses.

## Fields

Every field is present in a response; empty ones are `null`.

| Field | Type | Description |
|---|---|---|
| `tenantId` | `uuid` | The tenant's id. |
| `effectiveHours` | `integer` | The retention that applies, in hours: the override when there is one, otherwise the platform default. |
| `source` | [`TenantRetentionSource`](https://docs.maitento.com/reference/types/tenant-retention-source.md) | Where the retention that applies comes from. |
| `overrideHours` | `integer \| null` | The tenant's override in hours, or null when the platform default applies. |
| `platformDefaultHours` | `integer` | The platform default, in hours (72 unless the platform is configured otherwise). |
| `minHours` | `integer` | The shortest override the platform allows, in hours. |
| `maxHours` | `integer` | The longest override the platform allows, in hours. |
| `planMaxHours` | `integer \| null` | The longest the tenant's plan keeps a run, in hours: a tenant admin can set the retention up to it. Null when the plan sets no limit. |
| `resumableHours` | `integer` | How long, in hours, a failed or killed code pipeline run stays resumable. Such a run is never deleted sooner, whatever the retention. |
| `activeLeases` | `integer` | How many runs the tenant is keeping with a lease of their own right now (inherited leases don't count). |
| `maxActiveLeases` | `integer` | The most leases of their own the tenant's runs may hold at once. |

## Example

```json
{
  "tenantId": "3f2b8c1e-5d4a-4e6b-9c7d-2a1b0c9d8e7f",
  "effectiveHours": 0,
  "source": "PlatformDefault",
  "overrideHours": 0,
  "platformDefaultHours": 0,
  "minHours": 0,
  "maxHours": 0,
  "planMaxHours": 0,
  "resumableHours": 0,
  "activeLeases": 0,
  "maxActiveLeases": 0
}
```

## Where it's used

- [`tenant.retention`](https://docs.maitento.com/reference/api/tenant.md) (`GET /tenants/self/retention`)
- [`tenant.setRetention`](https://docs.maitento.com/reference/api/tenant.md) (`PUT /tenants/self/retention`)
