SieloTech API docs

Error Handling

All SieloTech APIs use standard HTTP status codes to indicate the success or failure of requests. This page provides information about how to handle errors when using our APIs.

HTTP Status Codes

The API returns appropriate HTTP status codes for various error conditions. Common status codes include:

Status CodeDescription
200 OKThe request was successful
401 UnauthorizedInvalid or missing API key
403 ForbiddenThe API key doesn't have permission to perform the request
404 Not FoundThe requested resource doesn't exist
422 Unprocessable EntityValidation error on request data
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorAn error occurred on our server

FastAPI Validation Errors

Since our API is built with FastAPI, validation errors return in FastAPI's standard format. These typically occur with a 422 Unprocessable Entity status code when request validation fails:

{
    "detail": [
        {
            "type": "missing",
            "loc": [
                "body",
                "text"
            ],
            "msg": "Field required",
            "input": {
                "tsext": "日本語の車は大好きです",
                "mode": "dictionary"
            }
        }
    ]
}

In the example above, the request failed because the required text field is missing, but there was a typo in the input (tsext instead of text). The validation error provides details about:

  • type: The type of error (missing, value_error, etc.)
  • loc: The location of the error (body, query, path) followed by the specific field
  • msg: A human-readable error message
  • input: The actual input that was received

Best Practices for Error Handling

When working with SieloTech APIs, follow these best practices for handling errors:

  • Always check the HTTP status code before processing the response
  • Implement appropriate retry logic for 429 and 5xx errors
  • Log detailed error information for troubleshooting
  • Display user-friendly error messages in your application