[[sessions]]
= Sessions (`sessions`)

The `sessions` endpoint provides information about the application's HTTP sessions that
are managed by Spring Session.



[[sessions-retrieving]]
== Retrieving Sessions

To retrieve the sessions, make a `GET` request to `/actuator/sessions`, as shown in the
following curl-based example:

include::{snippets}sessions/username/curl-request.adoc[]

The preceding examples retrieves all of the sessions for the user whose username is
`alice`.

The resulting response is similar to the following:

include::{snippets}sessions/username/http-response.adoc[]



[[sessions-retrieving-query-parameters]]
=== Query Parameters

The endpoint uses query parameters to limit the sessions that it returns. The following
table shows the single required query parameter:

[cols="2,4"]
include::{snippets}sessions/username/request-parameters.adoc[]



[[sessions-retrieving-response-structure]]
=== Response Structure

The response contains details of the matching sessions. The following table describes the
structure of the response:

[cols="3,1,3"]
include::{snippets}sessions/username/response-fields.adoc[]



[[sessions-retrieving-id]]
== Retrieving a Single Session

To retrieve a single session, make a `GET` request to `/actuator/sessions/\{id}`, as
shown in the following curl-based example:

include::{snippets}sessions/id/curl-request.adoc[]

The preceding example retrieves the session with the `id` of
`4db5efcc-99cb-4d05-a52c-b49acfbb7ea9`. The resulting response is similar to the
following:

include::{snippets}sessions/id/http-response.adoc[]



[[sessions-retrieving-id-response-structure]]
=== Response Structure

The response contains details of the requested session. The following table describes the
structure of the response:

[cols="3,1,3"]
include::{snippets}sessions/id/response-fields.adoc[]



[[sessions-deleting]]
== Deleting a Session

To delete a session, make a `DELETE` request to `/actuator/sessions/\{id}`, as shown in
the following curl-based example:

include::{snippets}sessions/delete/curl-request.adoc[]

The preceding example deletes the session with the `id` of
`4db5efcc-99cb-4d05-a52c-b49acfbb7ea9`.
