API Endpoints
Introduction to the HyperBloom API
The /swap/v1/price
endpoint in the Hyperbloom protocol is designed to provide an indicative price for a transaction. Unlike the /swap/v1/quote
endpoint, it does not return a transaction executable on an Ethereum node but rather offers pricing information that would be available for a similar call to /swap/v1/quote
. This endpoint is particularly useful for Request for Quote (RFQ) scenarios.
Request Schema
The request schema for /swap/v1/price
mirrors that of /swap/v1/quote
, with specific exceptions applicable across all supported chains:
Query Parameters
Query Param | Description |
---|---|
sellToken | The ERC20 token address of the token you wish to sell. Always use the token address instead of symbols (e.g., ETH) to ensure API recognition. |
buyToken | The ERC20 token address of the token you wish to receive. Always use the token address instead of symbols (e.g., ETH) to ensure API recognition. |
sellAmount | (Optional) The amount of sellToken (in base units) you intend to send. |
slippagePercentage | (Optional, default is 0.01) Maximum acceptable slippage for buyToken if sellAmount is provided, or for sellAmount if buyAmount is provided. Default is 1% if not specified. |
takerAddress | (Optional) Address that will fill the quote. Recommended for accurate gas estimation and transaction validation. |
excludedSources | (Optional) Specifies liquidity sources to exclude (e.g., Uniswap, SushiSwap). Cannot be combined with includedSources . |
includedSources | (Optional) Specifies liquidity sources to include. Cannot be combined with excludedSources . |
Response Schema
The response schema for /swap/v1/price
is identical to /swap/v1/quote
, except the guaranteedPrice
, to
, and data
fields are always undefined.
Response Fields
Field | Description |
---|---|
price | Provides the price of buyToken in sellToken and vice versa, excluding slippage. Includes fee if buyTokenPercentageFee and feeRecipient are set. |
estimatedPriceImpact | Estimated change in asset price due to swap execution. Returns null if estimation fails. |
value | Ether amount (in wei) to be sent with the transaction. |
gasPrice | Gas price (in wei) for transaction submission. Must be equal to or lower than this value for success. |
gas | Estimated gas limit for transaction settlement. Accurate estimate requires takerAddress . |
estimatedGas | Estimated actual gas usage, always less than gas . |
protocolFee | Maximum ether amount for protocol fee (in wei). |
minimumProtocolFee | Minimum ether amount for protocol fee (in wei). |
buyAmount | Amount of buyToken to be acquired. Excludes sources not supporting buyAmount . |
sellAmount | Amount of sellToken to be sold. Recommended for comprehensive on-chain source coverage. |
sources | Distribution of buyAmount or sellAmount across liquidity sources. |
buyTokenAddress | ERC20 token address for buyToken . |
sellTokenAddress | ERC20 token address for sellToken . |
allowanceTarget | Contract address requiring allowance for swap completion. Null address for “ETH” swaps. |
sellTokenToEthRate | Exchange rate between ETH and sellToken . |
buyTokenToEthRate | Exchange rate between ETH and buyToken . |
Example
Get Price for Selling WETH to Buy feUSD
To obtain a simple quote for exchanging 1 HYPE for feUSD, specify the sellToken
, buyToken
, and sellAmount
.
Request
Response