# Rating divergence

> Titles that Kinopoisk and IMDb rated differently.

> Documentation index for agents: https://kinodata.space/en/llms.txt — the whole documentation in one file: https://kinodata.space/en/llms-full.txt

Request: `GET https://api.kinodata.space/v1.3/discover/divergence`

`divergence` is the Kinopoisk rating minus the IMDb rating. Above zero, Kinopoisk rates it higher: the Turkish series *The Last Emperor: Abdul Hamid II* is 8.0 there and 5.1 on IMDb. Below zero, IMDb rates it higher: *Anne Boleyn* is 1.6 on Kinopoisk and 5.6 on IMDb.

By default it takes titles with 10,000 votes on both sites and a gap of at least 1 point, largest gaps first. `direction=ru` keeps the ones Kinopoisk rates higher, `direction=west` the ones IMDb rates higher.

Filters, `sort` and `fields` work as in the [catalog](https://kinodata.space/en/docs/titles.md), and `total` accounts for them. You can sort by the gap in the catalog itself too: `/titles?sort=-divergence`.

## Query parameters

- `direction` (enum) — `ru`: higher on Kinopoisk; `west`: higher on IMDb.
  Values: `ru`, `west`.
  Default: both directions. Example: `direction=ru`.
- `min_votes` (integer) — How many votes a title needs on each of the two sites.
  Default: 10000. Example: `min_votes=100000`.
- `min_delta` (number) — The smallest gap in points, from 0 to 10.
  Default: 1.0. Example: `min_delta=2`.
- `filters, sort and fields` — The catalog’s filters, sorting and field selection, as in [Filters and sorting](https://kinodata.space/en/docs/filters.md). The gap’s name in `fields` is `divergence`.
  Default: largest gaps first. Example: `kind=movie&sort=-year`.
- `lang` (ru | en) — Keep one language in the response. Without it, text fields come in `_ru` and `_en` pairs. More in [Response languages](https://kinodata.space/en/docs/languages.md).
  Example: `lang=en`.
- `limit` (integer) — How many titles to return, a whole number from 1 to 50.
  Default: 50. Example: `limit=20`.
- `offset` (integer) — How many titles to skip, a whole number from 0.
  Default: 0.

## Response fields

- `direction` (enum | null) — The `direction` from the request. `null` means both directions.
- `items` (array) — Titles: the same card as in the [catalog](https://kinodata.space/en/docs/titles.md).
  - `imdb_id`, `kp_id`, `tmdb_id`, `tmdb_tv_id`, `kinorium_id` (string | null) — The title’s catalog IDs. Always returned, even with `fields`.
  - `title_ru`, `title_en`, `title_original` (string | null) — Titles: Russian, English and in the original language.
  - `year` (integer | null) — Release year.
  - `release_date` (string | null) — First release date, `YYYY-MM-DD`.
  - `kind` (enum) — Kind of title: `movie`, `series`, `mini_series`, `tv_show`, `anime`, `cartoon`, `short`.
  - `poster_url_ru`, `poster_url_en` (string | null) — Poster for a Russian and an English storefront.
  - `posters_by_source` (object) — Each source’s poster: `kp`, `tmdb`, `imdb`, `kinorium`.
  - `rating_kp`, `rating_tmdb`, `rating_imdb`, `rating_kr`, `rating_letterboxd` (number | null) — Kinopoisk, TMDB, IMDb, Kinorium and Letterboxd ratings, 0–10 scale.
  - `votes_kp`, `votes_tmdb`, `votes_imdb` (integer | null) — Kinopoisk, TMDB and IMDb votes.
  - `countries` (array) — Countries: `code`, `name_ru`, `name_en`.
  - `genres` (array) — Genres: `slug`, `name_ru`, `name_en`.
  - `divergence` (number) — The Kinopoisk rating minus the IMDb rating.
- `total` (integer) — How many titles match the request, filters included.
- `limit`, `offset`, `has_more` — Paging, as in [every list](https://kinodata.space/en/docs/lists.md#the-shape-of-a-list).

## Errors

| status | code | when |
|---|---|---|
| 400 | `invalid_request` | An unknown `direction`; `min_delta` is not a number from 0 to 10; an unknown filter, `sort` key or `fields` name; a parameter of another endpoint (such as `role` or `relation`); `limit` is not a whole number from 1, or `offset` is below 0; `cursor`, since the feed pages with `offset`. |
| 401 | `unauthorized` | The `X-API-Key` header is missing, or the key is unknown or revoked. |
| 429 | `rate_limited` | The per-second rate limit or the daily quota is used up. |

Every code and what to do about it is on the [Errors](https://kinodata.space/en/docs/errors.md) page.

## Examples

### English only

```bash
curl -G -H "X-API-Key: $KINODATA_KEY" \
  --data-urlencode "limit=3" \
  --data-urlencode "fields=title,year,rating_kp,rating_imdb,divergence" \
  --data-urlencode "lang=en" \
  "https://api.kinodata.space/v1.3/discover/divergence"
```

Response `200`:

```json
{
  "direction": null,
  "has_more": true,
  "items": [
    {
      "imdb_id": "tt13406036",
      "kp_id": "2000450",
      "tmdb_id": null,
      "tmdb_tv_id": "126400",
      "kinorium_id": "2655539",
      "title_en": "Anne Boleyn",
      "year": 2021,
      "rating_kp": 1.6,
      "rating_imdb": 5.6,
      "divergence": -4
    },
    {
      "imdb_id": "tt1486193",
      "kp_id": "479701",
      "tmdb_id": "50601",
      "tmdb_tv_id": null,
      "kinorium_id": "495470",
      "title_en": "5 Days of War",
      "year": 2011,
      "rating_kp": 1.6,
      "rating_imdb": 5.6,
      "divergence": -4
    },
    {
      "imdb_id": "tt6536562",
      "kp_id": "1045683",
      "tmdb_id": null,
      "tmdb_tv_id": "70788",
      "kinorium_id": "1622848",
      "title_en": "The Last Emperor: Abdul Hamid II",
      "year": 2017,
      "rating_kp": 8,
      "rating_imdb": 5.1,
      "divergence": 2.9
    }
  ],
  "limit": 3,
  "offset": 0,
  "total": 780
}
```

### Both languages

```bash
curl -G -H "X-API-Key: $KINODATA_KEY" \
  --data-urlencode "limit=3" \
  --data-urlencode "fields=title,year,rating_kp,rating_imdb,divergence" \
  "https://api.kinodata.space/v1.3/discover/divergence"
```

Response `200`:

```json
{
  "direction": null,
  "has_more": true,
  "items": [
    {
      "imdb_id": "tt13406036",
      "kp_id": "2000450",
      "tmdb_id": null,
      "tmdb_tv_id": "126400",
      "kinorium_id": "2655539",
      "title_ru": "Анна Болейн",
      "title_en": "Anne Boleyn",
      "year": 2021,
      "rating_kp": 1.6,
      "rating_imdb": 5.6,
      "divergence": -4
    },
    {
      "imdb_id": "tt1486193",
      "kp_id": "479701",
      "tmdb_id": "50601",
      "tmdb_tv_id": null,
      "kinorium_id": "495470",
      "title_ru": "5 дней в августе",
      "title_en": "5 Days of War",
      "year": 2011,
      "rating_kp": 1.6,
      "rating_imdb": 5.6,
      "divergence": -4
    },
    {
      "imdb_id": "tt6536562",
      "kp_id": "1045683",
      "tmdb_id": null,
      "tmdb_tv_id": "70788",
      "kinorium_id": "1622848",
      "title_ru": "Последний император",
      "title_en": "The Last Emperor: Abdul Hamid II",
      "year": 2017,
      "rating_kp": 8,
      "rating_imdb": 5.1,
      "divergence": 2.9
    }
  ],
  "limit": 3,
  "offset": 0,
  "total": 780
}
```

### Higher on Kinopoisk

```bash
curl -G -H "X-API-Key: $KINODATA_KEY" \
  --data-urlencode "direction=ru" \
  --data-urlencode "min_votes=50000" \
  --data-urlencode "limit=3" \
  --data-urlencode "fields=title,year,rating_kp,rating_imdb,divergence" \
  "https://api.kinodata.space/v1.3/discover/divergence"
```

Response `200`:

```json
{
  "direction": "ru",
  "has_more": true,
  "items": [
    {
      "imdb_id": "tt4877122",
      "kp_id": "957805",
      "tmdb_id": "378236",
      "tmdb_tv_id": null,
      "kinorium_id": "1555483",
      "title_ru": "Эмоджи фильм",
      "title_en": "The Emoji Movie",
      "year": 2017,
      "rating_kp": 5.9,
      "rating_imdb": 3.5,
      "divergence": 2.4
    },
    {
      "imdb_id": "tt0327554",
      "kp_id": "3523",
      "tmdb_id": "314",
      "tmdb_tv_id": null,
      "kinorium_id": "258070",
      "title_ru": "Женщина-кошка",
      "title_en": "Catwoman",
      "year": 2004,
      "rating_kp": 5.8,
      "rating_imdb": 3.5,
      "divergence": 2.3
    },
    {
      "imdb_id": "tt0810913",
      "kp_id": "462883",
      "tmdb_id": "71880",
      "tmdb_tv_id": null,
      "kinorium_id": "382922",
      "title_ru": "Такие разные близнецы",
      "title_en": "Jack and Jill",
      "year": 2011,
      "rating_kp": 5.2,
      "rating_imdb": 3.3,
      "divergence": 1.9
    }
  ],
  "limit": 3,
  "offset": 0,
  "total": 197
}
```
