Skip to main content

Error Handling

The GeniSpace API uses standard HTTP status codes to indicate request results and provides detailed error information in the response body.

HTTP Status Codes

Status CodeMeaningDescription
200SuccessRequest processed normally
201CreatedResource created successfully
400Bad RequestInvalid or missing request parameters
401UnauthorizedMissing or invalid API key
403ForbiddenNo permission to perform this operation
404Not FoundRequested resource does not exist
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer-side internal error

Error Response Format

{
"success": false,
"error": {
"code": "INVALID_PARAMETER",
"message": "Parameter 'name' cannot be empty",
"details": {}
}
}

Common Error Codes

Error CodeHTTP StatusDescription
UNAUTHORIZED401API key is invalid or expired
FORBIDDEN403No permission to access this resource
NOT_FOUND404Resource does not exist
INVALID_PARAMETER400Invalid request parameter
RATE_LIMIT_EXCEEDED429Request rate limit exceeded
INTERNAL_ERROR500Internal server error
INSUFFICIENT_TOKENS402Insufficient Token balance

Error Handling Recommendations

  1. Check the status code: Determine whether the request was successful based on the HTTP status code
  2. Parse the error message: Read error.message in the response body for the specific reason
  3. Retry strategy: Implement backoff retries for 429 and 5xx errors
  4. Logging: Record error information for troubleshooting