A simple public API to fetch free exchange rates (in IRR) from tgju.org
This API fetches data from tgju.org and provides it in a simple JSON format. Data is cached for 60 minutes.
Source Code: GitHub Repository
License: MIT
Returns the current USD to IRR exchange rate
| Parameter | Type | Description |
|---|---|---|
pretty |
boolean | When set to true, returns formatted JSON |
{
"success": true,
"price": "42,050",
"currency": "IRR",
"last_updated": "1402-05-15 14:30:45",
"source": "tgju.org"
}
fetch('https://charkharz.vercel.app/api/dollar')
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('Current price:', data.price);
}
});
curl -X GET 'https://charkharz.vercel.app/api/dollar?pretty=true'
import requests
response = requests.get('https://charkharz.vercel.app/api/dollar')
data = response.json()
print(data['price'])