Initiate A Withdrawal
In the withdrawal process, BENJI tokens will be taken out of circulation (burned), and in response funds corresponding to the amount of BENJI burned will be sent back to the client.
Prerequisites
$env:BENJI_ACCESS_TOKENis already set- you know your
walletId - you know your
productId - you know the
paymentInstructionIdthat should receive the withdrawal proceeds - you know the
userIdthat should be recorded as the creator
Step 1: Set your withdrawal inputs
This example uses value. If you want to withdraw by share amount instead, use quantity instead of value.
$walletId = "YOUR_WALLET_ID"
$productId = "YOUR_PRODUCT_ID"
$value = 12345.12
$paymentInstructionId = "YOUR_PAYMENT_INSTRUCTION_ID"
$userId = "YOUR_CREATOR_USER_ID"
Step 2: Run withdrawalCreate
$body = @{
query = @'
mutation (
$walletId: ID!,
$productId: ID!,
$value: BigDecimal!,
$paymentInstructionId: ID!,
$userId: String!
) {
withdrawalCreate(
institutionInput: {
walletId: $walletId
productId: $productId
value: $value
paymentInstructionId: $paymentInstructionId
buildSigningPackage: false
userId: $userId
}
) {
withdrawalId
approvalsRequired
blockchainStatus
}
}
'@
variables = @{
walletId = $walletId
productId = $productId
value = $value
paymentInstructionId = $paymentInstructionId
userId = $userId
}
} | ConvertTo-Json -Depth 10
Invoke-RestMethod `
-Uri "https://api-uat.frk.com/tf/platform/bve/graphql" `
-Method POST `
-Headers @{ Authorization = "Bearer $env:BENJI_ACCESS_TOKEN" } `
-ContentType "application/json" `
-Body $body | ConvertTo-Json -Depth 10
Save these outputs
After the call succeeds, keep:
withdrawalIdapprovalsRequiredblockchainStatus
If you continue the full lifecycle later, use withdrawalId for the approve, submit, and status-check steps.