API Reference

Error Reference

Written by , Product docsLast updated

All Hive API errors follow a consistent envelope so your code can parse failures programmatically.


REST API error format

Every REST error response returns this shape:

json
{
  "ok": false,
  "error": {
    "type": "authentication_error",
    "code": "AUTH_REQUIRED",
    "message": "API key required. Set Authorization: Bearer <key> (or x-api-key) header.",
    "request_id": "req_12345",
    "doc_url": "https://www.hiveintelligence.xyz/errors#auth-required"
  }
}
FieldDescription
okAlways false on errors
error.typeMachine-readable error category
error.codeSpecific error code for programmatic handling
error.messageHuman-readable explanation
error.request_idUnique ID for the request (include in support tickets)
error.doc_urlLink to the relevant documentation section

HTTP status codes

StatusError TypeCodeWhen It Happens
400invalid_request_errorMISSING_PARAMRequired field missing (e.g. tool) or malformed JSON body
401authentication_errorAUTH_REQUIREDNo API key in request
403authentication_errorINVALID_API_KEYAPI key is invalid or revoked
404not_found_errorTOOL_NOT_FOUNDTool name doesn't exist in catalog
404not_found_errorENDPOINT_NOT_FOUNDURL path doesn't match any route
422invalid_request_errorVALIDATION_ERRORTool arguments failed schema validation
429rate_limit_errorRATE_LIMITEDToo many requests in the current window
429rate_limit_errorQUOTA_EXCEEDEDMonthly credit quota exhausted
400provider_errorTOOL_ERRORA provider returned a handled error for the request
500internal_errorINTERNAL_ERRORServer error
503provider_errorPROVIDER_UNAVAILABLEUpstream provider (CoinGecko, DeFiLlama, etc.) failed after retries
503internal_errorSHUTTING_DOWNServer is restarting

Rate limit headers

All responses include rate limit headers:

text
RateLimit-Limit: 1000
RateLimit-Policy: 1000;w=60
X-RateLimit-Remaining: 999
X-Quota-Remaining: 499992
Retry-After: 60  (only on 429 responses)
HeaderDescription
RateLimit-LimitMaximum requests allowed in the current window
RateLimit-PolicyWindow size in seconds (w=60 means per minute)
X-RateLimit-RemainingRequests remaining before throttling
X-Quota-RemainingMonthly credits remaining for the account, or unlimited
Retry-AfterSeconds to wait before retrying (only present on 429 responses)

Plan limits

Plan limits can change independently of the error envelope. Use this page for error parsing and retry behavior; use Rate Limits, Pricing, or Dashboard Plans for the current per-minute and monthly credit limits.


Tool-level error codes

These codes appear in the error.code field when a tool execution fails:

CodeWhen It Happens
INVALID_PARAMETERParameter value is wrong type or out of range
INVALID_COIN_IDCoin ID doesn't exist (e.g., typo in CoinGecko ID)
INVALID_NETWORK_IDNetwork/chain ID not supported
INVALID_ADDRESSWallet or contract address is malformed
COIN_NOT_FOUNDCoinGecko can't find the requested coin
POOL_NOT_FOUNDDEX pool doesn't exist
TOKEN_NOT_FOUNDToken contract not found on the specified chain
RATE_LIMITProvider-level rate limit (separate from Hive rate limit)
TIMEOUTRequest to upstream provider timed out
NETWORK_ERRORConnection to upstream provider failed

Provider error handling

When an upstream provider (CoinGecko, DeFiLlama, GoPlus, etc.) returns an error, Hive follows this sequence:

  1. Retries with exponential backoff: up to 3 attempts before giving up.
  2. Returns 503 with error.type: "provider_error" and code PROVIDER_UNAVAILABLE if all retries fail.
  3. Circuit breaker opens after 5 consecutive failures to the same provider, failing fast for 30 seconds before testing recovery.

A 503 PROVIDER_UNAVAILABLE response with error.type: "provider_error" means the issue is upstream, not with your request. Retry after a short delay or check the provider's status page. A handled provider error for a specific request returns 400 with code TOOL_ERROR.


MCP error format

MCP errors follow the JSON-RPC 2.0 specification:

json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32603,
    "message": "Internal server error"
  },
  "id": null
}

MCP error codes

CodeMeaning
-32700Parse error - invalid JSON received
-32600Invalid request - missing required JSON-RPC fields
-32601Method not found - the method name doesn't exist
-32603Internal error - server-side failure

Troubleshooting

"AUTH_REQUIRED" but I'm sending my key

Check that you're using the correct header format:

text
Authorization: Bearer YOUR_KEY

or (legacy alias)

text
x-api-key: YOUR_KEY

Common causes: sending the key as a query parameter instead of a header, or using Authorization: YOUR_KEY without the Bearer prefix.

"RATE_LIMITED" or "QUOTA_EXCEEDED"

RATE_LIMITED (per-minute rate limit) responses include a Retry-After: 60 header. Wait that many seconds, then retry. QUOTA_EXCEEDED means your monthly credit balance is exhausted; it does not carry Retry-After. Credits refill when your billing cycle rolls over, or upgrade your plan. Check usage in the dashboard and review Rate Limits before increasing traffic.

"TOOL_NOT_FOUND"

Tool names are case-sensitive. Use the REST discovery endpoint to find the correct name:

bash
curl https://mcp.hiveintelligence.xyz/api/v1/tools?search=price \
  -H "Authorization: Bearer YOUR_KEY"

Or use the MCP resource hive://tools for the full live tool inventory.

Provider returning empty results

Some providers require specific parameter formats. Check hive://tools or the REST discovery endpoint for the exact schema:

bash
curl https://mcp.hiveintelligence.xyz/api/v1/tools?search=TOOL_NAME \
  -H "Authorization: Bearer YOUR_KEY"