canton-ledger-api
The gRPC Ledger API — the primary interface to a validant's participant node. Covers command submission (CommandService submit-and-wait, CommandSubmissionService async submit), the update/transaction stream (UpdateService), state queries (StateService active-contracts, ledger-end), party/user/package admin services, interactive submission (prepare/execute) for external parties, TLS + JWT auth, and that types are addressed by (entity, module, package-hash). Use for high-throughput backends.
Works with
--- name: canton-ledger-api description: The gRPC Ledger API — the primary interface to a validant's participant node. Covers command submission (CommandService submit-and-wait, CommandSubmissionService async submit), the update/transaction stream (UpdateService), state queries (StateService active-contracts, ledger-end), party/user/package admin services, interactive submission (prepare/execute) for external parties, TLS + JWT auth, and that types are addressed by (entity, module, package-hash). Use for high-throughput backends. license: Apache-2.0 --- # Canton Ledger API (gRPC) ## Overview The **Ledger API** is the primary interface for submitting commands and reading transactions, exposed by a validator's **participant node** over **gRPC** (and mirrored by the JSON API, which translates to it). It's the high-throughput choice for production backends because it avoids JSON serialization overhead. ## What it provides | Capability | Service(s) | | --- | --- | | **Command submission** | `CommandService` (submit-and-wait variants), `CommandSubmissionService` (async submit) | | **Update / transaction stream** | `UpdateService` (`GetUpdates`, by-offset/by-id) | | **Active Contract Set / state** | `StateService` (`GetActiveContracts`, `GetLedgerEnd`, connected synchronizers) | | **Command completions** | `CommandCompletionService` (`CompletionStream`) | | **Events** | `EventQueryService` (events by contract id) | | **Interactive submission** | `InteractiveSubmissionService` (`prepare`/`execute`) — for external parties | | **Admin** | `PartyManagementService`, `UserManagementService`, `PackageManagementService`, `IdentityProviderConfigService`, `ParticipantPruningService` | ## Submitting commands You act **as a party** hosted on the participant. Commands are `CreateCommand`, `ExerciseCommand`, `CreateAndExerciseCommand`, `ExerciseByKeyCommand`. - **`CommandService.SubmitAndWait*`** — submit and block until commit; returns the transaction/update. Simplest for request/response backends. - **`CommandSubmissionService.Submit`** — fire-and-forget; track outcomes via the **completion** stream. Higher throughput. Use a stable **command ID** per logical command for **deduplication** (see `appdev/deep-dives/command-deduplication.mdx`). Commands carry `actAs`/`readAs` party sets and a `userId`. ## Reading state - **Transaction/update stream** (`UpdateService.GetUpdates`) — subscribe from an **offset** to receive committed transactions for your parties; drive your read model from it. - **ACS** (`StateService.GetActiveContracts`) — snapshot of active contracts at an offset; bootstrap then follow the stream. Get the current offset from `GetLedgerEnd`. - Filters use party + **template/interface** filters (e.g. an `InterfaceFilter` with `includeInterfaceView`/`includeCreatedEventBlob`) — the same filter shapes the JSON API uses. ## Type identifiers Over the Ledger API every type is addressed by the triple **`(entity name, module name, package hash)`** (e.g. `<hash>:Main:Asset`). Your client must know the package hashes it targets — generate bindings from the DAR so this is type-safe (see `canton-language-bindings`). ## External parties: prepare / execute For **external parties** (keys held off-validator), you don't submit directly. You **`prepare`** a submission on the participant, sign the resulting hash with the party's key, then **`execute`** it. See `canton-external-signing`. ## Auth & transport Production uses **TLS + JWT** bearer tokens (scopes like `daml_ledger_api`); on LocalNet auth can run through Keycloak or be disabled for fast iteration. The Admin API (gRPC) handles node administration, party allocation, and DAR upload. ## Source docs - [`sdks-tools/api-reference/ledger-api.mdx`](../canton-docs/sdks-tools/api-reference/ledger-api.mdx), [`ledger-api-services.mdx`](../canton-docs/sdks-tools/api-reference/ledger-api-services.mdx) - [`appdev/modules/m4-sdks-apis.mdx`](../canton-docs/appdev/modules/m4-sdks-apis.mdx), [`m4-backend-dev.mdx`](../canton-docs/appdev/modules/m4-backend-dev.mdx) - [`appdev/deep-dives/command-deduplication.mdx`](../canton-docs/appdev/deep-dives/command-deduplication.mdx), [`values-in-the-ledger-api.mdx`](../canton-docs/appdev/deep-dives/values-in-the-ledger-api.mdx) - Related skills: `canton-json-api`, `canton-language-bindings`, `canton-external-signing`, `canton-app-architecture`. ## AI Agent Prompt > "Implement a backend against the gRPC Ledger API: submit creates/exercises via `CommandService.SubmitAndWait` (with a dedup command ID), bootstrap state from `StateService.GetActiveContracts` at the current ledger-end, then follow `UpdateService.GetUpdates` to maintain a read model. Address templates by their (entity, module, package-hash) triple and authenticate with a JWT."
More API Design skills
lark-event
larksuite/cli
Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM messages/reactions/chat changes, Approval status changes, Task updates, VC meeting started/joined/ended, Minutes generated, Whiteboard updated, etc.). Use for Lark bots, real-time message processing, long-running subscribers, streaming webhook/push handlers. Supports `--max-events` / `--timeout` bounded runs and a stderr ready-marker contract — designed for AI agents running as subprocesses.
lark-contact
larksuite/cli
飞书 / Lark 通讯录:按姓名 / 邮箱解析成 open_id,或按 open_id 反查姓名 / 部门 / 邮箱 / 联系方式 / 个人状态 / 签名,以及按关键词搜索当前用户可见的机器人 / 智能体(agent)。当用户提到一个名字要下一步发消息 / 排日程,或拿到 open_id 想查具体信息时使用。不负责部门树遍历、按部门列员工、组织架构图,这类需求走原生 OpenAPI。
lark-openapi-explorer
larksuite/cli
飞书/Lark 原生 OpenAPI 探索:从官方文档库中挖掘未经 CLI 封装的原生 OpenAPI 接口。当用户的需求无法被现有 lark-* skill 或 lark-cli 已注册命令满足,需要查找并调用原生飞书 OpenAPI 时使用。

