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.
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) |
|---|---|
| Categories | Transactions |
| Account templates | Balances |
| Control accounts | Template 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).
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.
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.
# 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
- 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.