amount of the strategy’s input asset. The returned transaction is base64-encoded:
- Unsigned for
sol-liquid-stake,sol-leveraged-stake, andusdc-earn. - Partially signed for
sol-native-stake(the stake-account slot is pre-signed by the server; you only sign the wallet slot).
POST /api/v1/broadcast.
Request
Referral attribution
Pass areferral_code on a stake call and the staking wallet is credited to the code’s owner. This is Hubra’s native referral model — the same relationship the web app records — so a wallet’s referred_by is set to the code owner’s wallet.
If you’re a Hubra partner (protocol, dev, or creator), your referral code from partner.hubra.app resolves to your payout wallet, so wallets that stake with your code show up on your partner dashboard. But any referrer’s code works — a partner is just a referrer.
Send the code either as a body field or a header:
Attribution is first-write-wins per wallet: the first referrer to bring a wallet in keeps the credit, and a wallet is never credited to itself. Passing a code is optional — omit it and the stake behaves exactly as before. A code is matched case-insensitively (
^[A-Z0-9]{4,12}$); if you pass one that is malformed or does not resolve, the call returns 400 invalid_request or 404 not_found so you notice rather than silently losing attribution.Response — sol-native-stake
The server generates a fresh stake-account keypair and pre-signs that signature slot. The agent only signs as the wallet. Save the returned stakeAccount pubkey — you need it for future deactivate / withdraw / instant-unstake calls against this position.
route: "rpc" (no Sanctum involvement on the create + delegate path).
Response — sol-liquid-stake (Sanctum-routed)
route: "sanctum", the response also carries sanctumKind and sanctum_order. All three (hubra_token, sanctumKind, sanctum_order) must be passed back to /broadcast if you want Sanctum’s MEV-protected broadcaster. Sanctum’s execute endpoint validates the signed transaction against the original order and rejects mismatches.
Plain RPC (route: "rpc" at broadcast) works without the Sanctum-specific fields, but loses Sanctum’s broadcaster guarantees.
Response — usdc-earn (Voltr-routed)
sanctum_order. Broadcast via route: "rpc" — that is the only supported broadcast path for Voltr transactions.
Response — sol-leveraged-stake (raSOL Max)
amount is SOL. The server builds a single transaction that does the whole conversion: create the raSOL ATA (idempotent) → SPL stake-pool DepositSol (SOL → raSOL) → Voltr depositVault (raSOL → raSOL Max LP). One signature, atomic.
route: "rpc" — no Sanctum or Voltr execute leg. After it confirms, read your raSOL Max LP balance on-chain; you pass that figure to POST /api/v1/unstake to burn the position later.
The API deposits SOL only — the SOL → raSOL leg is built in for you. There is no “deposit raSOL directly” variant on the agent surface. The Voltr leg is sized from the exact raSOL the stake-pool mint produces (the same floor-rounded
lamports × supply / total_lamports the pool applies on-chain), so the staged raSOL always matches what the deposit instruction expects.The hubra_token
Every /stake (and /unstake) response includes a hubra_token HMAC’d over the message bytes of the unsigned transaction. POST /api/v1/broadcast requires this token and rejects any transaction that was not built by Hubra. Save it alongside the transaction and pass it back when broadcasting.
Tokens expire ~2 minutes after issue (matching Solana’s blockhash window). If your token expires, rebuild via /stake.
For the full mechanics, see Hubra token.
Examples
Errors
See also
POST /unstake
Reverse the position.
POST /broadcast
Submit the signed transaction.
Hubra token
The HMAC gate.
Strategies
All strategy keys.