Skip to content

API Reference

Error Handling

Copy page

Status codes, error bodies and the WWW-Authenticate header in the Hostino API and MCP

Errors are returned with an HTTP status code and a short JSON body:

{ "error": "insufficient_scope", "required_scope": "domains:read" }

The error value is stable and safe to branch on in code.

API and MCP errors

CodeerrorMeaningFix
401missing_tokenNo Authorization: Bearer headerGet a token and send it in the header
401inactive_tokenToken expired, revoked or unknownUse your refresh_token or sign in again
401invalid_audienceToken was issued for another resourceRequest tokens with resource=https://mcp.hostino.ai
403insufficient_scopeToken lacks the required scopeRe-authenticate and approve the missing permission
403session_owner_mismatch(MCP) The MCP session belongs to another userStart a new session (initialize)
404—(MCP) Mcp-Session-Id expired or unknownThe client should initialize again
429—Rate limit exceededRetry after RateLimit-Reset seconds
502backend_error / backend_unreachableTemporary internal errorRetry with backoff
503auth_unavailableToken validation temporarily unavailableRetry with backoff

Request id

Every API response carries an X-Request-Id header, and every error body repeats it as request_id:

{ "error": "invalid_status", "allowed": ["Unpaid", "Paid"], "request_id": "b19e6a38-dda8-4df5-bbad-f4c75bc9c14e" }

Include the request_id when reporting a problem to support so the request can be found quickly.

WWW-Authenticate header

Every 401 and 403 carries the standard RFC 6750 header so clients know what to do:

HTTP/2 401
WWW-Authenticate: Bearer resource_metadata="https://mcp.hostino.ai/.well-known/oauth-protected-resource", error="invalid_token"

MCP clients read resource_metadata to discover the authorization server and start the sign-in flow automatically.

OAuth errors

Authorization server errors follow the OAuth standard:

errorMeaning
invalid_clientUnknown client_id; register again (in Claude Code: remove and re-add the server)
invalid_grantCode / refresh token invalid, expired or already used
invalid_targetresource not allowed; use https://mcp.hostino.ai
invalid_requestA required parameter (e.g. PKCE) is missing
access_deniedThe user clicked “Deny” on the consent page
authorization_pending(Device Flow) the user hasn’t approved yet; keep polling
expired_token(Device Flow) the device code expired; start over