> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-docs-add-auth0-cli-management-api-examples.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Describes how to configure session lifetime for a tenant using the Auth0 Dashboard, the Management API and Actions.

# Configure Session Lifetime

To configure a session lifetime, you can use the Auth0 [Dashboard](/docs/get-started/auth0-overview/dashboard), [Management API](https://auth0.com/docs/api/management/v2), or a [Post-Login Action](/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger).

## Auth0 Dashboard

To configure the session lifetime using Auth0 Dashboard:

1. Navigate to **Dashboard > Tenant Settings** and select the **Advanced** view.

2. Under **Session Expiration**, you can configure:

| Session Policy                                | Description                                                                               |
| --------------------------------------------- | ----------------------------------------------------------------------------------------- |
| **Idle Session Lifetime (Persistent)**        | Maximum time (in minutes) of inactivity before a persistent session expires.              |
| **Idle Session Lifetime (Non-Persistent)**    | Maximum time (in minutes) of inactivity before a non-persistent session expires.          |
| **Maximum Session Lifetime (Persistent)**     | Maximum time (in minutes) a persistent session can exist, even if the user is active.     |
| **Maximum Session Lifetime (Non-Persistent)** | Maximum time (in minutes) a non persistent session can exist, even if the user is active. |

<Frame>
  <img src="https://mintcdn.com/docs-dev-docs-add-auth0-cli-management-api-examples/NMhIvzx2mb9yct8L/docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png?fit=max&auto=format&n=NMhIvzx2mb9yct8L&q=85&s=ccf5bd1aa7fd522c9be08d9b66e6accf" alt="Dashboard > Tenant > Settings > Advanced > Session Expiration" data-og-width="1404" width="1404" data-og-height="995" height="995" data-path="docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-docs-add-auth0-cli-management-api-examples/NMhIvzx2mb9yct8L/docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png?w=280&fit=max&auto=format&n=NMhIvzx2mb9yct8L&q=85&s=f6b7c2818f43ed7c621550335f6df9dd 280w, https://mintcdn.com/docs-dev-docs-add-auth0-cli-management-api-examples/NMhIvzx2mb9yct8L/docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png?w=560&fit=max&auto=format&n=NMhIvzx2mb9yct8L&q=85&s=cd29d7cc9c004e1528ad26463a78feeb 560w, https://mintcdn.com/docs-dev-docs-add-auth0-cli-management-api-examples/NMhIvzx2mb9yct8L/docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png?w=840&fit=max&auto=format&n=NMhIvzx2mb9yct8L&q=85&s=8ef6b08a71d6a50468abe2837fa184c4 840w, https://mintcdn.com/docs-dev-docs-add-auth0-cli-management-api-examples/NMhIvzx2mb9yct8L/docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png?w=1100&fit=max&auto=format&n=NMhIvzx2mb9yct8L&q=85&s=be7a4c78173d467d8f5c9b632f09c452 1100w, https://mintcdn.com/docs-dev-docs-add-auth0-cli-management-api-examples/NMhIvzx2mb9yct8L/docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png?w=1650&fit=max&auto=format&n=NMhIvzx2mb9yct8L&q=85&s=ecb4c9b7535e5d452f5b5f805ddd51b8 1650w, https://mintcdn.com/docs-dev-docs-add-auth0-cli-management-api-examples/NMhIvzx2mb9yct8L/docs/images/cdy7uua7fh8z/session-lifetime/Dashboard-Tenant-Settings-Advanced-Session-expiration.png?w=2500&fit=max&auto=format&n=NMhIvzx2mb9yct8L&q=85&s=1ee8da072cbdd89fd0c612424b489ca6 2500w" />
</Frame>

## Auth0 Management API

To configure the session lifetime using the Auth0 Management API:

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  Calls to the `/api/v2/tenants/settings` endpoint require a [Management API access token](/docs/secure/tokens/access-tokens) with the `update:tenant_settings` scope.
</Callout>

Make a `PATCH` request to the [/api/v2/tenants/settings](/docs/api/management/v2/tenants/patch-settings) endpoint:

<Tabs>
  <Tab title="Auth0 CLI">
    ```bash theme={null}
    auth0 api patch "tenants/settings" \
      --data '{     "session_lifetime": SESSION_LIFETIME_VALUE,     "idle_session_lifetime": IDLE_SESSION_LIFETIME_VALUE,     "ephemeral_session_lifetime": EPHEMERAL_SESSION_LIFETIME_VALUE,     "idle_ephemeral_session_lifetime": EPHEMERAL_IDLE_SESSION_LIFETIME_VALUE   }'
    ```

    <Note>Not logged in? [Set up and authenticate the Auth0 CLI](https://auth0.com/docs/deploy-monitor/auth0-cli) first.</Note>
  </Tab>

  <Tab title="cURL">
    ```bash cURL theme={null}
    curl --request PATCH \
      --url 'https://<your-domain>/api/v2/tenants/settings' \
      --header 'Authorization: Bearer MGMT_API_ACCESS_TOKEN' \
      --header 'Content-Type: application/json' \
      --data '{\
        "session_lifetime": SESSION_LIFETIME_VALUE,\
        "idle_session_lifetime": IDLE_SESSION_LIFETIME_VALUE,\
        "ephemeral_session_lifetime": EPHEMERAL_SESSION_LIFETIME_VALUE,\
        "idle_ephemeral_session_lifetime": EPHEMERAL_IDLE_SESSION_LIFETIME_VALUE\
      }'
    ```
  </Tab>
</Tabs>

| Parameter                         | Description                                                             |
| --------------------------------- | ----------------------------------------------------------------------- |
| `session_lifetime`                | Maximum duration (in hours) for absolute timeout.                       |
| `idle_session_lifetime`           | Maximum duration (in hours) before a session expires due to inactivity. |
| `ephemeral_session_lifetime`      | Maximum duration (in hours) for absolute timeout.                       |
| `idle_ephemeral_session_lifetime` | Maximum duration (in hours) before a session expires due to inactivity. |

## Auth0 Post-Login Actions

You can configure session behavior dynamically using `api.session` methods with a [post-login Action](/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger). This allows you to override default tenant session settings on a per-login basis, based on user or context-specific logic.

Use cases include:

* Shortening timeouts for high-risk logins

* Extending timeouts for trusted users or organizations

* Adjusting cookie persistence based on application type

The `api.session` methods available to configure session lifetimes are:

* `api.session.setExpiresAt`

* `api.session.setIdleExpiresAt`

* `api.session.setCookieMode`

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  The `api.session` methods only apply to the current session and must be called during the login transaction. These methods require that the event property `event.session.id` is available.
</Callout>

To learn more, read [Sessions with Actions](/docs/manage-users/sessions/manage-sessions-actions).
