# List your sessions

`GET https://api.mailmasker.org/api/v1/auth/sessions`

Every place you are signed in, the newest first.

- Who can use it: Any signed-in account
- Area: Sessions
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/list-sessions

Each session shows the program it came from (`user_agent`), the network address it signed in from, and when it began (`first_seen_at`), which stays put however often it refreshes. `expires_at` is when its current token runs out, `current` marks the session making this call, and `jti` is the id to end it by.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `user` | query | no | Another account's address, to list its sessions instead. Site admins only; anyone else gets 403. |  |

## Good to know

- A session whose token has run out isn't listed, though it can still refresh and come back. Signing out your other sessions ends those too.

## Examples

cURL:

```bash
curl -s 'https://api.mailmasker.org/api/v1/auth/sessions' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

```perl
use Mojo::Base -strict;
use Mojo::UserAgent;

my $ua  = Mojo::UserAgent->new;
my $res = $ua->get('https://api.mailmasker.org/api/v1/auth/sessions',
    { Authorization => "Bearer $ENV{TOKEN}" })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

```bash
homelab-cli sessions list
```

## Response

200 OK:

```json
[
  {
    "jti": "7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f",
    "user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0",
    "ip_address": "203.0.113.7",
    "first_seen_at": "2026-11-03 21:40:02.654321-06",
    "expires_at": "2026-11-04 21:40:02.654321-06",
    "current": true
  },
  {
    "jti": "c41ac41ac41ac41ac41ac41ac41ac41ac41ac41ac41ac41ac41ac41ac41ac41a",
    "user_agent": "homelab-cli/0.1.0 (Linux 6.8.0-49-generic)",
    "ip_address": "198.51.100.23",
    "first_seen_at": "2026-11-01 09:15:42.246810-06",
    "expires_at": "2026-11-04 08:05:31.135792-06",
    "current": false
  }
]
```
