Hyper API
Base URL:
Deposit Contract Address:
Router Contract Address:
To execute a swap, you must follow the steps in order
Send a POST request to
/getSwapInfo
to get the details of the upcoming transaction and the exchange rate. 1. Find route & get transactionSend a POST request to
/swap
to create a swap request and get itsID
. 2. Create a swap requestBased on the
/getSwapInfo
data, execute the transaction on behalf of the user. 3. Execute the transaction on behalf of the userSend a GET request to
/getSwapById
to obtain the swap status. 4. Get swap informationIf the user has rejected the deposit transaction (e.g., in Metamask), it is important to close the swap. 5. Close an undeposited swap if the user has rejected the transaction
Information for correct processing of swap statuses. 6. Swap request statuses
⚠️ Important note: data priority for transactions
When calling the POST /swap
endpoint, two types of responses are possible:
A standard response with an
ID
— means that the request was created successfully. In this case, use the data from the previous/getSwapInfo
call to execute the transaction.The response containing the transaction data and response structure as in
/getSwapInfo
means that this data should be used to form the transaction, rather than the data previously obtained from/getSwapInfo
. An application with anID
is not created — the transaction must be executed immediately with this data. This mode is used when the exchange can be performed instantly without creating a pending request.
1. Find route & get transaction
POST /trade/getSwapInfo
/trade/getSwapInfo
Returns the optimal routing path for a tokens. Provides the full route details, expected output amount, and raw transaction data for simulation purposes.
Request Body:
{
"inputAmount": "1000000",
"slippage": 0.3,
"inputTokenAddress": "0x...",
"outputTokenAddress": "0x...",
"feeAddress": "0x...",
"feeBps": 1,
"enableHyperCore": true
}
Parameters:
inputAmount
wei
Raw input token amount in atomic units (value × 10^decimals).
Non-negative integer for precision.
yes
slippage
number
Maximum slippage tolerance.
yes
inputTokenAddress
address
Contract address of the input token.
yes
outputTokenAddress
address
Contract address of the output token.
yes
feeAddress
address
Your address for receiving commissions from swaps, including positive slippage shares (requires address approval from our side for positive slippage).
optional
feeBps
number
Your commission in basis points (100 = 1%). Max: 100.
optional
enableHyperCore
boolean
Enable cross-chain multi-hop routing between HyperEVM and HyperCore. This allows to use intermediary tokens from both networks in a single route.
optional
✅ Successful Response (200 OK):
{
"action": "evm|core",
"economy": "123.45",
"fee": "123.45",
"outputAmount": "123.45",
"routeCore": {
"path": [
"string"
],
"pathIndexes": [
0
]
},
"routeEvm": [
{
"inputTokenAddress": "string",
"outputTokenAddress": "string",
"splits": [
{
"dex": "string",
"fee": 0,
"poolAddress": "string",
"portion": 0
}
]
}
],
"slippage": "123.45",
"to": "0x...Contract address",
"transaction": "evm:0xabc123...Raw-transaction for swap execution.|core:spotSend",
"transactionValue": "1000000"
}
2. Create a swap request
POST /trade/swap
/trade/swap
Creates a swap request or returns direct transaction data for immediate execution.
Request Body:
{
"userAddress": "0x...",
"recipientAddress": "0x...",
"inputAmount": "1000000",
"slippage": 0.3,
"inputTokenAddress": "0x...",
"outputTokenAddress": "0x...",
"feeAddress": "0x...",
"feeBps": 1,
"enableHyperCore": true
}
Parameters:
userAddress
address
User's wallet address for the swap.
yes
recipientAddress
address
Address for sending output tokens post-swap. Defaults to userAddress; optionally use a different one.
optional
inputAmount
wei
Raw input token amount in atomic units (value × 10^decimals).
Non-negative integer for precision.
yes
slippage
number
Maximum slippage tolerance.
yes
inputTokenAddress
address
Contract address of the input token.
yes
outputTokenAddress
address
Contract address of the output token.
yes
feeAddress
address
Your address for receiving commissions from swaps, including positive slippage shares (requires address approval from our side for positive slippage).
optional
feeBps
bps
Your commission in basis points (100 = 1%). Max: 100.
optional
enableHyperCore
boolean
Enable cross-chain multi-hop routing between HyperEVM and HyperCore. This allows to use intermediary tokens from both networks in a single route.
optional
✅ Successful Response (200 OK):
⚠️ Don't forget important note: data priority for transactions
{
"amount_in": 0,
"amount_out": 0,
"created_at": "string",
"deposit_core_tx_hash": "string",
"deposit_evm_tx_hash": "string",
"fee_gas": 0,
"fee_our": 0,
"id": "string",
"integration_fee_address": "string",
"integration_fee_bps": 0,
"recipient": "string",
"retries_count": 0,
"route": "string",
"slippage": 0,
"status": 0,
"status_extra": 0,
"token_in": "string",
"token_out": "string",
"updated_at": "string",
"usd_amount": 0,
"wallet": "string"
}
3. Execute the transaction on behalf of the user
4. Get swap information
GET /trade/getSwapById
/trade/getSwapById
Retrieves the current status of a created swap request by its ID and User Wallet.
Request:
/trade/getSwapById?id={id}&wallet={wallet}
Parameters:
id
string
Swap ID returns in /swap
request.
yes
wallet
address
The wallet address of the user who initiated the swap.
yes
✅ Successful Response (200 OK):
{
"amount_in": 0,
"amount_out": 0,
"created_at": "string",
"deposit_core_tx_hash": "string",
"deposit_evm_tx_hash": "string",
"fee_gas": 0,
"fee_our": 0,
"id": "string",
"integration_fee_address": "string",
"integration_fee_bps": 0,
"recipient": "string",
"retries_count": 0,
"route": "string",
"slippage": 0,
"status": 0,
"status_extra": 0,
"token_in": "string",
"token_out": "string",
"updated_at": "string",
"usd_amount": 0,
"wallet": "string"
}
5. Close an undeposited swap if the user has rejected the transaction
GET /trade/closeSwapById
/trade/closeSwapById
Close the current created undeposited swap request by its ID and User Wallet.
Request:
/trade/closeSwapById?id={id}&wallet={wallet}
Parameters:
id
string
Swap ID returns in /swap
request.
yes
wallet
address
The wallet address of the user who initiated the swap.
yes
✅ Successful Response (200 OK):
{
"amount_in": 0,
"amount_out": 0,
"created_at": "string",
"deposit_core_tx_hash": "string",
"deposit_evm_tx_hash": "string",
"fee_gas": 0,
"fee_our": 0,
"id": "string",
"integration_fee_address": "string",
"integration_fee_bps": 0,
"recipient": "string",
"retries_count": 0,
"route": "string",
"slippage": 0,
"status": 0,
"status_extra": 0,
"token_in": "string",
"token_out": "string",
"updated_at": "string",
"usd_amount": 0,
"wallet": "string"
}
6. Swap request statuses
0
Pending deposit (recently created), 5 minutes given to deposit.
1
Deposit confirmed.
2
Swap order in progress to cancel.
2
1
Swap order in progress to cancel in core.
2
2
Swap order in progress to cancel in core(2).
2
3
Swap order in progress to cancel in evm.
3
Swap order is cancelled.
3
1
Swap order cancelled because 5 minutes passed, the deposit has not been found or confirmed.
3
2
Swap order cancelled in core.
3
3
Swap order cancelled in core(2).
3
4
Swap order cancelled in evm.
3
5
Swap order cancelled by user.
4
Swap order in progress to complete.
5
Swap order is completed.
999
Undefined error.
Last updated