---
title: Chromeの最新のバージョン番号を取得するVersionHistory APIの使い方
url: https://roboin.io/article/2025/04/21/chrome-version-history-api/
description: 何らかの理由でChromeの最新バージョンのバージョン番号を取得したい場合があります。Googleは、そんなときに使えるVersionHistory
  APIを公式に提供しています。
publishedDate: 2025-04-20T15:19:00.000Z
modifiedDate: 2025-04-20T15:19:00.000Z
thumbnail: https://roboin.io/api/media/file/thumbnail-69.png
thumbnailAlt: サムネイル
thumbnailCaption: N/A
---

# Chromeの最新のバージョン番号を取得するVersionHistory APIの使い方

何らかの理由でChromeの最新バージョンのバージョン番号を取得したい場合があります。Googleは、そんなときに使えるVersionHistory APIを公式に提供しています。

VersionHistory APIを使うと、過去のものも含めてChromeのバージョン履歴を取得できます。

次のエンドポイントにアクセスすると、Chromeのバージョン履歴をJSON形式で取得できます。

```plaintext
https://versionhistory.googleapis.com/v1/{product}/platforms/{platform}/channels/{channel}/versions
```

- `{product}`：Chromeの場合は`chrome`、Fuchsiaウェブエンジンの場合は`fuchsiawebengine`を指定
- `{platform}`：`all`、`win64`、`mac_arm64`、`linux`などのプラットフォームを指定
- `{channel}`：`stable`、`beta`、`dev`、`canary`などのリリースチャネルを指定

たとえば、64ビット版WindowsのChromeの安定版のバージョンは、次のURLから取得できます。

```plaintext
https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions
```

この例では、次のようなJSON形式のレスポンスを取得できます。

```json
{
  "versions": [
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.96",
      "version": "135.0.7049.96"
    },
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.95",
      "version": "135.0.7049.95"
    },
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.86",
      "version": "135.0.7049.86"
    },
    // ...
  ]
}
```

また、URLの末尾に`/all/releases`を追加すると、より詳細なリリース情報を取得できます。

```plaintext
https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions/all/releases
```

```json
{
  "releases": [
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.96/releases/1744927565",
      "serving": {
        "startTime": "2025-04-17T22:06:05.763771Z"
      },
      "fraction": 1,
      "version": "135.0.7049.96",
      "fractionGroup": "144",
      "pinnable": false
    },
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.85/releases/1744748247",
      "serving": {
        "startTime": "2025-04-15T20:17:27.180816Z",
        "endTime": "2025-04-17T22:06:05.763771Z"
      },
      "fraction": 0.5,
      "version": "135.0.7049.85",
      "fractionGroup": "144",
      "pinnable": false
    },
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.86/releases/1744748247",
      "serving": {
        "startTime": "2025-04-15T20:17:27.180816Z",
        "endTime": "2025-04-17T22:06:05.763771Z"
      },
      "fraction": 0.25,
      "version": "135.0.7049.86",
      "fractionGroup": "144",
      "pinnable": false
    },
    // ...
  ]
}
```

リリース情報に含まれる`fraction`は、どれくらいの割合のユーザーにロールアウトされているかを示しています。Chromeなどのブラウザーでは、一斉にすべてのユーザーにアップデートを配信するのではなく、段階的に配信することがあります。たとえば、`fraction`が0.5の場合、50%のユーザーにロールアウトされていることを意味します。

VersionHistory APIはフィルタリングにも対応しており、たとえば64ビット版WindowsのChromeの安定版のうち、完全にロールアウトが完了しているリリースの情報は、次のように取得できます。

```plaintext
https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions/all/releases?filter=fraction%3D1
```

```json
{
  "releases": [
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.96/releases/1744927565",
      "serving": {
        "startTime": "2025-04-17T22:06:05.763771Z"
      },
      "fraction": 1,
      "version": "135.0.7049.96",
      "fractionGroup": "144",
      "pinnable": false
    },
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.96/releases/1744748247",
      "serving": {
        "startTime": "2025-04-15T20:17:27.180816Z"
      },
      "fraction": 1,
      "version": "135.0.7049.96",
      "fractionGroup": "143",
      "pinnable": true
    },
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.85/releases/1744314334",
      "serving": {
        "startTime": "2025-04-10T19:45:34.953596Z",
        "endTime": "2025-04-15T20:17:27.180816Z"
      },
      "fraction": 1,
      "version": "135.0.7049.85",
      "fractionGroup": "144",
      "pinnable": false
    },
    // ...
  ]
}
```

ページングにも対応しているので、`page_size=1`を指定すると最新の1件のリリースのみを取得できます。

```plaintext
https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions/all/releases?filter=fraction%3D1&page_size=1
```

```json
{
  "releases": [
    {
      "name": "chrome/platforms/win64/channels/stable/versions/135.0.7049.96/releases/1744927565",
      "serving": {
        "startTime": "2025-04-17T22:06:05.763771Z"
      },
      "fraction": 1,
      "version": "135.0.7049.96",
      "fractionGroup": "144",
      "pinnable": false
    }
  ],
  "nextPageToken": "3857063383"
}
```

VersionHistory APIはライブラリーも提供されています。たとえば、TypeScriptで64ビット版WindowsのChromeの最新バージョンのバージョン番号は、次のように取得できます。

```bash
npm install @googleapis/versionhistory
```

```typescript
import { versionhistory } from "@googleapis/versionhistory";

/**
 * Get the latest Chrome version.
 * @returns The latest Chrome version or null if not found.
 */
const getLatestChromeVersion = async (): Promise<string | null> => {
    const VersionHistory = versionhistory("v1");
    const versionHistory = await VersionHistory.platforms.channels.versions.releases.list({
        filter: "fraction=1",
        pageSize: 1,
        parent: "chrome/platforms/win64/channels/stable/versions/all"
    });

    const { releases } = versionHistory.data;
    if (!releases) return null;

    const [latestRelease] = releases;
    if (!latestRelease) return null;

    return latestRelease.version ?? null;
};
```

## 参考リンク

- [VersionHistory API ガイド  |  Chrome for Developers](https://developer.chrome.com/docs/web-platform/versionhistory/guide?hl=ja)
- [VersionHistory API リファレンス  |  Chrome for Developers](https://developer.chrome.com/docs/web-platform/versionhistory/reference?hl=ja)