# Withdraw an invite

`DELETE https://api.mailmasker.org/api/v1/invites/:id`

Cancel a pending invite, so its link stops working.

- Who can use it: Any signed-in account
- Area: Invites
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/invite-revoke

The invite stays on your list, as revoked, and no longer counts toward your limit of waiting invites. Only a pending invite can be withdrawn.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `id` | path | yes | The invite's `id`, from List your invites. | `12` |
| `user` | query | no | The sender's address, to withdraw an invite someone else sent. Site admins only; anyone else gets 403. |  |

## Good to know

- An invite that isn't yours, or isn't pending any more, answers 404.

## Examples

cURL:

```bash
curl -s -X DELETE 'https://api.mailmasker.org/api/v1/invites/12' \
  -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/invites/12',
    { 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 invite revoke 12
```

## Response

200 OK:

```json
{ "ok": true }
```
