# Metrics

An essential part of managing a wallet is UTXO state management. The Relysia infrastructure is a native peer to peer system that continuously keeps track of its own UTXOs. Since we support classic addresses and transactions from external parties, we automatically run transaction listeners to always keep wallets in sync with the blockchain.

```javascript
var parameters = { serviceId: 'optional',
    walletID: 'optional',
}

const response = await relysia.wallet.v1.metrics(parameters);
```

## Get the latest wallet UTXO state.

<mark style="color:blue;">`GET`</mark> `https://api.relysia.com/v1/metrics`

UTXOs are the base unit of transactions in the Bitcoin network. The metrics endpoint first updates the last UTXO state, and then shows a detailed output of each UTXO in the wallet.

#### Headers

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| walletID | string |             |

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

```javascript
{
  "statusCode": 200,
  "data": {
    "status": "success",
    "msg": "operation completed successfully !",
    "data": {
      "balance": 248542,
      "userUtxos": [
        {
          "height": 757221,
          "tx_pos": 0,
          "tx_hash": "39c1cbaee9cb45600fb07240f394c1f69erd456d81df8c5f5f132661426b32d8",
          "value": 100,
          "script": "76a914ec83f1fb2c52dbd7d2b4c70cf95150560d611b9088ac",
          "path": "m/44'/0'/0'/0/0",
          "address": "1NZaXzJHBLTqeBXn45AvkoPCkbwatizeCW"
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
You can force refresh the UTXO state by calling the metrics function
{% endhint %}

{% hint style="warning" %}
When refreshing the UTXO state less than 15 seconds after last transaction was submitted, it is likely that miners (such as TAAL) haven't indexed the current state. A force refresh would thus sync an out of date UTXO and it is therefore not advisable to regularly force refresh the UTXO state.&#x20;
{% endhint %}


---

# 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.relysia.com/wallets/metrics.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.
