Skip to main content
POST
/
rate
cURL
curl --request POST \
  --url https://api.bestflow.xyz/rate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from": "BTC",
  "to": "ETH",
  "fromNetwork": "BTC",
  "toNetwork": "ETH",
  "amount": 0.5
}
'
import requests

url = "https://api.bestflow.xyz/rate"

payload = {
"from": "BTC",
"to": "ETH",
"fromNetwork": "BTC",
"toNetwork": "ETH",
"amount": 0.5
}
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({from: 'BTC', to: 'ETH', fromNetwork: 'BTC', toNetwork: 'ETH', amount: 0.5})
};

fetch('https://api.bestflow.xyz/rate', 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.bestflow.xyz/rate",
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([
'from' => 'BTC',
'to' => 'ETH',
'fromNetwork' => 'BTC',
'toNetwork' => 'ETH',
'amount' => 0.5
]),
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://api.bestflow.xyz/rate"

payload := strings.NewReader("{\n \"from\": \"BTC\",\n \"to\": \"ETH\",\n \"fromNetwork\": \"BTC\",\n \"toNetwork\": \"ETH\",\n \"amount\": 0.5\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://api.bestflow.xyz/rate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"BTC\",\n \"to\": \"ETH\",\n \"fromNetwork\": \"BTC\",\n \"toNetwork\": \"ETH\",\n \"amount\": 0.5\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.bestflow.xyz/rate")

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 \"from\": \"BTC\",\n \"to\": \"ETH\",\n \"fromNetwork\": \"BTC\",\n \"toNetwork\": \"ETH\",\n \"amount\": 0.5\n}"

response = http.request(request)
puts response.read_body
{
  "from": "<string>",
  "to": "<string>",
  "fromNetwork": "<string>",
  "toNetwork": "<string>",
  "amount": 123,
  "rates": [
    {
      "exchange": "swapter",
      "estReceive": 123,
      "eta": "<string>",
      "minAmount": 123,
      "maxAmount": 123
    }
  ]
}
{
"message": "<string>"
}
{
"error": "UNAUTHORIZED",
"message": "Invalid API key"
}
{
"message": "<string>"
}
{
"error": "SERVICE_UNAVAILABLE",
"message": "Auth service unavailable"
}

Authorizations

Authorization
string
header
required

Optional Bearer authentication using an API key provided as a Bearer token. Required for unlimited requests and revenue sharing.

Body

application/json

Rate estimation request details

from
string
required

Source currency ticker

Example:

"BTC"

to
string
required

Destination currency ticker

Example:

"ETH"

fromNetwork
string
required

Source network identifier

Example:

"BTC"

toNetwork
string
required

Destination network identifier

Example:

"ETH"

amount
number
required

Amount to swap

Example:

0.5

Response

Rate estimation from supported exchanges

from
string
required
to
string
required
fromNetwork
string
required
toNetwork
string
required
amount
number
required
rates
object[]
required

Rate estimates per exchange, sorted descending by estReceive (best rate first). Exchanges with unavailable rates appear last.