Currency Swap Endpoint

Our Currency Swap API endpoint is useful for applications where you just want to convert between two specific currencies and aren't interested in any others.

You'll need to choose your base currency code and the target currency you'd like to get the exchange rate for.

You'll then get a minimal JSON response back from our API with exactly the data you need. It's a much smaller response than the one you'd get from our Live Rate endpoint - quick & easy to develop with.

Each request to the currency swap endpoint consumes 1 token.

Code Snippet

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://ipforensics.net/api/v1/currency/swap?apikey=IPF-36ae36a6-4a32-4fae-a422-e45e70b0a515-X&to=NGN&from=USD',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Sample Response

{
    "status": true,
    "code": 200,
    "message": "Successful",
    "meta_data": {
        "from": "usd",
        "to": "ngn",
        "exchange_rate": 440.28684
    }
}

Endpoint

Returns the swap currency.

GET https://ipforensics.net/api/v1/currency/swap?apikey=...&to=NGN&from=USD

Returns response object and a metadata of the request

Query Parameters

Name
Type
Description

apikey*

String

Your API key

from*

String

Specify the currency to swap from.

to*

String

Specify the currency to swap to.

{
    "status": true,
    "code": 200,
    "message": "Successful",
    "meta_data": {
        "from": "usd",
        "to": "ngn",
        "exchange_rate": 440.28684
    }
}

Last updated