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

# Sandbox Testing

> Test Wire Transactions

In Sandbox, wires do not connect to Fedwire and no real funds move. Statuses, webhooks, and validations behave the same as production. Use the simulation endpoints below to control wire lifecycle events and test your integration end to end.

## Simulation Endpoints

| Endpoint                                                               | Description                                                      |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `POST /v1/simulate/wires/incoming`                                     | Simulate an incoming wire landing on one of your account numbers |
| `POST /v1/simulate/wires/{wire_id}/advance`                            | Advance an outgoing wire to its next status                      |
| `POST /v1/simulate/wires/{wire_id}/incoming_return`                    | Simulate the counterparty returning a wire you sent              |
| `POST /v1/simulate/wires/{wire_id}/incoming_return_request`            | Simulate a return request arriving from the counterparty         |
| `POST /v1/simulate/wires/{wire_id}/incoming_return_request_acceptance` | Simulate the counterparty accepting a return request you sent    |
| `POST /v1/simulate/wires/{wire_id}/incoming_return_request_rejection`  | Simulate the counterparty rejecting a return request you sent    |

## Test an Outgoing Wire

Create an outgoing wire using `POST /v1/wires`. The wire starts in `created` status. Each call to the advance endpoint moves the wire forward one status, triggering the corresponding webhook.

| Call | Status transition          |
| ---- | -------------------------- |
| 1    | `created` → `scheduled`    |
| 2    | `scheduled` → `processing` |
| 3    | `processing` → `posted`    |

The advance endpoint also applies to cancellations. If a wire is in `cancel_pending`, one advance call moves it to `canceled`. Manual review is not simulated in Sandbox.

## Test an Incoming Wire

Use `POST /v1/simulate/wires/incoming` to simulate a wire arriving on one of your account numbers. Specify the receiving account number, amount, and debtor details.

```json theme={null}
{
  "amount": 500000,
  "creditor_account_number_id": "account_number_id",
  "debtor": {
    "name": "Alex Smith",
    "account_identifier": {
      "type": "account_number",
      "value": "9900000001"
    }
  },
  "debtor_agent": {
    "routing_number": "021000021"
  }
}
```

The simulated wire is created in `posted` status. A `wire.posted` webhook fires on receipt.

## Test Returns

### Returning an Incoming Wire

To test returning a wire you received:

1. Simulate an incoming wire using `POST /v1/simulate/wires/incoming`.
2. Initiate a return using `POST /v1/wires/{wire_id}/return`. This creates a new outgoing wire.
3. Advance the return wire to `posted` using the advance endpoint.

### Simulating a Return on a Wire You Sent

Use `POST /v1/simulate/wires/{wire_id}/incoming_return` to simulate the counterparty returning a wire you sent. Provide a `return_code` and, if using `NARR`, a `return_additional_information` value.

## Test Return Requests

### Simulating an Incoming Return Request

Use `POST /v1/simulate/wires/{wire_id}/incoming_return_request` to simulate the counterparty requesting the return of a wire you received. Respond through the API by either returning the funds (`POST /v1/wires/{wire_id}/return`) or rejecting the request (`POST /v1/wires/{wire_id}/reject_return_request`).

### Simulating a Response to a Return Request You Sent

After sending a return request with `POST /v1/wires/{wire_id}/request_return`, simulate how the counterparty responds:

* **Accepted:** `POST /v1/simulate/wires/{wire_id}/incoming_return_request_acceptance` - the counterparty accepts and returns the funds.
* **Rejected:** `POST /v1/simulate/wires/{wire_id}/incoming_return_request_rejection` - the counterparty declines the request.
