Currency Conversion API
USD-GBP Currency Conversion API
The Currency Conversion API provides real-time exchange rates between USD (United States Dollar) and GBP (British Pound Sterling). This API allows you to:
- Convert USD to GBP at current market rates
- Convert GBP to USD at current market rates
- Get accurate conversions for any amount
- Access real-time exchange rate data
The API uses up-to-date exchange rates and provides instant conversions between these two major world currencies.
/v1/convertcurrency GET
https://api.api-ninjas.com/v1/convertcurrency
Parameters
haverequiredCurrency you currently hold. Must be either
USDorGBP.wantrequiredCurrency you want to convert to. Must be either
USDorGBP.amountrequiredAmount of currency to convert.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Sample Request Live Demo!
have
want
amount
https://api.api-ninjas.com/v1/convertcurrency?have=USD&want=GBP&amount=1000Sample Response
JSON
1
2
3
4
5
6
{
"old_amount": 1000,
"old_currency": "USD",
"new_currency": "GBP",
"new_amount": 789.54
}Code Examples
1
2
3
4
5
6
7
8
import requests
api_url = 'https://api.api-ninjas.com/v1/convertcurrency?have=USD&want=GBP&amount=1000'
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.