Get Swap Quote
curl --request GET \
--url https://inkyswap.com/api/quoteimport requests
url = "https://inkyswap.com/api/quote"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://inkyswap.com/api/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inkyswap.com/api/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://inkyswap.com/api/quote"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://inkyswap.com/api/quote")
.asString();require 'uri'
require 'net/http'
url = URI("https://inkyswap.com/api/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyInkySwap API
Get Swap Quote
Quote an InkySwap V2 route on Ink and optionally build router calldata.
GET
/
api
/
quote
Get Swap Quote
curl --request GET \
--url https://inkyswap.com/api/quoteimport requests
url = "https://inkyswap.com/api/quote"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://inkyswap.com/api/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inkyswap.com/api/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://inkyswap.com/api/quote"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://inkyswap.com/api/quote")
.asString();require 'uri'
require 'net/http'
url = URI("https://inkyswap.com/api/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyBase URL:
The old example that used Ethereum-mainnet USDC (
https://inkyswap.com
This endpoint covers the wider InkySwap V2 router. It is not the InkyPump bonding-curve or V4 post-bond quote endpoint.
Query parameters
string
required
Input token. Use
0x0000000000000000000000000000000000000000 for native ETH.string
required
Output token. Use the zero address for native ETH.
string
Exact input in smallest units. Send either
amount or amountOut, never both.string
Exact output in smallest units.
number
Basis points from
0 to 10000.boolean
default:"false"
When
true, build router calldata for a routed swap.string
Required with
buildTx=true.Response
type Quote = {
amountIn: string
amountOut: string
minimumAmountOut?: string
maximumAmountIn?: string
executionRate: string
spotRate: string
path: `0x${string}`[]
priceImpact: number
lpFee: string
metadata: {
lpFeePercent: number
routerAddress: `0x${string}`
slippageBps?: number
}
transaction?: {
from: `0x${string}`
to: `0x${string}`
data: `0x${string}`
value: string
gasPrice: string
gas: string
}
}
Verified example
Native ETH and WETH on Ink are a 1:1 wrap path:curl "https://inkyswap.com/api/quote?tokenIn=0x0000000000000000000000000000000000000000&tokenOut=0x4200000000000000000000000000000000000006&amount=1000000000000000&slippage=100"
{
"amountIn": "1000000000000000",
"amountOut": "1000000000000000",
"minimumAmountOut": "990000000000000",
"executionRate": "1",
"spotRate": "1",
"path": [
"0x0000000000000000000000000000000000000000",
"0x4200000000000000000000000000000000000006"
],
"priceImpact": 0,
"lpFee": "0",
"metadata": {
"lpFeePercent": 0,
"routerAddress": "0xA8C1C38FF57428e5C3a34E0899Be5Cb385476507",
"slippageBps": 100
}
}
0xA0b8…eB48) on Ink was invalid and returned no route.
Transaction building
For routed swaps, setbuildTx=true and provide userAddress. Simulate the returned transaction before signing and confirm any ERC-20 allowance targets the returned router.
The direct ETH/WETH wrap case returns quote data but does not return router transaction calldata from this endpoint.
Errors
400for missing parameters, both exact-input and exact-output, or invalid slippage.500when the router cannot produce a route, liquidity is insufficient, or gas estimation fails.