# JSON Ledger APIの入口

> HTTPで使うJSON Ledger APIのエンドポイントと認証とエラーの返し方、状態を確かめるエンドポイント、台帳と話す手引き、QuickStartのライセンスの流れを、章の中の図解で追います。

- URL: https://cardene.dev/diagrams/canton-json-ledger-api-basics
- 公開日: 2026-11-23
- 更新日: 2026-11-23
- トピック: Blockchain
- タグ: Canton
- 親の図解: [Canton Networkの全体像](https://cardene.dev/diagrams/canton-network.md): トランザクションの中身を関わるpartyにだけ見せるCanton Networkについて、部品ごとの役割と、1つのトランザクションが部品の間をどう流れるかを段ごとに追います。
- 子の図解: [HTTPからLedger APIを使う](https://cardene.dev/diagrams/canton-json-api.md): JSON Ledger APIの主なエンドポイントが受け取る物と返す物、トークンの渡し方、HTTPのステータスとエラーの本体の形を、2つの図と表で追います。
- 子の図解: [JSON APIの入口と状態を確かめる](https://cardene.dev/diagrams/canton-json-entry.md): JSON Ledger APIの操作の参照の読み方と、トークンを付けて呼ぶ形、エラーの読み方を押さえ、稼働中かと版と台帳の位置とpackageとtrafficの状態を確かめるエンドポイントを追います。
- 子の図解: [JSON Ledger APIで台帳と話す](https://cardene.dev/diagrams/canton-json-api-tutorials.md): JSON Ledger APIでpartyとコントラクトを作って照会する流れを図Aで、複数のSynchronizerの5つの場面を図Bで追い、TypeScriptの例とpackageのアップロードは本文と表で説明します。
- 子の図解: [ライセンスの流れをAPIで回す](https://cardene.dev/diagrams/canton-quickstart-json-license.md): QuickStartのライセンスの流れを、Keycloakでのトークンの取得から、JSON Ledger APIでのコントラクトの作成と更新の依頼、walletでの割り当て、バックエンドでの更新の完了まで追います。

この章では、JSON Ledger APIを使い始める所を追います。
Canton 3.xでは、Participant NodeのJSON Ledger APIは、HTTPの要求をgRPCの呼び出しに変換して、JSON APIの操作を提供します。
gRPCのLedger APIの仕組みと権利は、章「Ledger APIの接続と認可」と章「userと権利」が追っているので、この章は、つなぎ方と認証と要求と応答の形を書きます。
HTTPは、ブラウザやプログラムがWebのサーバーと要求と応答をやり取りする決まりです。

:::details gRPC
gRPCは、Googleが開発した、ネットワーク越しに別のプログラムの処理を呼び出すための通信の仕組みです。
:::

:::details JSON
JSONは、データを文字で表すための形式で、Webのプログラムどうしのデータのやり取りに広く使われています。
:::

https://cardene.dev/diagrams/canton-ledger-api-access

https://cardene.dev/diagrams/canton-ledger-user-rights

まず、JSON Ledger APIの主なエンドポイントが何を受け取り何を返すかを見ます。
トークンの渡し方と、トークンを要さないエンドポイントと、gRPCのエラーコードに対応するHTTPのステータスでのエラーの返し方も追います。

https://cardene.dev/diagrams/canton-json-api

次に、トークンを付けた要求の送り方と、エラーの読み方を押さえ、ノードが稼働中かと、版と、台帳の位置と、接続するSynchronizerと、packageと、trafficの状態を確かめるエンドポイントを追います。

https://cardene.dev/diagrams/canton-json-entry

さらに、JSON Ledger APIでpartyとコントラクトを作って照会する手引きを、コマンドラインとTypeScriptで追います。
複数のSynchronizerの間でコントラクトを動かす5つの場面と、packageをアップロードして一覧する呼び出しも見ます。

https://cardene.dev/diagrams/canton-json-api-tutorials

最後に、QuickStartのライセンスの流れを、Keycloakでのトークンの取得から、ライセンスの更新の完了まで追います。
台帳へのコマンドの送信はJSON Ledger APIが、支払いの割り当てはwalletの画面が、更新の完了はQuickStartのバックエンドが受け持ちます。

https://cardene.dev/diagrams/canton-quickstart-json-license

図の語は、それぞれの頁が説明します。

下の図は、この章の4つの頁が扱う物を、アプリと端末の道具、その次にJSON Ledger APIとKeycloak、その次にgRPCのLedger APIの順に置きます。
虫眼鏡の印が付いた部品を押すと、その部品の中へ入ります。
外側へ戻る時は、右上の「戻る」か、上に並んだ名前を押します。
部品の中へ入ると、名前の並びの下にその部品を説明する頁の題が出て、押すとその頁を開きます。

```dragon
architecture アプリからJSON Ledger APIへ
group Top as アプリからJSON Ledger APIへ [icon: net]
  box App as アプリ [note: HTTPで呼ぶ, color: blue, icon: app, link: /diagrams/canton-json-api]
  box Cli as 端末の道具 [note: コマンドラインからHTTPで呼ぶ, color: blue, icon: app, link: /diagrams/canton-json-api-tutorials]
  box Kc as Keycloak [note: トークンを出す, color: rose, icon: server, link: /diagrams/canton-quickstart-json-license]
  box Json as JSON Ledger API [note: Canton 3.xでParticipant Nodeに組み込まれる, color: slate, icon: net, link: /diagrams/canton-json-api]
  box Grpc as gRPCのLedger API [note: 台帳の操作を出す, color: slate, icon: server, link: /diagrams/canton-json-api]
end
group JsonIn as JSON Ledger APIの中 [color: slate, icon: net]
  box Main as 主な操作 [note: 受け取る物と返す物, icon: card, link: /diagrams/canton-json-api]
  box State as 状態を確かめる操作 [note: 稼働と準備と版と台帳の位置と接続するSynchronizerとpackageとtraffic, icon: card, link: /diagrams/canton-json-entry]
end
group CliIn as 端末の道具の中 [color: blue, icon: app]
  box Tut as partyとコントラクトを作って照会する [note: コマンドラインの手引き, icon: refresh, link: /diagrams/canton-json-api-tutorials]
  box Lic as ライセンスの更新を依頼する [note: QuickStartで、トークンの取得から更新の依頼まで, icon: refresh, link: /diagrams/canton-quickstart-json-license]
end

step アプリからJSON Ledger APIへ
  say アプリは、認証が要る要求を、トークンとともにHTTPでJSON Ledger APIへ送り、JSON Ledger APIは、同じトークンでgRPCのLedger APIを呼びます。QuickStartの例では、端末の道具が、Keycloakへ資格情報を渡し、Keycloakから得たトークンを付けた要求を、JSON Ledger APIへ送ります。
  App -> Json: 要求とトークン
  Json -> Grpc: 同じトークンで呼ぶ
  Cli -> Kc: 資格情報
  Cli -> Json: トークン付きの要求
  source CantonのJSON API [url: https://docs.canton.network/sdks-tools/api-reference/json-api]
  source CantonのAPI Reference [url: https://docs.canton.network/api-reference]
  source CantonのWallet SDKの設定 [url: https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration]
  source CantonのPOST /v2/state/active-contracts [url: https://docs.canton.network/reference/json-api-reference/post-v2stateactive-contracts]
  source CantonのPOST /v2/commands/submit-and-wait [url: https://docs.canton.network/reference/json-api-reference/post-v2commandssubmit-and-wait]
  source CantonのPOST /v2/commands/async/submit [url: https://docs.canton.network/reference/json-api-reference/post-v2commandsasyncsubmit]
  source CantonのPOST /v2/interactive-submission/execute [url: https://docs.canton.network/reference/json-api-reference/post-v2interactive-submissionexecute]
  source Cantonのactive-contractsのAsyncAPI [url: https://docs.canton.network/reference/json-api-asyncapi-reference/operations/v2-state-active-contracts/publish]
  source CantonのJSON Ledger API OpenAPI [url: https://docs.canton.network/reference/json-api-reference/overview]
  source CantonのDELETE /v2/idps/:idp-id [url: https://docs.canton.network/reference/json-api-reference/delete-v2idps:idp-id]
  source CantonのGET /livez [url: https://docs.canton.network/reference/json-api-reference/get-livez]
  source CantonのGET /readyz [url: https://docs.canton.network/reference/json-api-reference/get-readyz]
  source CantonのGET /v2/version [url: https://docs.canton.network/reference/json-api-reference/get-v2version]
  source CantonのGET /v2/state/ledger-end [url: https://docs.canton.network/reference/json-api-reference/get-v2stateledger-end]
  source CantonのGET /v2/state/latest-pruned-offsets [url: https://docs.canton.network/reference/json-api-reference/get-v2statelatest-pruned-offsets]
  source CantonのGET /v2/state/connected-synchronizers [url: https://docs.canton.network/reference/json-api-reference/get-v2stateconnected-synchronizers]
  source CantonのGET /v2/packages [url: https://docs.canton.network/reference/json-api-reference/get-v2packages]
  source CantonのGET /v2/packages/:package-id [url: https://docs.canton.network/reference/json-api-reference/get-v2packages:package-id]
  source CantonのGET /v2/packages/:package-id/status [url: https://docs.canton.network/reference/json-api-reference/get-v2packages:package-idstatus]
  source CantonのGET /v2/traffic/accounts/:account-id [url: https://docs.canton.network/reference/json-api-reference/get-v2trafficaccounts:account-id]
  source Cantonのlocal traffic management [url: https://docs.canton.network/global-synchronizer/production-operations/local-traffic-management]
  source Cantonの3.6.1のリリースノート [url: https://docs.canton.network/global-synchronizer/release-notes/canton-releases/3-6-1]
  source CantonのLedger Model Detailed [url: https://docs.canton.network/overview/reference/ledger-model-detailed]
  source CantonとJSON Ledger API [url: https://docs.canton.network/appdev/modules/m4-json-api-tutorial]
  source CantonのMulti-Synchronizer Operations [url: https://docs.canton.network/appdev/modules/m4-multi-synchronizer-tutorial]
  source CantonのManage Daml Packages [url: https://docs.canton.network/appdev/modules/m5-manage-daml-packages]
  source CantonのPOST /v2/commands/submit-and-wait-for-reassignment [url: https://docs.canton.network/reference/json-api-reference/post-v2commandssubmit-and-wait-for-reassignment]
  source CantonのPOST /v2/packages [url: https://docs.canton.network/reference/json-api-reference/post-v2packages]
  source CantonのUsing the JSON Ledger API [url: https://docs.canton.network/appdev/quickstart/json-api]
  source CantonのQuickStart FAQ [url: https://docs.canton.network/appdev/quickstart/faq]
  source CantonのGET /v2/users/:user-id [url: https://docs.canton.network/reference/json-api-reference/get-v2users:user-id]

step JSON Ledger APIの中
  say JSON Ledger APIの主な操作は、トークンが要る例として、コマンドの送信と台帳の状態の読み取りと外部partyのコマンドの準備と署名後の送信があり、要らない物として、文書と版と稼働状態があります。状態を確かめる操作は、稼働中かと準備ができたかと、版と、台帳の位置と、接続するSynchronizerと、packageと、trafficを読みます。
  act Main: 受け取る物と返す物
  act State: 状態を確かめる
  source CantonのJSON API [url: https://docs.canton.network/sdks-tools/api-reference/json-api]
  source CantonのAPI Reference [url: https://docs.canton.network/api-reference]
  source CantonのWallet SDKの設定 [url: https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration]
  source CantonのPOST /v2/state/active-contracts [url: https://docs.canton.network/reference/json-api-reference/post-v2stateactive-contracts]
  source CantonのPOST /v2/commands/submit-and-wait [url: https://docs.canton.network/reference/json-api-reference/post-v2commandssubmit-and-wait]
  source CantonのPOST /v2/commands/async/submit [url: https://docs.canton.network/reference/json-api-reference/post-v2commandsasyncsubmit]
  source CantonのPOST /v2/interactive-submission/execute [url: https://docs.canton.network/reference/json-api-reference/post-v2interactive-submissionexecute]
  source Cantonのactive-contractsのAsyncAPI [url: https://docs.canton.network/reference/json-api-asyncapi-reference/operations/v2-state-active-contracts/publish]
  source CantonのJSON Ledger API OpenAPI [url: https://docs.canton.network/reference/json-api-reference/overview]
  source CantonのDELETE /v2/idps/:idp-id [url: https://docs.canton.network/reference/json-api-reference/delete-v2idps:idp-id]
  source CantonのGET /livez [url: https://docs.canton.network/reference/json-api-reference/get-livez]
  source CantonのGET /readyz [url: https://docs.canton.network/reference/json-api-reference/get-readyz]
  source CantonのGET /v2/version [url: https://docs.canton.network/reference/json-api-reference/get-v2version]
  source CantonのGET /v2/state/ledger-end [url: https://docs.canton.network/reference/json-api-reference/get-v2stateledger-end]
  source CantonのGET /v2/state/latest-pruned-offsets [url: https://docs.canton.network/reference/json-api-reference/get-v2statelatest-pruned-offsets]
  source CantonのGET /v2/state/connected-synchronizers [url: https://docs.canton.network/reference/json-api-reference/get-v2stateconnected-synchronizers]
  source CantonのGET /v2/packages [url: https://docs.canton.network/reference/json-api-reference/get-v2packages]
  source CantonのGET /v2/packages/:package-id [url: https://docs.canton.network/reference/json-api-reference/get-v2packages:package-id]
  source CantonのGET /v2/packages/:package-id/status [url: https://docs.canton.network/reference/json-api-reference/get-v2packages:package-idstatus]
  source CantonのGET /v2/traffic/accounts/:account-id [url: https://docs.canton.network/reference/json-api-reference/get-v2trafficaccounts:account-id]
  source Cantonのlocal traffic management [url: https://docs.canton.network/global-synchronizer/production-operations/local-traffic-management]
  source Cantonの3.6.1のリリースノート [url: https://docs.canton.network/global-synchronizer/release-notes/canton-releases/3-6-1]
  source CantonのLedger Model Detailed [url: https://docs.canton.network/overview/reference/ledger-model-detailed]

step 端末の道具の中
  say 端末の道具は、JSON Ledger APIで、partyとコントラクトを作って照会し、QuickStartのライセンスの更新を依頼します。
  act Tut: 作って照会する
  act Lic: 更新を依頼する
  source CantonとJSON Ledger API [url: https://docs.canton.network/appdev/modules/m4-json-api-tutorial]
  source CantonのMulti-Synchronizer Operations [url: https://docs.canton.network/appdev/modules/m4-multi-synchronizer-tutorial]
  source CantonのManage Daml Packages [url: https://docs.canton.network/appdev/modules/m5-manage-daml-packages]
  source CantonのJSON API [url: https://docs.canton.network/sdks-tools/api-reference/json-api]
  source CantonのPOST /v2/state/active-contracts [url: https://docs.canton.network/reference/json-api-reference/post-v2stateactive-contracts]
  source CantonのPOST /v2/commands/submit-and-wait-for-reassignment [url: https://docs.canton.network/reference/json-api-reference/post-v2commandssubmit-and-wait-for-reassignment]
  source CantonのPOST /v2/packages [url: https://docs.canton.network/reference/json-api-reference/post-v2packages]
  source CantonのUsing the JSON Ledger API [url: https://docs.canton.network/appdev/quickstart/json-api]
  source CantonのQuickStart FAQ [url: https://docs.canton.network/appdev/quickstart/faq]
  source CantonのPOST /v2/commands/submit-and-wait [url: https://docs.canton.network/reference/json-api-reference/post-v2commandssubmit-and-wait]
  source CantonのGET /v2/users/:user-id [url: https://docs.canton.network/reference/json-api-reference/get-v2users:user-id]
```

一番外の階では、アプリが、認証が要る要求をトークンとともにJSON Ledger APIへ送り、JSON Ledger APIが同じトークンでgRPCのLedger APIを呼びます。
QuickStartの例では、端末の道具が、Keycloakへ資格情報を渡し、Keycloakから得たトークンを付けた要求をJSON Ledger APIへ送ります。
アプリからの呼び方は頁「HTTPからLedger APIを使う」が、端末の道具の手引きは頁「JSON Ledger APIで台帳と話す」が、Keycloakでのトークンの取得は頁「ライセンスの流れをAPIで回す」が追います。

JSON Ledger APIの中では、主な操作を頁「HTTPからLedger APIを使う」が、状態を確かめる操作を頁「JSON APIの入口と状態を確かめる」が追います。
端末の道具の中では、partyとコントラクトを作って照会する呼び出しを頁「JSON Ledger APIで台帳と話す」が、ライセンスの更新の依頼を頁「ライセンスの流れをAPIで回す」が追います。
更新の依頼の後の、支払いの割り当てと更新の完了は、同じ頁が、walletの画面とQuickStartのバックエンドの担当として追います。

この図では、Keycloakがトークンを返す向きの線を引かず、トークンの取得は頁「ライセンスの流れをAPIで回す」の図に任せます。
この図では、端末の道具の中に置く2つの箱を、道具が呼ぶ操作として置きます。

## 出典

https://docs.canton.network/sdks-tools/api-reference/json-api

https://docs.canton.network/reference/json-api-reference/overview

https://docs.canton.network/appdev/modules/m4-json-api-tutorial

https://docs.canton.network/appdev/quickstart/json-api

https://docs.canton.network/appdev/modules/m4-multi-synchronizer-tutorial

https://docs.canton.network/reference/json-api-reference/get-livez

https://docs.canton.network/reference/json-api-reference/get-readyz

https://docs.canton.network/reference/json-api-reference/get-v2version

https://docs.canton.network/reference/json-api-reference/get-v2stateledger-end

https://docs.canton.network/reference/json-api-reference/get-v2statelatest-pruned-offsets

https://docs.canton.network/reference/json-api-reference/get-v2stateconnected-synchronizers

https://docs.canton.network/reference/json-api-reference/get-v2packages

https://docs.canton.network/reference/json-api-reference/get-v2packages:package-id

https://docs.canton.network/reference/json-api-reference/get-v2packages:package-idstatus

https://docs.canton.network/reference/json-api-reference/get-v2trafficaccounts:account-id

https://docs.canton.network/api-reference

https://docs.canton.network/appdev/modules/m5-manage-daml-packages

https://docs.canton.network/appdev/quickstart/faq

https://docs.canton.network/global-synchronizer/production-operations/local-traffic-management

https://docs.canton.network/global-synchronizer/release-notes/canton-releases/3-6-1

https://docs.canton.network/overview/reference/ledger-model-detailed

https://docs.canton.network/reference/json-api-asyncapi-reference/operations/v2-state-active-contracts/publish

https://docs.canton.network/reference/json-api-reference/delete-v2idps:idp-id

https://docs.canton.network/reference/json-api-reference/get-v2users:user-id

https://docs.canton.network/reference/json-api-reference/post-v2commandsasyncsubmit

https://docs.canton.network/reference/json-api-reference/post-v2commandssubmit-and-wait

https://docs.canton.network/reference/json-api-reference/post-v2commandssubmit-and-wait-for-reassignment

https://docs.canton.network/reference/json-api-reference/post-v2interactive-submissionexecute

https://docs.canton.network/reference/json-api-reference/post-v2packages

https://docs.canton.network/reference/json-api-reference/post-v2stateactive-contracts

https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration
