# Cancel a new signing key

`DELETE https://api.mailmasker.org/api/v1/domains/:domain/dkim/:selector`

Throw away a pending key that was never switched to.

- Who can use it: Site admins
- Area: DKIM signing keys
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/dkim-cancel

Removes the key's DNS record and the key itself, and drops it from the list altogether, where a retired key would stay listed.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `domain` | path | yes | The domain. | `example.com` |
| `selector` | path | yes | The pending key's selector. | `20261103a` |

## Good to know

- Only a pending key can be cancelled; any other answers 409, and retire is the way to take it out of use.

## Examples

cURL:

```bash
curl -s -X DELETE 'https://api.mailmasker.org/api/v1/domains/example.com/dkim/20261103a' \
  -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/domains/example.com/dkim/20261103a',
    { Authorization => "Bearer $ENV{TOKEN}" })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

There is no homelab-cli command for this yet.

## Response

200 OK:

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