---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - en/datalens/operations/api-versioning.md
  - en/operations/api-versioning
  - ru/operations/api-versioning
  - href: en/operations/api-versioning.md
    type: text/markdown
    title: Markdown version
csp:
  - script-src:
      - https://mc.yandex.ru
    img-src:
      - https://mc.yandex.ru
    connect-src:
      - https://mc.yandex.ru
      - wss://mc.yandex.ru
    child-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-ancestors:
      - 'blob:'
      - https://mc.yandex.ru
canonical: en/operations/api-versioning.html
title: Public API versioning in DataLens On-premises
description: >-
  Public API versioning in DataLens On-premises ensures compatibility of methods
  and object schemas between the API and the interface.
vcsPath: en/operations/api-versioning.md
---
# Public API versioning in DataLens On-premises

As the Public API in DataLens evolves, its methods, their arguments, and object schemas, e.g., dashboard, chart, or dataset schemas, may change.

These changes may be either non-breaking or breaking:

* Adding new fields is a non-breaking change.
* Removing or renaming fields, modifying schema structure, or removing methods constitute breaking changes.

With each breaking change, a [new Public API version](../release-notes/api-changelog.md) is created and the API version number is incremented by one. If multiple breaking changes are introduced to methods or object schemas at once, the API version is still incremented by one.

The version number is provided in the `X-DL-API-Version` request header. To specify the latest version available at the moment, provide `latest` in the header.

The previous Public API version remains supported for some time after a new release to give users time to migrate to the new version.

The DataLens interface only supports the latest version of schemas. As a result, all objects modified via the interface are automatically saved under the latest version.

{% note info %}

Regularly update your Public API to ensure correct operation.

{% endnote %}

{% note warning %}

We recommend following these steps when updating entities in the Public API:

1. Get the current object version by using the relevant read method.
1. Edit as appropriate.
1. Send the entire object without filtering out any fields. Preserve all fields, including those not described in the schema, to maintain compatibility with different API versions.

{% endnote %}

## Example of a non-breaking change {#non-breaking-change}

Added a field for providing a description to the report creation method:

Previously:

```bash
X-DL-API-Version: 1
POST http://<хост_on-premises>/rpc/createReport {key, config}
```

Now:

```bash
X-DL-API-Version: 1
POST http://<хост_on-premises>/rpc/createReport {key, config, description}
```

Reports created before this update will be converted, and the new field will be populated with a default value.

## Example of a breaking change {#breaking-change}

Removed the `key` argument from the report creation method and replaced it with `workbookId`.

Previously:

```bash
X-DL-API-Version: 1
POST http://<хост_on-premises>/rpc/createReport {key, config}
```

Now:

```bash
X-DL-API-Version: 2
POST http://<хост_on-premises>/rpc/createReport {workbookId, config}
```

You can use the legacy method behavior while the previous API version is still supported. To do this, specify the required version in the header:

```bash
X-DL-API-Version: 1
POST http://<хост_on-premises>/rpc/createReport {key, config}
```


