> ## 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 the SDK

> Initialize the Encore SDK with your API key at app launch.

## Overview

As soon as your app launches, you need to configure the SDK with your **API Key**. Retrieve your publishable **Live** key yourself from the Dashboard under **Settings → Project API Keys** (use the **Test** key for staging and local development).

***

## Initialize Encore in Your App

Edit your main `App` struct to configure Encore at launch:

```swift theme={null}
import SwiftUI
import Encore

@main
struct YourApp: App {
    init() {
        // Configure Encore with your API key
        Encore.shared.configure(apiKey: "pk_live_your_key")
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
```

This configures a shared instance of `Encore`, the primary class for interacting with the SDK's API. Make sure to replace `pk_live_your_key` with your publishable API key.

<Note>
  Can't find your API key? Open your project's **Settings → Project API Keys** in the [Encore Dashboard](https://dashboard.encorekit.com) and copy the **Live** key `pk_live_…` (or the **Test** key `pk_test_…` for non-production builds).
</Note>

***

## Options: Logging and Unlock Mode

`configure(apiKey:options:)` accepts an `Options` value for runtime behavior:

```swift theme={null}
Encore.shared.configure(
    apiKey: "pk_live_your_key",
    options: .init(
        logLevel: .info,      // .none (default), .error, .warn, .info, .debug
        unlock: .optimistic   // .optimistic (default) or .strict
    )
)
```

* **`logLevel`** — verbosity of SDK logs. Use `.debug` during development; leave it `.none` in production.
* **`unlock`** — when entitlements are granted after an offer flow:
  * `.optimistic` (default) grants immediately when the user returns from the offer (a **provisional** grant, later verified by the backend).
  * `.strict` waits for advertiser postback verification before granting.

See [`configure()` reference → Unlock mode](../sdk-reference/configure#unlock-mode) and [EntitlementScope](../sdk-reference/entitlement-scope#two-phase-entitlements-provisional-vs-verified) for the two-phase model.

***

## Next Steps

Now that Encore is configured, you're ready to:

* [User Management](./user-management) - Identify users for entitlement tracking
* [Present Offers](./present-offers) - Show promotional offers and handle purchase results
