# create a sell order

### Endpoint usage

<mark style="color:green;">`POST`</mark> `https://open.tronify.io/api/tronRent/addTronSale`

The fields with \* are required, and the fields without \* are optional

#### Request Body

| Name                                            | Type   | Description                                                                                       |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------- |
| relateOrderId<mark style="color:red;">\*</mark> | String | purchase order Id                                                                                 |
| saleAddress<mark style="color:red;">\*</mark>   | String | user address(wallet address for seller)                                                           |
| sourceFlag<mark style="color:red;">\*</mark>    | String | Source channel (Both sides need to agree on a name to represent the channel of the third parties) |
| buyPledgeNum<mark style="color:red;">\*</mark>  | String | amount of eneger/bandwidth                                                                        |
| payTrxAddress<mark style="color:red;">\*</mark> | String | trx recieving address                                                                             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "orderId": "82gaugby_r7oh_ki1y_f2ma_ltelk84hivte",
        "relateOrderId": "3j354cx4_a4to_hbck_3amx_zrc0zh51dfkg",
        "transaction": {
            "visible": false,
            "txID": "14fc0e21c3be5889bb413c2406b184df724ce0cefa239adf1e3ed8368e39d741",
            "raw_data": {
                "contract": [
                    {
                        "parameter": {
                            "value": {
                                "balance": 301000000,
                                "resource": "ENERGY",
                                "receiver_address": "41242e5341ccd7d16af9e3a3b1c5cb07794f596609",
                                "lock": true,
                                "owner_address": "41dcf5a07cfac1534c2410714d6ba6576f49c4a6d7"
                            },
                            "type_url": "type.googleapis.com/protocol.DelegateResourceContract"
                        },
                        "type": "DelegateResourceContract"
                    }
                ],
                "ref_block_bytes": "141a",
                "ref_block_hash": "b29ae11706ac4963",
                "expiration": 1682213709000,
                "timestamp": 1682213651693
            },
            "raw_data_hex": "0a02141a2208b29ae11706ac496340c8c980defa305a75083912710a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e44656c65676174655265736f75726365436f6e747261637412380a1541dcf5a07cfac1534c2410714d6ba6576f49c4a6d7100118c0cac38f01221541242e5341ccd7d16af9e3a3b1c5cb07794f596609280170ed89fdddfa30"
        }
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### code example

{% tabs %}
{% tab title="JavaScript" %}

```
// example
const params = {
    relateOrderId: 'mt1wxcl1_dplo_r0qp_5bho_w5an5hev6d70',
    saleAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    payTrxAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    buyPledgeNum: 600,
    sourceFlag: 'tronLink'
}
 const res = await axios.post('https://open.tronify.io/api/tronRent/addTronSale',params)
 console.log(res)
 if(res.resCode === '100'){
    const signedTx = await tronWeb.trx.sign(res.data.transaction)
    const broastTx = await tronWeb.trx.sendRawTransaction(signedTx)
    return broastTx.txid 
 }
```

{% endtab %}
{% endtabs %}

### Postman example

<figure><img src="https://3188465811-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnv0Qbx2yTtH3TKQFd528%2Fuploads%2FkaBAL66eE6EEeDRjQ87W%2F3.jpg?alt=media&#x26;token=cb3bb9ee-5dcb-40c8-8fbb-aec23c242e4e" alt=""><figcaption></figcaption></figure>
