> ## 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 dynamic secret

> Fetch a dynamic secret by name with the Python SDK.

`client.dynamic_secrets.get_by_name()` fetches a [dynamic secret](https://infisical.com/docs/documentation/platform/dynamic-secrets/overview) by its name.

## Parameters

**name** `str` *required*

The name of the dynamic secret.

**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

**dynamic\_secret** `DynamicSecret`

The dynamic secret, with its `id`, `name`, `type`, TTLs, and provider settings in `inputs`.

```python Basic theme={"dark"}
dynamic_secret = client.dynamic_secrets.get_by_name(
    name="postgres-readonly",
    project_slug="<project-slug>",
    environment_slug="dev",
)
```

```json Response theme={"dark"}
{
  "id": "4d5e6f7a-8b9c-4d0e-1f2a-3b4c5d6e7f8a",
  "name": "postgres-readonly",
  "type": "sql-database",
  "defaultTTL": "1h",
  "maxTTL": "24h",
  "folderId": "3a1f6c2e-9b4d-4e7a-8c5f-2d1e0b9a8c7f",
  "version": 1,
  "status": null,
  "statusDetails": null,
  "metadata": [],
  "inputs": {
    "client": "postgres",
    "host": "<postgres-host>",
    "port": 5432,
    "database": "app"
  },
  "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.