# Tenant settings

5 calls. Every request needs the `Authorization` header: see [the overview](https://docs.maitento.com/reference.md).

## `tenant.modelAccess`

```http
GET /tenants/self/model-access
```

Whether the tenant's runs may fall back to the platform's own provider keys, and whether it has keys of its own. When `forbidMaitentoCredentials` is true, every model call needs a key the run supplies or a tenant model key.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Ftenants%2Fself%2Fmodel-access).

**Response:** [`TenantModelAccess`](https://docs.maitento.com/reference/types/tenant-model-access.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/tenants/self/model-access" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const { forbidMaitentoCredentials, hasModelKeys } = await mt.tenant.modelAccess();
```
```python title="Python"
mt.tenant.model_access()
```

## `tenant.retention`

```http
GET /tenants/self/retention
```

How long finished runs are kept, and the lease limits.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Ftenants%2Fself%2Fretention).

**Response:** [`TenantRetention`](https://docs.maitento.com/reference/types/tenant-retention.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/tenants/self/retention" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const retention = await mt.tenant.retention();
```
```python title="Python"
mt.tenant.retention()
```

## `tenant.setRetention`

```http
PUT /tenants/self/retention
```

Sets how long finished runs are kept, in hours, up to the plan's `planMaxHours` (`Tenant.Admin`); `hours: null` goes back to the platform default.

**Who can call it:** Tenant admins only, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Ftenants%2Fself%2Fretention).

**Request body:** [`TenantRetentionRequest`](https://docs.maitento.com/reference/types/tenant-retention-request.md)

| Field | Type | Required | Description |
|---|---|---|---|
| `hours` | `integer \| null` |  | How long the tenant's runs are kept once they end, in whole hours: at least `TenantRetention.MinHours`, and at most the plan's `TenantRetention.PlanMaxHours` (and the platform's `MaxHours`). Null goes back to the platform default. |

**Response:** [`TenantRetention`](https://docs.maitento.com/reference/types/tenant-retention.md) (200)

```bash title="curl"
curl -X PUT "https://api.maitento.com/tenants/self/retention" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '{"hours":0}'
```
```ts title="TypeScript"
await mt.tenant.setRetention({ hours: 7 * 24 });
```
```python title="Python"
mt.tenant.set_retention(hours=7 * 24)
```

## `tenant.webAccess`

```http
GET /tenants/self/web-access
```

The tenant's web-access settings (its default web-download partition).

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Ftenants%2Fself%2Fweb-access).

**Response:** [`WebAccessSettings`](https://docs.maitento.com/reference/types/web-access-settings.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/tenants/self/web-access" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const settings = await mt.tenant.webAccess();
```
```python title="Python"
mt.tenant.web_access()
```

## `tenant.setWebAccess`

```http
PUT /tenants/self/web-access
```

Replaces the tenant's web-access settings (Tenant.Admin).

**Who can call it:** Tenant admins only, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Ftenants%2Fself%2Fweb-access).

**Request body:** [`WebAccessSettingsInput`](https://docs.maitento.com/reference/types/web-access-settings.md#in-a-request)

| Field | Type | Required | Description |
|---|---|---|---|
| `defaultWebDownloadPartitionId` | `uuid \| null` |  | The temporary partition web downloads go to by default. Null: none is set here (sending null clears it). |

**Response:** [`WebAccessSettings`](https://docs.maitento.com/reference/types/web-access-settings.md) (200)

```bash title="curl"
curl -X PUT "https://api.maitento.com/tenants/self/web-access" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '{"defaultWebDownloadPartitionId":"..."}'
```
```ts title="TypeScript"
await mt.tenant.setWebAccess({ defaultWebDownloadPartitionId: "d6e5f4a3-b2c1-4d0e-9f8a-7b6c5d4e3f2a" });
```
```python title="Python"
mt.tenant.set_web_access(default_web_download_partition_id="4b5c6d7e-8f9a-4b0c-9d1e-2f3a4b5c6d7e")
```
