> ## Documentation Index
> Fetch the complete documentation index at: https://docs.degroshi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox

> A separate space of made-up data to try the API, webhooks and the reference console without touching your money.

The sandbox is your separate space of made-up data. Try reads and writes, webhooks and the SDKs in it, and run an
integration's tests, without touching your real accounts. Only sandbox keys work with it, and they start with
`dg_test_`.

## What’s in the sandbox

* Five accounts: «Картка» (a card), «Кредитка» (a credit card with a limit and a negative balance), «Готівка» (cash),
  «Скарбничка» (savings) and «Долари» in USD.
* About 120 transactions over the last 90 days: groceries, cafés, transport, a salary, utilities, a refund, transfers
  to «Скарбничка» and an exchange of hryvnias into dollars.
* A monthly «Кава» budget, a recurring subscription and the «Мій скрипт» source.

The names are in Ukrainian, as in the app’s default data. Dates count from the day the sandbox was created or reset,
so the data always looks recent. Everything in it is made up.

## Create a sandbox

**1. Open “Tokens and sources”**

On the web, open “Settings” › “For developers” › “Tokens and sources”.

**2. Create the sandbox**

In the “Sandbox” card, click “Create a sandbox”. It’s ready in a few seconds, and “Refreshed …” shows when its data
was seeded.

**3. Have a look**

“Open” switches the web app to the sandbox. In the space switcher it comes last, marked “Sandbox”.

Each person has one sandbox, and it doesn’t count towards your plan’s space limit.

## A sandbox key

**1. Create a key**

In “Tokens and sources”, click “Create a key” and tick “For the sandbox”. The list of spaces goes away: the key
works with the sandbox alone.

**2. Copy it**

The key starts with `dg_test_`. Copy it right away: it’s shown only once.

A sandbox key reaches only the sandbox, and an ordinary `dg_pat_` key can’t reach it. You don’t need the `X-Space-ID`
header: the key has one space. You can have up to 5 sandbox keys, and they don’t count towards your plan’s key limit.
Everything else works as for any key: access, expiry, IP addresses and revoking are in
[API keys](https://docs.degroshi.com/en/developers/authentication.md).

```bash curl theme={null}
curl https://api.degroshi.com/v1/accounts \
  -H "X-API-Key: dg_test_YOUR_KEY"
```

```javascript JavaScript theme={null}
import { Degroshi } from "degroshi"

// DEGROSHI_API_KEY=dg_test_…
const degroshi = new Degroshi({ apiKey: process.env.DEGROSHI_API_KEY })
const accounts = await degroshi.accounts.list()
```

```python Python theme={null}
import os

from degroshi import Degroshi

# DEGROSHI_API_KEY=dg_test_…
with Degroshi(os.environ["DEGROSHI_API_KEY"]) as degroshi:
    accounts = degroshi.accounts.list()
```

## Reset to the starting data

A reset puts the sandbox back to its starting data: whatever changed in it goes, and the data is seeded again. The
space stays the same, so its id, keys and webhooks keep working.

* **On the web:** in the “Sandbox” card, click “Reset to the starting data”, then “Reset”.
* **Through the API:** `POST /v1/sandbox/reset` with a sandbox key, for example before each test run. In the SDKs
  it’s `sandbox.reset()`. An ordinary key gets 403 with the code `SBX_004`.

```bash curl theme={null}
curl -X POST https://api.degroshi.com/v1/sandbox/reset \
  -H "X-API-Key: dg_test_YOUR_KEY"
```

```javascript JavaScript theme={null}
await degroshi.sandbox.reset()
```

```python Python theme={null}
degroshi.sandbox.reset()
```

You can reset it 20 times a day. After that the API answers 429 with the code `SBX_003`, and `details.retry_after`
says how many seconds to wait. After a reset, [change feed](https://docs.degroshi.com/en/developers/changes.md) cursors get 410: start reading it
again. Webhooks for the `sandbox.reset` event hear about the reset first: see
[sandbox.reset](https://docs.degroshi.com/en/developers/events/sandbox-reset.md).

## What the sandbox doesn’t have

* **Connections:** banks, wallets, exchanges and brokers don’t connect to the sandbox (403, `SBX_001`). File imports
  work.
* **Sharing:** you can’t invite someone, share an account or move one into the sandbox (403, `SBX_002`).
* **AI:** it can’t be turned on in the sandbox (403, `SBX_006`), so AI clients through MCP don’t see it.
* **E-mails and push notifications:** notifications stay in the app. Webhooks arrive as from any space.
* **Summaries:** the sandbox isn’t part of «Рік із деГроші» or the account export.

## The reference console

On the [API reference](https://docs.degroshi.com/en/developers/api/accounts/list-accounts.md) pages you can send a request right from the page.
The console takes only a sandbox key: with any other key the API answers 403 with the code `AUTH_081`, so real data
can’t be read through the reference. The request goes from your browser straight to `api.degroshi.com`, through no
server in between.

## Delete the sandbox

In the “Sandbox” card, click “Delete”, then “Delete” again. The sandbox goes with all its data, and `dg_test_` keys
stop working. You can create a new one at any time.

## Error codes

| Code | What happened |
| - | - |
| `SBX_001` | Connecting a bank, wallet, exchange or broker in the sandbox |
| `SBX_002` | Sharing, an invitation or moving an account into the sandbox |
| `SBX_003` | The sandbox was already reset 20 times today |
| `SBX_004` | `POST /v1/sandbox/reset` with an ordinary key |
| `SBX_005` | A `dg_test_` key outside the sandbox, or an ordinary key in it |
| `SBX_006` | AI in the sandbox |
| `SBX_007` | No sandbox yet |
| `SBX_008` | 5 sandbox keys already |
| `SBX_009` | The sandbox is deleted in “For developers”, not as a space |
| `AUTH_081` | The reference console with a key that doesn’t start with `dg_test_` |

All codes: [Errors](https://docs.degroshi.com/en/developers/errors.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.