FASHN API
Errors
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
endpoint, refer to this guide for details on runtime errors.
Common API Errors
Code | Cause | Solution |
---|---|---|
400 - BadRequest | The request is invalid or improperly formatted. | Check the API documentation and ensure the request follows the correct format and includes all required parameters. |
401 - UnauthorizedAccess | The 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 - NotFound | The 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 - RateLimitExceeded | Too many requests were made in a short period. | Implement request throttling and respect the API rate limits. Wait before retrying. |
429 - OutOfCredits | You’ve used up all your API credits. | Check your account's API usage. Purchase more credits if needed. |
500 - InternalServerError | A server error occurred while processing the request. | Retry the request after some time. If the issue persists, contact support@fashn.ai. |
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.
Name | Cause | Solution |
---|---|---|
ImageLoadError | The pipeline was unable to load the model or garment image from the provided inputs. | For Image URLs:
|
NSFWError | The NSFW filter is enabled, and NSFW content was detected in either the model or garment image. | If NSFW filtering is not required for your use case, disable it by setting nsfw_filter: false .
|
PhotoTypeError | The garment_photo_type parameter is set to auto (default value), and the pipeline could not determine whether the garment image is a flat-lay or a model image. | Manually set the garment_photo_type parameter to either flat-lay or model . Alternatively, improve the garment image quality according to our suggested guidelines. |
PoseError | The pipeline was unable to detect a body pose in either the model image or the garment image (if the garment_photo_type is set to model ). | Improve the quality of the model or garment image by following our model photo guidelines. |
PipelineError | An unexpected error occurred during the execution of the pipeline. | Retry the request (you will not be charged for failed attempts). If the issue persists, please reach out to us at support@fashn.ai and include the request ID from the failed attempt to help us locate and address the issue promptly. |
The Error Object
Example of an error when polling the /status
endpoint:
If you encounter an unrecognized error, please contact us at support@fashn.ai.