---
title: "Version checker"
slug: "version-checker"
abstract: ""
---
# Version checker

The SDK provides a version checker to check the compatibility of the JavaScript SDK version and a Sitecore Content Hub instance version.

> [!note]
> In the following code examples, the `client` variable refers to the `ContentHubClient` instance. When using the JavaScript SDK, you can choose your own variable name, but it is called `client` at instantiation in the docs.

## Check compatibility of the Content Hub instance with minimum required version

For example, the following snippet checks whether the Content Hub instance runs version `4.0.0`:

```javascript
await client.versionChecker.compatibilityCheckAsync(new FileVersion(4, 0, 0, 0));

```

> [!warning]
> The call throws a `NotSupportedError` if the Content Hub instance does not run version `4.0.0`.

## Get the compatibility between a Content Hub instance and the SDK

For example, the following snippet gets compatibility between a Content Hub instance and the SDK:

```javascript
const compatibility = client.versionChecker.getCompatibility(
  new FileVersion(3, 0, 0),
  new FileVersion(4, 0, 0),
  new FileVersion(3, 0, 0)
);

```

First, we pass the `FileVersion` of the Content Hub , then the `FileVersion` of the SDK, and finally, the minimum SDK version as dictated by the Content Hub instance.

The call returns:

- `Compatibility.Ok` if the Content Hub instance and the SDK are compatible.
- `Compatibility.SdkOld` if the Content Hub instance has a newer version than the SDK.
- `Compatibility.SdkNew` if the Content Hub instance has a older version than the SDK.

## Check if a Content Hub instance is compatible with a SDK version

The following snippet checks whether a Content Hub instance is compatible with a SDK version:

```javascript
const isCompatible = await client.versionChecker.isCompatibleAsync(new FileVersion(1, 0, 0, 0));

```

The `FileVersion` is the version of the SDK.