Pair Conversion Requests

Documentation for the Pair ExchangeRate-API endpoint.

Overview

Our Pair Conversion API endpoint is useful for applications where you just want to convert between two specific currencies and aren't interested in any others.

You'll need to choose your base currency code and the target currency you'd like to get the exchange rate for. You'll then get a minimal JSON response back from our API with exactly the data you need. It's a much smaller response than the one you'd get from our Standard endpoint - quick & easy to develop with.


Usage Guide

To use our Pair endpoint simply make the substitutions explained below and then send a GET request.

• Substitute `YOUR-API-KEY` with the API key displayed in your dashboard.

• Substitute `EUR` with the code you want to use as a base currency.

• Substitute `GBP` with the code you want to use as a target currency.

We use ISO 4217 Three Letter Currency Codes - e.g. USD for US Dollars, EUR for Euro etc. Here are the codes we support.

GET https://v6.exchangerate-api.com/v6/YOUR-API-KEY/pair/EUR/GBP

This will return the exchange rate from your base code to the other currency you supplied:

{
	"result": "success",
	"documentation": "https://www.exchangerate-api.com/docs",
	"terms_of_use": "https://www.exchangerate-api.com/terms",
	"time_last_update_unix": 1585267200,
	"time_last_update_utc": "Fri, 27 Mar 2020 00:00:00 +0000",
	"time_next_update_unix": 1585270800,
	"time_next_update_utc": "Sat, 28 Mar 2020 01:00:00 +0000",
	"base_code": "EUR",
	"target_code": "GBP",
	"conversion_rate": 0.8412
}

Alternatively, you could also supply an optional AMOUNT variable (decimal format xxxx.xxxx).

GET https://v6.exchangerate-api.com/v6/YOUR-API-KEY/pair/EUR/GBP/AMOUNT

This will return the exchange rate from your base code to the target currency you supplied, as well as a conversion of the amount you supplied:

{
	"result": "success",
	"documentation": "https://www.exchangerate-api.com/docs",
	"terms_of_use": "https://www.exchangerate-api.com/terms",
	"time_last_update_unix": 1585267200,
	"time_last_update_utc": "Fri, 27 Mar 2020 00:00:00 +0000",
	"time_next_update_unix": 1585270800,
	"time_next_update_utc": "Sat, 28 Mar 2020 01:00:00 +0000",
	"base_code": "EUR",
	"target_code": "GBP",
	"conversion_rate": 0.8412,
	"conversion_result": 5.8884
}

Error Responses

{
	"result": "error",
	"error-type": "unknown-code"
}

Where "error-type" can be any of the following:

  • "unsupported-code" if we don't support the supplied currency code (see supported currencies...).
  • "malformed-request" when some part of your request doesn't follow the structure shown above.
  • "invalid-key" when your API key is not valid.
  • "inactive-account" if your email address wasn't confirmed.
  • "quota-reached" when your account has reached the the number of requests allowed by your plan.

➡️️​ If you have any questions about the above please don't hesitate to email us!