# Authentication

URL: https://heaven.dev/docs/reference/authentication
Updated: 2026-11-22

A credential says who is making a request, and can limit what that request is allowed to do. Your [access](https://heaven.dev/docs/access) to the resource still applies.

## Credentials

| Credential | What it authorizes |
| --- | --- |
| API key | A key created for an organization acts with your permissions there, bounded by its allowed commands and resource scope. See [API keys](https://heaven.dev/docs/keys#api-keys). |
| Sign-in | A dashboard, CLI or agent sign-in acts with your permissions. See [Keys and sign-ins](https://heaven.dev/docs/keys). |
| SSH key | A registered public key can open Computer sessions within its scope. An unrestricted key can also run management commands. See [SSH keys](https://heaven.dev/docs/keys#ssh-keys). |

The request's reference page identifies any credential requirements. Every API key can read the [command catalog](https://heaven.dev/docs/reference/command/view).

## HTTP API

Send the API key in the `Authorization: Bearer …` header. The API also accepts a sign-in key, a website sign-in token or a bearer token signed with an unrestricted registered SSH key. The dashboard uses its signed-in browser session. Requests that change state using the browser session must come from Heaven's own origin.

## CLI

For management commands, `HEAVEN_API_KEY` takes precedence over a saved `heaven login` credential. Either sends commands over HTTPS. With neither set, the CLI uses your SSH keys. An expired or revoked HTTPS credential produces an error.

A Computer shell uses SSH even when you're signed in. The CLI can use its own SSH key if you registered it when approving the sign-in.

## SSH

Present a registered SSH key at `heaven.dev`. A key limited to one Computer or tag can connect to matching Computers. Management at `cli@heaven.dev` requires a key without that restriction.

## MCP

The hosted MCP server accepts an OAuth sign-in or an API key in the `Authorization: Bearer …` header. Its OAuth access tokens are for `/mcp` only. The local server follows the [CLI credential order](#cli) using its process's environment and available SSH keys.

## Refusals

| Error | HTTP status | What to check |
| --- | ---: | --- |
| `unauthenticated` | 401 | Supply a valid credential if yours is missing, expired or revoked. |
| `denied` | 403 | Check whether your credential can run the command and whether you have the required access. |
| `not_found` | 404 | Check the target's name or ID, organization and credential scope. A resource outside your visibility can produce this error. |

See [Errors](https://heaven.dev/docs/reference/errors) for the structured error fields and the full list.
