Agent API
Rebalance plans your agent can execute.
A single read-only endpoint returns the exact legs needed to move a wallet to a target allocation: raw token amounts, direction, estimated USD and a ready quote URL. No keys. The agent's own wallet signs.
Endpoint
GET /api/agent/plan?wallet=<pubkey>&preset=<id>&deposit=<usdc>
| Param | Description |
|---|---|
| wallet | Solana address to read (required) |
| preset | One of ai-titans, index-core, onchain-dollar, equal-weight |
| weights | Alternative to preset, e.g. NVDAx:50,GOOGLx:50 (must total 100) |
| deposit | USDC from the wallet to deploy (optional, default 0) |
Assets: NVDAx, GOOGLx, AAPLx, TSLAx, SPYx, MSTRx, CRCLx
Execute endpoint
Returns the full plan as unsigned, ready-to-sign transactions in execution order. Every leg is checked by the liquidity guard: legs with 2% or more price impact come back with transaction: null and a reason. The agent signs with its own wallet, submits, then polls the status URL.
POST /api/agent/execute
{
"wallet": "<pubkey>",
"preset": "ai-titans", // or "weights": {"NVDAx":50,"GOOGLx":50}
"deposit": 100, // USDC, optional
"slippageBps": 50 // optional, 1-500
}{
"ready": true,
"blockedLegs": 0,
"legs": [
{ "index": 0, "side": "buy", "symbol": "NVDAx",
"priceImpactPct": 0.04, "guard": "ok",
"transaction": "<base64 unsigned tx>" }
],
"statusUrl": "/api/status?sig=<signature>"
}