# Switch Inbox Insights on or off for a sending domain

`PATCH /v1/email/inbox-insights/domains/{sending_domain}`

Changes the workspace's monitoring preference for one of its verified sending
domains. Enabling enrolls the domain with eDataSource before saving the preference.
Disabling removes the preference without removing vendor enrollment or history.
Report reads remain available for verified owned domains regardless of this setting.

A domain switched on for the first time has to be measured before it has
anything to report, so its results start empty and fill in as its mail is
seen. Switching off keeps everything measured so far: switching the domain
back on restores it in full and takes effect immediately, rather than starting
the domain over.

Setting the value it already has changes nothing and answers normally, so this
is safe to repeat.

API-key and service-account calls require Insights preview access for your organization.

## Code samples

### TypeScript

```ts
// Requires Insights preview access for the organization.
let sendingDomain: string | undefined;
for await (const domain of bird.email.inboxInsights.domains.list({ search: "mail.example.com" })) {
  if (domain.domain === "mail.example.com") { sendingDomain = domain.domain; break; }
}
if (!sendingDomain) throw new Error("Verify mail.example.com in this workspace first");
const report = await bird.email.inboxInsights.domains.update(sendingDomain, { monitored: false });
console.log(report.monitored);
```

### Python

```py
# Requires Insights preview access for the organization.
sending_domain = None
for domain in client.email.inbox_insights.domains.list(search="mail.example.com"):
    if domain.domain == "mail.example.com":
        sending_domain = domain.domain
        break
if sending_domain is None:
    raise ValueError("Verify mail.example.com in this workspace first")
report = client.email.inbox_insights.domains.update(sending_domain, monitored=False)
print(report.monitored)
```

### Go

```go
// Requires Insights preview access for the organization.
client, err := bird.NewClient(option.WithAPIKey(os.Getenv("BIRD_API_KEY")))
if err != nil {
	log.Fatal(err)
}
ctx := context.Background()
sendingDomain := ""
for domain, err := range client.Email.InboxInsights.Domains.List(ctx, bird.EmailInboxInsightsDomainsListParams{Search: "mail.example.com"}) {
	if err != nil {
		log.Fatal(err)
	}
	if domain.Domain != nil && *domain.Domain == "mail.example.com" {
		sendingDomain = *domain.Domain
		break
	}
}
if sendingDomain == "" {
	log.Fatal("Verify mail.example.com in this workspace first")
}
report, err := client.Email.InboxInsights.Domains.Update(ctx, sendingDomain, bird.EmailInboxInsightsDomainsUpdateParams{Monitored: bird.Bool(false)})
if err != nil {
	log.Fatal(err)
}
encoded, err := json.MarshalIndent(report, "", "  ")
if err != nil {
	log.Fatal(err)
}
fmt.Println(string(encoded))
```

### PHP

```php
// Requires Insights preview access for the organization.
$sendingDomain = null;
foreach ($bird->email->inboxInsights->domains->list(['search' => 'mail.example.com']) as $domain) {
    if ($domain->getDomain() === 'mail.example.com') {
        $sendingDomain = $domain->getDomain();
        break;
    }
}
if ($sendingDomain === null) {
    throw new \RuntimeException('Verify mail.example.com in this workspace first');
}
$params = (new \MessageBird\Wire\Model\EmailInboxInsightsDomainUpdate())->setMonitored(false);
$report = $bird->email->inboxInsights->domains->update($sendingDomain, $params);
var_dump($report->getMonitored());
```

### CLI

```sh
bird email inbox-insights domains update <sending-domain> \
  --monitored=true
```

### cURL

```sh
curl -X PATCH "https://us1.platform.bird.com/v1/email/inbox-insights/domains/{sending_domain}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "monitored": true
  }'
```

## Example response `200`

```json
{
  "domain": "mail.acme.com",
  "monitored": true
}
```

## Path parameters

- `sending_domain` (string): The sending domain to change, exactly as it appears in your sending domains. A domain that is not verified in this workspace answers not-found.

## Request body

- `monitored` (boolean, required): Whether the workspace wants this domain monitored. Enabling enrolls it with eDataSource; disabling removes only the workspace preference and preserves vendor enrollment and measurement history. Verified ownership governs report access.

## Response body

- `domain` (string, required): The sending domain, lowercased, as it appears in your sending domains.
- `monitored` (boolean, required): Whether Inbox Insights reports on this domain. Switching it off stops the reporting and keeps the measurement history, so switching it back on restores the full history rather than starting again.

## Related resources

- [Should I use a Bird SDK or call the API directly?](/explained/platform/should-i-use-an-sdk-or-call-the-api-directly) (answer)
- [Build your first integration](/learn/paths/integration) (course)
- [Send your first email](/docs/get-started/send-your-first-email) (docs)

[Get an implementation brief](/learn/workspace?topic=api-basics)
