# createTrade

> POST /trades/createTrade creates a new crypto exchange and returns the deposit address and trade info. Parameters, SBP and RUB options, test mode, examples.

Source: https://docs.yellowchanger.com/createTrade

Create new trade and returns trade info

**POST** `https://api.yellowchanger.com/trades/createTrade`

## Headers

| Name | Value |
| --- | --- |
| Content-Type | application/json |
| Y_API_KEY | Public API Key |
| [Signature](https://docs.yellowchanger.com/signature.md) | HMAC SHA256 of Body |

## Body

| Name | Type | Description |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| send_name | string | Currency being sent |  |  |  |  |  |
| get_name | string | Currency being received |  |  |  |  |  |
| send_network | string | Network of currency being sent |  |  |  |  |  |
| get_network | string | Network of currency being received |  |  |  |  |  |
| send_value or get_value | number | Amount of the exchange you will receive or pay |  |  |  |  |  |
| get_creds | string | Credentials |  |  |  |  |  |
| uniq_id | _optional_ |  | string | Unique id of trade |  |  |  |
| sbpBank | _optional_ |  | string | Bank for receiving via SBP |  |  |  |
| exch_type | string |  | yellow | or | green |  |  |
| commission | float | Additional commission in percent, which is considered your profit (default 0.5) |  |  |  |  |  |
| get_memo | _optional_ |  | string | MEMO parameter for sending funds to the recipient's wallet |  |  |  |
| recipientName | _optional_ |  | string | Recipient's name |  |  |  |

## Response

**200**

```json
{
          "send_memo": null,
          "send_name": "USDT",
          "send_network": "TRC20",
          "get_network": "ERC20",
          "get_name": "USDT",
          "uniq_id": "nf4i3rh394h",
          "status": 1,
          "payment_wallet": "WalletForPay",
          "userPaidHash": null,
          "ourHash": null,
          "get_creds": "WalletForRecive",
          "network_commission": 0,
          "date": 1720120863,
          "time_expire": 1720142463,
          "send_value": "112",
          "get_value": "100",
          "sbpBank": null,
          "exch_type": "yellow",
          "percent_commission": 0.5
}
```

**40X**

```json
{
          "statusCode": 400,
          "message": "Some error message"
}
```

## Example

**JavaScript**

```javascript
const fetch = require("node-fetch");
let url = "https://api.yellowchanger.com/trades/createTrade",
          options = {
                    method: "POST",
                    headers: {
                              "Content-Type": "application/json",
                              Y_API_KEY: "Your API Key",
                              Signature: "0002b135569a4a29b7e7bf9489114eca8fa31e7f61a9e8e26b89bb7dfd4dcf5c",
                    },
                    body: '{"send_name":"USDT","get_name":"USDT","send_value":100,"send_network":"TRC20","get_network":"ERC20", "uniq_id":"nf4i3rh394h", "get_creds":"address, card or number"}',
          };
fetch(url, options)
          .then((e) => e.json())
          .then((e) => console.log(e))
          .catch((e) => console.error("error:" + e));
```

**Python**

```python
import requests

url = "https://api.yellowchanger.com/trades/createTrade"

payload = {
    "send_name": "USDT",
    "get_name": "USDT",
    "send_value": 100,
    "send_network": "TRC20",
    "get_network": "ERC20", 
    "uniq_id": "nf4i3rh394h",
    "get_creds": "address, card or number"
}

headers = {
    "Content-Type": "application/json",
    "Y_API_KEY": "Your API Key",
    "Signature": "0002b135569a4a29b7e7bf9489114eca8fa31e7f61a9e8e26b89bb7dfd4dcf5c"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

## Related

- [calculateTrade](https://docs.yellowchanger.com/calculateTrade.md): Returns exchange rate and details for a specific currency pair
- [Validate address](https://docs.yellowchanger.com/validateAddress.md): We use these methods to validate addresses, but if you don't want to check them with our server, you can check them yourself with this code.
- [getInfo](https://docs.yellowchanger.com/getInfo.md): Returns all information about transaction
- [cancelTrade](https://docs.yellowchanger.com/cancelTrade.md): Cancel the exchange
- [Status info](https://docs.yellowchanger.com/statusInfo.md): Description of statuses in methods createTrade and getInfo
- [Signature](https://docs.yellowchanger.com/signature.md): The "Signature" header is a body converted from JSON to a string and then HMAC SHA256 signed with a private key.

---

All methods: https://docs.yellowchanger.com/introduction.md · Index: https://docs.yellowchanger.com/llms.txt · Whole documentation in one file: https://docs.yellowchanger.com/llms-full.txt
