# Get delegated resource details (V2)

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/getdelegatedresourcev2

In Stake 2.0, queries detailed information of resource shares delegated from one account to another. Returns amounts staked for BANDWIDTH and ENERGY, and their expiration times if present.


Reference: https://www.alchemy.com/docs/chains/tron/tron-http-api-endpoints/tron-http-api-endpoints/get-delegated-resource-details-v-2

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/getdelegatedresourcev2 \
  --header 'Content-Type: application/json' \
  --data '{
  "fromAddress": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
  "toAddress": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1",
  "visible": true
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    fromAddress: 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g',
    toAddress: 'TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1',
    visible: true
  })
};

fetch('https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/getdelegatedresourcev2', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/getdelegatedresourcev2"

payload = {
    "fromAddress": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
    "toAddress": "TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1",
    "visible": True
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/getdelegatedresourcev2"

	payload := strings.NewReader("{\n  \"fromAddress\": \"TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g\",\n  \"toAddress\": \"TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1\",\n  \"visible\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/getdelegatedresourcev2")
  .header("Content-Type", "application/json")
  .body("{\n  \"fromAddress\": \"TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g\",\n  \"toAddress\": \"TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1\",\n  \"visible\": true\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/getdelegatedresourcev2");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"fromAddress\": \"TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g\",\n  \"toAddress\": \"TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1\",\n  \"visible\": true\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /wallet/getdelegatedresourcev2
method: POST
operation:
  summary: Get delegated resource details (V2)
  description: |
    In Stake 2.0, queries detailed information of resource shares delegated from one account to another. Returns amounts staked for BANDWIDTH and ENERGY, and their expiration times if present.
  tags:
    - Tron HTTP API Endpoints
  security:
    - apiKey: []
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: object
          required:
            - fromAddress
            - toAddress
          properties:
            fromAddress:
              type: string
              description: Base58 address of the account delegating resources.
              example: TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g
            toAddress:
              type: string
              description: Base58 address of the account receiving the delegated resources.
              example: TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1
            visible:
              type: boolean
              description: Indicates if the addresses are in base58 format (true) or hex (false).
              example: true
  responses:
    '200':
      description: Delegated resource details.
      content:
        application/json:
          schema:
            type: object
            properties:
              delegatedResource:
                type: array
                items:
                  type: object
                  properties:
                    from:
                      type: string
                      description: The delegating account address.
                    to:
                      type: string
                      description: The receiving account address.
                    frozen_balance_for_bandwidth:
                      type: integer
                      description: Amount of TRX staked for bandwidth delegation.
                    frozen_balance_for_energy:
                      type: integer
                      description: Amount of TRX staked for energy delegation.
                    expire_time_for_bandwidth:
                      type: integer
                      description: Lock‑up deadline for bandwidth delegation, in ms.
                    expire_time_for_energy:
                      type: integer
                      description: Lock‑up deadline for energy delegation, in ms.
          examples:
            response:
              value:
                delegatedResource:
                  - from: TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g
                    to: TPswDDCAWhJAZGdHPidFg5nEf8TkNToDX1
                    frozen_balance_for_bandwidth: 10000000
                    frozen_balance_for_energy: 5000000
                    expire_time_for_bandwidth: 1763000000000
                    expire_time_for_energy: 1763005000000
```
