Quick Reference
When to Use the JSON API
The JSON API is the recommended access method when:- You’re building browser-based frontends or web applications
- Your language/framework works better with HTTP/JSON than gRPC
- You want simpler tooling for development and debugging (curl, Postman, etc.)
- You’re using the TypeScript/JavaScript Wallet SDK
- You need maximum performance for high-throughput streaming
- You’re using Java and want the native gRPC experience
- You need access to gRPC-specific features not exposed via JSON
Key Endpoints
Version Check
Command Submission
/v2/commands/submit-and-wait-for-transaction (returns the full transaction) and /v2/commands/async/submit (returns immediately).
Active Contract Queries
Transaction Streaming
The JSON API supports both HTTP POST and WebSocket connections for streaming. The WebSocket channels are listed in the AsyncAPI reference. For WebSocket requests, you must pass two subprotocols:jwt.token.<paste-jwt-here>daml.ws.auth
wscat:
Ledger End
GET /v2/state/ledger-end returns the latest absolute offset on the participant. Use it as the activeAtOffset value when querying the ACS to get the most recent state, or pass an older non-pruned offset to read state at a historical point.
Interactive Submission
External-party command submission goes through two endpoints rather than the standardsubmit-and-wait flow:
POST /v2/interactive-submission/prepare— produces a prepared transaction the external party signs off-participant.POST /v2/interactive-submission/execute— submits the signed prepared transaction back to the participant for ledger execution.
Configuration
The JSON API is configured via thehttp-ledger-api section of the participant node’s configuration. In cn-quickstart LocalNet deployments, it is pre-configured and available at http://localhost:7575.
The OpenAPI and AsyncAPI specifications are available at runtime:
Your JSON Ledger API service should never be exposed to the Internet. When running in production the JSON Ledger API should be behind a reverse proxy, such as via NGINX.
Authentication
Each request to the JSON Ledger API must come with an access token (JWT). The JSON Ledger API does not hold on to the access token, which will be only used to fulfill the request it came along with. The same token will be used to issue the request to the Ledger API. The exceptions are the documentation endpoints (/docs/openapi, /docs/asyncapi), /v2/version, and the health endpoints (/livez, /readyz), which do not require a token.
For a reference on the JWT tokens we use, please read Authorization.
Auth via HTTP
Pass a JWT Bearer token in theAuthorization header:
Auth via WebSockets
WebSocket clients support a “subprotocols” argument (sometimes simply called “protocols”); this is usually in a list form but occasionally in comma-separated form. Check the documentation for your WebSocket library of choice for details. For WebSocket requests, you must pass two subprotocols:daml.ws.authjwt.token.<paste-jwt-here>
wscat:
Errors
The JSON Ledger API reports errors using standard HTTP status codes. When the gRPC Ledger API returns an error code, the JSON Ledger API maps it to an HTTP status code:
A request body that cannot be decoded is answered with 400 Bad Request.
If a client’s HTTP GET or POST request reaches an API endpoint, the corresponding response contains a JSON object. Either an expected message (corresponding to endpoint) or an error object specified as in the example below:
cause— a textual message containing readable error reason,code— a Ledger API error code,context— a Ledger API context of an error,traceId— telemetry tracing id,grpcCodeValueanderrorCategory— defined in Error Codes.
WebSockets Errors
In the case of WebSockets an error might be delivered as a frame. Each incoming frame can either be a correct response (corresponding to the endpoint definition) or an error frame in the format above.Related Pages
- Ledger API — gRPC Ledger API overview
- Ledger API Reference (AppDev) — Detailed service documentation
- Wallet Configuration — SDK configuration including JSON API endpoints