> For the complete documentation index, see [llms.txt](https://docs.idlayr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.idlayr.com/products/number-verification/secure-sna/integration/ios.md).

# iOS

{% hint style="info" %}
**Device API** · NV 1.0 · GA
{% endhint %}

The iOS SDK is `IDlayrKit`. Swift 5.9, iOS 13+. Distributed via private Cloudsmith Swift Package Registry (SPM) or CocoaPods.

This page covers the device-side integration. For the backend role, see [Backend integration](/products/number-verification/secure-sna/integration/backend.md).

## 1. Install the SDK

Add `IDlayrKit` to your project via Swift Package Manager or CocoaPods. The SDK is fetched from a private Cloudsmith repository — you'll need a Cloudsmith entitlement token (shared during onboarding).

See the iOS SDK installation page for the full SPM and CocoaPods configurations.

## 2. Obtain the verification URL

Your backend creates the Secure SNA check on IDlayr and receives a `check_id` and a `url` — the device-facing verification URL. **Your backend hands only the `url` to your iOS app**, over your own application API. The OAuth2 access token never leaves your backend; the SDK doesn't need it.

See [Backend integration](/products/number-verification/secure-sna/integration/backend.md#2-create-the-check) for the create flow.

## 3. Drive the verification

Pass the `url` to the SDK's Secure SNA method. The SDK pins the request to the cellular interface, follows the redirect chain (plain HTTP, no `Authorization` header required), and surfaces the result.

```swift
import IDlayrKit

let sdk = IDlayrSDK()
sdk.openWithDataCellular(
    url: URL(string: verificationURL)!,
    debug: false
) { response in
    // Inspect response — see Response handling below.
}
```

## 4. Response handling

The completion handler receives a JSON object. On a successful round trip, it contains `http_status`, `response_body` (with the verification code), and a `debug` block. On failure, it contains `error` and `error_description`.

```swift
sdk.openWithDataCellular(
    url: URL(string: verificationURL)!,
    debug: false
) { response in
    if let error = response["error"] as? String {
        // SDK-level error — see SDK errors below
        print("Error: \(error)")
        return
    }
    if let body = response["response_body"] as? [String: Any],
       let code = body["code"] as? String,
       let checkId = body["check_id"] as? String {
        // Send code + checkId to your backend for completion
        sendCodeToBackend(checkId: checkId, code: code)
    }
}
```

## 5. Send the code to your backend

Your backend completes the check by redeeming the code with a POST. See [Backend integration](/products/number-verification/secure-sna/integration/backend.md#4-complete-the-check).

## SDK errors

If the SDK can't complete the request, the response contains an `error` field with one of:

* `sdk_no_data_connectivity` — device has no cellular data path.
* `sdk_connection_error` — network-level failure during the request.
* `sdk_redirect_error` — error while following the redirect chain.
* `sdk_error` — generic SDK failure.
* `invalid_scheme` — URL was not HTTPS.

These are SDK errors, not API errors — they happen before any HTTP request reaches IDlayr.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.idlayr.com/products/number-verification/secure-sna/integration/ios.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
