Welcome to the UniRate API Go documentation. Our free exchange rate API gives you real-time and historical currency conversion you can drop into any Go service — whether it's an API, worker, CLI, or data pipeline. If you need to price orders, settle invoices, or run multi-currency analytics, the client is ready.
The official Go client library is written to feel like the standard library — context.Context on every method, sentinel errors, and no third-party dependencies.
context.Context on every method, sentinel errors
*http.Client for tests and custom transports
For full reference on endpoints, rate limits, and advanced options, see our main API documentation.
Below you'll find examples using the official UniRate Go client.
Install with go get github.com/UniRate-API/unirate-api-go, then import as unirate "github.com/UniRate-API/unirate-api-go".
// Install: go get github.com/UniRate-API/unirate-api-go
package main
import (
"context"
"fmt"
"log"
"os"
"time"
unirate "github.com/UniRate-API/unirate-api-go"
)
func main() {
client := unirate.New(os.Getenv("UNIRATE_API_KEY"),
unirate.WithTimeout(10*time.Second),
)
ctx := context.Background()
// Current rate
rate, err := client.GetRate(ctx, "USD", "EUR")
if err != nil {
log.Fatal(err)
}
fmt.Printf("USD -> EUR: %.4f\n", rate)
// Convert an amount
euros, err := client.Convert(ctx, 100, "USD", "EUR")
if err != nil {
log.Fatal(err)
}
fmt.Printf("100 USD = %.2f EUR\n", euros)
// All rates for a base
rates, _ := client.GetAllRates(ctx, "USD")
fmt.Printf("%d rates for USD\n", len(rates))
// Supported currencies
codes, _ := client.GetSupportedCurrencies(ctx)
fmt.Printf("%d currencies supported\n", len(codes))
// Historical rate on a specific date
hist, _ := client.GetHistoricalRate(ctx, "2024-01-01", "USD", "EUR")
fmt.Printf("USD -> EUR on 2024-01-01: %.4f\n", hist)
// Time series (up to 5 years)
series, _ := client.GetTimeSeries(ctx,
"2024-01-01", "2024-01-07",
1,
"USD",
[]string{"EUR", "GBP"},
)
_ = series
// VAT rate for a country (ISO-3166 alpha-2)
de, _ := client.GetVATRate(ctx, "DE")
fmt.Printf("Germany VAT: %.1f%%\n", de.VATData.VATRate)
}
USD -> EUR: 0.9245
100 USD = 92.45 EUR
593 rates for USD
593 currencies supported
USD -> EUR on 2024-01-01: 0.9056
Germany VAT: 19.0%
We offer paid implementation services to integrate our API into your application without you needing to write any code.
Contact Us for a QuoteSign up now to get your API key and start converting currencies in your Go applications.
Get Your API Key