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
Please find all the country and currencies codes in the Countries Specifications section.

Description

The Crypto Exchange Endpoint allows you to convert any amount in USD or Local Currency to the specified Cryptocurrency.

Request

In order to start using the Crypto Exchange endpoint, you need to:
  1. 1.
    Send the request with GET method.
  2. 2.
    Specify a valid currency code in the request as QUERY PARAMS.
  3. 3.
    Specify the amount to convert.* If it's not specified, 1 is assumed.
  4. 4.
    Specify a valid cryptocurrency symbol that will be converted the amount to.
  5. 5.
    Send the Authorization header with your read-only API Key as Bearer as follows:
Authorization: Bearer your_read_only_key_here

Example request

cURL
JAVA
C#
PHP
1
curl --location --request GET 'https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&crypto=USDT' \
2
--header 'Authorization: Bearer your_read_only_key_here'
3
4
Copied!
1
import java.io.*;
2
import okhttp3.*;
3
4
public class main {
5
public static void main(String []args) throws IOException{
6
OkHttpClient client = new OkHttpClient().newBuilder()
7
.build();
8
Request request = new Request.Builder()
9
.url("https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&amount=1000&crypto=USDT")
10
.method("GET", null)
11
.addHeader("Authorization", "Bearer your_read_only_key_here")
12
.build();
13
Response response = client.newCall(request).execute();
14
System.out.println(response.body().string());
15
}
16
}
17
18
Copied!
1
using System;
2
using RestSharp;
3
4
namespace HelloWorldApplication {
5
class HelloWorld {
6
static void Main(string[] args) {
7
var client = new RestClient("https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&amount=1000&crypto=USDT");
8
client.Timeout = -1;
9
var request = new RestRequest(Method.GET);
10
request.AddHeader("Authorization", "Bearer your_read_only_key_here");
11
IRestResponse response = client.Execute(request);
12
Console.WriteLine(response.Content);
13
}
14
}
15
}
16
17
Copied!
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => "https://api-stg.directa24.com/v3/exchange_rates/crypto?currency=BRL&amount=1000&crypto=USDT",
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => "",
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => "GET",
14
CURLOPT_HTTPHEADER => array(
15
"Authorization: Bearer your_read_only_key_here"
16
),
17
));
18
19
$response = curl_exec($curl);
20
21
curl_close($curl);
22
echo $response;
23
24
25
Copied!

Example Response

1
{
2
"fx_rate": 5.8829,
3
"converted_amount": 58.829,
4
"fee": 0.64
5
}
Copied!

Response fields

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.