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

# Quickstart — iOS SDK

> Integrate clickwrap agreements into your native iOS app in under 5 minutes.

<Note>
  **Latest SDK versions:** Web `2.5.0` · Android `2.4.0` · iOS `1.3.0` · React Native `1.2.0` — [View changelog](/dev/resources/changelog)
</Note>

This guide walks you through displaying a clickwrap agreement in an iOS app and verifying the result on your backend.

## Prerequisites

1. A [ClickTerm account](https://app.clickterm.com/auth/registration)
2. A **published template** with an effective version (see [Product Guide](/product/getting-started/first-clickwrap))
3. An **integration** with your App ID and App Key (from [Integrations](https://app.clickterm.com/integrations))
4. iOS 15.0+, Swift 5.9+, and Xcode 15.0+

<Info>
  Need to set up your credentials and template first? See [Creating an app & template](/dev/guides/creating-app-and-template).
</Info>

## 1. Add the SDK

Choose Swift Package Manager or add the XCFramework directly. Both options use the same prebuilt SDK from the ClickTerm CDN and do not require access to the SDK source repository.

<Tabs>
  <Tab title="Swift Package Manager">
    Create a small local package with this `Package.swift`:

    ```swift Package.swift theme={null}
    // swift-tools-version: 5.9
    import PackageDescription

    let package = Package(
        name: "ClicktermSDKBinary",
        platforms: [
            .iOS(.v15)
        ],
        products: [
            .library(
                name: "ClicktermSDK",
                targets: ["ClicktermSDK"]
            )
        ],
        targets: [
            .binaryTarget(
                name: "ClicktermSDK",
                url: "https://cdn.clickterm.com/sdk/ios/release/1.2.0/ClicktermSDK.xcframework.zip",
                checksum: "80caaf89e19da5beafa8d24f4376a505f6fc0d247dc5c35900e2a01fd5cfdafd"
            )
        ]
    )
    ```

    In Xcode, choose **File → Add Package Dependencies… → Add Local…**, select the package folder, and add the `ClicktermSDK` product to your app target.
  </Tab>

  <Tab title="Manual XCFramework">
    <Card title="Download ClicktermSDK 1.2.0" icon="download" href="https://cdn.clickterm.com/sdk/ios/release/1.2.0/ClicktermSDK.xcframework.zip">
      Prebuilt XCFramework for iOS devices and simulators.
    </Card>

    Unzip the download, then:

    1. Drag `ClicktermSDK.xcframework` into your Xcode project.
    2. Select **Copy items if needed** and add it to your app target.
    3. Under **General → Frameworks, Libraries, and Embedded Content**, select **Embed & Sign**.
  </Tab>
</Tabs>

For checksum verification and detailed setup, see [iOS SDK installation](/dev/sdk/ios/installation).

## 2. Initialize the SDK

Initialize ClickTerm once when your app starts:

```swift theme={null}
import ClicktermSDK

ClicktermClient.initialize(appId: "YOUR_CLICKTERM_APP_ID")
```

Get your App ID from the [Integrations page](https://app.clickterm.com/integrations) in the ClickTerm Dashboard.

<Warning>
  Never expose your **App Key** in client-side code. The App Key is used
  only for backend verification calls. The client SDK uses only the **App ID**.
  Store the App Key safely — it won't display again after creation, but can be
  regenerated. Regenerating the key requires updating your backend configuration.
</Warning>

<Warning>
  Calling SDK methods before initialization throws `ClicktermError.notInitialized`.
</Warning>

## 3. Show the clickwrap

From a visible `UIViewController`, create the request and present the dialog:

```swift theme={null}
let request = ClickwrapTemplateRequest(
    clickwrapTemplateId: "YOUR_TEMPLATE_ID",
    endUserId: "user-123",
    templatePlaceholders: [
        "fullName": AnyCodable("Alice Example")
    ],
    language: "en"
)

Task { @MainActor in
    do {
        let signature = try await ClicktermDialog.show(
            from: self,
            request: request
        )

        guard let signature else {
            // The user already acted on this agreement.
            return
        }

        // Send the Signature to your backend for verification.
        await sendToBackend(signature)
    } catch ClicktermError.userCancelled {
        // The user closed the dialog.
    } catch {
        print("Clickwrap error: \(error.localizedDescription)")
    }
}
```

The dialog only appears when a new user action is needed. Requests to display a clickwrap are **not** counted toward billing.

See [`ClicktermDialog`](/dev/sdk/ios/clickterm-dialog) for all results and the accepted-content flow.

## 4. Verify on your backend

Send the Signature to your server, then verify it with your **App ID** and **App Key**:

```bash theme={null}
curl -X POST https://api.clickterm.com/public-client/v1/clickwrap/verify \
  -H "X-APP-ID: YOUR_APP_ID" \
  -H "X-APP-KEY: YOUR_APP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"clicktermSignature": "SIGNATURE_FROM_SDK"}'
```

The response contains `clickwrapEventStatus`:

* **`ACCEPTED`** — Consent is verified and a Certificate of Acceptance is generated.
* **`DECLINED`** — The event is verified without generating a Certificate of Acceptance.

<Warning>
  Requests to `/clickwrap/verify` are counted toward billing. Implement rate
  limiting or a Captcha check before this step to prevent abuse.
</Warning>

For the complete backend flow, see [Verifying a Signature](/dev/guides/verifying-signature).

## Next steps

<CardGroup cols={2}>
  <Card title="iOS SDK reference" icon="mobile-screen-button" iconType="light" href="/dev/sdk/ios/clickterm-client">
    Explore the complete native iOS API.
  </Card>

  <Card title="Template placeholders" icon="brackets-curly" iconType="light" href="/dev/guides/placeholders">
    Add user-specific values to agreements.
  </Card>

  <Card title="Integration flow" icon="diagram-project" iconType="light" href="/dev/guides/integration-flow">
    Understand how the SDK and backend fit together.
  </Card>
</CardGroup>
