Skip to main content
POST
/
v1
/
ledgers
/
{id}
/
entries
Create ledger entry
curl --request POST \
  --url https://api.example.com/v1/ledgers/{id}/entries \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "amount": 2,
  "description": "<string>",
  "metadata": {}
}
'
import requests

url = "https://api.example.com/v1/ledgers/{id}/entries"

payload = {
"transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 2,
"description": "<string>",
"metadata": {}
}
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({
transaction_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
amount: 2,
description: '<string>',
metadata: {}
})
};

fetch('https://api.example.com/v1/ledgers/{id}/entries', 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.example.com/v1/ledgers/{id}/entries",
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([
'transaction_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'amount' => 2,
'description' => '<string>',
'metadata' => [

]
]),
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.example.com/v1/ledgers/{id}/entries"

payload := strings.NewReader("{\n \"transaction_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 2,\n \"description\": \"<string>\",\n \"metadata\": {}\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.example.com/v1/ledgers/{id}/entries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"transaction_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 2,\n \"description\": \"<string>\",\n \"metadata\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/ledgers/{id}/entries")

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 \"transaction_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 2,\n \"description\": \"<string>\",\n \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "ledger_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "amount": 123,
  "description": "<string>",
  "balance": 123,
  "timestamp": "2023-11-07T05:31:56Z",
  "metadata": {},
  "created_at": "2023-11-07T05:31:56Z",
  "created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string<uuid>
required

Ledger UUID

Body

application/json
transaction_id
string<uuid>
required

Unique transaction identifier

amount
integer
required

Entry amount in cents

Required range: x >= 1
type
enum<string>
required

Type of entry

Available options:
credit,
debit
description
string

Entry description

metadata
object

Additional entry metadata

Response

201 - application/json

Entry created successfully

id
string<uuid>
ledger_id
string<uuid>
transaction_id
string<uuid>
amount
integer

Amount in cents

type
enum<string>
Available options:
credit,
debit
description
string
balance
integer

Running balance in cents

timestamp
string<date-time>
metadata
object | null
created_at
string<date-time>
created_by
string<uuid>