Start Here
Java quick start
Install the Java SDK and create your first transaction.
Use the latest Java SDK release, v1.6.0.
This guide walks you through adding the Blnk Java SDK to your project, initializing the client, and creating your first transaction.
By the end, you’ll have a working connection to Blnk and be ready to build financial products from your Java application.
Install the SDK
Add the dependency from Maven Central. Requires JDK 17 or later.
<dependency>
<groupId>com.blnkfinance</groupId>
<artifactId>blnk-java</artifactId>
<version>1.6.0</version>
</dependency>Gradle:
implementation("com.blnkfinance:blnk-java:1.6.0")Create a sample class
Create a Main.java file as shown below to create your first transaction with the SDK.
public class Main {
public static void main(String[] args) {
String apiKey = System.getenv().getOrDefault("BLNK_API_KEY", "");
String baseUrl = System.getenv().getOrDefault(
"BLNK_BASE_URL",
"http://localhost:5001"
);
Blnk blnk = Blnk.init(
apiKey,
BlnkClientOptions.builder()
.baseUrl(baseUrl)
.build());
ApiResponse<JsonNode> response = blnk.transactions().create(
CreateTransactions.create()
.preciseAmount(100000)
.reference("first_txn_001")
.currency("USD")
.precision(100)
.source("@FundingPool")
.destination("@MyBalance")
.description("My first Blnk transaction")
.allowOverdraft(true)
);
if (response.status() != 201 || response.data() == null) {
throw new RuntimeException(response.message());
}
System.out.println(response.data().toPrettyString());
}
}Execute the class
Compile and run.
mvn compile exec:java -Dexec.mainClass="Main"You should get a response similar to:
{
"amount": 1000,
"precision": 100,
"precise_amount": 100000,
"transaction_id": "txn_8d2ce2f0-0d75-4a91-9d43-2ad2c2e6b9ad",
"parent_transaction": "",
"source": "bln_f344b673-e855-4bda-b769-3e94a02c1941",
"destination": "bln_d5cbde84-d20a-485b-8ce8-6677d782c3a1",
"reference": "first_txn_001",
"currency": "USD",
"description": "My first Blnk transaction",
"status": "QUEUED",
"hash": "0b9c25fb5b00d6c71cb4ca87026bf6dc316e63353d3330deb588bd0b3d74dcc0",
"allow_overdraft": true,
"inflight": false,
"created_at": "2024-11-26T09:33:35.265582042Z",
"scheduled_for": "0001-01-01T00:00:00Z",
"inflight_expiry_date": "0001-01-01T00:00:00Z",
"inflight_commit_date": "0001-01-01T00:00:00Z"
}View the transaction
Confirm the transaction landed in your ledger.
- Open Transactions in the sidebar.
- Find your transaction by reference (
first_txn_001) or by thetransaction_idfrom the script output. - Click the row to open the details and verify the amount, status, source, and destination.

Fetch the transaction by ID:
blnk transactions list --id txn_8d2ce2f0-0d75-4a91-9d43-2ad2c2e6b9adReplace the transaction ID with the value printed by your class.