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

# SpendOwlConfiguration

> Configuration options for the SDK

# SpendOwlConfiguration

Configuration struct for customizing SDK behavior.

```swift theme={null}
public struct SpendOwlConfiguration: Sendable
```

## Initializer

```swift theme={null}
public init(
    apiKey: String,
    baseURL: URL = URL(string: "https://spendowl.io/api")!,
    timeoutInterval: TimeInterval = 10,
    maxRetries: Int = 3
)
```

### Parameters

<ParamField path="apiKey" type="String" required>
  Your SpendOwl API key from the [dashboard](https://spendowl.io/dashboard).
</ParamField>

<ParamField path="baseURL" type="URL" default="https://spendowl.io/api">
  The API base URL. Only change for testing or if instructed by support.
</ParamField>

<ParamField path="timeoutInterval" type="TimeInterval" default="10">
  Network request timeout in seconds.
</ParamField>

<ParamField path="maxRetries" type="Int" default="3">
  Maximum retry attempts for failed requests. Client errors (4xx) are not retried.
</ParamField>

## Properties

### apiKey

```swift theme={null}
public let apiKey: String
```

Your SpendOwl API key.

***

### baseURL

```swift theme={null}
public let baseURL: URL
```

The base URL for API requests.

**Default:** `https://spendowl.io/api`

***

### timeoutInterval

```swift theme={null}
public let timeoutInterval: TimeInterval
```

Network request timeout in seconds.

**Default:** `10`

<Tip>
  Increase this value if users experience timeout issues on slow networks.
</Tip>

***

### maxRetries

```swift theme={null}
public let maxRetries: Int
```

Maximum retry attempts for transient failures.

**Default:** `3`

**Retry Behavior:**

* Network errors are retried with exponential backoff
* Server errors (5xx) are retried
* Client errors (4xx) are **not** retried

***

## Usage Examples

### Basic Configuration

For most apps, use the simple API key initializer:

```swift theme={null}
SpendOwl.configure(apiKey: "spendowl_live_xxx")
```

### Custom Timeout

For apps used on slower networks:

```swift theme={null}
let config = SpendOwlConfiguration(
    apiKey: "spendowl_live_xxx",
    timeoutInterval: 30
)
SpendOwl.configure(config)
```

### Aggressive Retries

For critical attribution tracking:

```swift theme={null}
let config = SpendOwlConfiguration(
    apiKey: "spendowl_live_xxx",
    maxRetries: 5
)
SpendOwl.configure(config)
```

### Testing Configuration

For integration tests:

```swift theme={null}
let config = SpendOwlConfiguration(
    apiKey: "spendowl_test_xxx",
    baseURL: URL(string: "https://staging.spendowl.io/api")!,
    timeoutInterval: 5,
    maxRetries: 1
)
SpendOwl.configure(config)
```

## Sendable Conformance

`SpendOwlConfiguration` conforms to `Sendable`, making it safe to pass across concurrency boundaries:

```swift theme={null}
Task {
    let config = SpendOwlConfiguration(apiKey: "xxx")
    await MainActor.run {
        SpendOwl.configure(config)
    }
}
```

## Related

<CardGroup cols={2}>
  <Card title="SpendOwl" icon="code" href="/api-reference/spendowl">
    Main SDK class
  </Card>

  <Card title="Configuration Guide" icon="gear" href="/sdk/configuration">
    Configuration guide
  </Card>
</CardGroup>
