Crypto Exchange Endpoint
The Crypto Exchange endpoint allows you to get the exchange of any cryptocurrency compared against USD or any other local currency
get
https://api-stg.directa24.com
/v3/exchange_rates/crypto?currency={currency}&amount={amount}&crypto={crypto}
Crypto Exchange Endpoint
The Crypto Exchange Endpoint allows you to convert any amount in USD or Local Currency to the specified Cryptocurrency.
In order to start using the Crypto Exchange endpoint, you need to:
- 1.Send the request with GET method.
- 2.
- 3.Specify the amount to convert.* If it's not specified, 1 is assumed.
- 4.Specify a valid cryptocurrency symbol that will be converted the amount to.
- 5.Send the Authorization header with your read-only API Key as Bearer as follows:
Authorization: Bearer your_read_only_key_here
cURL
JAVA
C#
PHP
curl --location --request GET 'https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&crypto=USDT' \
--header 'Authorization: Bearer your_read_only_key_here'
import java.io.*;
import okhttp3.*;
public class main {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&amount=1000&crypto=USDT")
.method("GET", null)
.addHeader("Authorization", "Bearer your_read_only_key_here")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&amount=1000&crypto=USDT");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer your_read_only_key_here");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&amount=1000&crypto=USDT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer your_read_only_key_here"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"fx_rate": 5.8829,
"converted_amount": 58.829,
"fee": 0.64
}
Field name | Format | Description |
fx_rate | Number | Exchange rate of the cryptocurrency against the base currency |
converted_amount | Number | Amount in the cryptocurrency specified. Default: 1 |
fee | Number | Fee for converting the specified amount to the cryptocurrency. |
Last modified 2yr ago