Skip to content
Panel

API Reference Basics

Authentication

Every request to the mot API and the MCP endpoint carries a key in the Authorization header.

mot authenticates every request with an API key sent as a bearer token. The same key format works on the REST API at https://api.mot3r.com and on the MCP endpoint at https://mcp.mot3r.com/mcp.

bash
curl -sS https://api.mot3r.com/v1/lines \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx"

The examples in this reference use the placeholder mot_lk_live_xxxxxxxxxxxx (a tunnel key); replace it with your full key. Examples of routes that need the root key read it from the MOT_ROOT_KEY environment variable instead: export your mot_sk_live_ key there, and never paste it into a shell command line or into client code. A real key is the prefix of its kind followed by 64 hexadecimal characters.

#Key kinds

Each key has a kind, encoded in its prefix. The kind decides what the key can reach.

KindPrefixScopeWorks on
Root keymot_sk_live_The whole accountREST API: tunnels, keys, balance, usage. Never on /mcp.
Tunnel keymot_lk_live_One tunnelMCP endpoint and the REST routes of its own tunnel.
Test keymot_tk_test_One tunnel, test limitsMCP endpoint, with the limits described in Rate limits.

A root key manages the account. Only the account owner can create one. Send it from your server, never from an agent or a browser.

A tunnel key belongs to exactly one tunnel. Give it to the agent that runs as that tunnel: the agent plugs into the tunnel with it, reads the tunnel's memory and writes through the tunnel's channels. On REST routes that take a tunnel id, a tunnel key sees only its own tunnel.

A test key is issued with a new account and is tied to one tunnel. It expires after 30 days, and an account holds at most three live test keys.

Warning

The root key never works on the MCP endpoint. A request with a root key returns 401 root_key_not_allowed. Use a tunnel key in MCP clients.

#Get a key

Create keys in the panel at mot3r.com/panel, under Keys. The panel shows a new key once, in the response to its creation. mot stores only a SHA-256 hash and a short prefix of the key, so a lost key cannot be recovered: rotate it instead.

You can list the keys of your account with the root key. The list returns prefixes, never the keys themselves.

bash
curl -sS https://api.mot3r.com/v1/keys \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx"

See Keys and tokens for the response shape.

#Scopes

A key also carries a list of scopes. When you create a key without choosing scopes, it gets the defaults of its kind.

KindDefault scopes
Root keytokens:w, keys:rw, billing:r
Tunnel keymcp, billing:r, events:r
Test keymcp

On the MCP endpoint, the scope mcp covers every tool family. A key limited to named families gets 403 scope_denied for tools outside them.

#Rotate a key

Rotate a key in the panel. Rotation issues a new key of the same kind, for the same tunnel, with the same scopes and limits, and revokes the old key at once. Agents connected to the tunnel are moved to the new key, so the tunnel keeps its history.

After rotation, a tool call with the old key returns 401 invalid_credential. Paid calls always check the key against the database, so a revoked key stops working on the next call. Update the key in every MCP client and server that used it.

#Authentication errors

StatusreasonWhen
401missing_credentialNo Authorization header on a route that needs one.
401no_sessionNo key on an account route such as GET /v1/balance or GET /v1/keys.
401invalid_credentialThe key is malformed, unknown or revoked.
401root_key_not_allowedA root key was sent to the MCP endpoint.
403key_kind_not_allowedThe key kind cannot use this route, for example a tunnel key on GET /v1/keys.
403scope_deniedThe key lacks the scope for this tool family.

A 401 from the MCP endpoint also carries a WWW-Authenticate: Bearer header. The full list of errors is in Errors.