# Connecting SDK to API

To connect SDK to Oz API, specify the API URL and [access token](/oz-knowledge/guides/developer-guide/api/oz-api/use-cases/authentication.md) as shown below.

```swift
OZSDK.setApiConnection(Connection.fromServiceToken(host: "https://sandbox.ohio.ozforensics.com", token: token)) { (token, error) in
}
```

{% hint style="info" %}
Please note: in your host application, it is recommended that you set the API address on the screen that precedes the liveness check. Setting the API URL initiates a service call to the API, which may cause excessive server load when being done at the application initialization or startup.
{% endhint %}

Alternatively, you can use the login and password provided by your Oz Forensics account manager:

```swift
OZSDK.setApiConnection(Connection.fromCredentials(host: “https://sandbox.ohio.ozforensics.com”, login: login, password: p)) { (token, error) in
    // Your code to handle error or token
}
```

By default, logs are saved along with the analyses' data. If you need to keep the logs distinct from the analysis data, set up the separate connection for [telemetry](/oz-knowledge/other/faq.md#what-is-telemetry-and-why-should-i-use-it) as shown below:

```swift
let eventsConnection = Connection.fromCredentials(host: https://echo.cdn.ozforensics.com/,
                                login: <your_telemetry_user_eg_tm@company.com>,
                                password: your_telemetry_password)
OZSDK.setEventsConnection(eventsConnection) { (token, error) in
}
```


---

# Agent Instructions: 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:

```
GET https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-mobile-sdk/ios/connecting-sdk-to-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
