CORS Proxy URL Converter

Proxied URL:

About

This service provides a CORS proxy for accessing the Economics Observatory and ONS APIs (and it should work for others too, though untested). It enables cross-origin requests for applications that need to access these data sources.

Usage

To use the proxy, prefix your target URL with our proxy endpoint:

https://eco-cors-proxy.netlify.app/proxy?url=YOUR_TARGET_URL

Example API Calls


Direct Legacy ONS API Calls (should return decommissioned message)



Direct New ONS API Calls



Economics Observatory ONS API Converter



CoinDesk API Examples

Note: Data provided by CoinDesk's Bitcoin Price Index. Updates every minute with current BTC prices in USD, GBP, and EUR.



Coinbase API Examples

Note: Returns current exchange rates for USD against all supported fiat currencies and cryptocurrencies on Coinbase. Updates frequently throughout the day.



FRED API Examples

Note: Replace YOUR_API_KEY with your actual FRED API key. The proxy handles URL encoding automatically!

Vega-Lite Chart Examples

Bitcoin Price Example:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "url": "https://eco-cors-proxy.netlify.app/proxy?url=https://api.coindesk.com/v1/bpi/currentprice.json",
    "format": {
      "type": "json",
      "property": "bpi.USD.rate_float"
    }
  },
  "mark": "bar",
  "encoding": {
    "y": {"field": "data", "type": "quantitative", "title": "Bitcoin Price (USD)"}
  }
}

US GDP Example:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "US GDP Over Time",
  "width": "container",
  "height": 300,
  "data": {
    "url": "https://eco-cors-proxy.netlify.app/proxy?url=https://api.stlouisfed.org/fred/series/observations?series_id=GDP&api_key=YOUR_API_KEY&file_type=json",
    "format": {
      "type": "json",
      "property": "observations"
    }
  },
  "mark": {
    "type": "line",
    "color": "#36B7B4"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "title": "Date"
    },
    "y": {
      "field": "value",
      "type": "quantitative",
      "title": "GDP (Billions of Dollars)"
    }
  }
}

You can use these specifications in the Vega Editor. Note that:

Limitations

Response Format

The proxy returns JSON responses with appropriate CORS headers. For Economics Observatory API Converter responses, the proxy will try extract and parse the JSON data from the HTML response, and fall back onto proxying the ONS beta API as a a backup.

Error Codes