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 exchange rate. 1. Find routeSend a POST request to
/swap
to get the details of the upcoming transaction, 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
1. Find route
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"
}
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):
⚠️ Important note: Understanding the /swap response structure
The response from POST /swap
always includes a transaction
field containing the unsigned transaction data needed to execute the swap on-chain.
Additionally, it may include a swap
field, which represents a created swap request with metadata (e.g. ID, status, timestamps).
If the response contains both
transaction
andswap
: A pending swap request has been created. Use thetransaction
data to submit the transaction, and track the request status using theswap
object via/getSwapById
.If the response contains only
transaction
(withoutswap
): The swap is executed immediately — no persistent request is created. Use thetransaction
data right away and consider the operation complete after on-chain confirmation.
👉 In all cases, the transaction
field holds the correct data to send to the blockchain. The presence of the swap
field determines whether the operation is tracked or instant.
{
"swap": {
"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"
},
"transaction": {
"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"
}
}
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