Transactions
Bulk transactions
Submit multiple transactions in one request with the TypeScript SDK.
POST
/
transactions
/
bulk
Bulk transactions
curl --request POST \
--url http://localhost:5001/transactions/bulk \
--header 'X-blnk-key: <api-key>'import requests
url = "http://localhost:5001/transactions/bulk"
headers = {"X-blnk-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-blnk-key': '<api-key>'}};
fetch('http://localhost:5001/transactions/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "5001",
CURLOPT_URL => "http://localhost:5001/transactions/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-blnk-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:5001/transactions/bulk"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-blnk-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:5001/transactions/bulk")
.header("X-blnk-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5001/transactions/bulk")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-blnk-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyUse
blnk.Transactions.createBulk to create many transactions in one request (up to 10,000 per request).
1
Call the method
- Create batch
- Dry run
blnk.Transactions.createBulk
const response = await blnk.Transactions.createBulk({
atomic: true,
transactions: [
{
amount: 1000,
precision: 100,
currency: 'USD',
source: '@source_1',
destination: '@dest_1',
reference: 'bulk_001',
description: 'Payment 1',
},
{
amount: 2000,
precision: 100,
currency: 'USD',
source: '@source_2',
destination: '@dest_2',
reference: 'bulk_002',
description: 'Payment 2',
},
],
});
| Field | Type | Description |
|---|---|---|
transactions | object[] | Transaction objects to create; up to 10,000 per request. References must be unique within the batch. |
atomic | boolean | When true, every transaction succeeds or fails together. |
inflight | boolean | When true, transactions are created in INFLIGHT status for a later commit or void. |
run_async | boolean | When true, Core processes the batch in the background and returns status: 'queued'. |
skip_queue | boolean | When true, transactions bypass the queue and process synchronously. |
Preview the batch without writing anything.
Pass
skip_queue selects cumulative vs independent projection. run_async is ignored. See Dry-run transactions.blnk.Transactions.createBulk
const preview = await blnk.Transactions.createBulk({
dry_run: true,
skip_queue: false,
transactions: [
{
precise_amount: 45000,
precision: 100,
currency: 'USD',
source: 'bln_source-bal-001',
destination: 'bln_dest-bal-001',
reference: 'ref_payout_450',
description: 'First payout',
},
{
precise_amount: 10000,
precision: 100,
currency: 'USD',
source: 'bln_source-bal-001',
destination: 'bln_dest-bal-002',
reference: 'ref_payout_100',
description: 'Second payout',
},
],
});
| Field | Type | Description |
|---|---|---|
dry_run | true | Return a BulkTransactionPreview without creating transactions or consuming references. |
skip_queue | boolean | true projects items in order against each other. false projects each item against current balances on its own. |
dry_run: true inline, as shown above, to infer the preview response. If the request is declared separately, type it as DryRun<BulkTransactions<T>>.2
Save the batch ID
On a posted batch, use
response.data.batch_id as parent_transaction to find child transactions, or with updateStatus to commit or void an inflight batch.A dry run has no batch_id. Check would_apply and results.3
Response
- Create batch
- Dry run
{
"batch_id": "bulk_c62f200b-905f-4983-a349-cadd279234aa",
"status": "applied",
"transaction_count": 4
}
{
"batch_id": "bulk_c62f200b-905f-4983-a349-cadd279234aa",
"status": "queued",
"message": "Bulk transaction processing started"
}
| Field | Type | Description |
|---|---|---|
batch_id | string | Identifier for the batch. Use as parent_transaction to find child transactions, or with updateStatus to commit or void an inflight batch. |
status | string | applied, inflight, or queued depending on the batch. |
transaction_count | number | Number of transactions when processed synchronously. |
message | string | Status message when run_async is true. |
200 OK
{
"dry_run": true,
"would_apply": true,
"cumulative": false,
"atomic": false,
"results": [
{
"dry_run": true,
"would_apply": true,
"status": "APPLIED",
"reference": "ref_payout_450",
"currency": "USD",
"amount": 450,
"precise_amount": "45000",
"precision": 100
},
{
"dry_run": true,
"would_apply": true,
"status": "APPLIED",
"reference": "ref_payout_100",
"currency": "USD",
"amount": 100,
"precise_amount": "10000",
"precision": 100
}
]
}
Need help?
We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool. To ask questions or discuss issues, please contact us or join our Discord community.Was this page helpful?
⌘I