Get withdrawal fee
Get the flat fee for withdrawing to Ethereum, in the currency you ask for.
On this page
Agent prompt
Write a small program that calls `transfer.get_withdrawal_fee` on Grvt {environment} {using}.
Target environment: {environment} (chain ID {chainId}). Recorded signing cases keep their original environment.
{executionGuidance}
Read this first: {origin}/bundle/reference/rpc/get_withdrawal_fee.md (~53 KB, plain Markdown: this page plus the AGENTS.md rules, Authentication and sessions, Errors and retries, Python SDK, Environments).
Fetch other pages from the index at {origin}/llms.txt only as you need them. {origin}/downloads/contract.json is a machine-readable contract for tools, not for reading.
Rules: follow AGENTS.md; do not send requests without the user asking you to; read credentials from environment variables; never retry writes automatically; show me the code and how to run it. URLs and generated code samples on this page: Testnet (chain ID 326). Other code on this page doesn't change: it stays on testnet until you switch it in your code. Tutorials, signing cases and live tools always use testnet.
| SDK | client. |
|---|---|
| HTTP | POST https:/, or / for lite names (the SDKs' default) |
| WebSocket | method v1/withdrawal_fee on wss:/, or /ws/lite for lite names |
| Auth | Session required (Authentication) |
| Retries | Read: the SDKs retry retryable errors (rules) |
| Contract id | transfer. (RPCGetWithdrawalFeeV1) |
Request
Body type ApiWithdrawalFeeRequest. Fields the server fills are left out.
- Currency ID to express the withdrawal fee in (e.g. USDT id 3).
Response
Body type ApiWithdrawalFeeResponse (the same object is the JSON-RPC result over WebSocket).
- The withdrawal fee. Decimal string, e.g. "1500.0"; up to the currency's balance_decimals.
- The currency the withdrawal fee is expressed in.
Errors
Errors come back as {"code", "message", "status"} (lite {"c", "m", "s"}) with the HTTP status. Codes this call can return (all error codes):
4 errors any call can return; none specific to this one
Example
Example code
import os
from grvt import Grvt
with Grvt(
env=os.environ.get("GRVT_ENV", "testnet"),
api_key=os.environ["GRVT_API_KEY"],
) as client:
resp = client.get_withdrawal_fee(
token_currency=3,
)
print(resp)
Raw HTTP (set GRVT_DOMAIN, see Environments; GRVT_COOKIE and GRVT_ACCOUNT_ID come from login):
With full field names:
curl -sS "https://trades.testnet.grvt.io/full/v1/withdrawal_fee" \
-H "Content-Type: application/json" \
-H "Cookie: gravity=$GRVT_COOKIE" \
-H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
--data @- <<EOF
{
"token_currency": 3
}
EOFWith lite field names:
curl -sS "https://trades.testnet.grvt.io/lite/v1/withdrawal_fee" \
-H "Content-Type: application/json" \
-H "Cookie: gravity=$GRVT_COOKIE" \
-H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
--data @- <<EOF
{
"tc": 3
}
EOFBuild request
Not sent from the docsThis call needs a logged-in session on the trading gateway. The docs only build the request: you see exactly what your code would send, and nothing is sent. See Authentication.