Wire Simulations

By default, all Wires created in the sandbox environment are moved through the normal Wire workflow, eventually ending with the status sent.

Wire simulations allow developers to manually trigger a wire into various states that may arise in the course of production money movement. Developers can better understand the flow of funds by manually updating a wire’s status to sent or error at an accelerated timeline, as defined in the Simulation Types table below. The corresponding impact to an account’s balance, transactions, and holds (if applicable) can also be observed by calling the various respective endpoints.

The three wire simulation types are listed below.

⚠️

Wire Simulations are representative of Wire behavior on Treasury Prime ledger accounts. They may not exactly reflect on-core activity at every bank.

Wire Simulation Types

Simulation TypeExplanation
wire.processing_sentSimulate a wire being sent by validating, processing and sending the wire immediately. If a wire fails validation or processing, the wire is instead updated to an error status.
wire.processing_voidedSimulate a wire being voided by validating, processing, sending and then erroring the wire immediately. Similarly to processing_sent, any validation or processing failure will cause the wire status to be updated to error.
wire.incoming_wireSimulate an incoming wire.

Setting up a Wire Sent or Voided Simulation

A wire must first be created via a POST request to the /wire endpoint with all the required parameters. In addition to this, the optional userdata field must be set and have the following parameters in order to be eligible for wire simulations:

ParameterTypeRequired?Description
manualbooleanRequiredtrue should be provided to indicate that this is a simulation request. This field prevents the wire from automatically being processed.

Create a Wire Sent or Voided Simulation

Initiate either a wire.processing_sent or a wire.processing_voided simulation.

POST https://api.sandbox.treasuryprime.com/simulation

Wire Sent or Voided Request Body

ParameterTypeRequired?Description
typestringRequiredThe wire simulation type.
simulationobjectRequiredThe simulation request sub-object.
Simulation Sub-Object
ParameterTypeRequired?Description
wire_idstringRequiredID of the wire to use as the source for simulated transactions.
Example Request
$ curl -u $API_KEY_ID:$API_SECRET_KEY https://api.sandbox.treasuryprime.com/simulation \
  -H 'Content-Type: application/json' \
  -d '{
        "type": "wire.processing_sent",
        "simulation": {
          "wire_id": "wire_123456",
        }
      }'
Success Response

There will be no response body. The response code will be a 202 - accepted.

Error Response
{
  "error": "Invalid simulation request or simulation not implemented"
}

Example: How to Simulate a Sent Wire

A common flow for a wire simulation is creating a wire, and then calling the simulation endpoint with the id of the wire. See wire for example wire requests. The following calls outline simulating a wire sent simulation.

$ curl -u $API_KEY_ID:$API_SECRET_KEY https://api.sandbox.treasuryprime.com/wire \
  -H 'Content-Type: application/json' \
  -d '{
        "account_id": "acct_1234567890",
        "amount": "10300.00",
        "counterparty_id": "cp_0987654321",
        "userdata": {
          "manual": true
        }
      }'
$ curl -u $API_KEY_ID:$API_SECRET_KEY https://api.sandbox.treasuryprime.com/simulation \
  -H 'Content-Type: application/json' \
  -d '{
        "type": "wire.processing_sent",
        "simulation": {
          "wire_id": "wire_104",
        }
      }'
Response

No response body is returned. A 202 HTTP status indicates a successful simulation.

Verifying a Successful Simulation

To ensure that the simulation was run successfully, call the GET /wire/:id endpoint to confirm that the status of the wire has been updated to sent or error. The funds should have been moved to/from an account and a corresponding transaction should appear.

Create an Incoming Wire Simulation

Initiating a wire.incoming_wire simulates a wire that was originated outside of the Treasury Prime API from a different bank. This will create a transaction on an account as well as an incoming wire object. You can then use the /incoming wire endpoint to access this object.

POST https://api.treasuryprime.com/simulation

Simulation Request Body

ParameterTypeRequired?Description
account_idstringRequiredThe id of the account that this wire should be originated from.
amountstringRequiredAmount of money in dollars to transfer, as a string with two-decimal precision.
originatorobjectRequiredA Wire Bank sub-object containing information about the wire originator (See below for definition).
originator_to_beneficiary_infostringRequiredInformation sent by the wire originator to the receiver.
Originator Sub-object
ParameterTypeRequired?Description
addressobjectA Wire Bank Address sub-object (See below for definition).
namestringName of the intermediary bank (maximum of 35 characters).
bank_dataobjectRequiredBank details sub-ojbect (See below for definition).
Wire Bank Address Sub-object
ParameterTypeRequired?Description
street_line_1stringRequiredStreet address (first line; maximum of 35 characters).
street_line_2stringStreet address (second line, if applicable; maximum of 35 characters).
citystringRequiredCity (maximum of 21 characters.)
statestringRequiredU.S. State (two letter abbreviation).
postal_codestringRequiredPostal code (5-digit or 5+4 Zip Code for U.S. addresses).
Wire Bank Data Sub-object
ParameterTypeRequired?Description
account_numberstringRequiredBank Account number.
account_typestringRequiredAccount type.
addressarrayUnparsed bank address data.
bank_namestringName of the bank.
routing_numberstringRequiredValid 9-digit ABA routing transit number associated with this bank.
Example Request

The following call outlines simulating an incoming wire.

$ curl -u $API_KEY_ID:$API_SECRET_KEY https://api.sandbox.treasuryprime.com/simulation \
  -H 'Content-Type: application/json' \
  -d '{
        "type": "wire.incoming_wire",
        "simulation": {
          "account_id": "acct_123456",
          "originator_to_beneficiary_info": "DEPOSIT",
          "amount": "100.00",
          "originator": {
            "name": "ORIGINATOR LLC",
            "address": [
              "22 Main St",
              "Town GA 012345-7500"
            ],
            "bank_data": {
             "account_number": "123456789",
             "account_type": "checking",
             "address": [],
             "bank_name": "",
             "routing_number": "123456789"
            }
          },
        }
      }'
Success Response

There will be no response body. The response code will be a
202 - Accepted.

Error Response
{
  "error": "Invalid simulation request or simulation not implemented"
}
Verifying a Successful Simulation

To ensure that the simulation was run successfully, call the GET /wire/incoming_wire endpoint to list the incoming wires and fetch the most recently created ID. The funds should have been moved to the corresponding account and a corresponding transaction should appear when running GET /account/:id/transaction.