# remove_www_domain

Source: https://modulify.ai/docs/api/domains/remove-www-domain

Detaches only the www companion of one custom domain, leaving that domain and every other domain of the site connected.

- Title: Remove the www companion domain
- Scope: `config:write`
- Access: Destructive
- Endpoint: `POST /v1/remove_www_domain`

It permanently deletes the companion and its TLS certificate, so visitors who type that www address stop reaching the site straight away, and adding it back starts the DNS and certificate work again from scratch. The tool tells the client to confirm with you before calling it.

When the domain is itself the www hostname, because its root was removed, its companion is the root, so this removes the root. A domain without a companion is refused with `example.com does not have a WWW variant!` It needs the **Manage domains** permission in the workspace. See [Removing one of them](https://modulify.ai/docs/publish/www-and-apex#removing-one-of-them).

## Request

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

> **Warning**
>
> This method is marked destructive: it deletes or overwrites data. Check the inputs before you call it, and send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it.

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

Over MCP, the same method is the [remove_www_domain tool](https://modulify.ai/docs/mcp/domains/remove-www-domain).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `workspaceId` | string | Yes | The workspace the site belongs to. |
| `domainId` | string | Yes | The `_id` of the custom domain whose www companion to remove, as `get_domain_status` or `add_custom_domain` returned it. |

## 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.