How to Set Up a Builder Code on Hyperliquid (For Developers)
Risk warning. Trading perpetual futures and other leveraged crypto-asset products is high risk. A large share of retail traders lose money, so never trade with money you cannot afford to lose entirely. Disclaimer
A builder code lets a third-party trading app earn a small, user-approved fee on orders it routes to Hyperliquid, this guide covers the developer-side setup, not a trader-facing feature.
This guide is part of TradeOnDEX’s Hyperliquid how-to series within Perpetual Futures, written for developers building on top of Hyperliquid’s infrastructure rather than for end-user traders.
Disclosure: TradeOnDEX may earn a commission from links to Hyperliquid on this page, at no extra cost to you. Full details at the end of this article.
What a builder code actually does
If you’re building a trading interface, bot, or aggregator on top of Hyperliquid, a builder code lets your application collect a fee on the fills it sends, on top of Hyperliquid’s own trading fee. This is explicit, user-approved, and capped, not something you can apply without the end user knowingly consenting first.
Prerequisites
- Your builder account needs at least 100 USDC in perps account value.
- Your account must use “standard” as its account abstraction mode.
The approval flow, step by step
- Get explicit user approval first. Before you can charge a builder fee, the end user must approve your builder address and a maximum fee rate via the
ApproveBuilderFeeaction. This must be signed by the user’s main wallet, an agent or API wallet cannot approve this on the user’s behalf. - Set your fee rate correctly. The fee parameter is specified in tenths of basis points as an integer:
f: 10equals 1 basis point (0.01%),f: 100equals 10 basis points (0.1%). Perpetuals cap out at 10 bps (0.10%); spot caps out at 100 bps (1.00%). - Apply the builder code per order. Builder fees are set per-order, giving you flexibility to vary the fee (within your approved maximum) by product, market, or user tier.
- Provide a clear revocation path. Users can revoke their approval at any time by signing a new
ApproveBuilderFeeaction with the maximum fee set to zero, your UI should expose this explicitly, not bury it.
Risk: the mistake that costs real money, and the trust obligation underneath it
The single most costly implementation error is a unit mismatch. Hyperliquid’s protocol expects the fee as tenths of basis points (an integer), while some SDK helper methods expect a percentage string instead. Mixing these up doesn’t throw a clean error, it silently results in fees that are 100x too high or 100x too low. Test this specific conversion carefully against a testnet account before shipping to real users.
A builder fee is still the end user’s money, even though it’s “just a fee.” Because the approval is a real, signed authorization with a real ceiling, treat the maximum fee rate you request as a genuine commitment to your users, not a technical formality, request only what your actual pricing model requires.
Revocation needs to be genuinely accessible, not just technically possible. A user who can’t easily find how to revoke a builder fee approval in your interface hasn’t meaningfully consented on an ongoing basis, even if the initial approval was clear.
This is infrastructure for builders, not a feature end users configure themselves. If you’re a trader rather than a developer reading this, builder codes are something apps you use may implement, not something you set up in the standard Hyperliquid trading interface.
Fee limits at a glance
| Product | Maximum builder fee |
|---|---|
| Perpetuals | 10 bps (0.10%) |
| Spot | 100 bps (1.00%) |
See it for yourself
The Python SDK’s builder fee example is a practical starting point for testing the approval and fee-application flow on testnet before going live.
Frequently asked questions
Can I charge a builder fee without the user approving it first?
No. The ApproveBuilderFee action must be signed by the user’s own main wallet before any builder fee can apply.
What’s the maximum builder fee I can charge on a perpetual trade?
10 basis points (0.10%), specified as f: 100 in the protocol’s tenths-of-basis-points unit.
Can an API or agent wallet approve a builder fee on the user’s behalf?
No, only the user’s main wallet can sign this specific approval.
How does a user revoke a builder fee approval?
By signing a new ApproveBuilderFee action with the maximum fee set to zero, your application should make this straightforward to do.
Affiliate disclosure
TradeOnDEX may earn a commission if you sign up or trade through a link on this page, at no extra cost to you. Hyperliquid’s own affiliate/referral terms are still being confirmed for this site, so links here are direct and untracked for now. This article is educational, written for developers, and is not financial or legal advice. See our disclaimer for the full risk warning.
Risk warning
Trading crypto assets, and leveraged products based on them such as perpetual futures ("perps"), is high risk. A large share of retail traders lose money on these products. Leverage magnifies gains and losses alike and can push your loss beyond the amount you put in. Positions can be closed automatically (liquidation) before you get a chance to react, and some of the platforms we cover offer no negative balance protection.
Never trade with money you cannot afford to lose entirely. TradeOnDEX gives no investment advice, no personal recommendation, and no guarantee of any outcome. Every decision you make is your own decision and your own responsibility.