Skip to main content

What You’ll Do

In this guide, you’ll make your first API call to explore yield opportunities across DeFi protocols. Get your free API key, install the SDK, and fetch vault data with APY and performance metrics.
1

Get your free Compass API key

Get your free API key and get instant access to every endpoint.
2

Install the Compass SDK

Check the API reference for all available endpoints. Use familiar TypeScript / Python wrappers, or hit pure REST.
pip install compass_api_sdk
npm install @compass-labs/api-sdk
3

Explore yield opportunities

Get the lifetime return for 3 Morpho vaults on Ethereum. No wallet setup needed.
from compass_api_sdk import CompassAPI, models

with CompassAPI(api_key_auth="<YOUR_API_KEY_HERE>") as compass_api:
    result = compass_api.earn.earn_vaults(
        chain=models.V2EarnVaultsChain.ETHEREUM,
        order_by="lifetime_return",
        direction=models.Direction.DESC,
        limit=50
    )

    morpho_vaults = [v for v in result.vaults if v.protocol == "Morpho"][:3]
    for vault in morpho_vaults:
        lifetime_return = float(vault.lifetime_return or 0) * 100
        print(f"{vault.name}: {lifetime_return:.2f}% lifetime return")
Example output:
Vault NameProtocolLifetime Return
Gauntlet USDC CoreMorpho12.96%
Smokehouse USDCMorpho8.29%
IMF USDSMorpho7.64%

Next Steps

Now that you’ve seen an example of vaults and information available, learn how to:

Create Product Accounts

Set up isolated accounts for Earn, Borrow, and Trade products. Enable bundling without approvals.

Variable Earn

Start earning yield by depositing into DeFi vaults and managing positions across protocols.

Add Embedded Fees

Monetize your integration by embedding fees directly in transactions to generate revenue.

Ready to test it yourself?

Get your free API key here and start building!
Need help? Ping us in on Discord or email contact@compasslabs.ai.