V3 endpoints
Our Swaps API utilizes 0x to execute swaps on EVM chains.
Overview
The Swaps API can be accessed at https://api.portalhq.io/
.
Authentication
There are two forms of required authentication in order to use the Swaps API
Client Authentication - a Client Session Token or Client API Key provided as a
Bearer
token in theAuthentication
header0x Authentication - a 0x API Key provided as
apiKey
property of the JSON request body
Supported Chains
Mainnet (
eip155:1
)Optimism (
eip155:10
)Binance Smart Chain (
eip155:56
)Polygon (
eip155:137
)Fantom (
eip155:250
)Base (
eip155:8453
)Arbitrum (
eip155:42161
)Celo (
eip155:42220
)Avalanche (
eip155:43114
)Sepolia (
eip155:11155111
)
Get a list of available liquidity sources
POST
/v3/swaps/sources
Returns a list of the available liquidity sources for a particular chain.
Headers
Content-Type
application/json
Authorization
Bearer <CLIENT_AUTHENTICATION_TOKEN>
Body
address
string
The client's ETH wallet address
apiKey
string
Your 0x API Key
chainId
string
(e.g. "eip155:1
" = Mainnet)
Response
The response of this request is a JSON object containing key/value pairs.
The key
is the Token Symbol and the value
is an acceptable value as the token
property provided to the /quote
route (either a Token Symbol or Token Address).
Example request
Get a quote for buying/selling tokens
POST
/v3/swaps/quote
Get an easy-to-consume quote for buying or selling a token.
Headers
Content-Type
application/json
Authorization
Bearer <CLIENT_AUTHENTICATION_TOKEN>
Body
address
string
The client's ETH wallet address.
apiKey
string (optional)
Your 0x API key.
chainId
string
(e.g. "eip155:1" = Mainnet)
buyToken
string
The token you'd like to buy.
buyAmount
number (optional)
The amount of buyToken
you'd like to buy in WEI. Exactly one of either buyAmount
or sellAmount
must be provided.
sellToken
string
The token you'd like to sell.
sellAmount
number (optional)
The amount of sellToken
you'd like to sell in WEI. Exactly one of either buyAmount
or sellAmount
must be provided.
Response
Example request
Last updated