Skip to content
Panel

API Reference Basics

Errors

One error shape for the REST API, one for the MCP endpoint, and the reason codes you will meet in both.

mot reports every failure with an HTTP status and a machine-readable reason. Branch on reason, not on the human message: messages can be reworded, reasons do not change.

#REST error shape

The REST API at https://api.mot3r.com returns errors as a JSON object with a single error key.

JSON
{
  "error": {
    "status": 404,
    "reason": "not_found",
    "message": "No such endpoint."
  }
}
FieldTypeDescription
statusintegerThe HTTP status, repeated in the body.
reasonstringStable code in snake_case.
messagestringA sentence in English for a person or a model.

Some errors add fields next to these three, for example available_micros and needed_micros on insufficient_balance.

A value the API could not read is never reported as zero. When the database does not answer, the API returns 503 with the reason unmeasured.

#MCP error shape

The MCP endpoint at https://mcp.mot3r.com/mcp answers in JSON-RPC 2.0. The HTTP status is set as well, and error.data carries the same status and reason as the REST API.

JSON
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32001,
    "message": "Unauthorized — send Authorization: Bearer <tunnel key>.",
    "data": { "status": 401, "reason": "missing_credential" }
  },
  "id": 3
}

The JSON-RPC code follows the HTTP status:

HTTP statusJSON-RPC code
400, 404-32602
401-32001
402-32002
403, 423-32003
409-32009
410-32010
429-32004
503 and any other failure-32005

When a 429 carries a wait time, the response has a Retry-After header and error.data.retry_after_s.

#Reason codes

These are the reasons you will meet most often. Each one below was observed on the production endpoints or is raised by the code path named in the description.

#Request

StatusreasonWhenWhat to do
400bad_jsonThe body is not valid JSON.Fix the body.
400bad_<field>A field has the wrong type or format, for example bad_from on GET /v1/usage.Check the parameter table of the endpoint.
400batch_tools_call_not_supportedA JSON-RPC batch on /mcp contains a tools/call.Send each tool call as its own request.
404not_foundThe path does not exist.Check the method and path.
406/mcp request whose Accept header lacks application/json or text/event-stream.Send Accept: application/json, text/event-stream.
413body_too_largeThe REST body is over 64 KB.Split the request.
415json_requiredA REST body without Content-Type: application/json.Add the header.

#Authentication and permission

StatusreasonWhenWhat to do
401missing_credentialNo Authorization header.Send Authorization: Bearer <key>.
401no_sessionNo key on an account route such as GET /v1/balance.Send the root key.
401invalid_credentialThe key is malformed, unknown or revoked.Check the key; after a rotation use the new one.
401root_key_not_allowedA root key was sent to /mcp.Use a tunnel key.
403key_kind_not_allowedThis kind of key cannot use the route.Use the key kind the endpoint names.
403scope_deniedThe key lacks the scope for this tool family. data.family names it.Create a key with the scope.
403trust_too_lowThe account's current trust level does not include this tool family. data.family and data.trust say which.See Rate limits for the families of each level.
403test_family_forbiddenA test key called a tool family that test keys cannot use, such as line. data.family names it.Use a tunnel key on a funded account.
403service_offThe family is switched off for this account or key.Switch it on in the panel.
403bad_originA browser request came from another site.Call the API from your server.

#Money and limits

StatusreasonWhenWhat to do
402insufficient_balanceThe balance does not cover the call. available_micros and needed_micros give the numbers.Top up the account in the panel (minimum 10 USD).
429rate_limitedThe key exceeded its requests-per-minute limit. Retry-After: 60.Wait and retry.
429daily_cap, monthly_capThe account reached its spending cap for the day or month.Wait for the next day or month, or raise the trust level.
429key_daily_capThe key reached its own daily spending cap.Wait for the next day or raise the key's cap.
429test_daily_calls, test_daily_sendsA test key used its daily calls or sends. data.limit gives the limit.Wait for the next day or use a tunnel key.
429mail_daily_limitThe daily number of mail recipients is reached.Wait for 00:00 UTC.
429too_many_streamsThe key already holds 5 open event streams. Retry-After: 30.Close a stream.
429too_many_attemptsToo many sign-in, sign-in link, password reset or code requests from the account or the address. Retry-After and data.retry_after_s give the wait. See Rate limits.Wait and retry.
429signup_rate_ip, signup_rate_globalToo many sign-ups from this address, or the service-wide daily sign-up limit is reached.Wait for the Retry-After time.
429code_attempts_exhaustedThe e-mail confirmation code was entered wrong too many times.Request a new code.

#Tunnels and cables

StatusreasonWhenWhat to do
404line_not_foundThe tunnel id is not in this account.Check the id with GET /v1/lines.
409lease_requiredA tool that writes as the tunnel was called before line_attach.Call line_attach first.
409cable_supersededAnother cable holds the tunnel now. Reads still work.Stop writing, or ask the owner to switch the tunnel back.
409lease_releasedThis cable released its lease.Call line_attach again.
409memory_fullThe memory of the tunnel is full.Remove content with mRAG_delete or raise the limit.
409mail_account_inactiveThe tunnel has no active mail account.Activate mail for the tunnel in the panel.
423line_offThe owner switched the tunnel off for agents.Ask the owner to switch it back on.
423line_mutedThe owner muted the tunnel: reads work, outgoing writes are refused.Ask the owner to unmute it.

#Service

StatusreasonWhenWhat to do
503unmeasuredThe API could not read a value. Retry-After: 5.Retry. This is a failure on our side, not missing data.
503auth_unavailableThe key could not be checked.Retry in a moment.
503auth_busyThe sign-in queue is full. Retry-After: 60.Retry after the wait.
503magic_unavailableThe server cannot send the sign-in link e-mail at the moment.Sign in with e-mail and password, or retry later.
503edge_not_liveThe tool needs the edge channel service (domain rooms, edge channels), which is not connected to the gateway. data.tool names the tool. The call costs zero.Use the other mURL_ and mIRC_ tools; retrying does not help.

#Example: handle an error

curl -sS -w "\n%{http_code}\n" https://api.mot3r.com/v1/balance \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx"