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 ParamDescription
sellTokenThe 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.
buyTokenThe 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

FieldDescription
priceProvides the price of buyToken in sellToken and vice versa, excluding slippage. Includes fee if buyTokenPercentageFee and feeRecipient are set.
estimatedPriceImpactEstimated change in asset price due to swap execution. Returns null if estimation fails.
valueEther amount (in wei) to be sent with the transaction.
gasPriceGas price (in wei) for transaction submission. Must be equal to or lower than this value for success.
gasEstimated gas limit for transaction settlement. Accurate estimate requires takerAddress.
estimatedGasEstimated actual gas usage, always less than gas.
protocolFeeMaximum ether amount for protocol fee (in wei).
minimumProtocolFeeMinimum ether amount for protocol fee (in wei).
buyAmountAmount of buyToken to be acquired. Excludes sources not supporting buyAmount.
sellAmountAmount of sellToken to be sold. Recommended for comprehensive on-chain source coverage.
sourcesDistribution of buyAmount or sellAmount across liquidity sources.
buyTokenAddressERC20 token address for buyToken.
sellTokenAddressERC20 token address for sellToken.
allowanceTargetContract address requiring allowance for swap completion. Null address for “ETH” swaps.
sellTokenToEthRateExchange rate between ETH and sellToken.
buyTokenToEthRateExchange 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

curl https://api.hyperbloom.xyz/swap/v1/price?sellToken=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&buyToken=0x02c6a2fa58cc01a18b8d9e00ea48d65e4df26c70&sellAmount=1000000000000000000   --header 'api-key: <API_KEY>'

Response

{
    "chainId": 999,
    "price": "36.749874001264005",
    "estimatedPriceImpact": "0",
    "value": "600000000000000000",
    "gasPrice": "47500000",
    "gas": "389135",
    "estimatedGas": "389135",
    "protocolFee": "0",
    "minimumProtocolFee": "0",
    "buyTokenAddress": "0x02c6a2fa58cc01a18b8d9e00ea48d65e4df26c70",
    "buyAmount": "22049924400758403000",
    "sellTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "sellAmount": "600000000000000000",
    "sources": [],
    "orders": [],
    "allowanceTarget": "0x0000000000000000000000000000000000000000",
    "sellTokenToEthRate": "1",
    "buyTokenToEthRate": "35.297931189190104285",
    "expectedSlippage": null
}