Ingest external transactions (idempotent batch)
curl --request POST \
--url https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"external_id": "txn_1OqIJq",
"amount": "10000000",
"currency": "USDC",
"occurred_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"reference_rail": "stripe",
"reference_kind": "charge",
"reference_value": "ch_3Nq",
"raw": {}
}
]
}
'import requests
url = "https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions"
payload = { "items": [
{
"external_id": "txn_1OqIJq",
"amount": "10000000",
"currency": "USDC",
"occurred_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"reference_rail": "stripe",
"reference_kind": "charge",
"reference_value": "ch_3Nq",
"raw": {}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{
external_id: 'txn_1OqIJq',
amount: '10000000',
currency: 'USDC',
occurred_at: '2023-11-07T05:31:56Z',
account_id: '<string>',
reference_rail: 'stripe',
reference_kind: 'charge',
reference_value: 'ch_3Nq',
raw: {}
}
]
})
};
fetch('https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'external_id' => 'txn_1OqIJq',
'amount' => '10000000',
'currency' => 'USDC',
'occurred_at' => '2023-11-07T05:31:56Z',
'account_id' => '<string>',
'reference_rail' => 'stripe',
'reference_kind' => 'charge',
'reference_value' => 'ch_3Nq',
'raw' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions"
payload := strings.NewReader("{\n \"items\": [\n {\n \"external_id\": \"txn_1OqIJq\",\n \"amount\": \"10000000\",\n \"currency\": \"USDC\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"account_id\": \"<string>\",\n \"reference_rail\": \"stripe\",\n \"reference_kind\": \"charge\",\n \"reference_value\": \"ch_3Nq\",\n \"raw\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"external_id\": \"txn_1OqIJq\",\n \"amount\": \"10000000\",\n \"currency\": \"USDC\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"account_id\": \"<string>\",\n \"reference_rail\": \"stripe\",\n \"reference_kind\": \"charge\",\n \"reference_value\": \"ch_3Nq\",\n \"raw\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"external_id\": \"txn_1OqIJq\",\n \"amount\": \"10000000\",\n \"currency\": \"USDC\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"account_id\": \"<string>\",\n \"reference_rail\": \"stripe\",\n \"reference_kind\": \"charge\",\n \"reference_value\": \"ch_3Nq\",\n \"raw\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "ingest_result",
"source_id": "2e0ce42a-46cf-4c61-bf63-0e1a72f5d8a1",
"created_count": 1,
"replayed_count": 1,
"error_count": 0,
"results": [
{
"external_id": "txn_1",
"status": "created"
},
{
"external_id": "txn_0",
"status": "replayed"
}
]
}Stores up to 1000 external money-movement rows. Idempotent on
(source, external_id): re-submitting a row never mutates the
stored copy and reports replayed. Invalid rows report error
per item without blocking the rest.
Amounts are integer minor units. occurred_at (alias at) is
ISO 8601. reference_rail/reference_kind/reference_value
must be provided together; they join against transaction
external refs during matching. raw retains the provider
payload.
POST
/
ledger
/
v1
/
sources
/
{source_id}
/
external_transactions
Ingest external transactions (idempotent batch)
curl --request POST \
--url https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"external_id": "txn_1OqIJq",
"amount": "10000000",
"currency": "USDC",
"occurred_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"reference_rail": "stripe",
"reference_kind": "charge",
"reference_value": "ch_3Nq",
"raw": {}
}
]
}
'import requests
url = "https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions"
payload = { "items": [
{
"external_id": "txn_1OqIJq",
"amount": "10000000",
"currency": "USDC",
"occurred_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"reference_rail": "stripe",
"reference_kind": "charge",
"reference_value": "ch_3Nq",
"raw": {}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{
external_id: 'txn_1OqIJq',
amount: '10000000',
currency: 'USDC',
occurred_at: '2023-11-07T05:31:56Z',
account_id: '<string>',
reference_rail: 'stripe',
reference_kind: 'charge',
reference_value: 'ch_3Nq',
raw: {}
}
]
})
};
fetch('https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'external_id' => 'txn_1OqIJq',
'amount' => '10000000',
'currency' => 'USDC',
'occurred_at' => '2023-11-07T05:31:56Z',
'account_id' => '<string>',
'reference_rail' => 'stripe',
'reference_kind' => 'charge',
'reference_value' => 'ch_3Nq',
'raw' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions"
payload := strings.NewReader("{\n \"items\": [\n {\n \"external_id\": \"txn_1OqIJq\",\n \"amount\": \"10000000\",\n \"currency\": \"USDC\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"account_id\": \"<string>\",\n \"reference_rail\": \"stripe\",\n \"reference_kind\": \"charge\",\n \"reference_value\": \"ch_3Nq\",\n \"raw\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"external_id\": \"txn_1OqIJq\",\n \"amount\": \"10000000\",\n \"currency\": \"USDC\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"account_id\": \"<string>\",\n \"reference_rail\": \"stripe\",\n \"reference_kind\": \"charge\",\n \"reference_value\": \"ch_3Nq\",\n \"raw\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/ledger/v1/sources/{source_id}/external_transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"external_id\": \"txn_1OqIJq\",\n \"amount\": \"10000000\",\n \"currency\": \"USDC\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"account_id\": \"<string>\",\n \"reference_rail\": \"stripe\",\n \"reference_kind\": \"charge\",\n \"reference_value\": \"ch_3Nq\",\n \"raw\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "ingest_result",
"source_id": "2e0ce42a-46cf-4c61-bf63-0e1a72f5d8a1",
"created_count": 1,
"replayed_count": 1,
"error_count": 0,
"results": [
{
"external_id": "txn_1",
"status": "created"
},
{
"external_id": "txn_0",
"status": "replayed"
}
]
}Authorizations
Same flow; ledger:write is required for any mutation.
Path Parameters
Body
application/json
Maximum array length:
1000Show child attributes
Show child attributes