Subaccounts
A subaccount is a separate trading account owned by a main account. It has its own address, balances, positions, orders and margin. For how subaccounts work in the app, see Subaccounts.
Subaccounts don't have their own API keys or signing keys. You trade every subaccount with your main account's API key and signing key, and each request names the subaccount it acts for. One key set covers the main account and all of its subaccounts.
How it works
Create a subaccount from the main account. See Creating subaccounts.
Select the subaccount on each request: the
AEVO-SUBACCOUNTheader on REST, or thesubaccountfield when you authenticate on the websocket.Sign orders with the main account's signing key, with
makerset to the subaccount's address.
For a step-by-step walkthrough with complete REST and websocket code, see Trading with a subaccount.
Endpoint map
Create a subaccount
Main account API key
Main wallet or signing key (CreateSubaccount), and the subaccount key (LinkSubaccount)
Trade, read and cancel as a subaccount
Any private endpoint, with AEVO-SUBACCOUNT
Main account API key
Main signing key, with maker = subaccount
Move funds out of a subaccount
POST /transfer, with AEVO-SUBACCOUNT
Main account API key
Subaccount key (Transfer)
Acting as a subaccount over REST
Add the AEVO-SUBACCOUNT header with the subaccount's address to any private request. The request then reads and acts on the subaccount instead of the main account.
Use the checksummed subaccount address, for example
0xAbC…, exactly asGET /subaccountsreturns it.Without the header, the same key acts on the main account.
A read-only API key stays read-only for subaccounts, and the key's IP allowlist still applies.
With HMAC signatures
When you authenticate with a signature, the subaccount is part of the signed message. Append it as a sixth field:
Requests without the header keep the usual five-field message. See Authentication for the base format.
Acting as a subaccount over the websocket
A websocket connection acts as one account at a time. Add subaccount to your authentication to bind the connection to that subaccount. Open one connection per account if you trade several at once.
Per-connection authentication
One-off signed authentication. Add subaccount to data and append it to the signed message. The data field of the signed message is empty for auth, so there are two commas before the subaccount:
Per-message authentication. Add subaccount to the auth object and append it to the signed message:
Private channels (orders, fills, positions) then stream the subaccount's data. See Websocket authentication for the base formats.
Signing orders for a subaccount
Orders use the usual Order type (see Signing Orders), with two differences:
makeris the subaccount's address.Sign with the main account's signing key. The main wallet itself also works.
Because the subaccount's address is inside the signed order, a signature for one subaccount can't be reused for another. Send the order with the AEVO-SUBACCOUNT header, or over a websocket connection bound to the subaccount.
RFQ quotes work the same way: maker is the subaccount, signed by the main account's signing key.
Moving funds
Main account
One of its subaccounts
Yes
Any other account
A subaccount
No
Main account
Any other Aevo account, or a withdrawal
Yes
Subaccount
Its main account
Yes
Subaccount
Another subaccount of the same main account
Yes
Subaccount
Any other account
No
Subaccount
Withdrawal (any destination)
No
A transfer out of a subaccount is signed with the subaccount's own key (the Transfer type, with account set to the subaccount), not the main signing key. If you create subaccounts as described in Creating subaccounts, you can re-derive that key from your main wallet at any time.
Subaccounts can never withdraw. To withdraw, transfer to the main account and withdraw from there.
Deposit to the main account, then transfer to a subaccount. On-chain deposits made directly to a subaccount's address can't be refused and are credited to it; move them to the main account with a transfer.
Shared rules
Rate limits are shared by a main account and its subaccounts. Adding subaccounts doesn't increase your limits. See Rate Limits.
Fees come from the main account: maker/taker fees, fee tier, staking discount and custom fees.
Margin and liquidation are per account. Each subaccount has its own margin, leverage and margin mode settings.
Self-trade prevention covers the whole family. A main account and its subaccounts, or two subaccounts of the same main account, never fill against each other. By default the incoming (taker) order is cancelled; an explicit
EXPIRE_MAKERorEXPIRE_TAKERsetting is honored. This applies to RFQ / block trades too.Builders. A subaccount can approve builders and place builder orders, but it can't register a builder.
POST /builder/registeras a subaccount returnsSUBACCOUNT_BUILDER_NOT_ALLOWED.Referrals don't apply to subaccounts. They can't use, own or claim referral codes or rewards.
Restrictions on the main account apply to all of its subaccounts.
Errors
SUBACCOUNT_NOT_FOUND
The AEVO-SUBACCOUNT address isn't an active subaccount of the authenticated main account.
SUBACCOUNT_ARCHIVED
The subaccount is archived.
SUBACCOUNT_TRANSFER_OUTSIDE_FAMILY
A transfer with a subaccount on either side crossed families: a subaccount can only send to, and receive from, its main account and that account's other subaccounts.
SUBACCOUNT_WITHDRAW_NOT_ALLOWED
A subaccount tried to withdraw. Transfer to the main account first.
SUBACCOUNT_BUILDER_NOT_ALLOWED
A subaccount tried to register a builder.
SUBACCOUNT_REFERRAL_NOT_ALLOWED
A subaccount tried to use, own or claim a referral.
SUBACCOUNT_CLAIM_NOT_ALLOWED
A subaccount tried to claim a reward that is paid to the main account.
Errors about the AEVO-SUBACCOUNT header are only returned after the request is fully authenticated. For creation errors, see Creating subaccounts.
Environments
REST
https://api.aevo.xyz
https://api-testnet.aevo.xyz
Websocket
wss://ws.aevo.xyz
wss://ws-testnet.aevo.xyz
App
https://app.aevo.xyz
https://testnet.aevo.xyz
Last updated
Was this helpful?

