# Get Internal Account Order History

To use this feature, you must have the API key. Read [here](/developer/get-api-key.md) to view how to get our API key

## Get order history by API key

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

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

Get many orders sorted by creation time. Default: return 10 newest orders

#### Query Parameters

<table><thead><tr><th width="192">Name</th><th width="182">Type</th><th>Description</th></tr></thead><tbody><tr><td>page</td><td>Integer</td><td>start from 0. Default:0</td></tr><tr><td>pageSize</td><td>Integer</td><td>default: 10</td></tr></tbody></table>

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

<pre class="language-json"><code class="lang-json"><strong>{
</strong><strong>   data:{
</strong>     id: string, // id of order
     requester: string, // the address represents for order owner
     target: string, // the address that is received resource 
     resource_amount: number, // the amount of resource
     resource_type: string, // the amount type is "ENERGY"
     remain_amount: number, // the remaining amount can matching by the system
     price: number, // price unit is equal to sun
     duration: number, // rent duration, duration unit is equal to second
     allow_partial_fill: boolean, //Allow the order to be filled partially or not
     payout_amount: number, // Total payout of this order
     fulfilled_percent: number, //The percent that shows filling processing. 0-100
     matched_delegates:{ //All matched delegate for this order
       delegator: string // The address that delegates resources for the target address
       amount: number //The amount of resource was delegated
       txid: number // The transaction id in on-chain 
     }[]
   } [],
   total:number
}
</code></pre>

{% endtab %}
{% endtabs %}

*Example*&#x20;

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

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

{% endtab %}

{% tab title="Success Response" %}

```json
{
    "data": [
        {
            "id": "651d0e5d8248d002ea08a231",
            "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "resource_amount": 100000,
            "resource_type": "ENERGY",
            "remain_amount": 100000,
            "price": 45,
            "duration": 259200,
            "allow_partial_fill": false,
            "payout_amount": 4500000,
            "fulfilled_percent": 100,
            "matched_delegates": [
                {
                    "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                    "amount": 100000,
                    "txid": "transaction_id_1"
                }
            ]
        },
        {
            "id": "651d2306e55c073f6ca0992e",
            "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "resource_amount": 100000,
            "resource_type": "ENERGY",
            "remain_amount": 0,
            "price": 67.5,
            "duration": 3600,
            "allow_partial_fill": true,
            "payout_amount": 6750000,
            "fulfilled_percent": 100,
             "matched_delegates": [
                {
                    "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                    "amount": 100000,
                    "txid": "transaction_id_2"
                }
            ]
        }
    ],
    "total": 2
}
```

{% endtab %}
{% endtabs %}

*Example Code*

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

```javascript
const GetOrderHistory = async (api_key) => {
    const url = "https://api.tronsave.io/v0/orders"
    const data = await fetch(url, {
        headers: {
            'apikey': api_key
        }
    })
    const response = await data.json()
    /**
     * Example response
     * @link https://docs.tronsave.io/buy-energy-on-telegram/using-api-key-to/get-internal-account-order-history 
        {
            "data": [
                {
                    "id": "651d0e5d8248d002ea08a231",
                    "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "resource_amount": 100000,
                    "resource_type": "ENERGY",
                    "remain_amount": 100000,
                    "price": 45,
                    "duration": 259200,
                    "allow_partial_fill": false,
                    "payout_amount": 4500000,
                    "fulfilled_percent": 100,
                    "matched_delegates": [
                        {
                            "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                            "amount": 100000,
                            "txid": "transaction_id_1"
                        }
                    ]
                },
                {
                    "id": "651d2306e55c073f6ca0992e",
                    "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "resource_amount": 100000,
                    "resource_type": "ENERGY",
                    "remain_amount": 0,
                    "price": 67.5,
                    "duration": 3600,
                    "allow_partial_fill": true,
                    "payout_amount": 6750000,
                    "fulfilled_percent": 100,
                    "matched_delegates": [
                        {
                            "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                            "amount": 100000,
                            "txid": "transaction_id_2"
                        }
                    ]
                }
            ],
            "total": 2
        }
     */
    return response
}
```

{% endtab %}

{% tab title="cURL" %}

```powershell
curl --location 'https://api.tronsave.io/v0/orders' \
--header 'apikey: {{apikey}}'
```

{% 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/developer/rest-api-v0/buy-on-rest-api/use-api-key/get-internal-account-order-history.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.
