# 创建订单

## 创建订单

### [Buy API (Postman)](https://www.postman.com/tronsave/tronsave/request/q6ml25s/3)

**API Method:**&#x20;

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

速率限制 (Rate limit): 每1秒15个请求。

**请求参数 (Request params):**

<table><thead><tr><th width="178.33333333333331">域</th><th width="72">地点</th><th width="171">类型</th><th width="92">必需</th><th>描述</th></tr></thead><tbody><tr><td>resource_type</td><td>body</td><td>string</td><td>true</td><td>"ENERGY"</td></tr><tr><td>unit_price</td><td>body</td><td>number</td><td>true</td><td>填写价格以Sun为单位</td></tr><tr><td>allow_partial_fill</td><td>body</td><td>boolean</td><td>true</td><td>允许订单部分匹配或整体匹配。</td></tr><tr><td>target_address</td><td>body</td><td>string</td><td>true</td><td>资源接收者的地址。</td></tr><tr><td>duration_millisec</td><td>body</td><td>number</td><td>true</td><td>购买资源的持续时间, 时间单位等于毫秒</td></tr><tr><td>tx_id</td><td>body</td><td>string</td><td>true</td><td>从第2步的已签名交易获取的交易ID</td></tr><tr><td>signed_tx</td><td>body</td><td>SignedTransaction</td><td>true</td><td>已签名交易，请注意它是第2步中的JSON对象响应 (<a href="/pages/BNeWfKAe9TBO1jVApaMT">signed_tx ->步骤2</a> )</td></tr></tbody></table>

**请求参数示例 (Request params example):**

```java
{
    "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"]
    }
}
```

**回应 (Responses):**

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tronsave.io/chinese/developer/rest-api-v0/buy-on-rest-api/use-signed-transaction/create-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
