> For the complete documentation index, see [llms.txt](https://docs.eximee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/scriptcode/skrypty-scriptservice/api-skryptow/platform-services/pobieranie-konfiguracji-aplikacji.md).

# Retrieving application configuration

Interface `api.config.v1` allows reading the platform's global configuration parameters of Eximee directly from the business logic code. Using this API makes it possible to decouple scripts from "hardcoded" values (so-called hardcoding), which makes it easier to manage URLs of external services, business constants, or feature flags across different environments (test, production, etc.).

{% hint style="warning" %}
**Requirements and availability:**

* **Platform version:** Functionality available from version **3.190.0**.
* **Runtime context:** The functionality works only on requests run as **Business Application**.
  {% endhint %}

{% hint style="info" %}
The configuration API can be used globally, across all types of programming inserts: in scripts (`scriptService`), process tasks (`scriptTask`) and script validators (`validationScript`).
{% endhint %}

## API methods

The configuration interface provides two main data read methods. They always return text values (`String`). When storing numbers or complex structures (e.g. JSON), the developer must parse the result themselves.

| Method                            | Return type | Operation description                                                                                                                                                            |
| --------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `get(key)`                        | `String`    | Retrieves the assigned value for the specified key. If the key does not exist in the configuration, the method **throws an exception**.                                          |
| `getOrDefault(key, defaultValue)` | `String`    | Retrieves the value for the key. If the key does not exist or has not been set, the method returns the specified value `defaultValue` without interrupting the script execution. |

## Usage examples

It is recommended to use the method `getOrDefault` to retrieve parameters that are not critical for process operation, whereas the method `get` in a `try-catch` block for mandatory parameters, so that missing configuration can be handled precisely.

```javascript
function callService(context) {
    let appUrl;
    let timeoutLimit;
    
    // 1. Safely retrieve the required key with error handling (try-catch)
    try {
        appUrl = api.config.v1.get("application.url");
    } catch (error) {
        Logger.warn("Missing critical key 'application.url' in configuration: {}", error);
        appUrl = "[https://default.url.com](https://default.url.com)"; // Assign fallback value
    }
    
    // 2. Retrieve with a default value - recommended solution, shorter to write
    timeoutLimit = api.config.v1.getOrDefault("integration.timeout_ms", "5000");
    
    // Return the retrieved values (they can be used, for example, as input parameters to ServiceProxy)
    return [{
        'url': appUrl, 
        'timeout': timeoutLimit
    }];
}
```

{% hint style="info" %}
**More information:** [**Configuration from Low-code**](https://docs.eximee.com/documentation/documentation-en/zarzadzanie-aplikacja-biznesowa/zarzadzanie-konfiguracja/konfiguracja-aplikacji-biznesowej-serwer-konfiguracji/konfiguracja-z-poziomu-low-code.md)
{% endhint %}


---

# 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://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/scriptcode/skrypty-scriptservice/api-skryptow/platform-services/pobieranie-konfiguracji-aplikacji.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.
