Define an account template
curl --request POST \
--url https://api.kordio.io/ledger/v1/account_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "accounts_receivable",
"accounting_type": "asset",
"allowed_currencies": [
"USD",
"EUR",
"USDC"
],
"description": "Amounts owed to the business."
}
'import requests
url = "https://api.kordio.io/ledger/v1/account_templates"
payload = {
"name": "accounts_receivable",
"accounting_type": "asset",
"allowed_currencies": ["USD", "EUR", "USDC"],
"description": "Amounts owed to the business."
}
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({
name: 'accounts_receivable',
accounting_type: 'asset',
allowed_currencies: ['USD', 'EUR', 'USDC'],
description: 'Amounts owed to the business.'
})
};
fetch('https://api.kordio.io/ledger/v1/account_templates', 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/account_templates",
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([
'name' => 'accounts_receivable',
'accounting_type' => 'asset',
'allowed_currencies' => [
'USD',
'EUR',
'USDC'
],
'description' => 'Amounts owed to the business.'
]),
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/account_templates"
payload := strings.NewReader("{\n \"name\": \"accounts_receivable\",\n \"accounting_type\": \"asset\",\n \"allowed_currencies\": [\n \"USD\",\n \"EUR\",\n \"USDC\"\n ],\n \"description\": \"Amounts owed to the business.\"\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/account_templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"accounts_receivable\",\n \"accounting_type\": \"asset\",\n \"allowed_currencies\": [\n \"USD\",\n \"EUR\",\n \"USDC\"\n ],\n \"description\": \"Amounts owed to the business.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/ledger/v1/account_templates")
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 \"name\": \"accounts_receivable\",\n \"accounting_type\": \"asset\",\n \"allowed_currencies\": [\n \"USD\",\n \"EUR\",\n \"USDC\"\n ],\n \"description\": \"Amounts owed to the business.\"\n}"
response = http.request(request)
puts response.read_body{
"object": "account_template",
"name": "<string>",
"accounting_type": "<string>",
"allowed_currencies": [
"<string>"
],
"balance_non_negative": true,
"description": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z"
}{
"livemode": false,
"request_id": "req_3LhM8XKx9q4hQv",
"error": {
"code": "invalid_request",
"message": "<string>",
"hint": "<string>",
"param": "<string>",
"details": {},
"docs_url": "<string>",
"request_id": "<string>"
}
}{
"livemode": false,
"request_id": "req_3LhM8XKx9q4hQv",
"error": {
"code": "invalid_request",
"message": "<string>",
"hint": "<string>",
"param": "<string>",
"details": {},
"docs_url": "<string>",
"request_id": "<string>"
}
}A template names a reusable shape for accounts: accounting type, allowed
currencies, balance sign rule. When POST /v1/accounts is called with
template: <name>, the request is validated against the template before
insert. Templates are immutable; create a new name to evolve.
POST
/
ledger
/
v1
/
account_templates
Define an account template
curl --request POST \
--url https://api.kordio.io/ledger/v1/account_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "accounts_receivable",
"accounting_type": "asset",
"allowed_currencies": [
"USD",
"EUR",
"USDC"
],
"description": "Amounts owed to the business."
}
'import requests
url = "https://api.kordio.io/ledger/v1/account_templates"
payload = {
"name": "accounts_receivable",
"accounting_type": "asset",
"allowed_currencies": ["USD", "EUR", "USDC"],
"description": "Amounts owed to the business."
}
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({
name: 'accounts_receivable',
accounting_type: 'asset',
allowed_currencies: ['USD', 'EUR', 'USDC'],
description: 'Amounts owed to the business.'
})
};
fetch('https://api.kordio.io/ledger/v1/account_templates', 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/account_templates",
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([
'name' => 'accounts_receivable',
'accounting_type' => 'asset',
'allowed_currencies' => [
'USD',
'EUR',
'USDC'
],
'description' => 'Amounts owed to the business.'
]),
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/account_templates"
payload := strings.NewReader("{\n \"name\": \"accounts_receivable\",\n \"accounting_type\": \"asset\",\n \"allowed_currencies\": [\n \"USD\",\n \"EUR\",\n \"USDC\"\n ],\n \"description\": \"Amounts owed to the business.\"\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/account_templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"accounts_receivable\",\n \"accounting_type\": \"asset\",\n \"allowed_currencies\": [\n \"USD\",\n \"EUR\",\n \"USDC\"\n ],\n \"description\": \"Amounts owed to the business.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/ledger/v1/account_templates")
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 \"name\": \"accounts_receivable\",\n \"accounting_type\": \"asset\",\n \"allowed_currencies\": [\n \"USD\",\n \"EUR\",\n \"USDC\"\n ],\n \"description\": \"Amounts owed to the business.\"\n}"
response = http.request(request)
puts response.read_body{
"object": "account_template",
"name": "<string>",
"accounting_type": "<string>",
"allowed_currencies": [
"<string>"
],
"balance_non_negative": true,
"description": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z"
}{
"livemode": false,
"request_id": "req_3LhM8XKx9q4hQv",
"error": {
"code": "invalid_request",
"message": "<string>",
"hint": "<string>",
"param": "<string>",
"details": {},
"docs_url": "<string>",
"request_id": "<string>"
}
}{
"livemode": false,
"request_id": "req_3LhM8XKx9q4hQv",
"error": {
"code": "invalid_request",
"message": "<string>",
"hint": "<string>",
"param": "<string>",
"details": {},
"docs_url": "<string>",
"request_id": "<string>"
}
}Authorizations
Same flow; ledger:write is required for any mutation.
Body
application/json
Example:
"accounts_receivable"
Available options:
asset, liability, revenue, expense, equity Empty list means any currency is allowed.
Example:
["USD", "EUR", "USDC"]
When true, accounts using this template default to overdraft_policy=none.
Default classification inherited by accounts using this template.
Available options:
client_held, operator, neutral Optional custody identifier inherited by accounts.
Paired with custody_provider.