API Reference
Code Examples
Copy-paste examples for calling the CurrencyCore API in cURL, JavaScript, Python, Go, Java, and PHP.
Every request is a plain authenticated GET. Send your key as a bearer token in
the Authorization header (or the x-api-key header) — never in the URL. Pick
your language below; all endpoints follow the same shape.
Replace
cc_live_your_keywith a key from your dashboard. See Authentication for both header options.
Convert an amount
GET /v1/convert — convert 100 USD to INR.
curl "https://api.currency-core.com/v1/convert?from=USD&to=INR&amount=100" \
-H "Authorization: Bearer cc_live_your_key"const res = await fetch(
"https://api.currency-core.com/v1/convert?from=USD&to=INR&amount=100",
{ headers: { Authorization: "Bearer cc_live_your_key" } },
);
const data = await res.json();
console.log(data.results[0].result); // 8345import requests
res = requests.get(
"https://api.currency-core.com/v1/convert",
params={"from": "USD", "to": "INR", "amount": 100},
headers={"Authorization": "Bearer cc_live_your_key"},
)
data = res.json()
print(data["results"][0]["result"]) # 8345package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET",
"https://api.currency-core.com/v1/convert?from=USD&to=INR&amount=100", nil)
req.Header.Set("Authorization", "Bearer cc_live_your_key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var data struct {
Results []struct {
Result float64 `json:"result"`
} `json:"results"`
}
json.NewDecoder(res.Body).Decode(&data)
fmt.Println(data.Results[0].Result)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.currency-core.com/v1/convert?from=USD&to=INR&amount=100"))
.header("Authorization", "Bearer cc_live_your_key")
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());<?php
$ch = curl_init("https://api.currency-core.com/v1/convert?from=USD&to=INR&amount=100");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer cc_live_your_key"]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $data["results"][0]["result"];All rates for a base currency
GET /v1/rates/:base — every currency expressed against EUR.
curl "https://api.currency-core.com/v1/rates/EUR" \
-H "Authorization: Bearer cc_live_your_key"const res = await fetch("https://api.currency-core.com/v1/rates/EUR", {
headers: { Authorization: "Bearer cc_live_your_key" },
});
const { rates } = await res.json();
console.log(rates.USD); // USD per 1 EURimport requests
res = requests.get(
"https://api.currency-core.com/v1/rates/EUR",
headers={"Authorization": "Bearer cc_live_your_key"},
)
rates = res.json()["rates"]
print(rates["USD"]) # USD per 1 EURreq, _ := http.NewRequest("GET", "https://api.currency-core.com/v1/rates/EUR", nil)
req.Header.Set("Authorization", "Bearer cc_live_your_key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var data struct {
Rates map[string]float64 `json:"rates"`
}
json.NewDecoder(res.Body).Decode(&data)
fmt.Println(data.Rates["USD"])HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.currency-core.com/v1/rates/EUR"))
.header("Authorization", "Bearer cc_live_your_key")
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());<?php
$ch = curl_init("https://api.currency-core.com/v1/rates/EUR");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer cc_live_your_key"]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $data["rates"]["USD"];Need a different language or framework? Email support — we’re happy to help.