Portals Logo

Documentation
Introduction

Introduction

Portals is a yield and protocol aggregator for gas-free swaps, zaps, and real-time data.

Taking advantage of the lego-like composability of DeFi, Portals allows anyone to bundle multiple DeFi actions into a single transaction with ease. For example, you can add liquidity to Curve Pools with Balancer pool tokens, top up your ETH collateralization ratio on Aave using a Beefy vault token, or simply swap UNI tokens for DAI - all from one unified endpoint.

In addition, Portals V2 (Milky Way) now supports Permit (EIP-2612), Intents (via EIP-712), and Smart Contract Signatures (EIP-1271) allowing you to execute trades gas-free without the use of ETH, Matic, BNB, or other Native Tokens with any wallet.

API

To enable builders to create experiences around the Portals ecosystem, there is a robust API available which provides contextual information about all of our supported opportunities, including asset prices, liquidity data, account balances, APYs, token images, contract addresses, and more.

API Authentication

The Portals API uses API keys to authenticate requests. You can view and manage your API keys on your Dashboard.

API keys must be kept secure as they can be used to make requests to the Portals API on your behalf. It is imperative that you do not publish your API key on Github or leave it accessible in client-side code.

If you believe your API key has been compromised, you can delete it and create a new one from your dashboard.

When submitting a request, provide your API key as an Authorization header as shown:

curl --location --request GET 'https://api.portals.fi/v2/tokens?search=eth&platforms=native&networks=ethereum' --header 'Authorization: [YOUR_API_KEY]'

Quickstart

To jump right in and start using the Portals API in your project, check out our Quickstart guide.

Concepts

Learn about the structure and categorization of the Portals API:

  • Native Tokens and Basic Tokens are the most underlying asset of any opportunity on our platform
  • LP Tokens are composed of Basic, Native, or other LP tokens
  • Platforms are the highest organizational component of the Portals API
  • Accounts track the balances of both EOA and smart contract wallets
  • Portals enable gas-free transaction bundling and any-to-any swaps

Guides

Dive deeper into the features, endpoints, and use cases of the API with these guides, starting with:

More

Additional resources that may be helpful for working with and integrating the Portals API:

  • API Reference for a complete list of all endpoints and their request and response objects
  • Swagger UI to try API requests in your browser
  • Boilerplate repo for quickly building dapps on top of the Portals API

Tools

The Portals REST API conforms to the OpenAPI 3.0 standard. The API functions are fully keyed on the URL and they use query parameters as their arguments. You can find our OpenAPI schema at https://api.portals.fi/docs-json.

  • openapi-fetch a Typescript interface generator that uses the OpenAPI schema (above) to generate ready-to-use request and response objects in TS. This includes a built in fetch client supporting fully typed request and response objects
  • Axios a popular HTTP client
  • Ethers.js a Web3 library used for signing and sending transactions

Integrations