Portals Logo

Documentation
API Quickstart

API Quickstart

This quickstart guide demonstrates some use cases of the Portals API to help you get started. The API provides comprehensive data about the DeFi ecosystem, including token prices, liquidity, APYs, balances, and more. In addition, you can retrieve quotes for swapping any token or zapping into/out of any pool, vault, etc. on any of our supported networks. You can try the example requests below directly in your browser with our Swagger UI (API key required).

Feel free to play around with the API and explore its features.

Tokens

Get all Curve pools that contain FRAX

Use the search and filtering features of the API to find all Curve pools that contain FRAX tokens on Ethereum:

https://api.portals.fi/v2/tokens?search=frax&platforms=curve&networks=ethereum&sortBy=liquidity&sortDirection=desc

Find the most liquid Balancer pools

Use the sort feature of the API to find the most liquid Balancer pools on Polygon:

https://api.portals.fi/v2/tokens?platforms=balancerv2&networks=polygon&sortBy=liquidity&sortDirection=desc

Get all Beefy vaults

To get a less granular response that you can filter or process yourself, you can simply call the v2/tokens endpoint without a search string or filters. For example, to get all Beefy vaults on Optimism:

https://api.portals.fi/v2/tokens?platforms=beefy&networks=optimism&limit=250

Prices

Get the USD price of an Aave token

Use the IDs filter to find a specific token and get its USD price, as well as metrics like its APY and liquidity. For example, to get the price of Aave V3 wrapped staked ETH (aOptwstETH) on Optimism:

https://api.portals.fi/v2/tokens?ids=optimism:0xc45a479877e1e9dfe9fcd4056c699575a1045daa

Get the latest ETH price

All of the v2/tokens endpoints return the latest price of each token in USD, as well as other contextual data like its contract address on different networks, relevant images, and more. To get the latest price of ETH on all networks:

https://api.portals.fi/v2/tokens?search=eth&platforms=native&networks=ethereum

Balances

Get the balance of Vitalik Buterin's wallet on all networks

Use the account endpoint to query the balance of any wallet on any network. For example, to get the balance of Vitalik Buterin's wallet on all networks:

https://api.portals.fi/v2/account?owner=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&networks=ethereum&networks=optimism&networks=fantom&networks=arbitrum&networks=polygon&networks=avalanche&networks=bsc

Track the 1inch treasury Safe Multisig

The account endpoint can also be used to track the balance of a smart contract. For example, to track the balance of the 1inch treasury Safe Multisig on Ethereum:

https://api.portals.fi/v2/account?owner=0x7951c7ef839e26F63DA87a42C9a87986507f1c07&networks=ethereum

Portal

Zap into a Yearn vault with any token

The portal endpoint can be used to to zap into or out of any of our supported platforms. For example, entering a Yearn vault whose underlying token is a Curve pool token:

https://api.portals.fi/v2/portal?inputToken=ethereum:0x0000000000000000000000000000000000000000&inputAmount=10000000000000000&outputToken=ethereum:0x6e9455d109202b426169f0d8f01a3332dae160f3&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045

Swap BNB for USDC

You can also execute basic swaps - for example, to swap BNB for USDC on Binance Smart Chain (BSC):

https://api.portals.fi/v2/portal?inputToken=bsc:0x0000000000000000000000000000000000000000&inputAmount=100000000000000000&outputToken=bsc:0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045

Next steps

Dig deeper by learning more about the structure and categorization of the Portals API in the Concepts section. You can also check out the Guides section for more in-depth examples of how to use the API.