# The `api/sql/stat/sessions` Resource

> The `api/sql/stat/sessions` resource displays statistics for current SQL sessions.

> ### For an overview see page eXtremeDB Web Service Resources

> With the REST server started (listening on port 8083), the following http request will display statistics for SQL client sessions:

>         http://localhost:8083/api/sql/stat/sessions

> For example, the page would appear like the following:

>         {
>             "sessions":
>             [
>                 {
>                     "clientid": -1,
>                     "client_type": "interactive",
>                     "connected": 1,
>                     "begin_time": 1523278397728268,
>                     "end_time": 0,
>                     "idle_time": 2354789,
>                     "ip": "0:0:0:0:0:0:0:0",
>                     "port": 0,
>                     "memory": 0
>                 },
>             ]
>         }

> ## Session Statistics

> The `sessions` array displays the following statistics for each session:

> clientid | The Id of the client
> client_type | The type of client session
> connected | The client status: 1 = connected, 0 = disconnected
> begin_time | The session start timestamp
> end_time | The session end timestamp (0 if the session is still active)
> idle_time | Idle time, i.e. the time elapsed since the last query was executed (ms)
> ip | The client IP address
> port | The client port
> memory | The peak memory consumption

> ## Removal of Sessions from the Session History

> Sessions can be removed from the session history using the HTTP DELETE method on the `api/sql/stat/sessions` endpoint. Session Ids to be removed are passed using the `ids` query parameter. For example:

>         DELETE /api/sql/stat/sessions?ids=118929065126869

> It is prudent to keep the number of Ids in a single request under a reasonable number (less than 100).

> This request returns a JSON array named `failed` with the Ids of the sessions that could not be removed (which means that the UDF `xsql_session_clear()` returned false). For example:

>         {
>             "failed":
>             [
>                 118929065126870,
>                 118929065126871
>             ]
>         }

> If all sessions are cleared successfully, the failed array is empty:

>         {
>             "failed":
>             [
>             ]
>         }