Simulate Flows

Treasure API Sandbox Simulations allow you to test user flows in real time. The following guides walk you through how to test creating and funding an account and withdrawal flows.
Test Account Opening
Once you have a Treasure business and business ID, you'll need to onboard that business by making a POST call to /v1/businesses/{business_id}/onboarding. You can find more information about this step at Onboard a Business
A business will be in a pending status until reviewed by Treasure. This step has three possible outcomes: approved, declined or needs more information. If the KYB review is declined by Treasure the account will not be opened. If we need more information to make a determination Treasure’s KYB team will reach out to your company’s specified support line to gather the needed information. You can simulate the internal decline scenario through the business internal rejection PUT call and the needs more information scenario through the business internal needs info PUT call. Finally, you can simulate an internal approval scenario through the business internal approve PUT call.
After Treasure’s approval, the account will be passed on to our custodian partner for their KYB approval. You can simulate this through the  PUT call. Similarly to the internal KYB process, this step can have three possible outcomes: approved, declined or needs more information. If the KYB review is declined by our custodian partner the account will not be opened. If we need more information to make a determination Treasure’s KYB team will reach out to your company’s specified support line to gather the needed information. You can simulate the internal decline scenario through the business custodian rejection PUT call and the needs more information scenario through the business custodian needs info PUT call. Finally, you can simulate an internal approval scenario through the business custodian approve PUT call. The webhook business.updated will be fired with the following possible statuses: Pending, Open, Closed, Rejected.
Test Account Funding & Allocation
When the webhook business.updated event updates to open, you can query the wire instructions and initiate a wire transfer. Start by simulating an account opening scenario through the business account open PUT call.
Now that the account is open, send a GET call to the /v1/businesses/{business_id}/wire_instructions endpoint to retrieve the wire instructions used to fund this business’s portfolio. Pay special attention to the memo field and be sure to provide that information to avoid wire returns and ensure funds arrive correctly at their destination.
Two webhooks will fire during the transfer execution flow. A transfer.created webhook is emitted when the custodian acknowledges the transfer. At this point the status is set to pending. A transfer.updated webhook will fire when the status of the transaction is moved from pending to complete. This will happen at the start of the next day. You can simulate this use case by using a PUT call to the transfer created and transfer completed simulation calls respectively. Note: unlike other simulations, transfer created and transfer completed have a request body where you will designate a payload.
At the end of this flow, portfolio.updated will fire, which is emitted around the same time that transfer.updated is emitted. At this point, your customer would have an open account, a selected portfolio and funds ready to be allocated. In production, the funds will be automatically allocated at this stage. In the sandbox environment you can simulate this by using the portfolio rebalance PUT call.
At this point you can call the GET portfolio call to show the composition of the portfolio. Please note that the actual funds associated with each sub-product in the portfolio are coming soon. 
Test a Withdrawal 
The first step of the withdrawal flow is adding a bank account to a business. You can do this by sending a POST request on /v1/businesses/{business_id}/bank_accounts and passing the business ID at any time.
The bank_account.created webhook would emit when the creation of the bank account is complete. You can update the bank account at any point by  sending a POST request to /v1/businesses/{business_id}/bank_accounts/{bank_account_id} and passing the business ID and bank account ID. 
At this point you can create a new transfer for a business by making a POST request to /v1/businesses/{business_id}/transfer and passing a business ID. The transfer.created webhook would be emitted and it would pass the bank_account object. A transfer.updated webhook will be emitted when the status of the transaction is moved from pending to completed. You can simulate this use case by using a PUT call to the transfer created  and transfer completed call respectively.
Note that the bank account and transfer API calls are only used in the withdrawal flow and not the deposit flow. 
A withdrawal of funds would trigger an asset sale to provide the cash liquidity and a rebalance of the portfolio to bring the portfolio composition back to the specified target portfolio. You can simulate the assets sold scenario via the asset sold PUT call and the portfolio rebalance scenario through the rebalance PUT call. When simulating assets sold, you can simulate multiple days by selling some assets at first but not enough for the transfer. These simulations also have a request body to designate payload. At this point the portfolio.updated would be emitted to communicate that the portfolio has been rebalanced. 
Treasure Technologies Inc.
447 Sutter St
STE 405 PMB 25
San Francisco, CA 94108
Website is operated by Treasure Investment Management, LLC ("Treasure"), a wholly-owned subsidiary of Treasure Technologies, Inc., and an investment adviser registered with the U.S. Securities and Exchange Commission ("SEC"). Brokerage services are provided to clients of Treasure by Apex Clearing Corporation ("Apex"), an SEC-registered broker-dealer and member FINRA.

Investing involves risk, including loss of principal. The contents of this website are provided for information purposes only and do not constitute an offer to sell or a solicitation to buy securities. Past performance is no guarantee of future returns.