Ledgers

Create ledger

Create a new ledger with the TypeScript SDK.

POST/ledgers

Use blnk.Ledgers.create to create a new ledger for your system.

Call the method

const response = await blnk.Ledgers.create({
  name: 'Customer wallets',
  meta_data: {
    environment: 'production',
  },
});
FieldTypeDescription
namestringDisplay name for the ledger.
meta_dataobjectOptional metadata for extra context.

Save the ledger ID

Use response.data.ledger_id when creating balances or transactions in this ledger.

Response

{
  "ledger_id": "ldg_073f7ffe-9dfd-42ce-aa50-d1dca1788adc",
  "name": "Customer wallets",
  "created_at": "2024-02-20T05:28:03.558281542Z",
  "meta_data": {
    "environment": "production"
  }
}
FieldTypeDescription
ledger_idstringUnique ID for the ledger. Use this when creating balances and transactions.
namestringName you passed in the request.
created_atstringDate and time the ledger was created.
meta_dataRecord<string, unknown>Metadata object, if you sent one.