> For the complete documentation index, see [llms.txt](https://docs-tron.en.tronify.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-tron.en.tronify.io/tron-api/create-bandwidth-order.md).

# create bandwidth  order

### Endpoint usage

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

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

#### Request Body

| Name                                            | Type   | Description                                                                                                                    |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------ |
| fromAddress<mark style="color:red;">\*</mark>   | String | user address(wallet address for buyer)                                                                                         |
| pledgeAddress<mark style="color:red;">\*</mark> | String | bandwidth receiving address.                                                                                                   |
| pledgeNum<mark style="color:red;">\*</mark>     | String | amount of bandwidth, cannot be less than 1000                                                                                  |
| orderPrice<mark style="color:red;">\*</mark>    | String | <p>price(unit: sun)，default 900</p><p>The value must be greater than 700</p>                                                   |
| orderType<mark style="color:red;">\*</mark>     | String | BANDWIDTH                                                                                                                      |
| pledgeDay                                       | String | <p>Rental Time, (unit: day)</p><p>1-30<br>（<code>pledgeDay</code>, <code>pledgeHour</code> cannot be empty simultaneously）</p> |
| 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)                              |
| pledgeHour                                      | String | <p>Rental Time, (unit: hour)</p><p></p><p>\[1,3]</p>                                                                           |

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

```javascript
{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "orderId": "16zi4ynw_sdvn_qv8h_ujfc_crfsgyi07zat",
        "platformAddr": "TAdm9uEjiDge14T6AkZuo8vCNBEV1Fitmn",//trx recieving platform address
        "fromAddress": "TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k",//wallet address
        "pledgeAddress": "TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k",//energy recieving address
        "pledgeDay": 3,
        "source": "tronLink",
        "orderType": "ENERGY",
        "orderPrice": 900,
        "pledgeNum": 3500,
        "pledgeTrxNum": 9.45
    }
}
```

{% endtab %}
{% endtabs %}

### code example

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

```
// example
const params = {
    fromAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    pledgeAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    pledgeDay: 3,
    orderType: 'BANDWIDTH',
    orderPrice: 900,
    pledgeNum: 3500,
    sourceFlag: 'tronLink'
}
const res = await axios.post('https://open.tronify.io/api/tronRent/addTronRentRecord',params)
console.log(res)
if(res.resCode === '100'){
    const orderId = res.data.orderId;
    const transaction = res.data.transaction;
    const signedTx = await tronWeb.trx.sign(transaction)
    const params = {
        "orderId": orderId,
        "fromHash": signedTx.txID,
        "signedData": signedTx
    };
    const rest = await axios.post('https://open.tronify.io/api/tronRent/uploadHash', params );
    console.log(rest)
    if(rest.resCode === '100'){
        // ...
    }
}
```

{% endtab %}
{% endtabs %}

### Postman example

<figure><img src="/files/XnVOne4F41wYqQB34w5n" alt=""><figcaption></figcaption></figure>
