# Sandbox for the Accounts API

Build and test against simulated accounts with a test key, covering opening a test account, making money arrive, holding and returning an arrival, recipients and payment requests with simulated approvals, moving a sandbox transfer through its statuses, the events it sends, what works like live, and the sandbox's limits.

Source: https://dev.vezmo.com/docs/developers/accounts-api-sandbox


## Overview

The sandbox is a simulation beside your real accounts. A **test key** reads it: you open test accounts, make money
arrive from a payer you name, and read the balances, transactions, statements and events it makes, exactly as you
would read your real ones. No real money moves.

The sandbox needs the Accounts API on for your business and a test key with Accounts API permissions. See
[Keys and permissions for the Accounts API](/docs/developers/accounts-api-keys).

## The key picks the sandbox

- Test and live use the same base URL. A test key (`vzm_test_…`) always reads the sandbox; a live key always reads your
  real accounts. There is no switch or header.
- The simulation endpoints work only with a test key. A live key gets `404`.
- Sandbox events carry `livemode: false` and go only to webhook endpoints set to **Test**.

## Try it

(Diagram: Open a test account with POST /simulations/accounts. Make money arrive with POST /simulations/incoming. It is credited, booked and sent as events. Then read balances, transactions, statements and events with the same test key.)

1. **Get a token with your test key**
Swap the test key for an access token with `POST /oauth/token`, as for live.

2. **Open a test account**
`POST /simulations/accounts` with a `currency`: `USD`, `EUR`, `GBP` or `AED`. You get the account as `GET /accounts`
shows it. There is one test account per currency: asking again gives you the same one.

3. **Make money arrive**
`POST /simulations/incoming` with the `accountId` and the `amount` in the smallest unit. You can also send the
`payerName`, the `payerCountry` and the `rail` (`ach`, `wire`, `swift`, `sepa` or `local_transfer`).

4. **Read what it made**
`GET /balances`, `GET /transactions`, `GET /events` and `GET /statements` now show it. A test webhook endpoint that
listens to Accounts events gets them too.

## Choose what happens to the money

Send `outcome` with the arrival to see each path your integration must handle:

| `outcome` | What happens | Events sent |
| --- | --- | --- |
| `credited` (the default) | The money reaches the balance and a line is booked. | `incoming.received`, then `incoming.credited` and `transaction.posted` |
| `held` | It waits, as when we review an arrival. | `incoming.received`, then `incoming.held` |
| `returned` | It never reaches the balance. | `incoming.received`, then `incoming.returned` |

A held arrival moves on with `POST /simulations/incoming/{id}/advance` and `to` set to `credited` or `returned`. It
sends that event. An arrival that isn't held, or was already moved on, answers `409`.

## Sending with approval in the sandbox

With sending with approval on for your business, a test key also adds recipients and asks for payments in the
sandbox. Nobody approves them in the dashboard: the **Approvals** page lists live requests only. You decide sandbox
approvals yourself with a simulation, so you can test every answer your integration must handle.

1. **Add a sandbox recipient**
`POST /recipients` with a test key. It is checked against the sandbox's own requirements (below) and waits as
`pending_approval`, like a live one.

2. **Approve it**
`POST /simulations/approvals/{id}/decide` with the recipient's approval id and `decision` set to `approve`, from the same
key that added the recipient. That key needs both `recipients.write` and `transfers.request`. The recipient waits 2
minutes, then it is `active`. `recipient.approved` and `recipient.active` are sent.

3. **Ask for a payment and approve it**
Create a transfer request for the recipient, then decide its approval the same way. A sandbox transfer is made from
your test balance, at a fixed rate and with no fee, and starts as `pending`.

4. **Move the transfer on**
`POST /simulations/transfers/{id}/advance` with `to` set to the next status. Each one sends its `transfer.*` event and
books the money as live would.

(Diagram: A sandbox transfer starts as pending. It can move to processing, or straight to succeeded. From processing it can move to succeeded, then to returned. From pending or processing it can move to failed, which gives the money back.)

### The simulations

- **Name check**:`POST /simulations/recipients/{id}/name-check` with `result`: `match`, `close_match`, `no_match` or `unavailable`, and the name held if you want. Sets a sandbox recipient's name check, pending or approved.
- **Screening**:`POST /simulations/recipients/{id}/screening` with `result`: `clear` or `in_review`. Puts an approved sandbox recipient in review, or clears it. Its sandbox transfers wait or go.
- **Decide an approval**:`POST /simulations/approvals/{id}/decide` with `decision`: `approve` or `reject`, and a reason if you want. Decides a sandbox approval, for a recipient or a payment request. A live approval's id answers `404`.
- **Move a transfer on**:`POST /simulations/transfers/{id}/advance` with `to`: `processing` (from `pending`), `succeeded` (from `pending` or `processing`), `failed` (from `pending` or `processing`) or `returned` (from `succeeded`), and a reason if you want. Any other move answers `409`.

The first two need the `recipients.write` permission, the last two `transfers.request`. Deciding a recipient's approval
also needs `recipients.write`. Only the key that made a recipient or a payment request can decide its approval: another
key, even of your own business, gets `404`.

Like every request that asks for something, these four need your business at **Send with approval** (else `403
api_access_not_enabled`), and the person responsible for the key must still be allowed to send money or manage
recipients (else `403 key_owner_cannot_send`).

### What behaves like live

- A payment request for a recipient still in its 2-minute wait can't be approved yet: the decide answers `409` with
  `recipient_waiting`.
- The same limits apply as live, so you meet them early. See
  [Limits for sending with approval](/docs/developers/accounts-api-limits).
- A request your test balance can't cover fails with `insufficient_funds`, as live would. Make money arrive first.
- A failed transfer gives the money back to your test balance; a returned one brings it back after it succeeded.

### The sandbox's recipients and rates

| Way | Details a sandbox recipient needs |
| --- | --- |
| US local transfer | Account number, routing number, bank name and address |
| UK local transfer | Account number, sort code and bank name |
| Euro (SEPA) transfer | IBAN and bank name |
| International (SWIFT) transfer | IBAN or account number, SWIFT code, bank name and address |
| India mobile wallet | UPI id |
| Stablecoin wallet | A Base, Solana or Tron address, and the owner details the Travel Rule asks for |

Sandbox rates are fixed: 1 USD is 0.9200 EUR, 0.7900 GBP or 3.6725 AED, and the other way round at the inverse. A
stablecoin is worth 1 USD. Sandbox payments have no fee.

## What is different from live

- Sandbox money has no fee.
- Statements come as JSON or CSV only. Sandbox statements aren't made as PDFs, so a made-up balance never looks like a
  real statement.
- A test account has no bank name.
- The simulation endpoints allow 5 requests a second and 60 a minute per key on each endpoint, and 500 simulated
  arrivals a day per business.
- A sandbox nobody uses for 90 days is deleted, with its test accounts, simulated money, recipients, payment requests,
  approvals and transfers.
- A test key whose secret was found in public code can no longer run simulations. It still reads test data until you
  revoke it: make a new test key.
- Test webhook endpoints get 5 seconds per attempt and 3 attempts.
- A test key can name only sandbox recipients, and a live key only real ones. Either way the other answers `404`.
- Everything else behaves as live: permissions, versions, paging, errors and the statement limits.

Requests and answers with examples are in the
[sandbox section of the Accounts API reference](https://user.vezmo.com/docs/v1/accounts-api/sandbox).

## Related

- [Accounts API](/docs/developers/accounts-api)
- [Webhooks for Accounts](/docs/developers/accounts-api-webhooks)
- [Test mode for developers](/docs/developers/test-mode)

Vezmo is a financial technology company, not a bank. Banking, stablecoin and card services are provided by regulated
partners.
