Currency Conversion API
USD-CAD Currency Conversion API
The Currency Conversion API provides real-time exchange rates between USD (United States Dollar) and CAD (Canadian Dollar). This API allows you to:
- Convert USD to CAD at current market rates
- Convert CAD 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. For example,
USDorCAD.wantrequiredCurrency you want to convert to. For example,
USDorCAD.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=CAD&amount=1000Sample Response
JSON
1
2
3
4
5
6
{
"old_amount": 1000,
"old_currency": "USD",
"new_currency": "CAD",
"new_amount": 1350.67
}Code Examples
1
2
3
4
5
6
7
8
import requests
api_url = 'https://api.api-ninjas.com/v1/convertcurrency?have=USD&want=CAD&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.