⚠️ Error Handling & Exceptions

Our API returns structured errors whenever validation fails, credits are depleted, or credentials are invalid.

Standard Error Response

Errors are returned in JSON format. The response body includes a status boolean, the HTTP status code, a descriptive message, and detail information to aid troubleshooting.

Standard Error JSON Schema
{
  "success": false,
  "statusCode": 401,
  "message": "Invalid or revoked API Key.",
  "detail": "Invalid or revoked API Key."
}

Response Status Codes

The VTON service maps execution failures to semantic HTTP status codes.

HTTP StatusException ClassDescriptionRecommended Resolution
400HTTPExceptionRequest parameters are missing or formatted incorrectly.Verify fields and types against schemas.
401InvalidAPIKeyErrorMissing, invalid, or revoked X-API-Key header.Verify key syntax (smd_live_...) and status in dashboard.
403UnauthorizedErrorRequested userId does not match the authenticated API key owner.Ensure correct matching userId payload.
404UserNotFoundError / APIKeyNotFoundErrorDatabase lookup failed for the provided user ID or API key.Verify the target user exists.
422RequestValidationErrorJSON payload schema validation failed (FastAPI standard).Inspect the detail object to pinpoint validation issues.
501InsufficientCreditsErrorCredit balance is lower than the model credit cost.Direct the developer to buy credit top-up packages.
500InternalServerErrorAn unhandled error occurred within the engine.Retry the request after a backoff period.