MMTMMT Docs
Basics

Errors

Error response format, error codes, and HTTP status codes for REST and WebSocket APIs.

All errors follow a consistent format with a code, message, and optional details.

Error Format

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description",
    "details": {
      "field": "additional context"
    }
  }
}

Error Codes

Authentication Errors

CodeHTTPDescription
INVALID_API_KEY401Missing or invalid API key
{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Missing or invalid API key"
  }
}

Validation Errors

CodeHTTPDescription
INVALID_PARAMS400General parameter validation failure
INVALID_EXCHANGE400Unknown/unsupported exchange ID, duplicate exchange in aggregate string, or non-alphabetical aggregate ordering
INVALID_SYMBOL400Unknown or unsupported trading symbol
INVALID_TIMEFRAME400Invalid timeframe format or outside allowed range
INVALID_BUCKET400Invalid or restricted bucket group
INVALID_STREAM400Invalid or unknown stream type
{
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Invalid request parameters",
    "details": {
      "message": "from and to are required"
    }
  }
}
{
  "error": {
    "code": "INVALID_TIMEFRAME",
    "message": "Invalid timeframe format",
    "details": {
      "timeframe": "2x"
    }
  }
}
{
  "error": {
    "code": "INVALID_EXCHANGE",
    "message": "Invalid exchange",
    "details": {
      "exchange": "unknown",
      "valid_exchanges": ["binancef", "bybitf", "coinbase", "okx", "deribit", "hyperliquid"]
    }
  }
}

For invalid aggregated exchange strings, REST responses use the same INVALID_EXCHANGE code and include details such as:

{
  "error": {
    "code": "INVALID_EXCHANGE",
    "message": "Invalid exchange",
    "details": {
      "message": "invalid aggregated exchange string: exchanges must be ordered alphabetically",
      "provided": "bybitf:binancef",
      "expected": "binancef:bybitf"
    }
  }
}

Tier Restriction Errors

CodeHTTPDescription
TIER_RESTRICTED403Request outside tier's allowed access
AGG_NOT_ALLOWED403Multi-exchange aggregation not allowed on tier
MAX_POINTS_EXCEEDED400Request exceeds maximum datapoints
{
  "error": {
    "code": "TIER_RESTRICTED",
    "message": "Data outside tier's allowed range",
    "details": {
      "max_history_days": 90,
      "earliest_allowed": 1701475200
    }
  }
}

max_history_days is plan-dependent (for example: Basic Monthly 90, Basic Yearly 365, Pro Yearly 0 for unlimited).

{
  "error": {
    "code": "AGG_NOT_ALLOWED",
    "message": "Aggregated requests not allowed on your plan"
  }
}
{
  "error": {
    "code": "MAX_POINTS_EXCEEDED",
    "message": "Request exceeds max datapoints for stream",
    "details": {
      "requested": 150000,
      "max": 100000
    }
  }
}

Rate Limit Errors

CodeHTTPDescription
RATE_LIMITED429Rate limit exceeded
{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded",
    "details": {
      "retry_after": 45
    }
  }
}

WebSocket Errors

CodeHTTPDescription
MAX_SUBS_EXCEEDED400Maximum subscriptions exceeded on connection
MAX_CONNS_EXCEEDED429Too many WebSocket connections
INVALID_MESSAGE400Malformed WebSocket message
UNKNOWN_CHANNEL400Unknown subscription channel
ALREADY_SUBSCRIBED400Already subscribed to this stream
NOT_SUBSCRIBED400Not subscribed to this stream
{
  "error": {
    "code": "MAX_SUBS_EXCEEDED",
    "message": "Maximum subscriptions exceeded",
    "details": {
      "max": 100,
      "current": 100
    }
  }
}

Bucket Validation Errors

When an invalid or restricted bucket group is requested:

{
  "error": {
    "code": "INVALID_BUCKET",
    "message": "Invalid or restricted bucket group",
    "details": {
      "bucket": "15",
      "valid_buckets": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
      "bucket_descriptions": {
        "1": "all",
        "2": "1-1K",
        "3": "1K-10K",
        "4": "10K-25K",
        "5": "25K-50K",
        "6": "50K-100K",
        "7": "100K-250K",
        "8": "250K-500K",
        "9": "500K-1M",
        "10": "1M-5M",
        "11": "5M+"
      }
    }
  }
}

Server Errors

CodeHTTPDescription
TIMEOUT504Query exceeded 30 second timeout
INTERNAL_ERROR500Internal server error
SERVICE_UNAVAILABLE503Service temporarily unavailable
{
  "error": {
    "code": "TIMEOUT",
    "message": "Query exceeded 30s timeout",
    "details": {
      "request_id": "01HQXYZ123ABC456DEF789GHI"
    }
  }
}
{
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Internal server error",
    "details": {
      "request_id": "01HQXYZ123ABC456DEF789GHI"
    }
  }
}

WebSocket Error Messages

WebSocket errors are sent as JSON messages on the connection:

{
  "type": "error",
  "code": "INVALID_MESSAGE",
  "message": "Failed to parse message"
}

WebSocket Error Codes

CodeDescription
INVALID_JSONMessage is not valid JSON
UNKNOWN_TYPEUnknown message type
INVALID_MESSAGEMalformed WebSocket message
INVALID_PARAMSMissing required fields
INVALID_STREAMUnknown or invalid channel
INVALID_EXCHANGEUnknown exchange ID, duplicate exchange in aggregate string, or non-alphabetical aggregate ordering
INVALID_TIMEFRAMEInvalid timeframe format or outside allowed range
INVALID_BUCKETInvalid or restricted bucket group
MAX_SUBS_EXCEEDEDMaximum subscriptions reached
ALREADY_SUBSCRIBEDAlready subscribed to this stream
NOT_SUBSCRIBEDNot subscribed to this stream

After certain errors (like MAX_CONNS_EXCEEDED), the server will close the connection.

HTTP Status Code Summary

StatusMeaning
200Success
400Bad request (validation error)
401Unauthorized (invalid API key)
403Forbidden (tier restriction)
429Too many requests (rate limited)
500Internal server error
503Service unavailable
504Gateway timeout

On this page