Documentation Index
Fetch the complete documentation index at: https://docs.treasuryprime.com/llms.txt
Use this file to discover all available pages before exploring further.
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 Simulation Types
| Simulation Type | Explanation |
|---|
| wire.processing_sent | Simulate 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_voided | Simulate 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_wire | Simulate 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:
| Parameter | Type | Required? | Description |
|---|
| manual | boolean | Required | true 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
| Parameter | Type | Required? | Description |
|---|
| type | string | Required | The wire simulation type. |
| simulation | object | Required | The simulation request sub-object. |
Simulation Sub-Object
| Parameter | Type | Required? | Description |
|---|
| wire_id | string | Required | ID 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.sandbox.treasuryprime.com/simulation
Simulation Request Body
| Parameter | Type | Required? | Description |
|---|
| account_id | string | Required | The id of the account that this wire should be originated from. |
| amount | string | Required | Amount of money in dollars to transfer, as a string with two-decimal precision. |
| originator | object | Required | A Wire Bank sub-object containing information about the wire originator (See below for definition). |
| originator_to_beneficiary_info | string | Required | Information sent by the wire originator to the receiver. |
Originator Sub-object
| Parameter | Type | Required? | Description |
|---|
| address | object | | A Wire Bank Address sub-object (See below for definition). |
| name | string | | Name of the intermediary bank (maximum of 35 characters). |
| bank_data | object | Required | Bank details sub-ojbect (See below for definition). |
Wire Bank Address Sub-object
| Parameter | Type | Required? | Description |
|---|
| street_line_1 | string | Required | Street address (first line; maximum of 35 characters). |
| street_line_2 | string | | Street address (second line, if applicable; maximum of 35 characters). |
| city | string | Required | City (maximum of 21 characters.) |
| state | string | Required | U.S. State (two letter abbreviation). |
| postal_code | string | Required | Postal code (5-digit or 5+4 Zip Code for U.S. addresses). |
Wire Bank Data Sub-object
| Parameter | Type | Required? | Description |
|---|
| account_number | string | Required | Bank Account number. |
| account_type | string | Required | Account type. |
| address | array | | Unparsed bank address data. |
| bank_name | string | | Name of the bank. |
| routing_number | string | Required | Valid 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.