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

# Upgrade the Kotlin API client to version 2

> Keep your Kotlin API client up to date to benefit from improvements and bug fixes.

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

<Legacy title="Upgrade" href="/doc/libraries/sdk/upgrade/kotlin" />

The Kotlin API client follows [semantic versioning](http://semver.org).

## Update to version 2

Version 2 of the library uses Ktor client version 2.

### Ktor

Refer to Ktor's [migration guide](https://ktor.io/docs/migrating-2.html#feature-plugin-client).

### `LogLevel`

The library uses its own `LogLevel` instead of Ktor's `Loglevel`.
Update your imports:

| Subsystem  | Version 1                                  | Version 2                             |
| ---------- | ------------------------------------------ | ------------------------------------- |
| `LogLevel` | `io.ktor.client.features.logging.LogLevel` | `com.algolia.search.logging.LogLevel` |

### Public constants

Constants like `KeyIndexName`, `KeyEnglish`, and `RouteIndexesV1` aren't exposed anymore.
Use your own constants instead.
You can find the internal constants in the package:
`com.algolia.search.serialize.internal`.

This new version removes all deprecated methods and features from version 1.

## Update with Android Studio or IntelliJ Idea

Go to your `build.gradle` or `build.gradle.kts` file and synchronize it.
Check the line for `com.algolia:algoliasearch-client-kotlin`.
If you see the warning "a newer version com.algolia:algoliasearch-client-kotlin than X is available: Y",
you can replace X by Y and re-build your project.

## Update without Android Studio or IntelliJ Idea

Go to the [latest release on GitHub](https://github.com/algolia/algoliasearch-client-kotlin/releases/latest)
and note its release number, for example, `X.Y.Z`.
Go to your `build.gradle` or `build.gradle.kts` file,
find the line with `com.algolia:algoliasearch-client-kotlin`,
replace its version by `X.Y.Z` and build your project to upgrade.
