For the complete documentation index, see llms.txt. This page is also available as Markdown.

Builder Codes

Builder codes on HyperLink: charge an approved per-order fee on the orders your app routes to Hyperliquid, with fixed fee tiers and API-based claims.

Builder codes let applications charge a fee on the orders they send through HyperLink on a user's behalf. The user approves a maximum fee rate for each builder with their main wallet and can revoke it at any time. The fee is set per order and accrues to the builder's HyperLink account.

The flow mirrors Hyperliquid's builder codes: approve a rate with approveBuilderFee, then attach {"b": builder, "f": fee} to order actions.

Differences from Hyperliquid

HyperLink
Hyperliquid

Per-order fee f

One of four tiers: 5, 10, 15, 20 (0.5–2 bp)

Any value up to the approved max

Maximum fee rate

0.02% (2 bp) on perps and spot

0.1% on perps, 1% on spot

Everything else carries over: approvals are signed by the user's main wallet, f is in tenths of a basis point (10 = 1 bp), fees are charged in the quote or collateral asset, and each user can have at most 10 active builder approvals.

Approve a builder fee

The user signs an approveBuilderFee action with their main wallet; agent (API) keys cannot approve builder fees. maxFeeRate is a percent string with up to three decimals, at most "0.02%".

{
  "action": {
    "type": "approveBuilderFee",
    "hyperliquidChain": "Mainnet",
    "signatureChainId": "0xa4b1",
    "maxFeeRate": "0.01%",
    "builder": "0x8c67a1b3d5e9f2407b6a0c4d8e1f5a3b7c9d0e2f",
    "nonce": 1712140800000
  },
  "nonce": 1712140800000,
  "signature": { "r": "0x...", "s": "0x...", "v": 27 }
}

The action uses the user-signed EIP-712 domain, identical to Hyperliquid's HyperliquidTransaction:ApproveBuilderFee type; see Authentication & Keys for signing chainIds. A success returns { "status": "ok", "response": { "type": "default" } }.

With the HyperLink Python SDK, construct the client with the main wallet key:

To revoke a builder, approve them with "0%". Approving an 11th builder is rejected until one is revoked.

Attach the fee to orders

Once approved, order actions may include the optional builder field. b is the builder address in lowercase hex; f is the fee in tenths of a basis point and must be one of the four tiers, at or below the user's approved max.

f

Fee rate

5

0.5 bp (0.005%)

10

1 bp (0.01%)

15

1.5 bp (0.015%)

20

2 bp (0.02%)

Or through the SDK's builder parameter (orders can use your regular agent-keyed client):

Fees are calculated from fill notional and accrue in the market's quote or collateral token. They apply to both sides of perp trades and to spot sells on any configured quote token. Spot buys do not accrue builder fees (same as Hyperliquid).

Query approvals

Two signed POST /exchange queries cover approvals; in both, user must be the authenticated account.

approvedBuilders lists the builder addresses the account has approved:

Response:

maxBuilderFee returns the approved rate for one builder in tenths of a basis point, or 0 when unapproved:

Response:

Track accrued fees

As on Hyperliquid, accrued builder fees are part of the referral query response. builderRewards is the cumulative total, unclaimedRewards is what is currently claimable, and claimedRewards is what has been claimed. Top-level amounts are USDC; tokenToState breaks the same figures down per settlement token index. The response also carries the account's referral statistics.

Response:

Claim builder fees

Builders claim accrued fees with the claimRewards action, which credits each eligible DEX/token reward bucket to the builder's HyperLink spot balance in the same settlement token. Each bucket must exceed one whole settlement token; smaller buckets remain unclaimed. The action takes no parameters and can be agent-signed.

Errors

The API returns Builder fee has not been approved. when approval is missing, revoked, or below the order's f. Other builder-code admission failures return Order rejected.; verify the builder address and fee tier.

Next steps

Last updated