Get a quote for buying or selling any ERC20 token
curl --request GET \
--url https://api.fuse.io/api/v1/trade/quoteimport requests
url = "https://api.fuse.io/api/v1/trade/quote"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.fuse.io/api/v1/trade/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://api.fuse.io/api/v1/trade/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://api.fuse.io/api/v1/trade/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://api.fuse.io/api/v1/trade/quote")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fuse.io/api/v1/trade/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_body{
"price": "<string>",
"guaranteedPrice": "<string>",
"to": "<string>",
"data": "<string>",
"value": "<string>",
"gasPrice": "<string>",
"gas": "<string>",
"estimatedGas": "<string>",
"protocolFee": "<string>",
"minimumProtocolFee": "<string>",
"buyAmount": "<string>",
"sellAmount": "<string>",
"sources": [
{
"name": "<string>",
"proportion": "<string>"
}
],
"buyTokenAddress": "<string>",
"sellTokenAddress": "<string>",
"allowanceTarget": "<string>",
"fees": {
"zeroExFee": {
"feeType": "<string>",
"feeToken": "<string>",
"feeAmount": "<string>",
"billingType": "<string>"
}
},
"grossPrice": "<string>",
"grossBuyAmount": "<string>",
"grossSellAmount": "<string>",
"sellTokenToEthRate": "<string>",
"buyTokenToEthRate": "<string>",
"expectedSlippage": "<string>"
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}V2 Swap
Get a quote for buying or selling any ERC20 token
GET
/
api
/
v1
/
trade
/
quote
Get a quote for buying or selling any ERC20 token
curl --request GET \
--url https://api.fuse.io/api/v1/trade/quoteimport requests
url = "https://api.fuse.io/api/v1/trade/quote"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.fuse.io/api/v1/trade/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://api.fuse.io/api/v1/trade/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://api.fuse.io/api/v1/trade/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://api.fuse.io/api/v1/trade/quote")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fuse.io/api/v1/trade/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_body{
"price": "<string>",
"guaranteedPrice": "<string>",
"to": "<string>",
"data": "<string>",
"value": "<string>",
"gasPrice": "<string>",
"gas": "<string>",
"estimatedGas": "<string>",
"protocolFee": "<string>",
"minimumProtocolFee": "<string>",
"buyAmount": "<string>",
"sellAmount": "<string>",
"sources": [
{
"name": "<string>",
"proportion": "<string>"
}
],
"buyTokenAddress": "<string>",
"sellTokenAddress": "<string>",
"allowanceTarget": "<string>",
"fees": {
"zeroExFee": {
"feeType": "<string>",
"feeToken": "<string>",
"feeAmount": "<string>",
"billingType": "<string>"
}
},
"grossPrice": "<string>",
"grossBuyAmount": "<string>",
"grossSellAmount": "<string>",
"sellTokenToEthRate": "<string>",
"buyTokenToEthRate": "<string>",
"expectedSlippage": "<string>"
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}Query Parameters
Response
Successful response with the quote details