Sandboxes

Before you wire real money through an integration, you want to run it end to end — post transactions, check balances, look at reports — without risking production data or your books. A sandbox gives you exactly that: a working copy of a production ledger you can experiment in freely, with the same chart of accounts but its own throwaway data.

The unit is a sandbox ledger. There is no separate "sandbox account" — a sandbox copies a production ledger's accounts, and you use those accounts inside it exactly as you would in production.

What a sandbox is

A sandbox is a ledger created from a production ledger. It copies that ledger's structure — its categories, account templates, and control accounts — but keeps its own, separate transactions and balances. A fresh sandbox has the exact chart of accounts of production with nothing posted to it yet, so you can replay real flows against a familiar shape without touching anything real.

Copied from production (structure)Not copied (data)
CategoriesTransactions
Account templatesBalances
Control accountsTemplate accounts (the per-object ones)

Template accounts aren't copied because they are data, not structure — a sandbox creates its own the first time a transaction references their slug, just like production (see Accounts).

How a sandbox relates to its production ledgerA sandbox copies the production ledger's structure (categories, control accounts, templates) in a one-way sync, but keeps its own separate data and starts empty.Production ledgerSource of truthSandboxTest copy · reached with a test keySTRUCTURESTRUCTUREstructure syncedone-wayDATADATAempty until you postseparate data
A sandbox mirrors production's structure (synced one-way) but keeps its own data.

Structure stays in sync

You don't edit a sandbox's structure directly. You change the chart of accounts in the production ledger, and Ledfra syncs those changes down to every sandbox automatically. Add a control account in production and it appears in the sandbox; remove a category in production and it's removed from the sandbox. The sync is one-way — production is always the source of truth.

Why structure is read-only in a sandbox
Keeping structure one-way means your sandbox can never drift from production. You test against the same accounts you'll run for real, and there's no "works in sandbox, breaks in production" gap caused by mismatched charts of accounts.

Using a sandbox from the API

Sandboxes use the same endpoints as production — there is no separate base URL. Which ledgers you can reach is decided entirely by your API key type:

  • A live key (lfk_live_…) reaches your production ledgers.
  • A test key (lfk_test_…) reaches your sandbox ledgers.

So to work against a sandbox, create a test key and use it exactly as you would a live one. GET /ledgers returns your sandbox ledgers, and you post transactions and read balances the same way — only the key changes.

bash
# A test key (lfk_test_…) sees your sandbox ledgers — the same endpoint as production
curl 'https://ledfra.com/api/ledgers' \
  -H 'Authorization: Bearer lfk_test_YOUR_TEST_KEY'

For both key formats and how to send them, see Authentication in the API reference.

Creating and deleting sandboxes

Create a sandbox from its production ledger in the Ledfra app, on the ledger's Sandboxes tab, and give it a name like Staging or Dev. You can keep more than one. Deleting a sandbox is permanent and removes all of its data — the production ledger and its data are never affected.

Limitations

Know these edges
  • A sandbox's structure is read-only. Change the chart of accounts in production and it syncs down — you can't edit it in the sandbox.
  • Sync is one-way (production → sandbox). Deleting a category or account in production removes its copy from the sandbox.
  • A new sandbox starts empty — no transactions, balances, or template accounts until you post to it.
  • A test key only sees sandboxes and a live key only sees production, so reach for the key type that matches what you're doing.
  • Deleting a sandbox is permanent.

Next, see how accounts are addressed in Accounts, or how amounts work in Money.