Swap Endpoints

Get a quote for swapping tokens, including price details and executable transaction data.

get/api/v2/swap/quote

Request

Query parameters

from_chainstring required

Chain of the token to swap from

from_addressstring required

Contract address of the token to swap from

to_chainstring required

Chain of the token to swap to

to_addressstring required

Contract address of the token to swap to

quantitystring required

Amount to swap in the smallest unit of the token (e.g. wei for ETH)

addressstring required

Wallet address executing the swap

slippagenumber double

Slippage tolerance (0.0 to 0.5, default: 0.01)

recipientstring

Recipient address (defaults to sender address)

Response

OK

Example response

{
  "quote": {
    "costs": [
      {
        "type": "GAS",
        "usd": "0.5"
      }
    ],
    "estimated_duration_ms": 30000,
    "marketplace_fee_bps": 50,
    "price_impact": {
      "percent": "-0.08",
      "usd": "-1.5"
    },
    "recommended_slippage": 2,
    "refresh_after_ms": 2000,
    "route_errors": [
      {
        "type": "INSUFFICIENT_FUNDS"
      }
    ],
    "slippage_tolerance": 0.01,
    "swap_provider": "RELAY",
    "total_cost_usd": 1869,
    "total_price_usd": 1850.5
  },
  "transactions": [
    {
      "chain": "ethereum",
      "svm": {
        "instructions": [
          {
            "accounts": [
              {
                "pubkey": "So11111111111111111111111111111111111111112"
              }
            ],
            "data": "01020304",
            "program_id": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
          }
        ],
        "transaction_config": {
          "compute_unit_limit": 200000,
          "priority_fee_lamports": "5000"
        }
      }
    }
  ]
}

Changes

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the / response's property type changed from object to no type for status

    • breaking

      removed the required property // from the response with the status

    • breaking

      removed the required property // from the response with the status

    • warning

      added the new EXECUTION enum value to the /// response property for the response status

    • info

      added the media type */* for the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added subschema #2 to the / response property anyOf list for the response status