> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beliefstate.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API authentication

> Choose REST API keys or MCP OAuth and protect credentials.

## Choose an authentication path

Choose where the credential can be kept safely.

<CardGroup cols={2}>
  <Card title="AI client" icon="robot" href="/guides/mcp-server" cta="Connect an AI" arrow>
    Use browser sign-in with OAuth in a supported AI client.
  </Card>

  <Card title="Trusted code" icon="code" href="/quickstart" cta="Read quickstart" arrow>
    Use a Bearer API key in a server, notebook, or local agent.
  </Card>
</CardGroup>

Local agents can also use [device authorization](https://beliefstate.ai/auth.md). Check [supported AI clients](https://beliefstate.ai/agents) before choosing OAuth.

## REST API keys

Send the revocable secret in the Authorization header on every protected request.

```text theme={null}
Authorization: Bearer $BELIEFSTATE_API_KEY
```

Keep the key server-side. BeliefState stores only its hash and cannot show the full value again.

## MCP OAuth

The client discovers BeliefState's authorization metadata and opens browser sign-in and consent.

Each client gets its own user-owned, revocable grant. Never paste an API key into a retail AI chat.

* [Connect a supported AI client](https://beliefstate.ai/agents)

## Recovery

Revoke a suspected leaked key immediately, then create a replacement through the same approved flow. Never reuse a leaked key.

* [Manage API keys](https://beliefstate.ai/account#api-keys)
* [Manage AI connections](https://beliefstate.ai/account/connections)

## Agent feedback

Report unclear, stale, or incorrect documentation through [BeliefState support](https://beliefstate.ai/contact). Include this page URL and the smallest reproducible detail.

*Last updated: 2026-09-04 · API version: v1 (Latest) · OpenAPI publication: 2026-09-13.*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.