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

# Quick Start

> Add device attestation to your iOS app in under 5 minutes

## Choose your setup

<CardGroup cols={2}>
  <Card title="Physical device" icon="mobile-screen" href="#1-create-an-account">
    **Recommended.** Full attestation, risk scoring, and JWT. Requires an iPhone or iPad running iOS 18+. Continue reading below.
  </Card>

  <Card title="Simulator / CI" icon="display" href="/simulator-setup">
    **No device handy? Start here.** API key fallback — build and test everything today, switch to hardware attestation when ready.
  </Card>
</CardGroup>

## Prerequisites

* Xcode 16+ with Swift 6.0+
* A physical iOS 18+ device
* Your Apple **Team ID** (found in the Apple Developer portal under Membership)
* Your app's **Bundle ID**

## 1. Create an account

Sign up at [grantiva.io/get-started](https://grantiva.io/get-started) with email, GitHub, or Google. Then add your first app from the dashboard — you'll need your Apple Team ID and Bundle ID.

## 2. Add the SDK

Add the Grantiva Swift package to your Xcode project:

```
https://github.com/grantiva/ios-sdk
```

Or add it to your `Package.swift`:

```swift theme={null}
dependencies: [
    .package(url: "https://github.com/grantiva/ios-sdk", from: "2.0.0")
]
```

Then add `Grantiva` to your target dependencies.

<Info>Requires iOS 18+ / macOS 15+ and Swift 6.0+. The SDK has zero external dependencies.</Info>

## 3. Initialize Grantiva

```swift theme={null}
import Grantiva

let grantiva = Grantiva(teamId: "YOUR_TEAM_ID")
```

That's it. The SDK reads your Bundle ID automatically from `Bundle.main`.

## 4. Attest the device

```swift theme={null}
do {
    let result = try await grantiva.validateAttestation()
    print("Device verified: \(result.isValid)")
    if let score = result.deviceIntelligence.riskScore {
        print("Risk score: \(score)")  // Pro+ only
    } else {
        print("Risk category: \(result.deviceIntelligence.riskCategory)")
    }
    // Send result.token to your backend as a Bearer token
} catch {
    print("Attestation failed: \(error)")
}
```

The returned JWT token contains device intelligence, risk score, and any custom claims you've configured in the dashboard.

## 5. Verify on your backend

Include the token in API requests from your app:

```swift theme={null}
var request = URLRequest(url: apiURL)
request.setValue("Bearer \(result.token)", forHTTPHeaderField: "Authorization")
```

Your backend can decode the JWT to read device intelligence and make trust decisions. See [Backend JWT Verification](/backend-verification) for working examples in Node.js, Python, and Go.

## Next steps

<CardGroup cols={2}>
  <Card title="Test your integration" icon="circle-check" href="/sdk/testing">
    Verify attestation is working correctly — checklist, sample responses, and common errors.
  </Card>

  <Card title="Attestation deep dive" icon="shield-check" href="/sdk/attestation">
    Token caching, refresh, and the full attestation flow.
  </Card>

  <Card title="Risk scoring" icon="gauge-high" href="/concepts/risk-scoring">
    Understanding risk scores and how to set thresholds.
  </Card>

  <Card title="Feature flags" icon="flag" href="/sdk/feature-flags">
    Toggle features remotely from the dashboard.
  </Card>

  <Card title="In-app feedback" icon="message" href="/sdk/feedback">
    Add feature requests and support tickets to your app.
  </Card>
</CardGroup>
