---
title: "Spatial Compiler API keys: SPATIAL_API_KEY, bearer tokens and OAuth"
description: "Where a Spatial Compiler API key goes: SPATIAL_API_KEY for the local MCP server, a bearer token for REST. The hosted MCP server uses an OAuth 2.1 login instead."
canonical: https://appliedmanifold.com/docs/api-keys/
site: "Applied Manifold: The spatial compute cloud for 3D reality"
---

1.  [Home](https://appliedmanifold.com/)
2.  [Docs](https://appliedmanifold.com/docs/)
3.  API keys

DOCS // SPATIAL.COMPILER

# API keys

An API key is the credential for the local MCP server, read from `SPATIAL_API_KEY`, and for REST, sent as a bearer token in the `Authorization` header. The hosted MCP server needs no key; it uses an OAuth 2.1 browser login.

## Where the key goes

| Surface | Credential |
| --- | --- |
| Local MCP server (`@spatial-compiler/mcp`) | The API key in the `SPATIAL_API_KEY` environment variable. |
| REST (`https://api.spatialcompiler.dev`) | `Authorization: Bearer <API key>` in the header, never in a URL. |
| Hosted MCP server (`https://mcp.spatialcompiler.dev`) | No key: an OAuth 2.1 browser login with PKCE (S256). |
| Local `spatial-compiler` program with the Claude plugin | No credential. |

## The example key

Keys start with `spck_live_` for live use and `spck_test_` for testing. Code samples on this site use the example key `spck_test_example`. Replace it with your own. New accounts start with $5 of usage on their USD balance.

terminal

```sh
curl -X POST https://api.spatialcompiler.dev/v1/compile \
  -H "Authorization: Bearer $SPATIAL_API_KEY" \
  -F "file=@model.glb" \
  -F 'options={"target_tris":15000,"dry_run":true}'
```

## Limits and errors

-   Each key has an hourly velocity limit; a call over it gets a 429.
-   Treat a 401 as a revoked or invalid key and ask the developer for a new one.
-   The account also has a monthly spend limit, $1,000 by default: see [Billing](https://appliedmanifold.com/docs/billing/).
-   The full credential reference for agents is [auth.md](https://appliedmanifold.com/auth.md).

## Questions

### Where does the local MCP server read the API key?

From the `SPATIAL_API_KEY` environment variable. The local server runs no login flow.

### How do I send the API key over REST?

As a bearer token in the header: `Authorization: Bearer <API key>`. Never put the key in a URL.

### Does the hosted MCP server need an API key?

No. The hosted server at `https://mcp.spatialcompiler.dev` signs you in with an OAuth 2.1 browser login with PKCE (S256), so the client config holds no key.

### What does a 401 mean?

The key is missing, revoked or invalid. Get a new key and replace the old one; a call over the hourly velocity limit gets a 429 instead.
