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

# configure()

> Initialize the Encore SDK with your public API key

Configures the shared Encore instance for use throughout your app. This must be called once, typically in your `Application.onCreate()`, before using any other SDK methods.

<Warning>
  Call `configure()` before using any other SDK methods. Failure to do so will result in `EncoreError.Integration.NotConfigured` errors.
</Warning>

## Signature

```kotlin theme={null}
fun configure(
    context: Context,
    apiKey: String,
    logLevel: LogLevel = LogLevel.NONE
)
```

## Parameters

| Name       | Type                    | Default         | Description                                                  |
| ---------- | ----------------------- | --------------- | ------------------------------------------------------------ |
| `context`  | Context                 | —               | Your application context                                     |
| `apiKey`   | String                  | —               | Your Live Key or Test Key from the Encore Dashboard settings |
| `logLevel` | [LogLevel](#log-levels) | `LogLevel.NONE` | Logging verbosity level                                      |

### Log levels

```kotlin theme={null}
enum class LogLevel(val level: Int) {
    NONE(0),    // No logging (recommended for production)
    ERROR(1),   // Only errors
    WARN(2),    // Warnings and errors
    INFO(3),    // Milestones, warnings, and errors
    DEBUG(4),   // Everything (verbose, development only)
}
```

<Info>
  Higher levels include all lower levels. For example, `INFO` will also show warnings and errors.
</Info>

### API keys

Encore supports two types of API keys:

| Key Type     | Format        | Description                                                                                                        |
| ------------ | ------------- | ------------------------------------------------------------------------------------------------------------------ |
| **Live Key** | `pk_live_...` | Production key with standard geo-filtering based on offers' configured regions                                     |
| **Test Key** | `pk_test_...` | Testing key that bypasses geo-filtering, allowing you to test the complete entitlement lifecycle from any location |

<Info>
  Use the test key (`pk_test_...`) during development to test offers from any location without geo-filtering restrictions. This makes it easy to test the entire entitlement lifecycle end-to-end for a single user.
</Info>

<Warning>
  Always use your live key (`pk_live_...`) in production builds. The test key is for development and testing only.
</Warning>

## Usage

### Basic Configuration

```kotlin theme={null}
class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Encore.shared.configure(this, apiKey = "pk_your_api_key")
    }
}
```

### With Debug Logging (Development)

```kotlin theme={null}
Encore.shared.configure(
    context = this,
    apiKey = "pk_your_api_key",
    logLevel = if (BuildConfig.DEBUG) LogLevel.DEBUG else LogLevel.NONE
)
```

### Using Test Key for Development

Use the test key to test offers from any location without geo-filtering:

```kotlin theme={null}
Encore.shared.configure(
    context = this,
    apiKey = if (BuildConfig.DEBUG) "pk_test_your_key" else "pk_live_your_key",
    logLevel = if (BuildConfig.DEBUG) LogLevel.DEBUG else LogLevel.NONE
)
```

<Tip>
  The test key (`pk_test_...`) is perfect for comprehensive end-to-end testing of the entitlement lifecycle, allowing you to test location-restricted offers from anywhere during development.
</Tip>

<Tip>
  Use `LogLevel.DEBUG` during development to see detailed SDK logs, then use `LogLevel.NONE` for production builds.
</Tip>
