AutoWithdrawService
Preview Auto-Withdraw Run
Preview the account's next auto-withdraw run from its balances now: when it starts, whether it would pay, and per asset what it would pay, what would stay and why, its USD value and the expected network fee. A price that is not current leaves the value absent instead of failing the read.
Request
curl --request GET \ \ --url 'https://api.testnet.polyester.com/v1/auto-withdraw/preview?subaccountId=45LUmqjT' \ --header 'Accept: */*' \ --header 'X-API-KEY-ID: YOUR_API_KEY_ID' \ --header 'X-API-TIMESTAMP: YOUR_API_TIMESTAMP' \ --header 'X-API-SIGNATURE: YOUR_API_SIGNATURE'
Responses
{
"assets": [
{
"assetId": 100,
"available": "18.446744073709551617",
"destinationAddress": "0x3333333333333333333333333333333333333333",
"destinationChainId": "1",
"heldBack": "18.446744073709551617",
"holdReason": "value",
"minimum": "18.446744073709551617",
"networkFee": "18.446744073709551617",
"networkFeeSampledAt": "2025-01-01T00:00:00Z",
"payable": "18.446744073709551617",
"payableFrom": "2025-01-01T00:00:00Z",
"pricedAt": "2025-01-01T00:00:00Z",
"valueUsd": "18.446744073709551617"
}
],
"computedAt": "2025-01-01T00:00:00Z",
"minUsdValue": "18.446744073709551617",
"nextRunAt": "2025-01-01T00:00:00Z",
"pause": {
"assetId": 100,
"pausedAt": "2025-01-01T00:00:00Z",
"reason": "value"
},
"ruleVersion": 1,
"status": "WILL_PAY"
}Public subaccount ID; omit for the caller's root account. Public ID, as a base58 string.
Ledger asset.
100The account's available balance of the asset now, as a decimal string in whole units of the asset.
18.446744073709551617Canonical destination address; absent when the rule has no destination for the asset.
0x3333333333333333333333333333333333333333External destination chain identifier; absent when the rule has no destination for the asset.
1What would stay on the account, as a decimal string in whole units of the asset: available minus payable.
18.446744073709551617Why held_back_e18 stays, or why nothing pays: below_minimum (below minimum_e18 or the rule's min_usd_value_e18), price_unavailable (the rule has a USD minimum and no current price values the asset), no_destination (the rule pays no destination for the asset), destination_cooling_down (a broker vault pays a destination only once it has been on the vault's external withdraw whitelist for 24 hours; see payable_from), above_max (the balance above max_amount_e18 stays) or dust (less than one whole on-chain unit stays); empty when the whole balance pays.
valueThe least one payout of the asset pays, as a decimal string in whole units of the asset: the destination's minAmount, or its minFloor when that is higher and known now. Absent when the rule has no destination for the asset.
18.446744073709551617The network fee a payout to the destination is expected to be charged now, as a decimal string in whole units of the asset; the destination receives about payable minus this fee. Absent when the rule has no destination for the asset or the fee is not known now.
18.446744073709551617When network_fee_e18 was sampled; unset with it.
2025-01-01T00:00:00ZWhat the run would pay, as a decimal string in whole units of the asset; '0' when the asset holds. The network fee is taken out of it on the way.
18.446744073709551617Present only on a broker vault while the destination is cooling down: when it can be paid, RFC 3339 UTC, 24 hours after it was added to the vault's external withdraw whitelist. Absent with holdReason destination_cooling_down when that time is not known yet.
2025-01-01T00:00:00ZWhen the price behind value_usd_e18 was observed; unset with it.
2025-01-01T00:00:00ZUSD value of what the asset pays before its minimums, as a decimal string in whole USD, at the current price as of pricedAt. Absent when no current price values the asset or the rule has no destination for it.
18.446744073709551617When the balances, prices and fees the preview used were read, RFC 3339 UTC.
2025-01-01T00:00:00ZThe rule's least USD value of one payout, as a decimal string in whole USD; '0' means no USD minimum. Absent when the account has no rule.
18.446744073709551617When the next run starts, RFC 3339 UTC; for an hourly rule, the next hourly check. Absent when the account has no rule or the rule is paused.
2025-01-01T00:00:00ZAsset whose payout paused the rule; zero when no payout did.
100When the rule was paused.
2025-01-01T00:00:00ZMachine-readable reason: destination_not_whitelisted when the destination left the account's external withdraw whitelist, destination_invalid when it is no longer a valid destination, or authority_revoked when the person who set the rule may no longer change it or withdraw from the account. On a broker vault the rule pauses with authority_revoked as soon as its author's broker role changes in any way: removed, demoted, or promoted (for example Finance to Owner), and also when the author is removed and added back. An Owner or Finance member resumes it with a fresh step-up.
valueThe latest rule version; zero when the account has no rule.
1Whether the next run would pay.
WILL_PAY| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |