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

SurfaceCredential
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 pluginNo 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
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.
  • The full credential reference for agents is 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.