API ReferenceError Codes
API Reference

Errors

TokenBay Gateway error response format, HTTP status code, and business error code reference

This page defines the error response format for TokenBay Gateway business APIs and documents the conventions for HTTP status codes and business error codes.

HTTP status codes identify request processing and service availability outcomes; specific business failure reasons are returned in error.code.

For asynchronous task APIs, task results and progress are represented by endpoint-specific response fields.

Error Response Format

Response

schema
error.messagestringOptional

Error message for the caller.

error.typestringOptional

Error category.

error.codestringOptional

Business or protocol error code.

HTTP Status Code Conventions

Errors

StatusMeaningTypical Scenario
200SuccessTask query succeeded. Even if the task itself failed, it is represented by status: "failed" in the response body.
400Client Request ErrorInvalid parameters, missing required fields, request body parsing failure, or task not found.
401Authentication FailedToken is missing or invalid.
403Insufficient PermissionsUser is banned, quota is insufficient, access to the group or model is not allowed, or IP restrictions do not pass.
404Resource Not FoundNo route matched, or the task does not exist in the video content proxy.
413Payload Too LargeThe request body exceeds the size limit.
429Rate LimitedModel request rate limit, global API rate limit, or upstream load saturation.
500Internal Server ErrorRequest conversion failed, upstream invocation failed, response parsing failed, or serialization failed.
501Not ImplementedThe interface or conversion is not implemented.
502Bad GatewayThe upstream URL fetch failed in the video content proxy.
503Service UnavailableNo available channel, system resource overload (CPU / memory / disk), or no available key in the channel.
504Upstream TimeoutThe channel response time exceeded the timeout limit.

HTTP status codes identify request processing and service availability outcomes; specific business failure reasons are returned in error.code.

Business Error Codes

Errors

StatusCodeMeaning
403api_key_disabledAPI key is disabled
403api_key_expiredAPI key has expired
403api_key_unavailableAPI key status is unavailable
403ip_denied_by_blacklistSource IP matched the blacklist
403ip_not_in_whitelistSource IP is not in the whitelist
403model_disabledModel is disabled
403model_capability_not_supportedModel does not support the requested endpoint capability
403api_key_model_not_allowedAPI key model allowlist or denylist does not permit this model
403account_point_insufficientAccount point balance is insufficient
403api_key_point_insufficientAPI key sub-quota is insufficient
403access_rule_time_window_deniedRequest is outside the allowed access-rule time window
404model_not_foundModel does not exist
429account_rate_limitedAccount request rate limit exceeded
429api_key_point_limit_exceededAPI key periodic point limit exceeded

Business error codes are returned in error.code to identify specific business failure causes and support client-side classification and handling.

Related