> For the complete documentation index, see [llms.txt](https://docs.serenicity.fr/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.serenicity.fr/api/reference/api-reference/flux.md).

# Flux

{% hint style="info" %}
For all flux queries, you have a pagination that allows you to retrieve the data.
{% endhint %}

```json
"meta": {
    "total": 122170,
    "per_page": 100,
    "current_page": 1,
    "last_page": 1222,
    "first_page": 1
},
```

{% hint style="warning" %}
Fields with \* are required.
{% endhint %}

## Get all flux of a sensor between two dates.

<mark style="color:blue;">`GET`</mark> `https://api.control.serenicity.fr/api/v1/sensors/:sensor_id/flux`

Return list of flux. Filtering options are available.

#### Path Parameters

| Name                                         | Type | Description |
| -------------------------------------------- | ---- | ----------- |
| sensor\_id<mark style="color:red;">\*</mark> | 1    |             |

#### Query Parameters

| Name                                   | Type                 | Description                                                                            |
| -------------------------------------- | -------------------- | -------------------------------------------------------------------------------------- |
| from<mark style="color:red;">\*</mark> | 2022-01-01T00:00:00Z | Start date in ISO format                                                               |
| to<mark style="color:red;">\*</mark>   | 2022-02-01T00:00:00Z | End date in ISO format                                                                 |
| ip0                                    | 192.168.1.1          | Filter with private IP/device                                                          |
| ip1                                    | 1.1.1.1              | Filter with public IP                                                                  |
| protocol                               | TCP                  | Filter on specific protocol                                                            |
| port                                   | 22                   | Filter on specific port                                                                |
| mac\_address                           | 00:15:5d:86:eb:5f    | Filter on specific mac\_address                                                        |
| only\_toxic                            | true                 | Filter only toxic flux                                                                 |
| only\_in                               | true                 | Filter only ingoing flux                                                               |
| only\_out                              | true                 | Filter only outgoing                                                                   |
| sort\_by                               | ip0                  | Sort by specific field. One of : `ip0, ip1, startOfHour, sumFlux, dir, protocol, port` |
| sort\_desc                             | true                 | Sort desc according to sort by param                                                   |
| page                                   | 1                    | By default 1. The page has to be between `last_page` *and* `first_page`.               |
| per\_page                              | 100                  | Number of flux per page. 100 by default.                                               |

{% tabs %}
{% tab title="200: OK List of flux" %}

```javascript
{
    "meta": {
        "total": 122170,
        "per_page": 100,
        "current_page": 1,
        "last_page": 1222,
        "first_page": 1
    },
    "data": [
        {
            "start_of_hour": "2024-07-23T07:00:00.000Z",
            "ip0": "192.168.1.10",
            "ip1": "3.219.173.44",
            "dir": "OUT",
            "protocol": "TCP",
            "port": 443,
            "occurrences": 1,
            "duration": {
                "minutes": 35,
                "seconds": 10,
                "milliseconds": 13
            },
            "timestamps": [
                [
                    "2024-07-23T07:14:01.854Z",
                    "2024-07-23T07:49:11.867Z"
                ]
            ],
            "last_netbios": "TV",
            "netbios_list": [
                "TV"
            ],
            "last_mac_address": "d8:e0:e1:69:d8:df",
            "mac_address_list": [
                "d8:e0:e1:69:d8:df"
            ],
            "out_flux": "1260",
            "in_flux": "0",
            "filtered": false,
            "toxic": false,
            "bruteforce": false,
            "command_center": false,
            "hcard": false,
            "military": false,
            "tor_node": false,
            "trojan": false,
            "sip": false,
            "supply_chain_compromise": false,
            "video": false,
            "custom_ip0": {
                "id": 1341,
                "sensor_id": 54,
                "ip0": "192.168.1.10",
                "name": "Télé salon",
                "icon": "i-lucide-monitor-smartphone",
                "is_critical": false,
                "category": null,
                "created_at": "2024-02-12T18:17:28.561946+01:00",
                "updated_at": "2024-08-01T16:25:11.408+02:00"
            },
            "vendor": "Samsung Electronics Co.,Ltd"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

#### Query Parameters


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.serenicity.fr/api/reference/api-reference/flux.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
