# configure()

A static method that configures the Superwall SDK with your API key.

> **Note**

This method is typically called once in your app's initialization, such as in your `main()` function or during app startup.



Purpose [#purpose]

Configures the Superwall SDK with your API key and optional configuration settings.

Signature [#signature]

## Tab

```dart Flutter
static Superwall configure(
  String apiKey, {
  PurchaseController? purchaseController,
  SuperwallOptions? options,
  Function? completion,
})
```

## Tab

```swift iOS
static func configure(
  apiKey: String,
  purchaseController: PurchaseController? = nil,
  options: SuperwallOptions? = nil,
  completion: ((Result<Void, Error>) -> Void)? = nil
)
```

## Tab

```kotlin Android
fun configure(
  application: Application,
  apiKey: String,
  purchaseController: PurchaseController? = null,
  options: SuperwallOptions? = null,
  completion: ((Result<Unit>) -> Unit)? = null
)
```



Parameters [#parameters]

<TypeTable
  type="{
  apiKey: {
    type: &#x22;String&#x22;,
    description: &#x22;Your Superwall API key from the dashboard.&#x22;,
    required: true,
  },
  purchaseController: {
    type: &#x22;PurchaseController?&#x22;,
    description: &#x22;Optional custom purchase controller.&#x22;,
    default: &#x22;`null` to use the default controller&#x22;,
  },
  options: {
    type: &#x22;SuperwallOptions?&#x22;,
    description: &#x22;Optional configuration options.&#x22;,
    default: &#x22;`null` for default settings&#x22;,
  },
  completion: {
    type: &#x22;Function?&#x22;,
    description: &#x22;Optional callback called when configuration completes.&#x22;,
  },
}"
/>

Returns / State [#returns--state]

Returns a `Superwall` instance that is immediately configured and ready to use.

Usage [#usage]

Basic configuration:

```dart
import 'package:superwallkit_flutter/superwallkit_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  Superwall.configure('pk_your_api_key_here');
  
  runApp(MyApp());
}
```

With options:

```dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  final options = SuperwallOptions(
    paywalls: PaywallOptions(
      shouldPreload: true,
      automaticallyDismiss: false,
    ),
    logging: Logging(
      level: LogLevel.debug,
    ),
  );
  
  Superwall.configure(
    'pk_your_api_key_here',
    options: options,
  );
  
  runApp(MyApp());
}
```

With completion callback:

```dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  Superwall.configure(
    'pk_your_api_key_here',
    completion: () {
      print('Superwall configuration completed');
    },
  );
  
  runApp(MyApp());
}
```