Withdrawals
This guide explains how to withdraw funds from your wallets to external addresses.
Request withdrawal
Create a new withdrawal request from a wallet. The withdrawal will require approval from authorized users.
Required parameters
- Name
- asset_id
- Type
- string
- Description
The UUID of the asset to withdraw.
- Name
- amount
- Type
- string
- Description
The amount to withdraw in decimal string format.
- Name
- recipient_address
- Type
- string
- Description
The blockchain address to send funds to.
Response
- Name
- id
- Type
- string
- Description
The UUID of the withdrawal request.
- Name
- status
- Type
- string
- Description
Current status of the withdrawal:
PENDING_APPROVAL
: Waiting for approvals from authorized usersPENDING
: Approved and waiting to be processedEXECUTED
: Transaction has been sent to the blockchainSUCCESS
: Transaction has been confirmed on the blockchainREJECTED
: Withdrawal was rejected by an approverFAILED
: Transaction failed to execute
- Name
- wallet_id
- Type
- string
- Description
The UUID of the source wallet.
- Name
- asset_id
- Type
- string
- Description
The UUID of the asset being withdrawn.
- Name
- amount
- Type
- string
- Description
The withdrawal amount.
- Name
- recipient_address
- Type
- string
- Description
The destination blockchain address.
- Name
- creator_id
- Type
- string
- Description
The UUID of the user who created the withdrawal request.
- Name
- withdrawal_approvals
- Type
- array
- Description
List of approval statuses from authorized users.
- Name
- created_at
- Type
- string
- Description
Timestamp of when the request was created.
- Name
- updated_at
- Type
- string
- Description
Timestamp of the last status update.
The withdrawal process follows this flow:
- PENDING_APPROVAL → Waiting for required approvals
- PENDING → Approved and queued for processing
- EXECUTED → Transaction sent to blockchain
- SUCCESS → Transaction confirmed
Or if rejected/failed:
- REJECTED → An approver rejected the withdrawal
- FAILED → Transaction failed to execute
Request
import { FystackSDK, Environment } from "@fystack/sdk"const apiCredentials = {apiKey: process.env.API_KEY,apiSecret: process.env.API_SECRET}const sdk = new FystackSDK({credentials: apiCredentials,environment: Environment.Sandbox,logger: true})const response = await sdk.requestWithdrawal("e0851607-417a-475a-b399-5f3aa262b81d",{assetId: "f1be472d-1338-43ff-b547-06faba7ecce7",amount: "0.001",recipientAddress: "0xe6EBF81E9C225BbCEa9b5399E0D0d0f29f30f119"})
Get withdrawal status
Get the current status of a withdrawal request.
Response
- Name
- success
- Type
- boolean
- Description
Indicates whether the request was successful.
- Name
- data
- Type
- object
- Description
Contains the withdrawal details.
- Name
- id
- Type
- string
- Description
The UUID of the withdrawal request.
- Name
- status
- Type
- string
- Description
Current status of the withdrawal.
- Name
- amount
- Type
- string
- Description
The withdrawal amount.
- Name
- recipient_address
- Type
- string
- Description
The destination blockchain address.
- Name
- creator
- Type
- object
- Description
Information about the user who created the withdrawal.
- Name
- asset
- Type
- object
- Description
Details about the asset being withdrawn.
- Name
- transaction
- Type
- object
- Description
Complete transaction details once executed.
Request
import { FystackSDK, Environment } from "@fystack/sdk"const apiCredentials = {apiKey: process.env.API_KEY,apiSecret: process.env.API_SECRET}const sdk = new FystackSDK({credentials: apiCredentials,environment: Environment.Sandbox,logger: true})// Get withdrawal statusconst withdrawal = await sdk.getWithdrawalStatus("4cebc6c3-1e46-4166-ab59-86a59971215f")// Check withdrawal statusif (withdrawal.status === 'SUCCESS') {console.log('Transaction hash:', withdrawal.transaction.tx_hash)console.log('Amount:', withdrawal.amount)console.log('Asset:', withdrawal.asset.symbol)}// Check approval statusconst approvals = withdrawal.withdrawal_approvalsconst pendingApprovals = approvals.filter(a => a.status === 'PENDING')const approvedCount = approvals.filter(a => a.status === 'APPROVED').lengthconsole.log('Pending approvals:', pendingApprovals.length)console.log('Approved count:', approvedCount)