Managing Deposits and Withdrawals via API¶
This is a step by step guide on how to you can perform deposits and withdrawals using the Cactus API.
What This Guide Covers¶
- Create a wallet
- Apply for addresses within the wallet
- Initiate a deposit of tokens into the wallet and track the transaction status
- Withdraw tokens from the wallet
- Get wallet balances
Prerequisites¶
- Ensure that all required API Preparation have been completed before interacting with our API.
- Ensure that all API authentication are adhered to when calling our API.
- Administrators must assign the appropriate roles and permissions to the API user. For more information on available roles and permissions, refer to User Manual > Quick Start > Operator Permissions.
- Additionally, administrators must add the operator's outbound IP address to the API IP Whitelist. This is the IP address from which API requests originate, and can be configured under the User Management section.
- Administrators should review and configure the various risk controls such as Withdrawal Approval, Withdrawal Limits, and Withdrawal Whitelist under each business line according to your business requirements.
Create a Wallet¶
To create a wallet on Cactus, an administrator must create the wallet under the selected business line.
Please note that wallets in a segregated account can only be created via the web interface and are not supported through the API.
Apply for Addresses within the Wallet¶
After setting up a wallet, you now need to generate deposit addresses within the wallet to receive tokens. To generate deposit addresses within the Wallet under the business line you have just created, call the Apply For Address API.
Upon successful request completion, the response will return the newly created addresses. These addresses will also be visible in the Cactus portal. You may then proceed to deposit tokens into the addresses.
Initiate a Deposit¶
After depositing tokens into the addresses above, users are able to monitor the transaction using 2 ways : Either using Callback to receive notification of the deposit or Getting the transaction Status by API.
Option 1: Use Callback to receive notification of the deposit¶
We recommend implementing a callback to receive real-time deposit status notifications and withdrawal status notifications.
In order to set up the callback for your business line, Administrators are required to login into the portal and set the callback url for the specific business line.
For details on the Cactus callback structure and data delivery mechanism, please refer here. To understand how deposit status updates flow across different scenarios, see the Order & Deposit Status page.
Option 2: Get Transaction Status by API ¶
To check the status of a deposit transaction via the API, users can call the Get Transaction Details operation and set the tx_types query parameter to DEPOSIT.
Withdraw Tokens¶
Create Withdrawal Order¶
To initiate an order request via the API, users can use the Create Withdrawal Order API. We recommend that users first call Get Wallet Information to check the available balance in their wallet or address before making a withdrawal.
Confirm the Withdrawal¶
Depending on your internal risk control settings set by the administrator, all withdrawal orders are subject to whitelisting protection, withdrawal amount threshold checks, and the required withdrawal approval flow.
To track the status of a withdrawal order, refer to either the callback notifications or the Get Order Details API (via the status field).
If you have the Order Checker role and the withdrawal is pending approval, you may also review and approve the order via Review An Oder API.
Monitor the Withdrawal Status¶
The workflow for the various withdrawal statuses is illustrated here. Please note that the Cactus Callback and the Get Order Details API follow the same withdrawal order status flow.
Get Wallet Balances¶
Once the order has finished, you are able to retrieve the updated wallet balance using the Get Wallet Information API. On top of that, you are able to view the completed transaction under the Get Transaction Details API.