Strapi v5 plugin that integrates the UniRate API for currency exchange rates and VAT data. Registers four content-API routes and an injectable unirate service — your API key stays server-side, never exposed to clients.
npm install strapi-plugin-unirateSet your API key as an environment variable:
UNIRATE_API_KEY=your_key_hereOr pass it via Strapi plugin config in config/plugins.ts:
export default {
unirate: {
enabled: true,
config: {
apiKey: process.env.UNIRATE_API_KEY,
// baseUrl: 'https://api.unirateapi.com', // default
// timeoutMs: 30000, // default
},
},
};The plugin registers these content-API routes (prefix: /api/unirate):
| Method | Path | Description |
|---|---|---|
| GET | /api/unirate/rate?base=USD&target=EUR |
Exchange rate (single or all) |
| GET | /api/unirate/convert?from=USD&to=EUR&amount=100 |
Convert amount |
| GET | /api/unirate/currencies |
List supported currencies |
| GET | /api/unirate/vat?country=DE |
VAT rates (optional country filter) |
Routes have no Strapi auth by default — add Strapi API token restrictions in the admin panel as needed.
Access the service in lifecycle hooks, custom controllers, or middleware:
// In a Strapi lifecycle hook or custom controller
const unirate = strapi.plugin('unirate').service('unirate');
// Get a single rate
const rate = await unirate.getRate('USD', 'EUR'); // → 0.92
// Get all rates for a base
const rates = await unirate.getRate('USD'); // → { EUR: 0.92, GBP: 0.79, ... }
// Convert an amount
const result = await unirate.convert('EUR', 100, 'USD'); // → 92.00
// List supported currencies
const currencies = await unirate.listCurrencies(); // → ['USD', 'EUR', 'GBP', ...]
// VAT rates
const vat = await unirate.getVatRates(); // all countries
const de = await unirate.getVatRates('DE'); // single countryAll errors extend UniRateError:
import { UniRateError, AuthenticationError, RateLimitError, ProRequiredError } from 'strapi-plugin-unirate';
try {
const rate = await unirate.getRate('USD', 'EUR');
} catch (err) {
if (err instanceof AuthenticationError) { /* invalid key */ }
if (err instanceof RateLimitError) { /* slow down */ }
if (err instanceof ProRequiredError) { /* upgrade plan */}
}Free-tier endpoints: rates, convert, currencies, VAT rates. Historical data and time series require a Pro subscription.
UniRate API client libraries: Python · Node.js · Go · Rust · Ruby · PHP · Java · Swift · .NET
Framework integrations: Next.js · Nuxt · SvelteKit · Astro · NestJS · Eleventy · React · Vue · tRPC · Strapi (this package)
CMS & e-commerce: WordPress · Directus · Medusa · Hugo · Jekyll
Data & AI: LangChain Python · FastAPI · Flask · Django REST · dbt · Airflow
Other: MCP server · CLI · Obsidian · money gem · laravel-money
MIT © Unirate Team