# Set a domain's inbox-link default

`PUT https://api.mailmasker.org/api/v1/block-link/domains/:domain`

Choose whether accounts on a domain get a "block this address" link, and where it goes.

- Who can use it: Site admins
- Area: Domains and DNS
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/domain-block-link-set

Accounts whose login address is at this domain follow `enabled` unless they have made their own choice; `mode` applies to all of them.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `domain` | path | yes | The domain name. | `example.com` |
| `enabled` | body | yes | true to add the link by default, false for none. | `true` |
| `mode` | body | yes | Where the link goes, `header`, `body` or `both`. | `both` |

## Examples

cURL:

```bash
curl -s -X PUT 'https://api.mailmasker.org/api/v1/block-link/domains/example.com' \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"enabled":true,"mode":"both"}'
```

Perl:

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

my $ua  = Mojo::UserAgent->new;
my $res = $ua->put('https://api.mailmasker.org/api/v1/block-link/domains/example.com',
    { Authorization => "Bearer $ENV{TOKEN}" },
    json => { enabled => \1, mode => 'both' })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

```bash
homelab-cli admin block-link domain set example.com --enabled --mode both
```

## Response

200 OK:

```json
{
  "domain_name": "example.com",
  "enabled": 1,
  "mode": "both",
  "updated_by_email": "you@example.com",
  "updated_at": "2026-11-03 21:42:10.123456-06"
}
```
