# Sign out your other sessions

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

End every session but this one, or every one including it.

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

Ends your sessions all at once, along with their refresh tokens, including any whose token has run out but could still refresh. With `except_current=true` the session making this call stays signed in; with `false` it ends too, which signs you out everywhere. `revoked` is how many sessions ended.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `except_current` | query | yes | true to keep the session making this call, false to end it too. There is no default. | `true` |

## Good to know

- Leaving out except_current, or sending anything but true or false, answers 400.
- It only ever ends your own sessions.

## Examples

cURL:

```bash
curl -s -X DELETE 'https://api.mailmasker.org/api/v1/auth/sessions?except_current=true' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

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

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

homelab-cli:

```bash
homelab-cli sessions revoke --all-others
```

## Response

200 OK:

```json
{ "ok": true, "revoked": 2 }
```
