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

# iOS Quickstart

> Get started using the iOS SDK

## Overview

In this quickstart, you'll add Fingerprint to a new Xcode iOS app and identify the user's device.

The example use case in this quickstart is stopping new account fraud, where attackers create multiple fake accounts to abuse promotions, exploit systems, or evade bans. However, the steps you'll follow apply to most use cases. By identifying the device behind each sign-up attempt, login, or transaction, you can flag and block suspicious users early.

This guide focuses on the frontend mobile integration. You'll install the [Fingerprint iOS SDK](/docs/ios-sdk) and initialize the client agent to generate a request ID to send to your backend for analysis. **To see how to implement fraud prevention with this ID, continue to one of the [backend quickstarts](/docs/server-quickstarts-overview) after completing this quickstart.**

> Estimated time: \< 10 minutes

## Prerequisites

Before you begin, make sure you have the following:

* [Xcode](https://developer.apple.com/xcode/) installed (latest version)
* Basic knowledge of [Swift](https://www.swift.org/) and iOS development
* A Fingerprint account and public API key (see below)

<Note>
  This quickstart only covers the **frontend setup**. You'll need a [backend
  server](/reference/server-sdks) to receive and process the device identification event to enable
  fraud detection. Check out one of the [backend quickstarts](/docs/server-quickstarts-overview)
  after completing this quickstart.
</Note>

## 1. Create a Fingerprint account and get your API key

1. [Sign up](https://dashboard.fingerprint.com/signup) for a free Fingerprint trial if you don't already have an account.
2. After signing in, go to the [**API keys**](https://dashboard.fingerprint.com/api-keys) page in the dashboard.
3. Copy your **public API key**; you'll need it to initialize the client agent.

## 2. Set up your project

To get started, create a new Xcode project. If you already have a project you want to use, you can skip to the next section.

1. Open Xcode and create a new project.
2. Click on iOS and select App, then click Next.
3. Enter a name (e.g., `FingerprintQuickstart`), and an organization identifier (e.g., `com.example`), and make sure to use Swift and SwiftUI.
4. Click Next, choose a save location, and create the project.

## 3. Install the client agent

To integrate Fingerprint into your iOS app, add the package to your project.

1. In Xcode, go to File > Add Package Dependencies…
2. Enter the package URL: `https://github.com/fingerprintjs/fingerprintjs-pro-ios`
3. Choose the latest version and click Add Package.
4. In the Choose Package Products pop-up, make sure to check your app target (e.g., `FingerprintQuickstart`) under "Add to Target" so the SDK is properly linked.

## 4. Initialize the SDK

Open your `ContentView.swift` or app entry point and:

1. Import the SDK:

```swift ContentView.swift theme={"theme":"github-dark-dimmed"}
import FingerprintPro
```

2. Initialize the SDK with your public API key and region:

```swift ContentView.swift theme={"theme":"github-dark-dimmed"}
static let region: Region = .eu
static let configuration = Configuration(
    apiKey: "PUBLIC_API_KEY",
    region: region,
    extendedResponseFormat: true
)
```

3. Replace `PUBLIC_API_KEY` with your actual public API key from the Fingerprint [dashboard](https://dashboard.fingerprint.com/api-keys). Use .global, .eu, or .ap based on your workspace region. See region [**guide**](/docs/regions).

## 5. Trigger visitor identification

Now that the client agent is initialized, you can identify the visitor when needed. In this case, that's when the user taps a **Create Account** button.

When making the visitor identification request, you will receive the `visitorId` as well as a `requestId`. Instead of using the `visitorId` returned directly on the frontend (which could be tampered with), you'll send the `requestId` to your backend. This ID is unique to each identification event. Your server can then use the [Fingerprint Events API](/reference/server-api-get-event) to retrieve complete identification data, including the trusted visitor ID and other actionable insights like whether they are using a VPN or are a bot.

## Add a basic sign-up UI

1. Create a new SwiftUI function for the account creation screen. It will display a simple form with username and password fields, along with a **Create Account** button:

```swift ContentView.swift theme={"theme":"github-dark-dimmed"}
func AccountCreationForm(
    username: Binding<String>,
    password: Binding<String>,
    logOutput: Binding<String>,
    onSubmit: @escaping () -> Void
) -> some View {
    VStack(spacing: 20) {
        Text("Create Account")
            .font(.title)
            .foregroundColor(.orange)

        TextField("Username", text: username)
            .textFieldStyle(.roundedBorder)
            .autocapitalization(.none)

        SecureField("Password", text: password)
            .textFieldStyle(.roundedBorder)

        Button("Create Account") {
            onSubmit()
        }
        .buttonStyle(.borderedProminent)
        .tint(.orange)

        if !logOutput.wrappedValue.isEmpty {
            Text("Log: \(logOutput.wrappedValue)")
                .font(.caption)
                .foregroundColor(.gray)
                .multilineTextAlignment(.center)
                .padding(.top, 10)
        }
    }
}
```

2. In the ContentView struct; just before the `body` variable; add the `createAccount()` function that would be triggered when the **Create Account** button is clicked:

```swift ContentView.swift theme={"theme":"github-dark-dimmed"}
struct ContentView: View {
    @State private var username = ""
    @State private var password = ""
    @State private var logOutput = ""

    let fingerprintClient = FingerprintProFactory.getInstance(configuration)

    func createAccout() async {
        do {
            let response = try await fingerprintClient.getVisitorIdResponse()

            let requestId = response.requestId

            print("Request ID: \(requestId)")

            // Send username, password, and requestId to your backend server for processing

        } catch {
            print("Fingerprint error: \(error)")
            logOutput = "Error: \(error.localizedDescription)"
        }
    }
    //...
}
```

3. Update the body variable of the ContentView struct with the AccountCreationForm function:

```swift ContentView.swift theme={"theme":"github-dark-dimmed"}
struct ContentView: View {
    @State private var username = ""
    @State private var password = ""
    @State private var logOutput = ""

    let fingerprintClient = FingerprintProFactory.getInstance(configuration)

    func createAccount() async {
        do {
            let response = try await fingerprintClient.getVisitorIdResponse()

            let requestId = response.requestId

            print("Request ID: \(requestId)")

            // Send username, password, and requestId to your backend server for processing
        } catch {
            print("Fingerprint error: \(error)")
            logOutput = "Error: \(error.localizedDescription)"
        }
    }

    var body: some View {
        VStack(spacing: 20) {
            AccountCreationForm(
                username: $username,
                password: $password,
                logOutput: $logOutput,
                onSubmit:{
                    Task {
                        await createAccount()
                    }
                }
            )
        }
        .padding()
    }
}
```

This interface:

* Displays a basic form for account creation.
* Calls `getVisitorIdResponse()` to identify the visitor.
* Captures the `requestId`, which you'll forward to your server for analysis.

## 6. Run the app

1. Select an iOS simulator or real device in Xcode.
2. Build and run the app (⌘R).
3. Enter a username and password then click **Create Account**.
4. Check your Xcode console for something like:

```text Output theme={"theme":"github-dark-dimmed"}
Request ID: 1753730090897.s4bWk4
```

You're now successfully identifying the device and capturing the request ID and are ready to send it to your backend for further fraud prevention logic!

## Next steps

To use the identification data for fraud detection (like blocking repeat fake account creation attempts), you'll need to send the `requestId` to your [backend](/docs/server-quickstarts-overview). From there, your server can call the [Fingerprint Events API](/reference/server-api-get-event) to retrieve the full visitor information and make decisions.

Check out these related resources:

* [iOS SDK reference](/docs/ios-sdk)
* [Node.js backend quickstart](/docs/node-server-quickstart)
* [API reference for the Events endpoint](/reference/server-api-get-event)
* [Use case tutorial: Detecting new account fraud](/docs/new-account-fraud-use-case-tutorial)
* [Protecting from client-side tampering and replay attacks](/docs/protecting-from-client-side-tampering)
