# 获取单个订单详情

要使用此功能，您必须拥有 API 密钥。请阅读[**这里**](/chinese/developer/get-api-key.md)以了解如何获取我们的 API 密钥。

## 通过 API 密钥获取一个订单的详细信息

<mark style="color:blue;">`GET`</mark> `https://api.tronsave.io/v2/orders/:id`

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

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

```json
{
    "error": false,
    "message": "Success",
    "data": {
        "id": string, // 订单 ID
        "requester": string, // 代表订单所有者的地址
        "receiver": string, // 接收资源的地址
        "resourceAmount": number, // 资源数量
        "resourceType": string, // 资源类型，可以是 "ENERGY" 或 "BANDWIDTH"
        "remainAmount": number, // 系统可以匹配的剩余数量
        "price": number, // 价格，单位为 SUN
        "durationSec": number, // 租赁时长，单位为秒
        "orderType": string, // 订单类型，"NORMAL" 或 "EXTEND"
        "allowPartialFill": boolean, // 是否允许部分匹配
        "payoutAmount": number, // 订单的总支付金额
        "fulfilledPercent": number, // 显示填充进度的百分比，范围 0-100
        "delegates": [ // 所有匹配的委托人
            {
                "delegator": string, // 为目标地址委托资源的地址
                "amount": number, // 委托的资源数量
                "txid": number // 链上交易 ID
            }
        ]
    }
}

```

{% endtab %}
{% endtabs %}

**例子&#x20;*****(Example)***

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

```json
{
  "apikey": <YOUR_API_KEY>
}
```

{% endtab %}

{% tab title="Success Response" %}

```javascript
{
    "error": false,
    "message": "Success",
    "data": {
        "id": "6819c7578729a45600f740d1",
        "requester": "TFwUFWr3QV376677Z8VWXxGUAMFSSSSSS",
        "receiver": "TFwUFWr3QV376677Z8VWXxGUAMFSSSSSSS",
        "resourceAmount": 32000,
        "resourceType": "ENERGY",
        "remainAmount": 0,
        "price": 90,
        "durationSec": 300,
        "orderType": "NORMAL",
        "allowPartialFill": false,
        "payoutAmount": 2880000,
        "fulfilledPercent": 100,
        "delegates": [
            {
                "delegator": "THnnMCe67VMDXoivepiA7ZQSB888888",
                "amount": 32000,
                "txid": "19d3fa76a722d6d6e671e6141eb8057760d38d42b353153a3825f19a7d34326f"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

***Example code:***

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

```javascript
const GetOneOrderDetails = async (api_key, order_id) => {
    const url = `${TRONSAVE_API_URL}/v2/order/${order_id}`
    const data = await fetch(url, {
        headers: {
            'apikey': api_key
        }
    })
    const response = await data.json()
    /**
     * Example response 
        {
            "error": false,
            "message": "Success",
            "data": {
                "id": "680b3e9939...600b7734d",
                "requester": "TTgMEAhuzPch...nm2tCNmqXp13AxzAd",
                "receiver": "TAk6jzZqHwNU...yAE1YAoUPk7r2T6h",
                "resourceAmount": 32000,
                "resourceType": "ENERGY",
                "remainAmount": 0,
                "price": 91,
                "durationSec": 3600,
                "orderType": "NORMAL",
                "allowPartialFill": false,
                "payoutAmount": 2912000,
                "fulfilledPercent": 100,
                "delegates": [
                    {
                        "delegator": "TQ5VcQjA7w...Pio485UDhCWAANrMh",
                        "amount": 32000,
                        "txid": "b200e8b7f9130b67ff....403c51d6f7a92acc7c4618906c375b69"
                    }
                ]
            }
        }
     */
    return response
}
```

{% endtab %}

{% tab title="PHP" %}

```php
function getOrderDetails(string $orderId): array {
    $url = TRONSAVE_API_URL . "/v2/order/" . $orderId;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'apikey: ' . API_KEY
    ]);
    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}
```

{% endtab %}

{% tab title="Python" %}

```python
def get_order_details(order_id: str) -> Dict[str, Any]:
    """Get order details"""
    url = f"{TRONSAVE_API_URL}/v2/order/{order_id}"
    headers = {'apikey': API_KEY}
    
    response = requests.get(url, headers=headers)
    return response.json()
```

{% endtab %}
{% endtabs %}


---

# 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/buy-resources-v2/use-api-key/get-one-order-details.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.
