---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/hi/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/ko/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/ru/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/tr/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/vi/sdk/sdk-config.md
  - https://yandex.com/dev/games/doc/zh/sdk/sdk-config.md
  - href: en/sdk/sdk-config.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/en/llms.txt

# Remote configuration

<!-- source: en/_includes/script-common.md -->
<!-- source: en/_includes/script/index-js.md -->

<!-- endsource: en/_includes/script/index-js.md -->

<!-- source: en/_includes/script/requirements-js.md -->

<!-- endsource: en/_includes/script/requirements-js.md -->

<!-- source: en/_includes/script/image-modal-js.md -->

<!-- endsource: en/_includes/script/image-modal-js.md -->
<!-- endsource: en/_includes/script-common.md -->

To retrieve a remote flag configuration (Remote Config), use the `ysdk.getFlags()` method from the Yandex Games SDK. We recommend requesting the flags once at your game startup.

**Signature and interfaces of the method** {#signature-and-interfaces}

```typescript showLineNumbers
interface IFlags {
    [key: string]: string;
}

interface IClientFeature {
    name: string;
    value: string;
}

interface IGetFlagsParams {
    defaultFlags?: IFlags;
    clientFeatures?: IClientFeature[];
}

function getFlags(getFlagsParams: IGetFlagsParams = {}): IFlags {}
```

Accepts parameters:

<div class="table-25 table-2c25">

#|
|| **Parameter** | **Type** | **Description** ||
|| `name` | `string` | Client parameter name. ||
|| `value` | `string` | Client parameter value. ||
|| `defaultFlags` | `IFlags` | [Local configuration](#local-config): a flat object with key-value pairs. Corresponds to the remote configuration [set](https://yandex.com/dev/games/doc/en/config.md) in the Console. ||
|| `clientFeatures` | `IClientFeature[]` | Array with [client parameters](#client-params). Contains [player data](https://yandex.com/dev/games/doc/en/sdk/sdk-player.md#profile-data). ||
|#

</div>

#### Example {#example-getflags}

```javascript showLineNumbers
const ysdk = await YaGames.init();

const flags = await ysdk.getFlags(); // This method returns an object with flags.

// You can add this condition to your game logic:
if (flags.difficult === 'hard') {
    // Increasing the game difficulty.
}
```


## Local configuration {#local-config}

{% note tip %}

Always embed local flag configuration in the game code in case the remote configuration cannot be retrieved from the server (for example, due to internet connection issues).

{% endnote %}

To add local configuration (a flat object containing string values), pass it in the additional parameter of the `ysdk.getFlags()` method, in the `defaultFlags` field. The resulting object is a combination of the remote and local configurations. The remote configuration has a higher priority.

#### Example {#example-local-config}

```javascript showLineNumbers
const ysdk = await YaGames.init();

const flags = await ysdk.getFlags({ defaultFlags: { difficult: 'easy' } });

if (flags.difficult === 'easy') {

}
```


## Client parameters {#client-params}

If your game stores [player data](https://yandex.com/dev/games/doc/en/sdk/sdk-player.md) (completed levels, experience, in-app purchases, etc.), it can be used in remote configuration. For more information on how to configure a flag based on conditions, see [Step 1. Create a flag configuration](https://yandex.com/dev/games/doc/en/config.md#create-flag-config).

Client parameters must be passed as an array in the `clientFeatures` field of the `ysdk.getFlags()` method.

#### Example {#example-client-params}

```javascript showLineNumbers
const ysdk = await YaGames.init();

const player = await ysdk.getPlayer();

const payingStatus = player.getPayingStatus();

// Requesting the flags with the client parameter containing the user's payment activity status.
const flags = await ysdk.getFlags({
    clientFeatures: [
        { name: 'payingStatus', value: payingStatus }
    ]
});
```

---

<!-- source: en/_includes/sdk-support.md -->
{% note info %}

Our support team can help publish finished games on Yandex Games. If you have any questions about development or testing, ask them in the [Discord channel](https://discord.com/invite/wU4p3whr4T){.external}.

{% endnote %}

If you are facing an issue or have a question regarding the use of Yandex Games SDK, please contact support:

<!-- source: en/_includes/button-chat.md -->
<a href="https://yandex.com/chat/#/user/a4fa5c06-75db-9b38-6eea-b1673785f7d5">
  <span class="button">Write to chat</span>
</a>
<!-- endsource: en/_includes/button-chat.md -->
<!-- endsource: en/_includes/sdk-support.md -->
