Get price to swap one ERC20 token to another
curl --request POST \
--url https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"tokenIn": "0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"amount": "100",
"chainId": 1
}
'import requests
url = "https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token"
payload = {
"tokenIn": "0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"amount": "100",
"chainId": 1
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tokenIn: '0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
tokenOut: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
amount: '100',
chainId: 1
})
};
fetch('https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token', 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.dev.monei.cc/api/v1/evm-exchange/price/token-to-token",
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([
'tokenIn' => '0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
'tokenOut' => '0xdAC17F958D2ee523a2206206994597C13D831ec7',
'amount' => '100',
'chainId' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token"
payload := strings.NewReader("{\n \"tokenIn\": \"0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"tokenOut\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"amount\": \"100\",\n \"chainId\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tokenIn\": \"0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"tokenOut\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"amount\": \"100\",\n \"chainId\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tokenIn\": \"0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"tokenOut\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"amount\": \"100\",\n \"chainId\": 1\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 123,
"message": "<string>",
"data": {
"quoteId": "0x592dbadfad19da6808b637c2",
"fromToken": {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol": "DAI",
"decimals": 18
},
"toToken": {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol": "DAI",
"decimals": 18
},
"fromAmount": "100000000000000000",
"toAmount": "313241752841065035585",
"rate": "3132.41752841065035585",
"reverseRate": "0.000319",
"minToAmount": "310104629627834539485",
"protocolFee": "470558335793031453",
"protocolFeeToken": {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol": "DAI",
"decimals": 18
},
"estimatedGas": "60012335624148",
"estimatedGasUsd": "18.50",
"priceImpact": "0.15",
"liquidityAvailable": true,
"totalValueUsd": "313.24",
"expiryTimestamp": 1698765432,
"blockNumber": "24161093",
"chainId": 1
},
"errors": {}
}EVM Exchange
Get price to swap one ERC20 token to another
POST
/
api
/
v1
/
evm-exchange
/
price
/
token-to-token
Get price to swap one ERC20 token to another
curl --request POST \
--url https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"tokenIn": "0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"amount": "100",
"chainId": 1
}
'import requests
url = "https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token"
payload = {
"tokenIn": "0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"amount": "100",
"chainId": 1
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tokenIn: '0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
tokenOut: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
amount: '100',
chainId: 1
})
};
fetch('https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token', 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.dev.monei.cc/api/v1/evm-exchange/price/token-to-token",
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([
'tokenIn' => '0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
'tokenOut' => '0xdAC17F958D2ee523a2206206994597C13D831ec7',
'amount' => '100',
'chainId' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token"
payload := strings.NewReader("{\n \"tokenIn\": \"0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"tokenOut\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"amount\": \"100\",\n \"chainId\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tokenIn\": \"0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"tokenOut\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"amount\": \"100\",\n \"chainId\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dev.monei.cc/api/v1/evm-exchange/price/token-to-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tokenIn\": \"0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"tokenOut\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"amount\": \"100\",\n \"chainId\": 1\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 123,
"message": "<string>",
"data": {
"quoteId": "0x592dbadfad19da6808b637c2",
"fromToken": {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol": "DAI",
"decimals": 18
},
"toToken": {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol": "DAI",
"decimals": 18
},
"fromAmount": "100000000000000000",
"toAmount": "313241752841065035585",
"rate": "3132.41752841065035585",
"reverseRate": "0.000319",
"minToAmount": "310104629627834539485",
"protocolFee": "470558335793031453",
"protocolFeeToken": {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol": "DAI",
"decimals": 18
},
"estimatedGas": "60012335624148",
"estimatedGasUsd": "18.50",
"priceImpact": "0.15",
"liquidityAvailable": true,
"totalValueUsd": "313.24",
"expiryTimestamp": 1698765432,
"blockNumber": "24161093",
"chainId": 1
},
"errors": {}
}Authorizations
Body
application/json
Token address to swap from
Example:
"0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
Token address to swap to
Example:
"0xdAC17F958D2ee523a2206206994597C13D831ec7"
Amount of tokenIn to swap
Example:
"100"
Chain ID (e.g., 1 for Ethereum)
Example:
1
⌘I

