# Legend API ## Docs - [CLI Reference](https://docs.legend.xyz/agents/cli.md): Full command reference for the Legend CLI - [Using with Claude Code](https://docs.legend.xyz/agents/guides/claude-code.md): Step-by-step guide to using Legend with Claude Code - [Using with OpenAI Agents](https://docs.legend.xyz/agents/guides/openai.md): Connect Legend to OpenAI Responses API and other OpenAI-powered agents - [MCP Setup](https://docs.legend.xyz/agents/mcp/setup.md): Connect any AI agent to Legend via MCP — Claude Code, Cursor, and more - [MCP Tools](https://docs.legend.xyz/agents/mcp/tools.md): Complete reference for Legend MCP tools - [Agent Integration](https://docs.legend.xyz/agents/overview.md): The starting point for AI agents integrating Legend onchain finance. - [Create Account](https://docs.legend.xyz/api-reference/create-account.md): Create a new sub-account with a signer - [Get Account](https://docs.legend.xyz/api-reference/get-account.md): Get details for a specific sub-account - [Get Activity](https://docs.legend.xyz/api-reference/get-activity.md): Get details for a specific activity - [Get Events](https://docs.legend.xyz/api-reference/get-events.md): Poll for real-time account events - [Get Folio](https://docs.legend.xyz/api-reference/get-folio.md): Get a sub-account's portfolio (balances and positions) - [List Accounts](https://docs.legend.xyz/api-reference/list-accounts.md): List all sub-accounts under your Prime Account - [List Activities](https://docs.legend.xyz/api-reference/list-activities.md): Get the activity history for a sub-account - [List Assets](https://docs.legend.xyz/api-reference/list-assets.md): List all supported assets and their network availability - [List Networks](https://docs.legend.xyz/api-reference/list-networks.md): List all supported blockchain networks - [Plan Add Backing](https://docs.legend.xyz/api-reference/plan-add-backing.md): Create a plan to add collateral to a Morpho position - [Plan Borrow](https://docs.legend.xyz/api-reference/plan-borrow.md): Create a plan to borrow assets from a lending protocol - [Plan Claim Rewards](https://docs.legend.xyz/api-reference/plan-claim-rewards.md): Create a plan to claim protocol rewards - [Plan Earn](https://docs.legend.xyz/api-reference/plan-earn.md): Create a plan to earn yield on a DeFi protocol - [Execute Plan](https://docs.legend.xyz/api-reference/plan-execute.md): Execute a signed plan to trigger on-chain transactions - [Plan Loop Long](https://docs.legend.xyz/api-reference/plan-loop-long.md): Create a plan to open or increase a leveraged long position - [Plan Migrate](https://docs.legend.xyz/api-reference/plan-migrate.md): Create a plan to migrate a supply position between protocols - [Plan Reinvest Rewards](https://docs.legend.xyz/api-reference/plan-reinvest-rewards.md): Create a plan to claim rewards, swap them, and resupply - [Plan Repay](https://docs.legend.xyz/api-reference/plan-repay.md): Create a plan to repay a borrow and reclaim collateral - [Plan Swap](https://docs.legend.xyz/api-reference/plan-swap.md): Create a plan to swap one asset for another - [Plan Swap and Supply](https://docs.legend.xyz/api-reference/plan-swap-and-supply.md): Create a plan to swap an asset and supply the result to a protocol - [Plan Transfer](https://docs.legend.xyz/api-reference/plan-transfer.md): Create a plan to transfer assets to another address - [Plan Unloop Long](https://docs.legend.xyz/api-reference/plan-unloop-long.md): Create a plan to close or reduce a leveraged long position - [Plan Withdraw](https://docs.legend.xyz/api-reference/plan-withdraw.md): Create a plan to withdraw assets from a DeFi protocol - [Plan Withdraw Backing](https://docs.legend.xyz/api-reference/plan-withdraw-backing.md): Create a plan to remove collateral from a Morpho position - [Get Prime Account](https://docs.legend.xyz/api-reference/prime-account.md): Returns information about the authenticated Prime Account - [Stream Folio](https://docs.legend.xyz/api-reference/stream-folio.md): Stream real-time portfolio updates via Server-Sent Events - [Authentication](https://docs.legend.xyz/authentication.md): How to authenticate requests to the Legend API - [Activities & Events](https://docs.legend.xyz/concepts/activities-events.md): Tracking transactions and monitoring account changes - [Folio (Portfolio)](https://docs.legend.xyz/concepts/folio.md): Understanding account portfolios, balances, and the folio key/value structure - [Plan-Sign-Execute](https://docs.legend.xyz/concepts/plan-execute-flow.md): How Legend's non-custodial transaction flow works - [Earn Yield](https://docs.legend.xyz/guides/earn.md): Deploy assets into DeFi yield protocols - [Monitoring](https://docs.legend.xyz/guides/monitoring.md): Track transactions and monitor account state in real-time - [Using Privy Wallets](https://docs.legend.xyz/guides/privy.md): Connect Privy-managed embedded wallets to Legend for DeFi yield - [Transfer](https://docs.legend.xyz/guides/transfer.md): Transfer assets to another wallet - [Withdraw](https://docs.legend.xyz/guides/withdraw.md): Withdraw assets from DeFi positions - [Introduction](https://docs.legend.xyz/introduction.md): Programmatic access to DeFi yield, transfers, and portfolio management - [Quickstart](https://docs.legend.xyz/quickstart.md): Go from zero to earning yield in 5 minutes - [Python SDK](https://docs.legend.xyz/sdks/python.md): Install and use the Legend API Python client - [Rust SDK](https://docs.legend.xyz/sdks/rust.md): Rust client library for the Legend API - [TypeScript SDK](https://docs.legend.xyz/sdks/typescript.md): Install and use the Legend API TypeScript client ## OpenAPI Specs - [openapi](https://docs.legend.xyz/api-reference/openapi.json)