# Create order

## Create order

#### <mark style="color:orange;">`POST`</mark>  `https://api.tronsave.io/v0/buy-energy` <a href="#api-method" id="api-method"></a>

Rate limi&#x74;***: 15** requests per **1** second*

#### Request params <a href="#request-params" id="request-params"></a>

<table><thead><tr><th width="221">Field</th><th width="105">Type</th><th width="91">Required</th><th>Description</th></tr></thead><tbody><tr><td>resource_type</td><td>string</td><td>true</td><td>"ENERGY"</td></tr><tr><td>unit_price</td><td>number</td><td>true</td><td>Price unit is equal to sun.</td></tr><tr><td>allow_partial_fill</td><td>boolean</td><td>true</td><td>Allow the order to be filled partially or not</td></tr><tr><td>target_address</td><td>string</td><td>true</td><td>Resource receiving address</td></tr><tr><td>duration_millisec</td><td>number</td><td>true</td><td>The duration of the bought resource, time unit is equal to millisec.</td></tr><tr><td>tx_id</td><td>string</td><td>true</td><td>Transaction ID</td></tr><tr><td>signed_tx</td><td>SignedTransaction</td><td>true</td><td>Signed transaction, Note that it is a json object<br>(<em>signed_tx in</em> <a href="#step-2-get-signed-transaction"><em><strong>Step 2</strong></em></a>)</td></tr><tr><td>only_create_when_fulfilled</td><td>Boolean</td><td>false</td><td><p>[true]=> order only create when it can be fulfilled</p><p>[false] => order will create even it can not be fulfilled</p><p>Default value: false</p></td></tr><tr><td>max_price_accepted</td><td>Number</td><td>false</td><td>Only create order when the estimate price less than this value.</td></tr><tr><td>add_order_incomplete</td><td>Boolean</td><td>false</td><td><p>[true]=> order only create when there has no same parameters order is not complete in order list</p><p>[false] => order will create even there has no same parameters order is not complete in order list</p><p>Default value: false</p></td></tr></tbody></table>

#### Request params example <a href="#request-params-example" id="request-params-example"></a>

```
{
    "resource_type": "ENERGY",
    "unit_price": 45,
    "allow_partial_fill": true,
    "target_address": "TM6ZeEgpefyGWeMLuzSbfqTGkPv8Z6Jm4X",
    "duration_millisec": 259200000,
    "tx_id": "446eed36e31249b98b201db2e81a3825b185f1a3d8b2fea348b24fc021e58e0d",
    "signed_tx": {
      "visible": false,
      "txID": "446eed36e31249b98b201db2e81a3825b185f1a3d8b2fea348b24fc021e58e0d",
      "raw_data": {
        "contract": [
          {
            "parameter": {
              "value": {
                "amount": 13500000,
                "owner_address": "417a0d868d1418c9038584af1252f85d486502eec0",
                "to_address": "41055756f33f419278d9ea059bd2b21120e6add748"
              },
              "type_url": "type.googleapis.com/protocol.TransferContract"
            },
            "type": "TransferContract"
          }
        ],
        "ref_block_bytes": "0713",
        "ref_block_hash": "6c5f7686f4176139",
        "expiration": 1691465106000,
        "timestamp": 1691465046758
      },
      "raw_data_hex": "0a02071322086c5f7686f417613940d084b5999d315a68080112640a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412330a15417a0d868d1418c9038584af1252f85d486502eec0121541055756f33f419278d9ea059bd2b21120e6add74818e0fcb70670e6b5b1999d31",
      "signature": ["xxxxxxxxx"]
    },
    "only_create_when_fulfilled":false,
    "max_price_accepted":200,
    "add_order_incomplete":false
}
```

#### Responses <a href="#responses" id="responses"></a>

```
{
    "message": "651d2306e55c073f6ca0992e" //order_id
}
```
