- With a referral code: call
POST /v1/referral/activate-tx. This path requires auth and the user-controlled trader authority signature. - Without a referral code: call
POST /v1/exchange/build-register-ixs, build and sign the transaction locally, then submit it toPOST /v1/exchange/send-register-ixs. This path does not validate the trader authority signature and can register off-curve authorities such as PDAs.
traderAuthority is only the pubkey used to derive the trader account; it is not required to be a signer. The transaction sent to send-register-ixs must be signed by the fee payer and any other signer accounts you add. In the no-referral builder flow, pda_index and subaccount_index must be 0; max_positions is optional and defaults to 128.
Trader onboarding registers the default cross-margin account at
traderPdaIndex = 0 and traderSubaccountIndex = 0. Its max_positions value must be between 32 and 128 inclusive. Omit the field to use the default 128.With a referral code
Use/v1/referral/activate-tx when the user has a valid referral code. The TypeScript SDK builds the transaction, checks whether the default trader account needs to be registered, and submits the signed transaction request to the API.
If your app pays for onboarding, pass feePayer and sign the transaction with both the payer and the trader authority. If the trader pays, omit feePayer.
Without a referral code
Use this path when a builder wants to register and onboard a trader without a referral code. The flow is:- Call
POST /v1/exchange/build-register-ixswith the trader authority pubkey and the wallet that will pay transaction fees and account rent. - Build a Solana transaction locally with those returned instructions, your current blockhash, and your chosen fee payer.
- Sign the transaction with the fee payer and any other signer accounts you add.
- Send the base64-encoded wire transaction to
POST /v1/exchange/send-register-ixs. - The API validates the transaction, signs with the Phoenix onboarder, simulates it, verifies the onboarder pays no lamports, sends it to Phoenix’s RPC, and returns the transaction signature.
traderAuthority can sign. You may pass an on-curve wallet address or an off-curve PDA as the trader authority.
The fee payer must not be the Phoenix onboarder key. Your app should await confirmation for the returned signature.
After onboarding
Both paths activate the trader’s default cross-margin account attraderPdaIndex = 0 and traderSubaccountIndex = 0. The cross account’s max_positions value is set during registration and must be between 32 and 128 inclusive.
Next steps:
- Learn account indexes, isolated accounts, position authority, and trader-state subscriptions in Accounts.
- Fund the account in Collateral.
- Send orders in Orders and monitor account health in Margin.