# Authentication

Send your credential in the authorization header for HTTP and MCP requests:

```http
Authorization: Bearer YOUR_API_KEY
```

Keep keys in server-side secrets or your MCP client's secret storage. Create separate credentials for separate integrations and environments. Replace a key in the integration before revoking its predecessor.

## Create your API key

API keys are self-service from your Site Star account. Your normal account also serves as your developer account; no separate developer account is required.

1. Sign up or sign in to Site Star.
2. Open your account page, then **Access**.
3. Create an API key with **Entire account** selected.
4. Save the key when it is shown. Use the same key with the HTTP API or an MCP client.

An account-level key supports the published API capabilities across the account, including creating sites and managing existing sites, subject to its permission scopes. For a dedicated single-site integration, select that site instead. Keys created from a site's Access area are bound to that site. Keep keys out of source control and logs.

API keys and OAuth are distinct credential flows. The endpoints accept API keys or supported OAuth tokens, but a generic MCP client can use the bearer-key configuration in the [MCP guide](/api/mcp). The current OAuth registration configuration requires a site binding; use an account-level API key for account-wide automation.

## Context and permissions

| Credential | Context and use |
| --- | --- |
| Account | Permitted operations across one account; use for site creation |
| Site | Permitted operations restricted to one existing site |

The server derives the account namespace and user identity from the credential. Do not send `namespace`, `userId`, or other identity fields in operation input. On HTTP, supply the site ID in the documented path or query; a site-bound key remains restricted even when another site ID is supplied.

Permission scopes and site binding are separate. The default `api-user` role grants the published product-operation scopes and selected record scopes. The [operation reference](/reference/operations) lists required permissions for narrower credentials. Build approval, build revision requests, change decisions, and notification-preference writes require a credential carrying an authenticated Site Star user identity; a bare system credential cannot substitute a user ID in the body.

## MCP site binding

For a site-bound key, the server supplies the tool's bound `siteId` (or `id` for site-record operations). Omit that bound argument. For an account key, supply site identifiers explicitly as required by the discovered tool schema. `tools/list` is authoritative for your connection.

`list_sites` returns the one bound site for a site credential, or the account's sites for an account credential. Use an account-level key for `create_site`; site binding does not grant account-level permission.

## Revocation and permission failures

Disable or revoke credentials that are no longer needed. API Gateway's authorization cache can delay enforcement; revocation is not necessarily immediate.

For `401` or `403`, check the key's status, account standing, site binding, user identity, and scopes. Do not retry a permission failure indefinitely. See [errors and retries](/api/errors).
