This guide provides an overview of error codes and how to handle errors when using the API. If you encounter failed predictions from the /status/:id endpoint, refer to this guide for details on runtime errors.

Common API Errors

CodeCauseSolution
400 - BAD_REQUESTThe request is invalid or improperly formatted.Check the API documentation and ensure the request follows the correct format and includes all required parameters.
401 - UNAUTHORIZED_ACCESSThe API key is invalid, inactive, or missing in the request.Double-check your API key and ensure it is included in the request headers under “Authorization”. (See Authentication)
404 - NOT_FOUNDThe requested resource could not be found, or the requested prediction status is no longer tracked.Double-check the URL or endpoint. If it’s due to an untracked prediction ID, a corresponding message will appear.
429 - RATE_LIMIT_EXCEEDEDToo many requests were made in a short period.Implement request throttling and respect the API rate limits. Wait before retrying.
402 - OUT_OF_CREDITSYou’ve used up all your API credits.Check your account’s API usage. Purchase more credits if needed.
500 - INTERNAL_SERVER_ERRORA server error occurred while processing the request.Retry the request after some time. If the issue persists, please reach out to api.support@getayna.com.

Runtime Errors

If an error occurs during inference (while running the model), the API will return a 200 status code with a prediction status: failed. Additionally, an error object will be included under the error key in the response.
CodeCauseSolution
IMAGE_LOAD_ERRORThe pipeline was unable to load the model or garment image from the provided inputs.- For Image URLs: Ensure the URL is publicly accessible and not permission-restricted. Verify the Content-Type header is correct (e.g., image/jpeg, image/png).
- For Base64 images: Prefix with data:image/<format>;base64, (e.g., data:image/png;base64,).
- Image size: Images below 512x512 and above 4096x4096 are not supported.
CONTENT_MODERATION_ERRORProhibited content detected in the provided garment or model image.Ensure images do not contain nudity, violence, or inappropriate content. Only safe-for-work images are allowed.

The Error Object

{
  "error": {
    "code": "IMAGE_LOAD_ERROR",
    "message": "The error message"
  }
}
Example of an error when polling the /status/:id endpoint:
{
  "status": "failed",
  "output": {
    "image": null
  },
  "error": {
    "code": "IMAGE_LOAD_ERROR",
    "message": "Error loading model image: The URL's Content-Type is not an image. Content-Type: text/plain;charset=UTF-8"
  }
}
If you encounter an unrecognized error, please contact us at api.support@getayna.com.