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

# Get a lease

> Fetch a dynamic secret lease with the Python SDK.

`client.dynamic_secrets.leases.get()` fetches a lease, such as to check when it expires.

## Parameters

**lease\_id** `str` *required*

The ID of the lease.

**project\_slug** `str` *required*

The slug of the project.

**environment\_slug** `str` *required*

The slug of the environment, such as `dev`.

**path** `str` (default: /)

The path of the folder that the dynamic secret is in.

## Returns

**lease** `DynamicSecretLease`

The lease, with its expiry time in `expireAt` and its dynamic secret in `dynamicSecret`. The lease doesn't include the credentials.

```python Basic theme={"dark"}
lease = client.dynamic_secrets.leases.get(
    lease_id="<lease-id>",
    project_slug="<project-slug>",
    environment_slug="dev",
)

print(lease.expireAt)
```

```json Response theme={"dark"}
{
  "id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
  "version": 1,
  "externalEntityId": "inf_a8f3k2",
  "expireAt": "2026-12-02T11:30:00.000Z",
  "status": null,
  "statusDetails": null,
  "dynamicSecretId": "4d5e6f7a-8b9c-4d0e-1f2a-3b4c5d6e7f8a",
  "createdAt": "2026-12-02T11:00:00.000Z",
  "updatedAt": "2026-12-02T11:00:00.000Z",
  "dynamicSecret": {
    "id": "4d5e6f7a-8b9c-4d0e-1f2a-3b4c5d6e7f8a",
    "name": "postgres-readonly",
    "type": "sql-database",
    "defaultTTL": "1h",
    "maxTTL": "24h",
    "folderId": "3a1f6c2e-9b4d-4e7a-8c5f-2d1e0b9a8c7f",
    "version": 1,
    "createdAt": "2026-11-20T08:15:42.000Z",
    "updatedAt": "2026-11-20T08:15:42.000Z"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.