Skip to content

Ledger JSON API

HardlyDifficult edited this page Jul 9, 2026 · 3 revisions

Ledger JSON API Client

This client provides a type-safe interface for interacting with the Ledger JSON API.

Per-method documentation migrated from the former docs site: see Reference and the pages under reference/ledger (overview: reference/ledger).

Submit-And-Wait Request Envelopes

The Ledger JSON API v2 endpoints do not all share the same request-body shape. In particular, /v2/commands/submit-and-wait-for-transaction expects:

{
  "commands": {
    "commands": [],
    "commandId": "...",
    "actAs": ["..."]
  },
  "transactionFormat": {}
}

The SDK method accepts the convenient flat command parameters, then serializes the JsCommands fields under the top-level commands property. Keep transactionFormat beside that property. Do not infer this endpoint's wire shape from the deprecated transaction-tree endpoint, which uses a different OpenAPI schema.

Errors reporting missing commands.commands, commands.commandId, or commands.actAs indicate a malformed HTTP envelope. The participant rejects that request before sequencing, so it does not produce a Canton transaction.

When adding or changing a generated operation:

  1. Check the exact OpenAPI request schema for that endpoint.
  2. Keep public convenience parameters separate from the serialized wire body.
  3. Assert the complete request payload in a regression test, including default commandId and actAs values.
  4. Confirm a rejected-envelope test has no matching update ID before treating it as a ledger failure.

Clone this wiki locally