> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getruntimesetting.md).

# GetRuntimeSetting

**New in BoxLang 1.19.0**

Retrieve a user-defined runtime setting. Settings are defined in the `runtimeSettings` struct of `boxlang.json` and can be overridden (deep merged) by `this.runtimeSettings` in the Application descriptor. Values support `${env.X}` placeholders and `bxsecret:` values. The returned values are read-only.

Use a dotted path to reach nested values, e.g. \`features.beta\`. Array elements can be reached with a 1-based index, e.g. \`limits.1\`. If no key is passed, the whole merged settings struct is returned.

If the key is not found and no default is provided, an exception is thrown.

## Method Signature

```
GetRuntimeSetting(key=[String], defaultValue=[Any])
```

### Arguments

| Argument       | Type     | Required | Description                                                                        | Default |
| -------------- | -------- | -------- | ---------------------------------------------------------------------------------- | ------- |
| `key`          | `String` | `false`  | The name or dotted path of the setting to retrieve. Omit to retrieve all settings. |         |
| `defaultValue` | `Any`    | `false`  | The default value to return if the setting is not found                            |         |

## Examples

### Get a setting

```java
// boxlang.json: "runtimeSettings": { "apiUrl": "${env.API_URL:http://localhost}" }
apiUrl = getRuntimeSetting( "apiUrl" )
```

### Nested values and array indexes

```java
// "runtimeSettings": { "features": { "beta": true, "regions": [ "us", "eu" ] } }
isBeta = getRuntimeSetting( "features.beta" )
firstRegion = getRuntimeSetting( "features.regions.1" )
```

### With a default value

```java
timeout = getRuntimeSetting( "timeout", 30 )
```

### All settings

```java
all = getRuntimeSetting()
```

## Related

* [Runtime Settings](https://boxlang.ortusbooks.com/getting-started/configuration/runtime-settings.md)
* [GetSystemSetting](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getsystemsetting.md)
* [GetApplicationMetadata](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getapplicationmetadata.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getruntimesetting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
