Skip to content
TradePerpetuals9 pages
What a perpetual future isFoundationA perpetual future is a contract on an asset's price that never expires, kept close to that price by an hourly payment between longs and shorts.Contract specificationsPractitionerEvery Hyperliquid perp is a linear contract on 1 unit of its asset, defined by size decimals, maximum leverage, a margin table and a margin mode.FundingPractitionerFunding is an hourly payment between longs and shorts, set by how far the perp trades from the oracle price, that ties a contract with no expiry to its index.Margin: cross, isolated and margin tiersPractitionerMargin is the collateral behind a perp: initial margin to open, maintenance margin to stay open, shared in cross mode or ring-fenced in isolated mode.Leverage and liquidationPractitionerBelow maintenance margin, positions go to the order book as market orders; below two thirds of it, the liquidator vault takes them over.Auto-deleveragingExpertWhen an account goes below zero, auto-deleveraging closes the most profitable, most leveraged opposing positions at the previous mark price, leaving no bad debt.Hyperps and index perpetualsPractitionerHyperps fund against a moving average of their own mark price until spot trading exists; index perps track a formula the validators publish.AMM-priced perpetualsExpertSome perps price off a Uniswap V2 or V3 pool instead of exchange spot prices, and are isolated only, with margin locked in until the position closes.DelistingPractitionerWhen validators vote to delist a perp, positions settle at the 1-hour time-weighted oracle price before the vote and no new orders are accepted.

API wallets and agents

Practitioner

An API wallet is a key the master account approves to sign trades for it: it can place and cancel orders but cannot withdraw or send funds to another address.

An API wallet, also called an agent, limits what a stolen trading key can do. Your bot’s key sits on a server, and if it were your account key a breach would drain the account. An agent is a second key your cold master approves: it signs orders and cancels but can’t move money to another address.

Say your account holds 50,000 USDC and the bot’s server is breached. The thief can lose that 50,000 through bad trades, but can’t withdraw it or send it to another address.

What an agent can sign, and what only the master can

Section titled “What an agent can sign, and what only the master can”

The master signs approveAgent naming the agent’s address and an optional name. The agent then signs L1 actions for the master and its sub-accounts, only on the network hyperliquidChain binds: a testnet approval does nothing on mainnet.

Who can sign Actions
An agent (L1 actions) orders, cancels, modifies, scheduleCancel, vault transfers, borrowLend, agentSetAbstraction, HIP-3 and HIP-4 deployer actions such as settlements, and agentSendAsset, between the account’s own balances only (destination must equal source)
The master key only (user-signed) withdrawals (withdraw3), sends to another address (usdSend, spotSend, sendAsset), approving another agent, approving a builder fee
Never an agent, even an approved one activateOutcomeDeployer

An agent is a signer, not an account: queries on its address return empty (nonces and agents).

Slots. One unnamed slot, several named ones; approving into an occupied slot or name replaces the holder. A valid_until <timestamp in milliseconds> suffix on the name sets an expiry, at most 180 days ahead.

Removal. There is no revoke action. Per the docs an agent is removed, and its nonce state may be pruned, when replaced, when expired, or when the registering account has no funds. In each case the re-approval danger below applies.

Item Value Source
Unnamed agents per account 1 exchange endpoint docs
Named agents per account up to 3, plus 2 per sub-account exchange endpoint docs
API wallets per account 3 per master, plus 2 per sub-account sub-accounts docs
Observed on one live account 14 measured; unreconciled with either figure
Longest expiry 180 days exchange endpoint docs
Agent name length 1 to 16 characters SDK constants
Nonces kept per signer the 100 highest nonce docs
Nonce window block time minus 2 days to block time plus 1 day nonce docs

The count is unresolved: read extraAgents on your own account.

  • Retire a leaked key by approving a fresh address into its slot or name. Until then it trades without limit.
  • Set a valid_until expiry so a forgotten agent stops on its own.
  • Run one agent per process. Nonces are per signer, so processes sharing one collide. The docs recommend one API wallet per trading process and per sub-account.

The master key signs the approval; a null agentName signs as the empty string and approves the unnamed agent.

{
"type": "approveAgent",
"hyperliquidChain": "Mainnet",
"signatureChainId": "0xa4b1",
"agentAddress": "0x...",
"agentName": "mm-1 valid_until 1767225600000",
"nonce": 1760000000000
}
  • Listing: extraAgents returns {address, name, validUntil} entries, or null (not an empty list) when there are none.
  • Identifying: userRole returns {"role": "agent", "data": {"user": "0x..."}}, naming the master.
  • From a contract: CoreWriter action 9, (address wallet, string name), approves an API wallet for the contract’s own account; an empty name makes it the main agent. An off-chain keeper can then do what CoreWriter is not proven to carry, such as a borrow.
  • CoreWriter acts for the sender: an agent’s key calling CoreWriter acts for the agent’s own address, not its master.
  • Multi-sig: the submitting leader can be an authorised user’s API wallet; its nonce is the one checked (multi-sig).
  • Builder fees: an app can’t approve its own builder fee through a user’s agent (builder codes).
  • Unknown signer: an unapproved or replaced agent, or a malformed signature, fails with User or API Wallet ... does not exist, naming the recovered address (debugging).

For signing and replay protection in depth, see Nonces, expiry and API wallets. For L1 versus user-signed actions, see Signing from first principles.