Documentation

Exchange rate APIs

Get real-time exchange rates with multiple data options.

Get all rates

GET /api/rates
Description: Returns all current exchange rates with currency information including code, name, symbol, and flag.
Response:
{
  "success": true,
  "data": [
    {
      "currency_id": 1,
      "code": "USD",
      "name": "US Dollar",
      "symbol": "$",
      "rate": 62.64,
      "updated_at": "2025-10-16T17:32:34.661Z"
    },
    {
      "currency_id": 2,
      "code": "EUR",
      "name": "Euro",
      "symbol": "€",
      "rate": 71.95,
      "updated_at": "2025-10-16T17:32:34.661Z"
    }
  ],
  "count": 150,
  "timestamp": "2025-10-16T17:32:34.661Z"
}

Get historical rates

GET /api/historical/USD?days=30
Description: Returns historical exchange rate data for a specific currency over a specified time period.
Query parameters:
days: number of days back (default: 30, max: 365)
date: specific date in YYYY-MM-DD format (optional)
Response:
{
  "success": true,
  "data": {
    "currency": {
      "code": "USD",
      "name": "US Dollar",
      "symbol": "$"
    },
    "rates": [
      {
        "id": 1,
        "rate": 62.64,
        "date": "2025-10-16",
        "created_at": "2025-10-16T17:32:34.661Z"
      },
      {
        "id": 2,
        "rate": 62.50,
        "date": "2025-10-15",
        "created_at": "2025-10-15T17:32:34.661Z"
      }
    ],
    "count": 30
  },
  "timestamp": "2025-10-16T17:32:34.661Z"
}

Get rate by currency code

GET /api/rates/USD
Description: Returns the current exchange rate for a specific currency by its code (e.g., USD, EUR, DOP).
Response:
{
  "success": true,
  "data": {
    "currency_id": 1,
    "code": "USD",
    "name": "US Dollar",
    "symbol": "$",
    "rate": 62.64,
    "updated_at": "2025-10-16T17:32:34.661Z"
  },
  "timestamp": "2025-10-16T17:32:34.661Z"
}

Get all currencies

GET /api/currencies
Description: Returns all active currencies available in the system with their details.
Response:
{
  "success": true,
  "data": [
    {
      "id": 1,
      "code": "USD",
      "name": "US Dollar",
      "symbol": "$",
      "is_active": true
    },
    {
      "id": 2,
      "code": "EUR",
      "name": "Euro",
      "symbol": "€",
      "is_active": true
    }
  ],
  "count": 150,
  "timestamp": "2025-10-16T17:32:34.661Z"
}

Get currency info

GET /api/currency/info/DOP
Description: Returns detailed technical information about a currency including country codes, major and minor unit information, banknotes, coins, overview, and central bank.
Response:
{
  "success": true,
  "data": {
    "currency": {
      "code": "DOP",
      "name": "Dominican Peso",
      "symbol": "RD$"
    },
    "info": {
      "country_codes": ["DO"],
      "major_unit": {
        "name": "peso"
      },
      "minor_unit": {
        "name": "centavo",
        "value": 0.01
      },
      "banknotes": {
        "frequently": [20, 50, 100, 200, 500, 1000, 2000],
        "rarely": []
      },
      "coins": {
        "frequently": [1, 5, 10, 25],
        "rarely": []
      },
      "overview": "the dominican peso is the currency of the dominican republic, managed by the central bank of the dominican republic. it has been free-floating since 1985 and serves the country's tourism and manufacturing economy in the caribbean.",
      "central_bank": "central bank of the dominican republic"
    }
  },
  "timestamp": "2025-10-16T17:32:34.661Z"
}

Convert currency

GET /api/rates/convert?from=USD&to=EUR&amount=100
Description: Convert a specific amount from one currency to another using current exchange rates.
Query parameters:
from: source currency code (e.g., USD)
to: target currency code (e.g., EUR)
amount: amount to convert (default: 1)
Response:
{
  "success": true,
  "data": {
    "from": {
      "code": "USD",
      "amount": 100
    },
    "to": {
      "code": "EUR",
      "amount": 87.25
    },
    "rate": 0.8725,
    "timestamp": "2025-10-16T17:32:34.661Z"
  }
}

Rate limits

  • Unauthenticated requests: 1 request per minute
  • Authenticated requests: 60 requests per minute
  • Cache duration: Cached for 1 hour
  • Data source: Database with real-time exchange rates

Rate limit headers

All API responses include rate limit information in headers:

  • X-RateLimit-Limit - Maximum requests allowed
  • X-RateLimit-Remaining - Requests remaining in current window
  • X-RateLimit-Reset - Timestamp when the limit resets

Rate limit exceeded

{
  "success": false,
  "error": "Rate limit exceeded",
  "message": "You have exceeded the rate limit of 1 request per minute. Get an API key for higher limits.",
  "rateLimit": {
    "limit": 1,
    "remaining": 0,
    "reset": "2025-10-16T17:33:00.000Z"
  },
  "getApiKey": "https://flarexrate.com/key"
}

Authentication

All API endpoints require authentication except for public exchange rate data. Use the authentication endpoints to get an access token.

Header: X-API-Key: your-api-key-here
Authorization: Bearer: your-api-key-here

Error response

{
  "success": false,
  "error": "Failed to fetch exchange rates",
  "message": "Unable to retrieve current exchange rates. Please try again later."
}

SDK examples

JavaScript/TypeScript

// Get all exchange rates (without API key)
const response = await fetch('/api/rates');
const data = await response.json();

// Get all exchange rates (with API key - higher limits)
const response = await fetch('/api/rates', {
  headers: {
    'X-API-Key': 'your-api-key-here'
  }
});
const data = await response.json();

// Get rate for a specific currency
const response = await fetch('/api/rates/USD', {
  headers: {
    'X-API-Key': 'your-api-key-here'
  }
});
const data = await response.json();

// Convert currency
const response = await fetch('/api/rates/convert?from=USD&to=EUR&amount=100', {
  headers: {
    'X-API-Key': 'your-api-key-here'
  }
});
const data = await response.json();

// Get currency info
const response = await fetch('/api/currency/info/DOP', {
  headers: {
    'X-API-Key': 'your-api-key-here'
  }
});
const data = await response.json();

cURL

# Get all exchange rates (without API key)
curl -X GET https://your-domain.com/api/rates

# Get all exchange rates (with API key - higher limits)
curl -X GET https://your-domain.com/api/rates \
  -H "X-API-Key: your-api-key-here"

# Get rate for a specific currency
curl -X GET https://your-domain.com/api/rates/USD \
  -H "X-API-Key: your-api-key-here"

# Convert currency
curl -X GET "https://your-domain.com/api/rates/convert?from=USD&to=EUR&amount=100" \
  -H "X-API-Key: your-api-key-here"

# Get all currencies
curl -X GET https://your-domain.com/api/currencies \
  -H "X-API-Key: your-api-key-here"

# Get historical rates
curl -X GET "https://your-domain.com/api/historical/USD?days=30" \
  -H "X-API-Key: your-api-key-here"

Need help?

If you have questions about our API or need assistance with integration, please contact us.

Contact us