Configurable client options ship in v1.3.0. See the Changelog before upgrading.
Initialize the client
Your Blnk client is the single entry point to everything: ledgers, balances, transactions, webhooks, and more. Configure it once when your app starts, then use it everywhere.BlnkClient.java
CreateLedgerExample.java
ledgers(), ledgerBalances(), transactions(), balanceMonitor(), reconciliation(), identity(), metadata(), hooks(), search(), apiKeys(), and system().
Builders and wire fields
Request bodies are built with fluent types incom.blnkfinance.blnk.types. Builder methods use camelCase (for example metaData(), skipQueue(), preciseAmount()). Blnk Core receives snake_case JSON on the wire (for example meta_data, skip_queue, precise_amount).
On method pages, request field tables list the wire field name because it matches the HTTP API and response JSON. Map it to the Java builder in your code:
When prose refers to an SDK method, it uses Java names:
createBulk, updateStatus, blnk.transactions().create. JSON examples and metadata keys may still use snake_case (for example a custom metadata key named update_status).
Response bodies
Every method returnsApiResponse<JsonNode>. Treat response.data() as parsed JSON:
- Object responses:
response.data().get("ledger_id").asText() - Array responses: check
response.data().isArray(), then readresponse.data().get(i).get("field") - Nested arrays:
response.data().get("results").get(i).get("status").asText() - No body (204):
response.data()isnull; branch onresponse.status()only
JsonNode returned in response.data().
Authentication
Blnk.init takes two arguments: an API key and a BlnkClientOptions object.
The options object must include baseUrl, the root URL of your Blnk Core instance. The SDK sends the API key on every request in the X-Blnk-Key header.
How you set the API key depends on whether Core runs in secure mode:
- Secure mode
- Auth disabled
When
server.secure is enabled, pass your API key as the first argument. Set baseUrl to the URL where Core is reachable.Secure Blnk
Secure mode, master key, and server hardening.
Scoped API keys
Owner-scoped keys and permission limits.
Timeouts and retries
When connections fail, Core restarts, or requests hang, the SDK handles it without blocking your app. Pass these parameters onBlnkClientOptions.builder():
When to tune these:
- Keep defaults if you’re making fast, local calls and want to fail fast.
- Increase
timeoutif you’re running large batch requests that may take a while to complete synchronously. - Increase
retryCountif you’re reading data across an unreliable network.
Retries apply to
GET requests only. Timeouts return a synthetic 408 response and are never retried.Custom logger
By default, the SDK logs internal events through a built-in logger that writes to the console withINFO: and ERROR: prefixes.
Pass a custom BlnkLogger to route these messages to your own logging system instead of the console.
Metadata passed to the logger is redacted. The SDK strips values for keys such as
api_key, authorization, token, and secret before logging.Example logs
Related docs
Quick start
Install the SDK and create your first transaction.
Error handling
ApiResponse checks and Core error bodies.
Changelog
Java SDK releases and version history.