Skip to main content
GET
/
getAction
Get Action
curl --request GET \
  --url https://api-v2.swaps.xyz/api/getAction \
  --header 'x-api-key: <api-key>'
{
"tx": {
"to": "<string>",
"data": "<string>",
"value": "<string>",
"chainId": 123
},
"txId": "<string>",
"vmId": "evm",
"amountIn": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"amountInMax": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"amountOut": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"amountOutMin": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"protocolFee": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"applicationFee": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"exchangeRate": 123,
"estimatedTxTime": 123,
"estimatedPriceImpact": 123,
"requiresTokenApproval": true,
"requiresRegisterTransaction": true,
"allRoutes": [
{
"tx": {
"to": "<string>",
"data": "<string>",
"value": "<string>",
"chainId": 123
},
"txId": "<string>",
"vmId": "evm",
"amountIn": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"amountInMax": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"amountOut": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"amountOutMin": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"protocolFee": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"applicationFee": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"exchangeRate": 123,
"estimatedTxTime": 123,
"estimatedPriceImpact": 123,
"requiresRegisterTransaction": true,
"bridgeFee": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"bridgeIds": [
"optimism"
],
"bridgeRoute": [
{
"srcChainId": 123,
"dstChainId": 123,
"srcBridgeToken": "<string>",
"dstBridgeToken": "<string>",
"bridgeId": "optimism"
}
]
}
],
"bridgeFee": {
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"isNative": true,
"amount": "<string>",
"logo": "<string>",
"swapsXyzCode": "<string>",
"usdAmount": 123
},
"bridgeIds": [
"optimism"
],
"bridgeRoute": [
{
"srcChainId": 123,
"dstChainId": 123,
"srcBridgeToken": "<string>",
"dstBridgeToken": "<string>",
"bridgeId": "optimism"
}
]
}

Authorizations

x-api-key
string
header
required

Limited demo key for API Reference: 5c951bc81da566bbd030ba8e20724063.

Query Parameters

actionType
enum<string>
required

Type of action to perform Type of action to perform.

Available options:
swap-action,
evm-calldata-tx,
polymarket
sender
string
required

The address of the sender/user Address type - can be EvmAddress, HyperCoreAddress, SolanaAddress, or AltVmAddress.

srcChainId
integer
required

Source chain ID Chain ID. Find in the list of supported networks.

srcToken
string
required

Source token address Address type - can be EvmAddress, HyperCoreAddress, SolanaAddress, or AltVmAddress.

dstChainId
integer
required

Destination chain ID Chain ID. Find in the list of supported networks.

dstToken
string
required

Destination token address Address type - can be EvmAddress, HyperCoreAddress, SolanaAddress, or AltVmAddress.

slippage
number<float>
required

Slippage tolerance in bps

Required range: 0 <= x <= 10000
amount
string

The exact in or exact out amount of the swap

Required: for swap-action

Required: for polymarket action type

swapDirection
enum<string>

Swap direction for the action

Required: for swap-action

Required: for polymarket action type (use exact-amount-in) Swap direction for the action.

Available options:
exact-amount-in,
exact-amount-out
recipient
string

Address to receive the swapped tokens

Optional: for swap-action

Required: for polymarket action type (should be the proxy wallet address) Address type - can be EvmAddress, HyperCoreAddress, SolanaAddress, or AltVmAddress.

to
string

The EVM address of the target contract (20 bytes hex)

Required: for evm-calldata-tx action type Address type - can be EvmAddress, HyperCoreAddress, SolanaAddress, or AltVmAddress.

data
string

Calldata for the transaction

Required: for evm-calldata-tx action type Hex string with 0x prefix

value
string

Value to send with transaction

Optional: for evm-calldata-tx action type

erc20Amount
string

The amount of Erc20 being transferred

Optional: for evm-calldata-tx action type (use for calls requiring Erc20 transfers)

erc20Spender
string

The Erc20 spender requiring approval for the transaction call

Optional: for evm-calldata-tx action type (will default to the to address) Address type - can be EvmAddress, HyperCoreAddress, SolanaAddress, or AltVmAddress.

bridgeIds
enum<string>[]

Specific bridge protocols to use

Optional: Will default to all available protocols

Bridge protocol identifier.

Available options:
optimism,
arbitrum,
oft,
yield-oft,
hyperlane,
ghost,
mayan,
across,
relay,
alt-vm-1,
alt-vm-2
refundTo
string

Alternate address to receive refunds

Optional: Will default to the sender Address type - can be EvmAddress, HyperCoreAddress, SolanaAddress, or AltVmAddress.

returnDepositAddress
boolean
default:false

Return a deposit address for deposit-based flows

Optional: Set to true to receive a deposit address in the response

appFees
string

Application fees configuration as JSON array

Optional: Will default to fees configured for the application

Example: [{ "bps": 50, "receiverAddress": "0x..." }]

userId
string

Polymarket user ID - returned from POST /create

Required: for polymarket action type

side
enum<string>

Order side for Polymarket orders

Required: for polymarket action type

Available options:
BUY,
SELL
tokenID
string

Polymarket CLOB token ID

Required: for polymarket action type

orderType
enum<string>

Polymarket order type

Required: for polymarket action type

  • FOK: Fill or Kill (market order)
  • FAK: Fill and Kill (market order)
Available options:
FOK,
FAK
feeRateBps
number

Fee rate in basis points (non-negative)

Required: for polymarket action type

Required range: x >= 0
tickSize
enum<string>

Price tick size for Polymarket orders

Required: for polymarket action type

Available options:
0.01,
0.001,
0.0001
negRisk
enum<string>

Negative risk flag for Polymarket

Required: for polymarket action type

Available options:
true,
false

Response

Successful response with action data

tx
EVM Transaction · object
required

Transaction data for execution

txId
string
required

Transaction ID

vmId
enum<string>
required

Virtual machine identifier.

Available options:
evm,
solana,
alt-vm,
hypercore
amountIn
object
required

Expected amount to input (exclusive of slippage - recommended value to display in frontend)

amountInMax
object
required

Maximum amount to input (inclusive of slippage)

amountOut
object
required

Expected amount delivered to users (exclusive of slippage - recommended value to display in frontend)

amountOutMin
object
required

Minimum amount delivered to users (inclusive of slippage)

protocolFee
object
required

Swaps.xyz fee

applicationFee
object
required

Application fee (your fee!)

exchangeRate
number<float>
required

Exchange rate for the swap.

estimatedTxTime
number<float>
required

Estimated transaction time in seconds.

estimatedPriceImpact
number<float>
required

Estimated price impact percentage.

requiresTokenApproval
boolean
required

Flag indicating whether the transaction object requires a source token approval check.

requiresRegisterTransaction
boolean
required

Flag indicating whether the transaction requires registration via the registerTxs endpoint. Mandatory for non-EVM transactions.

allRoutes
object[]
required

All available routes for the action.

bridgeFee
object

Bridge fee (from aggregated providers)

bridgeIds
enum<string>[]

Bridge IDs used in the route.

Bridge protocol identifier.

Available options:
optimism,
arbitrum,
oft,
yield-oft,
hyperlane,
ghost,
mayan,
across,
relay,
alt-vm-1,
alt-vm-2
bridgeRoute
object[]

Bridge route information (src chain + token, dst chain + token, BridgeId)