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": {
    "tokenAddress": "<string>",
    "decimals": 123,
    "symbol": "<string>",
    "name": "<string>",
    "chainId": 123,
    "amount": "<string>"
  },
  "amountInMax": {
    "tokenAddress": "<string>",
    "decimals": 123,
    "symbol": "<string>",
    "name": "<string>",
    "chainId": 123,
    "amount": "<string>"
  },
  "amountOut": {
    "tokenAddress": "<string>",
    "decimals": 123,
    "symbol": "<string>",
    "name": "<string>",
    "chainId": 123,
    "amount": "<string>"
  },
  "amountOutMin": {
    "tokenAddress": "<string>",
    "decimals": 123,
    "symbol": "<string>",
    "name": "<string>",
    "chainId": 123,
    "amount": "<string>"
  },
  "protocolFee": {
    "tokenAddress": "<string>",
    "decimals": 123,
    "symbol": "<string>",
    "name": "<string>",
    "chainId": 123,
    "amount": "<string>"
  },
  "applicationFee": {
    "tokenAddress": "<string>",
    "decimals": 123,
    "symbol": "<string>",
    "name": "<string>",
    "chainId": 123,
    "amount": "<string>"
  },
  "bridgeFee": {
    "tokenAddress": "<string>",
    "decimals": 123,
    "symbol": "<string>",
    "name": "<string>",
    "chainId": 123,
    "amount": "<string>"
  },
  "bridgeIds": [
    "optimism"
  ],
  "bridgeRoute": [
    {
      "srcChainId": 123,
      "dstChainId": 123,
      "srcBridgeToken": "<string>",
      "dstBridgeToken": "<string>",
      "bridgeId": "optimism"
    }
  ],
  "exchangeRate": 123,
  "estimatedTxTime": 123,
  "estimatedPriceImpact": 123,
  "allRoutes": [
    {
      "tx": {
        "to": "<string>",
        "data": "<string>",
        "value": "<string>",
        "chainId": 123
      },
      "txId": "<string>",
      "vmId": "evm",
      "amountIn": {
        "tokenAddress": "<string>",
        "decimals": 123,
        "symbol": "<string>",
        "name": "<string>",
        "chainId": 123,
        "amount": "<string>"
      },
      "amountInMax": {
        "tokenAddress": "<string>",
        "decimals": 123,
        "symbol": "<string>",
        "name": "<string>",
        "chainId": 123,
        "amount": "<string>"
      },
      "amountOut": {
        "tokenAddress": "<string>",
        "decimals": 123,
        "symbol": "<string>",
        "name": "<string>",
        "chainId": 123,
        "amount": "<string>"
      },
      "amountOutMin": {
        "tokenAddress": "<string>",
        "decimals": 123,
        "symbol": "<string>",
        "name": "<string>",
        "chainId": 123,
        "amount": "<string>"
      },
      "protocolFee": {
        "tokenAddress": "<string>",
        "decimals": 123,
        "symbol": "<string>",
        "name": "<string>",
        "chainId": 123,
        "amount": "<string>"
      },
      "applicationFee": {
        "tokenAddress": "<string>",
        "decimals": 123,
        "symbol": "<string>",
        "name": "<string>",
        "chainId": 123,
        "amount": "<string>"
      },
      "bridgeFee": {
        "tokenAddress": "<string>",
        "decimals": 123,
        "symbol": "<string>",
        "name": "<string>",
        "chainId": 123,
        "amount": "<string>"
      },
      "bridgeIds": [
        "optimism"
      ],
      "bridgeRoute": [
        {
          "srcChainId": 123,
          "dstChainId": 123,
          "srcBridgeToken": "<string>",
          "dstBridgeToken": "<string>",
          "bridgeId": "optimism"
        }
      ],
      "exchangeRate": 123,
      "estimatedTxTime": 123,
      "estimatedPriceImpact": 123
    }
  ]
}

Authorizations

x-api-key
string
header
required

Limited demo key for API Playground: 5c951bc81da566bbd030ba8e20724063.

Query Parameters

actionType
enum<string>
required

Type of action to perform

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

The address of the sender/user

srcChainId
number
required

Source chain ID

srcToken
string
required

Source token address

dstChainId
number
required

Destination chain ID

dstToken
string
required

Destination token address

slippage
number
required

Slippage tolerance in bps

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

The exact in or exact out amount of the swap

swap-action

swapDirection
enum<string>

Swap direction for the action

swap-action

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

Address to receive the swapped tokens

swap-action

to
string

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

evm-calldata-tx

data
string

Calldata for the transaction

evm-calldata-tx

value
string

Value to send with transaction

evm-calldata-tx

erc20Amount
string

The amount of Erc20 being transferred

Optional: Use for calls requiring Erc20 transfers

evm-calldata-tx

Erc20Spender
string

The Erc20 spender requiring approval for the transaction call

Optional: Will default to the to address

evm-calldata-tx

bridgeIds
enum<string>[]

Specific bridge protocols to use

Optional: Will default to all available protocols

refundTo
string

Alternate address to receive refunds

Optional: Will default to the sender

Response

200 - application/json

Successful response with action data

The response is of type object.