The API implemented allows you to retrieve the official currency associated with a given country.
URL: https://api.apipip.com/v1/currency-country/
Parameters
| Name | Description |
|---|---|
Country |
(Required) (Required) The country you want to look up. |
Headers
| Name | Description |
|---|---|
X-Key |
(No required) |
How to use Currency From Country API
import requests
# Set the API endpoint URL
url = 'https://api.apipip.com/v1/currency-country/'
# Set the country name you want to look up
payload = {
"country": "United States"
}
# Send a POST request to the API
response = requests.post(url, json=payload)
# Print the currency information
print(response.text)
fetch('https://api.apipip.com/v1/currency-country/', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ country: "United States" })
})
.then(res => res.json())
.then(data => console.log(data));
import Foundation
let url = URL(string: "https://api.apipip.com/v1/currency-country/")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
let params = ["country": "United States"]
request.httpBody = try? JSONSerialization.data(withJSONObject: params)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8)!)
}
}
task.resume()
API Response
{
"currency": "USD",
"currency_name": "United States Dollar",
"country": "United States"
}
Note: The API works with all programming languages