> 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-usdt-energy-order.md).

# create usdt energy order

The energy required for the USDT transfer paid to Tronify is automatically included. You only need to place an order for the amount of energy required for your actual business transfer.

### 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 | energy receiving address.                                                                                                                                                                                       |
| pledgeNum<mark style="color:red;">\*</mark>     | int    | amount of energy, cannot be less than 15000                                                                                                                                                                     |
| orderType<mark style="color:red;">\*</mark>     | String | ENERGY                                                                                                                                                                                                          |
| 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)                                                                                                               |
| tradeType<mark style="color:red;">\*</mark>     | String | fastTrade                                                                                                                                                                                                       |
| pledgeDay<mark style="color:red;">\*</mark>     | String | <p>Rental Time(unit: day)</p><p>values: 0-30</p><p>（<br><code>pledgeDay</code>, <code>pledgeHour</code>, and <code>pledgeMinute</code> cannot be 0 simultaneously）</p>                                          |
| pledgeHour<mark style="color:red;">\*</mark>    | String | <p>Rental Time(unit: hour)</p><p>values: 0, 1, 3</p>                                                                                                                                                            |
| pledgeMinute<mark style="color:red;">\*</mark>  | String | <p>Rental Time(unit: minute)</p><p>values: 0, 10</p>                                                                                                                                                            |
| extraTrxNum<mark style="color:red;">\*</mark>   | String | <p>The amount of additional trx the user wants to receive.<br><strong>Valid values: 0 or in the range \[0.8, 500].</strong><br><strong>0</strong> means that only energy is required, and no TRX is needed.</p> |
| pledgeBandwidthNum                              | String | The amount of additional bandwidth the user wants to receive. If 0 or no passed, it means no bandwidth is required.                                                                                             |

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

```javascript
{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "fromAddress": "TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k",//User wallet address
        "pledgeAddress": "TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k",//User receiving energy address
        "pledgeDay": "0",
        "pledgeHour": "0",
        "pledgeMinute": "10",
        "source": "tronLink",
        "orderType": "ENERGY",
        "orderPrice": 90,
        "pledgeNum": 96400,
        "pledgeTrxNum": "10.512",
        "usdtModeAvailable": true,
        "payCoinCode": "USDT", //Payment Currency
        "payCoinAmt": "3.124527",//payment amount
        "extraTrxNum": "0.8",//The amount of additional trx the user wants to receive
        "pledgeBandwidthNum": "0",//The amount of bandwidth the user wants to obtain
        "activeAccountFee": "0",//the fee of activation address
        "purchaseTRXFee": "0.397105",//the fee of extra trx
        "purchaseBandwidthFee": "0",//the fee of bandwidth
        "purchaseEnergyFee": "2.727422"//the fee of energy
        //...
    }
}
```

{% endtab %}
{% endtabs %}

### code example

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

```
// example
const params = {
    fromAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    pledgeAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    tradeType: 'fastTrade',
    pledgeDay: '0',
    pledgeHour: '0',
    pledgeMinute: '10',
    orderType: 'ENERGY',
    pledgeNum: 32000,
    sourceFlag: 'tronLink',
    extraTrxNum: '0.8',
    pledgeBandwidthNum: '0'
}
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="https://3188465811-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnv0Qbx2yTtH3TKQFd528%2Fuploads%2FMfgS4zKhGUykezhmi0vN%2F%E6%88%AA%E5%B1%8F2023-12-04%2014.19.44.png?alt=media&amp;token=534b251a-650b-44b7-aefa-c576c9b62a2a" alt=""><figcaption></figcaption></figure>
