Skip to main content
POST
/
ledgers
Create ledger
curl --request POST \
  --url http://localhost:5001/ledgers \
  --header 'X-blnk-key: <api-key>'
Use client.Ledger.Create to create a new ledger for your system.
1

Call the method

client.Ledger.Create
ledger, resp, err := client.Ledger.Create(blnkgo.CreateLedgerRequest{
	Name: "Customer wallets",
	MetaData: map[string]interface{}{
		"environment": "production",
	},
})
FieldTypeDescription
NamestringDisplay name for the ledger.
MetaDatamap[string]interface{}Optional metadata for extra context.
2

Save the ledger ID

Use ledger.LedgerID when creating balances or transactions in this ledger.
3

Response

201 Created
{
  "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_dataobjectMetadata object, if you sent one.

View ledger docs

Ledger concepts and setup.

Create new ledger

HTTP request and response schema.

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.