# set_site_email_sending_domain

Source: https://modulify.ai/docs/api/emails/set-site-email-sending-domain

Chooses the domain a site sends its email from, one of its verified email domains or its built-in sending domain.

- Title: Choose the domain a site sends email from
- Scope: `config:write`
- Access: Makes changes
- Endpoint: `POST /v1/set_site_email_sending_domain`

Pass the domain exactly as `emailDomains.items` in `get_site_email_settings` lists it, or an empty string for the built-in sending domain. Always pass `domain`, even as an empty string, because leaving it out is refused with `Enter a valid domain, such as example.com!`

The part in front of the `@` (`fromLocal`) stays the same, so every later message goes out from that part at the new domain. That resets how mailboxes recognize the site, so the tool tells the client to change it only when you ask.

Only a `verified` domain can be chosen, and any other is refused with `Only a verified email domain can send email!` Should a chosen domain stop being verified later, the site sends from its built-in address until it is verified again, which `fromFallback` reports. Replies to an address on the chosen domain reach that domain's own mailboxes unless receiving is on for it or a reply-to is set.

It needs the **Manage domains** permission and works on every plan, except that a [paused](https://modulify.ai/docs/automations/emails#when-your-plan-ends) domain cannot be chosen and is refused with `Email domains are paused until the workspace is on a paid plan again!` See [Choose the domain the site sends from](https://modulify.ai/docs/automations/emails#choose-the-domain-the-site-sends-from).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/set_site_email_sending_domain`, sending the inputs below as a JSON object. The token needs the `config:write` scope.

It makes changes, so send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.

```bash
curl -X POST https://api.modulify.ai/v1/set_site_email_sending_domain \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'
```

Over MCP, the same method is the [set_site_email_sending_domain tool](https://modulify.ai/docs/mcp/emails/set-site-email-sending-domain).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `domain` | string | No | A verified email domain of the site, as `emailDomains.items` lists it, or an empty string to send from the built-in sending domain. Always pass it, because leaving it out is refused. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.