Skip to main content

userFees

Get fee rates, volume information, and referral discounts for a user on Hyperliquid.

Why Hyperliquid? Build on the dominant perpetuals DEX with 70% market share, $2.7T+ lifetime volume, and $2B TVL with 200K orders/second throughput, zero gas fees, sub-second finality, and fully onchain Central Limit Order Book (CLOB).

When to Use This Endpoint#

The userFees endpoint is essential for traders, trading platforms, and analytics tools who need to:

  • Calculate Trading Costs — Estimate fees before placing orders
  • Volume Tracking — Monitor daily trading volume
  • Fee Optimization — Compare user's fees against standard schedule
  • Referral Programs — Track referral discounts and benefits

Request#

Endpoint#

POST https://api-hyperliquid-mainnet-info.n.dwellir.com/info

Headers#

HeaderValueRequired
Content-Typeapplication/jsonYes
X-Api-KeyYour API keyYes

Parameters#

ParameterTypeRequiredDescription
typestringYesMust be "userFees"
userstringYesUser's Ethereum wallet address

Example Request#

{
"type": "userFees",
"user": "0x63E8c7C149556D5f34F833419A287bb9Ef81487f"
}

Response#

Success Response#

{
"dailyUserVlm": [
{
"date": "2026-02-07",
"userCross": "0.0",
"userAdd": "0.0",
"exchange": "6761946801.4399995804"
},
{
"date": "2026-02-08",
"userCross": "0.0",
"userAdd": "0.0",
"exchange": "3963888811.4499998093"
},
{
"date": "2026-02-09",
"userCross": "0.0",
"userAdd": "0.0",
"exchange": "2538522069.9000000954"
}
],
"feeSchedule": {
"cross": "0.00045",
"add": "0.00015",
"spotCross": "0.0007",
"spotAdd": "0.0004",
"tiers": {
"vip": [
{
"ntlCutoff": "5000000.0",
"cross": "0.0004",
"add": "0.00012",
"spotCross": "0.0006",
"spotAdd": "0.0003"
}
],
"mm": [
{
"makerFractionCutoff": "0.005",
"add": "-0.00001"
}
]
},
"referralDiscount": "0.04",
"stakingDiscountTiers": [
{
"bpsOfMaxSupply": "0.0",
"discount": "0.0"
},
{
"bpsOfMaxSupply": "0.0001",
"discount": "0.05"
}
]
},
"userCrossRate": "0.00045",
"userAddRate": "0.00015",
"userSpotCrossRate": "0.0007",
"userSpotAddRate": "0.0004",
"activeReferralDiscount": "0.04",
"trial": null,
"feeTrialEscrow": "0.0",
"nextTrialAvailableTimestamp": null,
"stakingLink": null,
"activeStakingDiscount": {
"bpsOfMaxSupply": "0.0",
"discount": "0.0"
}
}

Response Fields#

FieldTypeDescription
dailyUserVlmarrayArray of daily trading volume objects (last 15 days)
feeScheduleobjectComplete fee schedule with tiers and discounts
userCrossRatestringUser's current cross margin fee rate
userAddRatestringUser's current add liquidity fee rate
userSpotCrossRatestringUser's current spot cross margin fee rate
userSpotAddRatestringUser's current spot add liquidity fee rate
activeReferralDiscountstringActive referral discount (decimal, e.g., "0.04" = 4%)
trialnull | objectFee trial information if active
feeTrialEscrowstringAmount in escrow for fee trial
nextTrialAvailableTimestampnull | integerTimestamp when next trial becomes available
stakingLinknull | stringStaking link if applicable
activeStakingDiscountobjectCurrent staking discount tier

Daily Volume Object#

FieldTypeDescription
datestringDate in YYYY-MM-DD format
userCrossstringUser's cross margin trading volume for the day
userAddstringUser's add liquidity volume for the day
exchangestringTotal exchange volume for the day

Fee Schedule Object#

FieldTypeDescription
crossstringBase cross margin fee rate
addstringBase add liquidity fee rate
spotCrossstringBase spot cross margin fee rate
spotAddstringBase spot add liquidity fee rate
tiersobjectVIP and market maker tier structures
referralDiscountstringStandard referral discount percentage
stakingDiscountTiersarrayArray of staking discount tier objects

VIP Tier Object#

FieldTypeDescription
ntlCutoffstringNotional volume cutoff for this tier
crossstringCross margin fee rate at this tier
addstringAdd liquidity fee rate at this tier
spotCrossstringSpot cross margin fee rate at this tier
spotAddstringSpot add liquidity fee rate at this tier

Market Maker Tier Object#

FieldTypeDescription
makerFractionCutoffstringMaker fraction cutoff for this tier
addstringAdd liquidity rebate (negative = rebate)

Staking Discount Tier Object#

FieldTypeDescription
bpsOfMaxSupplystringBasis points of max supply staked
discountstringFee discount percentage at this tier

Note: Fee rates are expressed as decimals (e.g., "0.00045" = 0.045% or 4.5 basis points)

Code Examples#

curl -X POST 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info' \
-H 'X-Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"type": "userFees",
"user": "0x63E8c7C149556D5f34F833419A287bb9Ef81487f"
}'

Common Use Cases#

1. Calculate Trading Costs#

Estimate fees for a trade:

async function calculateTradingFee(userAddress, orderValue, isMaker = false) {
const fees = await getUserFees(userAddress);

// Use cross rate for taker, add rate for maker
const feeRate = isMaker
? parseFloat(fees.userRates.userAddRate)
: parseFloat(fees.userRates.userCrossRate);

// Apply referral discount if available
const discount = parseFloat(fees.referralDiscount);
const effectiveRate = feeRate * (1 - discount);

const feeAmount = orderValue * effectiveRate;

return {
orderValue: orderValue,
feeRate: feeRate,
discount: discount,
effectiveRate: effectiveRate,
feeAmount: feeAmount,
feeBps: effectiveRate * 10000
};
}

// Usage
const tradeFee = await calculateTradingFee(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
10000, // $10,000 order
true // maker order
);

console.log(`Order Value: $${tradeFee.orderValue}`);
console.log(`Fee Rate: ${tradeFee.feeBps.toFixed(2)} bps`);
console.log(`Estimated Fee: $${tradeFee.feeAmount.toFixed(2)}`);

2. Compare Against Standard Fees#

Compare user's fees to standard rates:

async function compareFeeRates(userAddress, standardRate = 0.0005) {
const fees = await getUserFees(userAddress);
const userRate = parseFloat(fees.userRates.userCrossRate);

const savingsBps = (standardRate - userRate) * 10000;
const savingsPercent = ((standardRate - userRate) / standardRate) * 100;

return {
userRate: userRate,
standardRate: standardRate,
savingsBps: savingsBps,
savingsPercent: savingsPercent,
hasBetterRate: userRate < standardRate
};
}

// Usage
const comparison = await compareFeeRates(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
0.0005 // 5 bps standard
);

if (comparison.hasBetterRate) {
console.log(`You save ${comparison.savingsBps.toFixed(2)} bps (${comparison.savingsPercent.toFixed(1)}%)`);
}

3. Estimate Monthly Fee Savings#

Calculate potential savings with referral discount:

async function estimateMonthlySavings(userAddress, monthlyVolume) {
const fees = await getUserFees(userAddress);

const baseRate = parseFloat(fees.userRates.userCrossRate);
const discount = parseFloat(fees.referralDiscount);

const baseFees = monthlyVolume * baseRate;
const discountedFees = baseFees * (1 - discount);
const savings = baseFees - discountedFees;

return {
monthlyVolume: monthlyVolume,
baseRate: baseRate,
discount: discount,
baseFees: baseFees,
discountedFees: discountedFees,
savings: savings,
savingsPercent: discount * 100
};
}

// Usage
const savings = await estimateMonthlySavings(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
1000000 // $1M monthly volume
);

console.log(`Monthly Volume: $${savings.monthlyVolume.toLocaleString()}`);
console.log(`Base Fees: $${savings.baseFees.toFixed(2)}`);
console.log(`With Discount: $${savings.discountedFees.toFixed(2)}`);
console.log(`Monthly Savings: $${savings.savings.toFixed(2)}`);

4. Fee Tier Analyzer#

Analyze user's fee tier and potential improvements:

async function analyzeFeePosition(userAddress) {
const fees = await getUserFees(userAddress);

const crossRate = parseFloat(fees.userRates.userCrossRate);
const addRate = parseFloat(fees.userRates.userAddRate);
const discount = parseFloat(fees.referralDiscount);

// Example tier thresholds (adjust based on actual schedule)
const tiers = [
{ name: 'Standard', rate: 0.0005, minVolume: 0 },
{ name: 'Tier 1', rate: 0.0004, minVolume: 100000 },
{ name: 'Tier 2', rate: 0.0003, minVolume: 500000 },
{ name: 'Tier 3', rate: 0.0002, minVolume: 2000000 },
];

const currentTier = tiers.findLast(t => t.rate >= crossRate) || tiers[0];
const nextTier = tiers[tiers.indexOf(currentTier) + 1];

console.log('=== Fee Analysis ===\n');
console.log(`Current Cross Rate: ${(crossRate * 10000).toFixed(2)} bps`);
console.log(`Current Add Rate: ${(addRate * 10000).toFixed(2)} bps`);
console.log(`Estimated Tier: ${currentTier.name}`);

if (discount > 0) {
console.log(`Referral Discount: ${(discount * 100).toFixed(1)}%`);
}

if (nextTier) {
const improvement = ((crossRate - nextTier.rate) / crossRate) * 100;
console.log(`\nNext tier saves ${improvement.toFixed(1)}% on fees`);
console.log(`Requires ~$${nextTier.minVolume.toLocaleString()} monthly volume`);
}
}

5. Fee Comparison Tool#

Compare fees across different order types:

async function compareFeeTypes(userAddress, orderValue) {
const fees = await getUserFees(userAddress);

const makerRate = parseFloat(fees.userRates.userAddRate);
const takerRate = parseFloat(fees.userRates.userCrossRate);
const discount = parseFloat(fees.referralDiscount);

const makerFee = orderValue * makerRate * (1 - discount);
const takerFee = orderValue * takerRate * (1 - discount);

console.log(`Order Value: $${orderValue.toLocaleString()}\n`);

console.log('Maker Order (limit):');
console.log(` Rate: ${(makerRate * 10000).toFixed(2)} bps`);
console.log(` Fee: $${makerFee.toFixed(2)}`);

console.log('\nTaker Order (market):');
console.log(` Rate: ${(takerRate * 10000).toFixed(2)} bps`);
console.log(` Fee: $${takerFee.toFixed(2)}`);

console.log(`\nSavings with maker: $${(takerFee - makerFee).toFixed(2)}`);
}

Error Handling#

Common Errors#

ErrorCauseSolution
401 UnauthorizedInvalid API keyVerify your API key is correct
400 Bad RequestMissing or invalid user addressEnsure valid Ethereum address format
429 Too Many RequestsRate limit exceededImplement request throttling
500 Internal Server ErrorServer issueRetry with exponential backoff

Error Response Example#

{
"error": "Missing required parameter: user",
"code": "MISSING_PARAMETER"
}

Robust Error Handling#

async function safeGetUserFees(userAddress, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await getUserFees(userAddress);
} catch (error) {
if (error.response?.status === 429) {
// Rate limit - exponential backoff
await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
} else if (error.response?.status === 400) {
throw new Error('Invalid user address');
} else if (i === maxRetries - 1) {
throw error;
}
}
}
}

Best Practices#

  1. Cache fee data — Fee rates change infrequently, cache for several minutes
  2. Always use effective rate — Apply referral discount when calculating costs
  3. Display fees clearly — Show both basis points and dollar amounts
  4. Validate addresses — Ensure user addresses are valid Ethereum addresses
  5. Consider order type — Use correct rate for maker vs taker orders

Access real-time Hyperliquid fee information with Dwellir's HyperCore Info Endpoint. Get your API key →