Instaswap

Development API DOCS

Version 1.2
Gather aprox. funds amount of selected ticker pair

GET /tickers/:giveCoin/:getCoin/:sendAmount

Params:
API KEY: Your api key.
API NONCE: Check Implementation
API MESSAGE: Check Implementation

giveCoin: Deposit Ticker (example: BTC)
getCoin: Receive Ticker (example: ETH)
sendAmount: Amount of funds you want to exchange (example: 1.8714)
Successful response: (/tickers?giveCoin=BTC&getCoin=ETH&sendAmount=1.8714)
{
   "apiInfo":"OK",
   "response":{
      "min":0.0049977283053157656,
      "getAmount":"29.792761550654",
      "maxDigitsAfterDecimal":"4"
   }
}
* maxDigitsAfterDecimal is required when you send a transaction. Every ticker has different maximum digits after decimal
* min is minimum deposit amount on a transaction
Send swap request (order)

GET /swap/:giveCoin/:getCoin/:sendAmount/:receiveWallet/:refundWallet/:memo

Params:
API KEY: Your api key.
API NONCE: Check Implementation
API MESSAGE: Check Implementation

giveCoin: Deposit Ticker (example: BTC)
getCoin: Receive Ticker (example: ETH)
sendAmount: Amount of funds you want to exchange (example: 1.8714)
receiveWallet: Address to receive a currency
refundWallet: Refund address
memo (Optional): Extra memo/tag for currencies that require it
Successful response: (/swap?giveCoin=BTC&getCoin=ETH&sendAmount=1.8714&receiveWallet=15cU6gZRLWU3UusbWjpynW6zT3oa4H8q5ce&refundWallet=15cU6gZRLWU3UusbWjpynW6zT3oa4H8q5ce
{
   "apiInfo":"OK",
   "response":{
      "TransactionId":"NX54MHF1",
      "depositWallet":"15cU6gZRLWU3UusbWjpynW6zT3oa4H8q5ce",
   }
}
* All Wallet addresses in this page are not real. We use them only for example!
Check Swap request (order) State

GET /swapState/:swapId

Params:
API KEY: Your api key.
API NONCE: Check Implementation
API MESSAGE: Check Implementation

swapId: Transaction id from create swap request
Successful response: (/swapState.php?swapId=NX54MHF1)
{
   "apiInfo":"OK",
   "response":"Awating Deposit"
}
OR
{
   "apiInfo":"OK",
   "response":"Swaping"
}
OR
{
   "apiInfo":"OK",
   "response":"Withdraw"
}
OR
{
   "apiInfo":"OK",
   "response":"Completed"
}
OR
{
   "apiInfo":"OK",
   "response":"Deposit Not Completed"
}
Gather all open / completed / failed swaps (orders)

GET /report/:openOrders

GET /report/:completedOrders

GET /report/:notCompletedOrders

Params:
API KEY: Your api key.
API NONCE: Check Implementation
API MESSAGE: Check Implementation
Successful response: (/report?openOrders) OR (/report?completedOrders) OR(/report?notCompletedOrders)
{
   "apiInfo":"OK",
   "response":[
       {
           "transactionId":"NX54MHF1",
           "depositCoin":"BTC",
           "receiveCoin":"ETH",
           "depositAmount":"1",
           "refundWallet":"15cU6gZRLWU3UusbWjpynW6zT3oa4H8q5ce",
           "receiveWallet":"15cU6gZRLWU3UusbWjpynW6zT3oa4H8q5ce",
           "depositWallet":"15cU6gZRLWU3UusbWjpynW6zT3oa4H8q5ce",
           "memo_tag":"is not required",
           "transactionState":"Awating Deposit", OR "Completed" OR "Deposit Not Completed"
           "timestamp":"2019-06-22 17:21:53"
        },
        {...}
    ]
}
* All Wallet addresses in this page are not real. We use them only for example!
Gather all available ticker pairs

GET /report/:allowedPairs

Params:
API KEY: Your api key.
API NONCE: Check Implementation
API MESSAGE: Check Implementation
Successful response: (/report?allowedPairs)
{
   "apiInfo":"OK",
   "response":[
      {
         "depositCoin":"BTC",
         "receiveCoin":"ETH"
      },
      {
         "depositCoin":"BTC",
         "receiveCoin":"GRS"
      },
      {
         "depositCoin":"BTC",
         "receiveCoin":"USDT"
      },
      {
         "depositCoin":"BTC",
         "receiveCoin":"RPM"
      },
      {
         "depositCoin":"BTC",
         "receiveCoin":"AWR"
      },
      {...}
   ]
}
Gather remaining requests , max limit for requests per hour and api mode

GET /report/:requests

Params:
API KEY: Your api key.
API NONCE: Check Implementation
API MESSAGE: Check Implementation
Successful response: (/report?requests)
{
   "apiInfo":"OK",
   "response":{
      "remainingRequests":"328",
      "MaxRequestsLimitPerHour":"500",
      "apiMode":"test",
   }
}
* MaxRequestsLimit is defined in cooperation with instaswap dev team

PHP - IMPLEMENTATION

/**
* 1st Example
* Gather aprox. funds amount of selected ticker pair
*/

$baseUrl = 'https://api.instaswap.io';
$path = '/tickers?giveCoin=BTC&getCoin=ETH&sendAmount=1';
$nonce = round(val:microtime(get_as_float:true) * 1000);
$key = ' ... '; <-- Your Api Key
$message = $path . $nonce;
$ch = curl_init(url:$baseUrl . $path);
curl_setopt($ch, option:CURLOPT_CUSTOMREQUEST, value:'GET');
curl_setopt($ch, option:CURLOPT_HTTPHEADER, [
'X-INSTASWAP-API-KEY:' . $key,
'X-INSTASWAP-API-NONCE:' . $nonce,
'X-INSTASWAP-API-MESSAGE:' . $message
]);
curl_setopt($ch, option:CURLOPT_RETURNTRANSFER, value:true);
$server_output = curl_exec($ch);
curl_close ($ch);
print_r($server_output);
/**
* 2nd Example
* Send swap request (order)
*/

$baseUrl = 'https://api.instaswap.io';
$path = '/swap?giveCoin=BTC&getCoin=ETH&sendAmount=1&receiveWallet=15cU6gZRLWU3UusbWzT3oa4H8q5ce&refundWallet=15cU6gZRLWU3UusbWjpynW6zT3oae';
$nonce = round(val:microtime(get_as_float:true) * 1000);
$key = ' ... '; <-- Your Api Key
$message = $path . $nonce;
$ch = curl_init(url:$baseUrl . $path);
curl_setopt($ch, option:CURLOPT_CUSTOMREQUEST, value:'GET');
curl_setopt($ch, option:CURLOPT_HTTPHEADER, [
'X-INSTASWAP-API-KEY:' . $key,
'X-INSTASWAP-API-NONCE:' . $nonce,
'X-INSTASWAP-API-MESSAGE:' . $message
]);
curl_setopt($ch, option:CURLOPT_RETURNTRANSFER, value:true);
$server_output = curl_exec($ch);
curl_close ($ch);
print_r($server_output);
/**
* 3rd Example
* Check Swap request (order) State
*/

$baseUrl = 'https://api.instaswap.io';
$path = '/swapState?swapId=NX54MHF1';
$nonce = round(val:microtime(get_as_float:true) * 1000);
$key = ' ... '; <-- Your Api Key
$message = $path . $nonce;
$ch = curl_init(url:$baseUrl . $path);
curl_setopt($ch, option:CURLOPT_CUSTOMREQUEST, value:'GET');
curl_setopt($ch, option:CURLOPT_HTTPHEADER, [
'X-INSTASWAP-API-KEY:' . $key,
'X-INSTASWAP-API-NONCE:' . $nonce,
'X-INSTASWAP-API-MESSAGE:' . $message
]);
curl_setopt($ch, option:CURLOPT_RETURNTRANSFER, value:true);
$server_output = curl_exec($ch);
curl_close ($ch);
print_r($server_output);
/**
* 4th Example
* 1st $path = Get Open Orders
* 2nd $path = Get Completed Orders
* 3rd $path = Get failed Orders
* 4th $path = Get all allowed ticker pairs
* 5th $path = Get api requests options
*/

$baseUrl = 'https://api.instaswap.io';
you will use one of thesepath = '/report?openOrders';
you will use one of these$path = '/report?completedOrders';
you will use one of these$path = '/report?notCompletedOrders';
you will use one of these$path = '/report?allowedPairs';
you will use one of these$path = '/report?requests';
$nonce = round(val:microtime(get_as_float:true) * 1000);
$key = ' ... '; <-- Your Api Key
$message = $path . $nonce;
$ch = curl_init(url:$baseUrl . $path);
curl_setopt($ch, option:CURLOPT_CUSTOMREQUEST, value:'GET');
curl_setopt($ch, option:CURLOPT_HTTPHEADER, [
'X-INSTASWAP-API-KEY:' . $key,
'X-INSTASWAP-API-NONCE:' . $nonce,
'X-INSTASWAP-API-MESSAGE:' . $message
]);
curl_setopt($ch, option:CURLOPT_RETURNTRANSFER, value:true);
$server_output = curl_exec($ch);
curl_close ($ch);
print_r($server_output);