# The sandbox

Free paper accounts on the real engine, with real prices and real rules, to test your code before it trades for real.

The sandbox is where your code learns to trade. It runs on the same engine as your evaluation and funded accounts, with the same prices, order types and rules. The only difference is the money: sandbox accounts hold paper money and never count for anything.

It is free for every Phoenix Perpetuals account holder. You do not need to have bought an evaluation.

## What you get

| | Sandbox | Live |
|---|---|---|
| Accounts | Ten for life, $100,000 each | Your evaluation and funded accounts |
| Host | `sandbox-api.phoenixperpsfunding.com` | `api.phoenixperpsfunding.com` |
| Keys | `ppk_test_`, up to 5, no email code | `ppk_live_`, up to 5, an email code to create |
| Prices and engine | Real | Real |
| Rules | An evaluation rule: daily loss limit, maximum drawdown, profit target | Your account's own rule |
| Payouts, certificates, rewards | Never | As your account allows |

A sandbox key only reaches sandbox accounts, and a live key only live ones. Use the wrong host and the API answers `401 wrong_environment`, naming the right one.

## Opening accounts

Your first sandbox key opens your first sandbox account by itself. After that, open more from **Developers > Sandbox** in your dashboard, or from your code:

```curl
curl -X POST https://sandbox-api.phoenixperpsfunding.com/v1/accounts \
  -H "Authorization: Bearer $PHOENIXPERPS_API_KEY" \
  -H "Idempotency-Key: ci-run-2026-10-08"
```

```python
account = client.accounts.create(idempotency_key="ci-run-2026-10-08")
print(account.id, account.status)  # SANDBOX-00042-002 pending
```

```typescript
const account = await client.accounts.create({}, { idempotencyKey: "ci-run-2026-10-08" });
console.log(account.id, account.status); // SANDBOX-00042-002 pending
```

The account answers `pending` and is ready a few seconds later. Read it again until its status is `active`.

> [!SANDBOX]
> Every account counts towards your ten once it opens, even after it fails or you close it. Send an `Idempotency-Key` when your tests open accounts: a retried request then returns the same account instead of spending another.

## Accounts can pass and fail

Sandbox accounts follow an evaluation rule, so you can test what your bot does at the edges: the daily loss limit pausing trading until midnight New York, the maximum drawdown failing the account, the profit target passing it. A failed sandbox account stays readable, so you can study what happened.

## Idle accounts sleep

An account with no position, no working order and no request for 72 hours is put to sleep. Your next request to it wakes it up within a few seconds; nothing is lost. A strategy that only checks in once a week still works: its first call simply takes a little longer.

## What the sandbox never touches

Sandbox accounts are kept apart from everything that pays or ranks: payouts, certificates, rewards, competitions, affiliate commissions and the totals on your dashboard. Trading on them can never affect your evaluation or your funded accounts.
