# Sign out

`POST https://api.mailmasker.org/api/v1/auth/logout`

End the session a refresh token belongs to.

- Who can use it: Anyone, with no sign-in
- Area: Sign-in and tokens
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/sign-out

The refresh token stops working, and so does that session's token, at once rather than when it would have run out. Your other sessions, on other devices or in other apps, stay signed in; "Sign out your other sessions" ends those.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `refresh_token` | body | yes | The refresh token of the session to end. | `$REFRESH_TOKEN` |

## Good to know

- The answer is the same for a refresh token that was already signed out, or never existed.

## Examples

cURL:

```bash
curl -s -X POST 'https://api.mailmasker.org/api/v1/auth/logout' \
  -H 'Content-Type: application/json' \
  -d "{\"refresh_token\":\"$REFRESH_TOKEN\"}"
```

Perl:

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

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

homelab-cli:

```bash
homelab-cli logout
```

## Response

200 OK:

```json
{ "success": true }
```
