---
title: Access control
subtitle: Docs not ready to go public, or meant only for partners? Protect the site with a shared password.
description: Access control for ButterIX hosted sites — public and password-protected modes, the visitor experience, what changing the password does, coverage of preview deployments and custom domains, access tokens and MCP sign-in, and visibility to search engines and AI.
---

## Two modes

<CardGroup cols={2}>
  <Card title="Public" icon="lucide:globe">
    Anyone can visit (default).
  </Card>
  <Card title="Password protected" icon="lucide:lock">
    Visitors must enter a shared password first.
  </Card>
</CardGroup>

Switch modes in the site's "Settings → Access control" (requires the admin role), or call [Update access control](/api-reference/sites/update-access):

```bash
curl -X PUT https://api.butterix.com/v1/sites/acme-payments/access \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode":"password","password":"preview-2026"}'
```

<Note>
  Changing access control requires the admin role. Organization API keys act as editor and can't call this endpoint; use the dashboard, or an admin's logged-in session.
</Note>

## Visitor experience

1. Unverified visitors opening any page of the site in a browser see a simple password page (HTTP 401, with `noindex`, following the system light/dark mode). After several wrong attempts they have to wait a moment.
2. After entering the correct password, the platform sets an HttpOnly access cookie (valid for 30 days, with `Secure` over HTTPS) and redirects to the home page.
3. Return visits within 30 days don't ask for the password again.

Passwords must be at least 6 characters; the platform stores only their hash.

## Changing the password and removing protection

- **Changing the password** immediately signs out every visitor and MCP sign-in; [access tokens](#access-tokens) aren't affected.
- If a password was set before, switching from "Public" back to "Password protected" can leave the password empty to reuse the previous one.
- Switching back to "Public" opens the site to everyone immediately.

## Coverage

Password protection applies to **every host** of the site:

| URL | Protected |
|---|---|
| Production URL `<subdomain>-sites.butterix.com` | Yes |
| Preview URL `<subdomain>--<short id>-sites.butterix.com` | Yes |
| Verified custom domains | Yes |
| Static files such as `.md`, `llms.txt`, `sitemap.xml` | Yes |
| Dynamic endpoints: Ask AI, MCP server, playground proxy, feedback | Yes |

Unverified clients can neither see pages nor retrieve content through MCP or Ask AI. Protected sites can't be [embedded](../features/ask-ai-embed.mdx), and their page menu doesn't offer to connect MCP.

## AI tools and programs

Requests that aren't a browser opening a page (`.md`, `llms.txt`, spec files, MCP, or requests that don't ask for HTML) get 401 and a short Markdown explanation when unauthorized, with a `WWW-Authenticate` header on how to sign in. There are two ways to authorize:

### Access tokens

Create an access token in the site's Settings (requires the admin role; the token is shown once) and send it with every request:

```bash
curl https://docs.acme.com/guides/quickstart.md \
  -H "Authorization: Bearer $DOCS_TOKEN"
```

- The same token works for pages, `.md`, `llms.txt`, and the MCP server;
- It can expire (after 1–3650 days) or stay valid;
- A site can have up to 50 and revoke them at any time; the list shows when each was last used;
- Changing the site password doesn't affect tokens.

Connect a protected MCP server in Claude Code:

```bash
claude mcp add --transport http acme-docs https://docs.acme.com/_mcp/server \
  --header "Authorization: Bearer $DOCS_TOKEN"
```

For the matching API see [Access tokens](/api-reference/sites/create-access-token).

### MCP sign-in

MCP clients that support OAuth don't need a token: after adding the MCP URL, the client opens a browser, where the reader enters the site password and clicks Allow. It stays valid for 30 days. After the site password changes, they sign in again.

## Search engines and AI

Protected sites return 401 to crawlers, so they aren't indexed by search engines; AI crawlers and MCP clients without a token or sign-in can't read the content either.

## Finer-grained access control

Currently only a site-wide shared password is supported; per-user login (SSO) and role-based content aren't available yet.
