Buy/Sell

Create a buy or sell request to trade an asset.

Method


POST https://api.ninjapay.me/tapi/v1/placeOrder

Parameters

Body (application/json)
{
  amount: string, // The amount in asset currency
  asset: string; // Symbol of the asset or token
  type: string; // Select "buy" or "sell" type order
  price?: string; // Optional limit price, if left empty, order excutes at market price
  note?: string; // Optional note for extra info
}

Other info

Parameters
Input options

asset

BTC , ETH , SOL , USDC , BNB , LINK , XRP , AVAX , MATIC , ADA , TRX , DOGE , LTC , DOT , SHIB , ATOM , UNI , BUSD

type

buy , sell

Response

{
    "status": bool,
    "data": {
        "tid": string
    },
    "message": string
}

Code Example


const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY' //Invoice key required
  },
  body: '{"amount":"0.00180204","asset":BTC, "type": "buy"}'
};

fetch('https://api.ninjapay.me/tapi/v1/placeOrder', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  

Last updated