# Buy/Sell

Create a buy or sell request to trade an asset.&#x20;

#### Method

```

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

```

#### Parameters

```javascript
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

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

#### Code Example

```jsx

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));
  
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ninjapay.gitbook.io/ninjapay-api-docs/how-to/api-reference-btc/spot-trade/buy-sell.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
