This document provides detailed information about the FXFeed API, including the available endpoints, query parameters, data format, error handling, and code examples in various programming languages. You can use the FXFeed API to access real-time and historical currency exchange rate data, convert between currencies, and retrieve time series data for currency pairs.
We also have an API Playground where you can test the API endpoints and see the responses in real-time. The Playgound is available here: API Playground.
The base URL for the API is:
https://api.fxfeed.io/v1
To authenticate, provide an api_key
in the query parameters for all requests. The api_key is required for all requests and can be found in your account settings after signing up.
Example:
https://api.fxfeed.io/v1/latest?base=EUR&api_key=YOUR_API_KEY
The API uses standard JSON for all responses.
Endpoint: /latest
Provides the latest currency exchange rate data.
Query Parameters:
base
(required): The base currency symbol (e.g., USD, EUR)currencies
(optional): A comma-separated list of currency symbols to retrieve rates forExample Request:
GET /latest?api_key=YOUR_API_KEY&base=USD¤cies=EUR,GBP,JPY
Example Response:
{
"success": true,
"base": "USD",
"date": "2024-09-02",
"rates": {
"EUR": 0.85,
"GBP": 0.73,
"JPY": 110.22
}
}
Endpoint: /historical
Provides historical currency exchange rate data for a specific date.
Query Parameters:
base
(required): The base currency symbol (e.g., USD, EUR)currencies
(optional): A comma-separated list of currency symbols to retrieve rates fordate
(required): The date for historical data in ISO format (YYYY-MM-DD)Example Request:
GET /historical?api_key=YOUR_API_KEY&base=USD¤cies=EUR,GBP,JPY&date=2023-12-31
Example Response:
{
"success": true,
"historical": true,
"base": "USD",
"date": "2023-12-31",
"rates": {
"EUR": 0.84,
"GBP": 0.74,
"JPY": 108.95
}
}
Endpoint: /convert
Converts an amount from one currency to another, optionally using historical rates.
Query Parameters:
from
(required): The three-letter currency code to convert fromto
(required): The three-letter currency code to convert toamount
(required): The amount to be converteddate
(optional): Specify a date (format YYYY-MM-DD) to use historical rates for this conversionExample Request:
GET /convert?api_key=YOUR_API_KEY&from=USD&to=EUR&amount=100&date=2024-09-02
Example Response:
{
"success": true,
"query": {
"from": "USD",
"to": "EUR",
"amount": 100
},
"info": {
"timestamp": 1630540800,
"rate": 0.85
},
"date": "2024-09-02",
"result": 85.0
}
Endpoint: /timeseries
Provides detailed time series data for currency exchange rates.
Query Parameters:
start_date
(required): The start date of your preferred timeframe (YYYY-MM-DD)end_date
(required): The end date of your preferred timeframe (YYYY-MM-DD)base
(optional): The three-letter currency code of your preferred base currencysymbols
(optional): A comma-separated list of currency codes to limit output currenciesExample Request:
GET /timeseries?api_key=YOUR_API_KEY&start_date=2024-09-01&end_date=2024-09-03&base=USD&symbols=EUR,GBP
Example Response:
{
"success": true,
"timeseries": true,
"start_date": "2024-09-01",
"end_date": "2024-09-03",
"base": "USD",
"rates": {
"2024-09-01": {
"EUR": 0.85,
"GBP": 0.73
},
"2024-09-02": {
"EUR": 0.86,
"GBP": 0.74
},
"2024-09-03": {
"EUR": 0.84,
"GBP": 0.72
}
}
}
The API uses HTTP status codes to indicate the success or failure of a request. Error responses include a JSON object with success: false
and an error
object containing a code
and info
message.
HTTP Status | Description | Affected Endpoints |
---|---|---|
400 | Bad Request: An invalid base currency has been entered | All |
400 | Bad Request: One or more invalid symbols have been specified | All |
400 | Bad Request: No date or invalid data has been specified | historical |
400 | Bad Request: No or an invalid amount has been specified | convert |
400 | Bad Request: No or an invalid timeframe has been specified | timeseries |
401 | Authentication failed: Missing or invalid API key | All |
402 | Payment Required: You have exceeded your monthly limit or your subscription plan is not active | All |
403 | Access denied: Your plan doesn't include this feature | All |
404 | Resource or API endpoint not found | All |
429 | Rate limit exceeded: Please wait a few seconds until retrying | All |
When you exceed your monthly API request limit:
{
"success": false,
"error": {
"code": 402,
"info": "Monthly API request limit reached. Please upgrade your plan."
}
}
Please note that API calls may be subject to rate limiting depending on your subscription plan. Consult the API provider for specific details on rate limits for your plan.
For additional support or questions about the API, please contact our support team.
Here are examples of how to connect to and parse data from the historical endpoint using various programming languages:
Note: Replace YOUR_API_KEY
with your actual API key in all examples.
const apiKey = "YOUR_API_KEY"
const base = "USD"
const currencies = "EUR,GBP,JPY"
const date = "2023-12-31"
fetch(
`https://api.fxfeed.io/historical?api_key=${apiKey}&base=${base}¤cies=${currencies}&date=${date}`,
)
.then((response) => response.json())
.then((data) => {
if (data.success) {
console.log(`Exchange rates for ${data.date}:`)
Object.entries(data.rates).forEach(([currency, rate]) => {
console.log(`${currency}: ${rate}`)
})
} else {
console.error("Error:", data.error.info)
}
})
.catch((error) => console.error("Fetch error:", error))
import axios from "axios"
interface HistoricalResponse {
success: boolean
historical: boolean
base: string
date: string
rates: { [key: string]: number }
}
const apiKey = "YOUR_API_KEY"
const base = "USD"
const currencies = "EUR,GBP,JPY"
const date = "2023-12-31"
axios
.get<HistoricalResponse>("https://api.fxfeed.io/historical", {
params: { api_key: apiKey, base, currencies, date },
})
.then((response) => {
const data = response.data
if (data.success) {
console.log(`Exchange rates for ${data.date}:`)
Object.entries(data.rates).forEach(([currency, rate]) => {
console.log(`${currency}: ${rate}`)
})
}
})
.catch((error) =>
console.error("Error:", error.response?.data?.error?.info || error.message),
)
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type HistoricalResponse struct {
Success bool `json:"success"`
Historical bool `json:"historical"`
Base string `json:"base"`
Date string `json:"date"`
Rates map[string]float64 `json:"rates"`
}
func main() {
apiKey := "YOUR_API_KEY"
base := "USD"
currencies := "EUR,GBP,JPY"
date := "2023-12-31"
url := fmt.Sprintf("https://api.fxfeed.io/historical?api_key=%s&base=%s¤cies=%s&date=%s",
apiKey, base, currencies, date)
resp, err := http.Get(url)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
var data HistoricalResponse
err = json.Unmarshal(body, &data)
if err != nil {
fmt.Println("Error parsing JSON:", err)
return
}
if data.Success {
fmt.Printf("Exchange rates for %s:\n", data.Date)
for currency, rate := range data.Rates {
fmt.Printf("%s: %.2f\n", currency, rate)
}
} else {
fmt.Println("Error: Unable to fetch exchange rates")
}
}
import requests
api_key = 'YOUR_API_KEY'
base = 'USD'
currencies = 'EUR,GBP,JPY'
date = '2023-12-31'
url = f'https://api.fxfeed.io/historical?api_key={api_key}&base={base}¤cies={currencies}&date={date}'
response = requests.get(url)
data = response.json()
if data['success']:
print(f"Exchange rates for {data['date']}:")
for currency, rate in data['rates'].items():
print(f"{currency}: {rate}")
else:
print("Error:", data['error']['info'])
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import org.json.JSONObject;
public class HistoricalRates {
public static void main(String[] args) {
String apiKey = "YOUR_API_KEY";
String base = "USD";
String currencies = "EUR,GBP,JPY";
String date = "2023-12-31";
String url = String.format("https://api.fxfeed.io/historical?api_key=%s&base=%s¤cies=%s&date=%s",
apiKey, base, currencies, date);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
JSONObject data = new JSONObject(response.body());
if (data.getBoolean("success")) {
System.out.println("Exchange rates for " + data.getString("date") + ":");
JSONObject rates = data.getJSONObject("rates");
for (String currency : rates.keySet()) {
System.out.println(currency + ": " + rates.getDouble(currency));
}
} else {
System.out.println("Error: " + data.getJSONObject("error").getString("info"));
}
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
class Program
{
static async Task Main(string[] args)
{
string apiKey = "YOUR_API_KEY";
string baseC = "USD";
string currencies = "EUR,GBP,JPY";
string date = "2023-12-31";
string url = $"https://api.fxfeed.io/historical?api_key={apiKey}&base={baseC}¤cies={currencies}&date={date}";
using (var client = new HttpClient())
{
try
{
string response = await client.GetStringAsync(url);
var data = JObject.Parse(response);
if (data["success"].Value<bool>())
{
Console.WriteLine($"Exchange rates for {data["date"]}:");
foreach (var rate in data["rates"])
{
Console.WriteLine($"{rate.Path}: {rate.Value<double>()}");
}
}
else
{
Console.WriteLine($"Error: {data["error"]["info"]}");
}
}
catch (Exception e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
curl -X GET "https://api.fxfeed.io/historical?api_key=YOUR_API_KEY&base=USD¤cies=EUR,GBP,JPY&date=2023-12-31"
Note: Replace YOUR_API_KEY
with your actual API key in all examples.