WithdrawService
Create Trading Withdraw
Create or return one API-key-authorized withdraw from Trading.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/chain/trading-withdraws' \
--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' \
--header 'Content-Type: application/json' \
--data '{
"payload": {
"action": "TO_FUNDING",
"amount": "18.446744073709551617",
"assetId": 100,
"deadlineTsSec": "1735689600",
"destinationAddress": "0x3333333333333333333333333333333333333333",
"destinationChainId": "1",
"idempotencyKey": "idem_01J5EXAMPLE0000000000000",
"nonce": "18446744073709551617"
},
"payloadSignature": "AA=="
}'Responses
{
"intentId": "9155001234567"
}Destination for funds leaving Trading.
Withdraw amount in canonical 18-decimal unified asset units. For example, 0.5 is encoded as 500000000000000000. For TO_EXTERNAL_CHAIN, it must be a whole number of the destination network token's smallest units: a multiple of 10^(18 - AssetChainVariant.source_decimals) when the token has fewer than 18 decimals. A finer amount is refused with ERROR_CODE_AMOUNT_EXCEEDS_ROUTE_PRECISION before any funds are reserved.
Unified asset identifier from Polyester asset metadata. amount_e18 is denominated in this asset at canonical 18-decimal scale.
Unix timestamp in seconds after which this signed user authorization is no longer accepted by the API. This is separate from the server-owned execution deadline used later for on-chain submission.
Destination address. For TO_EXTERNAL_CHAIN this is an address on destination_chain_id and is validated according to that network. For TO_FUNDING, omit it to move funds to the selected account's Funding account or provide another Polyester funding address for a Trading-to-Funding transfer.
External network id for TO_EXTERNAL_CHAIN. Omit for TO_FUNDING.
Client-chosen idempotency key. Reusing the same key with the same payload returns the existing withdraw; reusing it with different payload fails.
Client-generated unsigned 128-bit nonce bound to the signed request. This is an identifier, not a decimal amount.
User/API signature over deterministic TradingWithdrawIntentPayload bytes. Must not be empty.
Stable server-owned intent identifier for the accepted withdraw lifecycle. Clients use this id to follow later progress for the same withdraw flow.
9155001234567| 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. |