Exchange Rates API Documentation
Access real-time exchange rates for currencies & crypto. This API provides accurate, up-to-date rates for integrating into your financial applications.
Below are the endpoints for accessing exchange rates. Learn how to integrate the API into your application.
Authorization:
- privateId *Specify privateId for site
(e.g., "Bearer example^com-SomeIdString").
Query Parameters:
- show Specify which rates to show
(e.g., "all"|"rates"|"crypto"). - list Comma-separated list of currency codes
(e.g., "USD,INR,BTC").
Route Parameters:
- :region *Please check location table here
(e.g., "WEST_3|ARAB_1|EAST_3|NORD_6").
Response based on params:
{ "success": true, "data": { "rates": { "USD": 1, "INR": 83.540592, "JPY": 143.662125, "BTC": 0.000015737383 }, "crypto": { "BTC": 63478.467340116214, "DOGE": 0.012578131058644222 } } }
This endpoint provides the current exchange rates for the requested currencies.
<?php function fetchData() { // API configuration $baseUrl = 'https://exchangegrid.api.mapwale.com/v1'; $params = array( 'region' => 'YOUR_REGION' // Replace with actual region value ); $headers = array( 'Content-Type: application/json', 'Authorization: Bearer <privateId>' ); $queryParams = {"show":"all","list":"USD,INR,JPY,BTC,DOGE"}; try { // Build URL $url = $baseUrl; foreach (["region"] as $param) { $url .= '/' . urlencode($params[$param]); } $url .= '?' . http_build_query($queryParams); // Initialize cURL $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); if ('GET' === 'POST' || 'GET' === 'PUT') { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode({})); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); } // Execute request $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Check for errors if ($httpCode >= 400) { throw new Exception("HTTP Error: " . $httpCode); } curl_close($ch); return json_decode($response, true); } catch (Exception $e) { echo "Error: " . $e->getMessage(); return null; } } // Example usage $result = fetchData(); echo json_encode($result, JSON_PRETTY_PRINT);