# check_subdomain_available

Source: https://modulify.ai/docs/api/sites/check-subdomain-available

Checks whether a free modulify.website subdomain is still available before change_subdomain takes it.

- Title: Check a free subdomain is available
- Scope: `sites:read`
- Access: Read only
- Endpoint: `POST /v1/check_subdomain_available`

The subdomain is the free public web address of a site, which it holds whether or not it is published, and it is how a site is identified everywhere else. The check answers `ok` when the subdomain is free and `not-ok` when it is taken.

The answer is platform-wide, since a subdomain is unique across all of Modulify, and the `projectId` only says which workspace the call belongs to. Testing the address the site already holds reports it as taken, because the check cannot tell that the holder is you, and a deleted site keeps holding its subdomain.

A subdomain that breaks the rules `change_subdomain` applies, on length, characters or reserved words, comes back as an error rather than as taken. See [Your free web address](https://modulify.ai/docs/publish/your-web-address#availability).

## Request

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

It only reads and changes nothing, so retrying it is safe.

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

Over MCP, the same method is the [check_subdomain_available tool](https://modulify.ai/docs/mcp/sites/check-subdomain-available).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. It only decides which workspace the call belongs to. |
| `subdomain` | string | Yes | The subdomain to test, without the `.modulify.website` suffix. |

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