# Reading statistics from NetoFlow API

The NetoFlow API is a very simple API endpoint that provides client-side statistics from a running NetoFlow instance. By default, the API listens on TCP port 8080. The API is unauthenticated and read-only. For a production deployment, access to the API port on NetoFlow should be restricted by network access, or the API should be disabled if it is not needed.

Per-device statistics are calculated pre-filter and pre-downsample.

## Configuring the NetoFlow API <a href="#configuring-the-netoflow-api" id="configuring-the-netoflow-api"></a>

### `/etc/netoflow.conf` configuration settings <a href="#etcnetoflowconf-configuration-settings" id="etcnetoflowconf-configuration-settings"></a>

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

```
[api]
enabled         = true  # enable or disable the API, default: true
port            = 8080  # port for the API, default: 8080
```

{% endtab %}
{% endtabs %}

### environment variable configuration settings <a href="#environment-variable-configuration-settings" id="environment-variable-configuration-settings"></a>

```
NETO__API__ENABLED=true
NETO__API__PORT=8080
```

For more details on how to modify the configuration of NetoFlow, see [Install NetoFlow (container)](/netoflow-connector/install-container.md) or [Install NetoFlow (Linux package)](/netoflow-connector/install-linux.md).

## Reading statistics with the NetoFlow API <a href="#reading-statistics-with-the-netoflow-api" id="reading-statistics-with-the-netoflow-api"></a>

Read statistics from port 8080 on the NetoFlow host using this endpoint: `/api/v1/stats/rate`

On your local system: `http://localhost:8080/api/v1/stats/rate`

If you cannot access this port when NetoFlow is running, ensure you do not have a local firewall in place that is blocking the port, you have mapped the container port 8080 to a local port if you are using the NetoFlow container, and you have not disabled or changed the port in the NetoFlow configuration.

### Using `curl` to read statistics from NetoFlow running on localhost <a href="#using-curl-to-read-statistics-from-netoflow-running-on-localhost" id="using-curl-to-read-statistics-from-netoflow-running-on-localhost"></a>

`curl localhost:8080/api/v1/stats/rate`

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

```
{
  "code": 200,
  "meta": {
    "count": 1,
    "timems": 0
  },
  "data": {
    "type": "rate stats 1m",
    "instance": null,
    "aggregates": {
      "netflow-filtered": 0,
      "netflow-in": 1034.8078748433154,
      "netflow-out": 1034.8078748433154,
      "nfpktdecerrs": 0,
      "notemplate-all": 0,
      "notemplate-v10": 0,
      "notemplate-v9": 0,
      "sflow-filtered": 0.09559831561527027,
      "sflow-in": 0.18078967640840649,
      "sflow-out": 0.08519136079313624,
      "sfpktdecerrs": 0
    },
    "devices-inflow": [
      {
        "device": "10.0.10.253",
        "flows": 1082.9726620649064
      },
      {
        "device": "192.168.2.253",
        "flows": 0.18944462469620377
      }
    ],
    "devices-outflow": [
      {
        "device": "10.0.10.253",
        "flows": 1082.9726620649064
      },
      {
        "device": "192.168.2.253",
        "flows": 0.08951883493703489
      }
    ]
  }
}
```

{% 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.fusion.vectra.ai/netoflow-connector/reading-statistics.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.
