> This page is for Applications Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# Migrating SDK from v1 to v2

## Start the SDK

In version 1.x, the `start` function is called with 3 parameters: `AppId`, `context` and `enableDoctorCheck` (the later was added in 1.16.0).

In version 2.0, the `start` function has additional parameter:

1. `application` which replace the `context`.
2. `delegate` (`PerimeterXDelegate`) to handle the SDK's events.
3. `completion handler` to handle the result of the start process.

Notice that the new Interceptor will be enabled in 2.0. This has effect on the integration with the SDK, which i described in this document.

## Set custom parameters

In version 1.x, the set custom parameters function is called with the dictionary parameter only.

In version 2.0, the `setCustomParameters` function has another optional param: the `AppID`. This is required only when using multiple AppIDs.

## Get VID

In version 1.x, the get VID function is called without any parameters.

In version 2.0, the `vid` function has another optional param: the `AppID`. This is required only when using multiple AppIDs.

## Get HTTP headers

In version 1.x, the get HTTP headers function is called without any parameters.

In version 2.0, the `headersForURLRequest` function has another optional param: the `AppID`. This is required only when using multiple AppIDs. Please note that now this function should NOT be used when the interceptor is enabled.

## Check error and handle response

In version 1.x, a function is called to get the HUMAN's error response from the request's response which called another function to handle the HUMAN 's error response.

In version 2.0 the flow is as following:

1. If the interceptor is enabled, simply check whether the request was blocked with the `isRequestBlockedError` function.
2. If the interceptor is disabled, use the HUMAN SDK to handle the response with the `handleResponse` function. If it was a blocked response, the SDK will handle it and the function will return `true`.

## Other functions

All other functions existing in version 1.x were removed from the SDK's API in version 2.0.