# update_site_ai_settings

Source: https://modulify.ai/docs/api/ai/update-site-ai-settings

Turns AI on or off for a site. Monthly caps are set for the whole workspace with update_workspace_spending.

- Title: Turn AI on or off for a site
- Scope: `config:write`
- Access: Makes changes
- Endpoint: `POST /v1/update_site_ai_settings`

The answer is the same as `get_site_ai_settings`. Any member of the workspace whose role has API access can turn AI on or off, like the switch in the **AI** tab.

AI is on from the start for every site. Turning it off makes every AI request of the site answer `403` within a minute, from the live site and the preview alike, so every AI feature of the site stops answering until it is turned back on. The history and the key are kept. The tool tells the client to confirm with you before turning AI off on a published site, because its visitors notice at once. See [Turn AI off and on](https://modulify.ai/docs/built-in/ai#turn-ai-off-and-on).

There is no cap per site. The workspace owner caps what the AI of every site spends together, and everything the workspace spends, in **Spending** > **Settings**, or with `update_workspace_spending`. See [Spending caps and alerts](https://modulify.ai/docs/plans/spending).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/update_site_ai_settings`, 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/update_site_ai_settings \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","enabled":true}'
```

Over MCP, the same method is the [update_site_ai_settings tool](https://modulify.ai/docs/mcp/ai/update-site-ai-settings).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `enabled` | boolean | Yes | True to turn AI on, false to turn it off. |

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