Hyperswap AI will offer a powerful API for developers to integrate seamlessly, AI-powered crypto swaps into their applications.
https://api.hyperswap.ai
Authorization
header of your requests as a Bearer token:
Authorization: Bearer YOUR_API_KEY
chainId
)/api/v1/assets
endpoint. Each StandardizedAsset
object in the response includes a chainId
field.1
(Ethereum), 56
(BNB Chain), 137
(Polygon), 42161
(Arbitrum One), 10
(Optimism), 8453
(Base), 43114
(Avalanche), 25
(Cronos), 324
(ZkSync Era), 59144
(Linea).'1151111081099710'
(Solana), '20000000000001'
(Bitcoin), '9270000000000000'
(Sui), 'TRON'
(Tron), 'TON'
(TON), 'APTOS'
(Aptos), 'ALGORAND'
(Algorand), 'BITTENSOR'
(Bittensor), 'CARDANO'
(Cardano), 'CELESTIA'
(Celestia), 'COSMOS'
(Cosmos), 'DASH'
(Dash), 'DOGE'
(Dogecoin), 'HEDERA'
(Hedera), 'ICP'
(Internet Computer), 'LITECOIN'
(Litecoin), 'MANTLE'
(Mantle), 'POLKADOT'
(Polkadot), 'RIPPLE'
(Ripple), 'RONIN'
(Ronin), 'STACKS'
(Stacks), 'STELLAR'
(Stellar), 'XEC'
(eCash), 'BCH'
(Bitcoin Cash), 'LIQUID'
(Liquid), 'HYPEREVM'
(Hyperevm), 'SONIC'
(Sonic), 'BLAST'
(Blast), 'SCROLL'
(Scroll), 'FETCH'
(Fetch).chainName
and chainLogoUrl
fields in the asset response can help identify the human-readable name and logo for each chain. For the most current list of supported chains, always query the /api/v1/assets
endpoint.fromToken
, toToken
)/api/v1/assets
endpoint. Each StandardizedAsset
object includes an address
field, which represents the token’s contract address on its respective chainId
.0x0000000000000000000000000000000000000000
'bitcoin'
'11111111111111111111111111111111'
'0x2::sui::SUI'
symbol
and name
fields in the asset response provide human-readable identifiers for the tokens.preference
)'fastest'
: Prioritizes quotes with the quickest estimated completion time.'lowest_cost'
: Prioritizes quotes with the lowest estimated fees.status
)PENDING
: The transaction has been initiated but is awaiting further action (e.g., user deposit for hyperswapshift, user signature for hyperswap).IN_PROGRESS
: The swap is actively being processed by the liquidity provider.COMPLETED
: The swap has successfully finished, and funds have been settled.FAILED
: The swap encountered an unrecoverable error.REFUNDED
: The swap failed, and funds have been returned to the refund address.GET /api/v1/assets
chainId
(optional, string | number
): Filters the returned assets to a specific blockchain.Response (JSON Array of StandardizedAsset objects):
source
(string
): The data source (‘hyperswap’).name
(string
): Full name of the asset.symbol
(string
): Symbol of the asset.chainId
(string | number
): The ID of the blockchain the asset belongs to.address
(string
): The contract address of the asset. For native tokens, specific normalized addresses are used (see “Token Addresses” section above).decimals
(number
): The number of decimal places for the asset.logoUrl
(string
): URL to the asset’s logo.chainLogoUrl
(string
): URL to the logo of the chain the asset belongs to.chainName
(string
): Name of the chain the asset belongs to.priceUsd
(number
, optional): The price of the asset in USD.swappable
(boolean
): Indicates if the asset is swappable (always true
).providerId
(object
): An object containing provider-specific IDs for the asset.
hyperswap
(string
, optional): hyperswap identifier.hyperswapshift
(string
, optional): hyperswapshift identifier.priorityOrder
(number
, optional): A numerical order indicating the asset’s priority (e.g., native tokens, stablecoins).isPriorityToken
(boolean
, optional): Indicates if the asset is a priority token.500 Internal Server Error
: { "message": "Failed to fetch assets", "error": "An unknown error occurred" }
chainId
parameter can accept various formats, which are normalized internally.POST /api/v1/quote
quoteId
is returned for use in the /api/v1/swap
endpoint.
fromChain
(number
): The ID of the source blockchain. (See “Chain IDs” section for available values).toChain
(number
): The ID of the destination blockchain. (See “Chain IDs” section for available values).fromToken
(string
): The contract address of the source token. For native tokens, use the normalized address. (See “Token Addresses” section for available values).toToken
(string
): The contract address of the destination token. (See “Token Addresses” section for available values).fromAmount
(string
): The amount of the source token to swap, always in wei (the smallest unit of the token, e.g., for ETH, 1 ETH = 10^18 wei).fromAddress
(string
): The user’s wallet address on the source chain.toAddress
(string
, optional): The user’s wallet address on the destination chain. If not provided, the fromAddress
might be used as a fallback by some providers, but it’s best to explicitly provide it if known.fromDecimals
(number
): The number of decimals for the fromToken
.toDecimals
(number
): The number of decimals for the toToken
.preference
('fastest' | 'lowest_cost'
): The user’s preference for quote selection. (See “Preference” section for available values).quotes
(Array<object>
): An array of preview quotes, typically returning the top 2 based on the preference
.
quoteId
(string
): A unique identifier for the quote, to be used in the /api/v1/swap
endpoint.provider
(string
): The name of the liquidity provider (‘hyperswap’).toAmount
(string
): The estimated amount of destination token received (in wei).estimatedTime
(number
): Estimated time in seconds for the swap to complete.fees
(Array<object>
, optional): Details about any fees associated with the swap.type
(string
, optional): Specific type of swap (e.g., ‘standard’ for hyperswapshift).chainId
(string | number
): The chain ID for the quote.isPreview
(boolean
): Always true
for these preview quotes.bestQuote
(object
): The best quote from the quotes
array based on the preference
.providerErrors
(object
, optional): An object containing errors from individual liquidity providers if any failed to return quotes.isPreview
(boolean
): Always true
.message
(string
): A descriptive message indicating that these are preview quotes.400 Bad Request
:
{ "message": "fromChain, toChain, fromToken, toToken, fromAmount, fromAddress, and preference are required" }
{ "message": "preference must be either \"fastest\" or \"lowest_cost\"" }
{ "message": "Invalid fromToken or toToken", "details": { "fromTokenValid": false, "toTokenValid": true } }
{ "message": "No routes available for this token pair", "error": "ROUTE_NOT_SUPPORTED" }
503 Service Unavailable
: { "message": "Service temporarily unavailable" }
(e.g., if TokenService initialization fails).500 Internal Server Error
: { "message": "Failed to generate quotes. Please try again.", "error": "An unknown error occurred" }
fromAmount
must be provided in the smallest unit (wei) of the fromToken
.POST /api/v1/swap
provider
('hyperswap'
): The liquidity provider to use. (See “Provider” section for available values).settleAddress
(string
): The address where the swapped tokens should be sent.refundAddress
(string
, optional): The address for refunds in case of issues. This is crucial for hyperswapshift swaps.clientId
(string
): A unique identifier for your client application.preference
('fastest' | 'lowest_cost'
, optional): The preference used for the original quote.settleMemo
(string
, optional): Memo or tag for the settle address (e.g., for exchanges that require it).refundMemo
(string
, optional): Memo or tag for the refund address.For provider: 'hyperswap' (additional fields):
For provider: 'hyperswapshift' (additional fields):
quoteId
(string
): The quoteId
obtained from the /api/v1/quote
endpoint.For hyperswap Swaps (provider: 'hyperswap'):
transactionRequest
(object
): Details for the transaction that needs to be signed by the user’s wallet.
type
(string
): Indicates the chain type (‘evm’, ‘solana’, or ‘bitcoin’).to
, data
, value
, from
, gasPrice
, gasLimit
, chainId
.data
.to
, data
, value
.chainId
(string | number
): The chain ID where the transaction needs to be signed.requiresSigning
(boolean
): Always true
for hyperswap, indicating the user must sign the transaction.For hyperswapshift Swaps (provider: 'hyperswapshift'):
shiftId
(string
): hyperswapshift’s unique ID for the shift.depositAddress
(string
): The address where the user needs to deposit the fromToken
.depositMemo
(string
, optional): Memo for the deposit address, if required by the destination.expiresAt
(string
): ISO timestamp when the deposit address expires.type
(string
): Typically ‘hyperswapshift-deposit’.requiresSigning
(boolean
): Always false
for hyperswapshift, as it involves a deposit rather than a direct signature.400 Bad Request
:
{ "message": "provider, settleAddress, and clientId are required" }
{ "message": "Missing required fields for hyperswap swap" }
{ "message": "quoteId is required for hyperswapshift swaps" }
{ "message": "Quote not found or expired. Please generate a new quote." }
{ "message": "The generated hyperswap quote is not valid for execution" }
{ "message": "The cached hyperswapshift quote is no longer valid for execution" }
{ "message": "Unsupported provider" }
500 Internal Server Error
: { "message": "Failed to execute swap", "error": "An unknown error occurred" }
refundAddress
might be overridden by environment variables for specific chain types (e.g., Solana, Bitcoin, EVM) to ensure proper handling.Transaction
record is created in the internal database to track the swap’s lifecycle.GET /api/v1/status/{transactionId}
transactionId
. This endpoint polls the respective liquidity provider for the latest status and updates the internal database.
transactionId
(string
): The unique ID of the transaction, generated by the /api/v1/swap
endpoint.Transaction
object from the internal database.