Skip to main content
POST
/
api
/
quote
Calculate Best Path Quote
curl --request POST \
  --url https://ws.kuru.io/api/quote \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "userAddress": "0x1234567890abcdef1234567890abcdef12345678",
  "tokenIn": "0x0000000000000000000000000000000000000000",
  "tokenOut": "0x754704bc059f8c67012fed69bc8a327a5aafb603",
  "amount": "1000000000000000000",
  "slippageTolerance": 50,
  "autoSlippage": true,
  "referrerAddress": "0x5678567856785678567856785678567856785678",
  "referrerFeeBps": 25
}
'
import requests

url = "https://ws.kuru.io/api/quote"

payload = {
"userAddress": "0x1234567890abcdef1234567890abcdef12345678",
"tokenIn": "0x0000000000000000000000000000000000000000",
"tokenOut": "0x754704bc059f8c67012fed69bc8a327a5aafb603",
"amount": "1000000000000000000",
"slippageTolerance": 50,
"autoSlippage": True,
"referrerAddress": "0x5678567856785678567856785678567856785678",
"referrerFeeBps": 25
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userAddress: '0x1234567890abcdef1234567890abcdef12345678',
tokenIn: '0x0000000000000000000000000000000000000000',
tokenOut: '0x754704bc059f8c67012fed69bc8a327a5aafb603',
amount: '1000000000000000000',
slippageTolerance: 50,
autoSlippage: true,
referrerAddress: '0x5678567856785678567856785678567856785678',
referrerFeeBps: 25
})
};

fetch('https://ws.kuru.io/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://ws.kuru.io/api/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'userAddress' => '0x1234567890abcdef1234567890abcdef12345678',
'tokenIn' => '0x0000000000000000000000000000000000000000',
'tokenOut' => '0x754704bc059f8c67012fed69bc8a327a5aafb603',
'amount' => '1000000000000000000',
'slippageTolerance' => 50,
'autoSlippage' => true,
'referrerAddress' => '0x5678567856785678567856785678567856785678',
'referrerFeeBps' => 25
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://ws.kuru.io/api/quote"

payload := strings.NewReader("{\n \"userAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"tokenIn\": \"0x0000000000000000000000000000000000000000\",\n \"tokenOut\": \"0x754704bc059f8c67012fed69bc8a327a5aafb603\",\n \"amount\": \"1000000000000000000\",\n \"slippageTolerance\": 50,\n \"autoSlippage\": true,\n \"referrerAddress\": \"0x5678567856785678567856785678567856785678\",\n \"referrerFeeBps\": 25\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://ws.kuru.io/api/quote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"tokenIn\": \"0x0000000000000000000000000000000000000000\",\n \"tokenOut\": \"0x754704bc059f8c67012fed69bc8a327a5aafb603\",\n \"amount\": \"1000000000000000000\",\n \"slippageTolerance\": 50,\n \"autoSlippage\": true,\n \"referrerAddress\": \"0x5678567856785678567856785678567856785678\",\n \"referrerFeeBps\": 25\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://ws.kuru.io/api/quote")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"tokenIn\": \"0x0000000000000000000000000000000000000000\",\n \"tokenOut\": \"0x754704bc059f8c67012fed69bc8a327a5aafb603\",\n \"amount\": \"1000000000000000000\",\n \"slippageTolerance\": 50,\n \"autoSlippage\": true,\n \"referrerAddress\": \"0x5678567856785678567856785678567856785678\",\n \"referrerFeeBps\": 25\n}"

response = http.request(request)
puts response.read_body
{
  "type": "swap_calculation",
  "status": "success",
  "output": "950000000000000000",
  "path": {},
  "buildResponse": {},
  "gasPrices": {}
}

Authorizations

Authorization
string
header
required

JWT token obtained from /api/generate-token endpoint

Body

application/json
autoSlippage
enum<boolean>
required

Whether to use automatic slippage calculation

Available options:
true
Example:

true

userAddress
string
required

Ethereum address of the user

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0x1234567890abcdef1234567890abcdef12345678"

tokenIn
string
required

Address of the input token

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0xA0b86a33E6441051686442d3a1BA4Fab4F85d2b2"

tokenOut
string
required

Address of the output token

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"

amount
string
required

Amount to swap (in wei for tokens with 18 decimals)

Example:

"1000000000000000000"

slippageTolerance
integer<uint16>

Slippage tolerance in basis points (e.g., 50 = 0.5%)

Required range: 1 <= x <= 10000
Example:

50

referrerAddress
string

Optional referrer address for fee sharing

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0x5678567856785678567856785678567856785678"

referrerFeeBps
integer<uint16>

Optional referrer fee in basis points

Required range: 0 <= x <= 10000
Example:

25

Response

Successfully calculated best path

type
string

Response type identifier

Example:

"swap_calculation"

status
enum<string>

Status of the calculation

Available options:
success,
error
Example:

"success"

output
string

Expected output amount

Example:

"950000000000000000"

message
string

Status or error message

path
object

Swap route information (tx_builder.SwapRoute)

buildResponse
object

Transaction build response (tx_builder.BuildResponse)

gasPrices
object

Gas price information (swapcalc.GasPriceInfo)