Welcome to the TryonAPI documentation.
Our API allows you to generate virtual try-on images by combining person and garment photos. This documentation outlines the available endpoints and how to use them with your API key.
All API requests require authentication using your API key, which you can generate from the Dashboard after logging in.
Include your API key in all requests using the following HTTP header:
The following endpoints are available for virtual try-on operations.
/api/v1/tryon
Submits a new virtual try-on job.
Content-Type: multipart/form-data
Field Name | Type | Required | Description |
---|---|---|---|
person_images | File | Yes | One person image file. Public URLs are not currently supported. |
garment_images | File | Yes | One garment image file. Public URLs are not currently supported. |
Note: Currently only supports one image for person and garment each.
202 Accepted
Use the statusUrl
to poll for the job result.
This endpoint initiates an asynchronous job. The response includes a job ID that you can use to check the status.
/api/v1/tryon/status/{jobId}
Retrieves the status and result of a try-on job.
Path Parameter: jobId
(The ID returned by the POST /api/v1/tryon call)
Authentication: API Key (must be the same key used to create the job or belong to the same user)
200 OK
Notes:
imageUrl
: Present when status
is completed
and the result is stored as an object. This can be a temporary signed URL (e.g., valid for 1 hour) or a permanent public URL if configured.imageBase64
: Present when status
is completed
if the image is returned directly as base64 data. This might occur as a fallback if URL generation is not possible or as a primary method depending on service configuration.message
: Present when status
is processing
, providing a human-readable update.result
: A nested object. For completed
jobs, it may contain metadata about the generation (like objectKey
). For failed
jobs, it will contain detailed error information, including a provider-specific error
message, errorCode
, and potentially the internal step
at which the failure occurred.error
and errorCode
: Present when status
is failed
, often mirroring details found within the result
object.Possible status values:
processing
- The job is still being processed by the queue or the try-on service.completed
- The job has completed successfully. The result image can be accessed via imageUrl
or imageBase64
.failed
- The job has failed during processing. Check error
, errorCode
, and the nested result
object for details. Failures can be due to invalid input (see specific errorCode
values), processing errors, or internal issues.Possible errorCode values (when status is 'failed'):
INVALID_PERSON_IMAGE
- The person image is invalid, unsuitable, or could not be processed.INVALID_GARMENT_IMAGE
- The garment image is invalid, unsuitable, or could not be processed.VALIDATION_FAILED
- A general validation check failed for the input images or parameters.GENERATION_FAILED
- The core try-on image generation process failed.STORAGE_FAILED
- An error occurred while attempting to save input or output images.R2_FETCH_FAILED
- The system failed to retrieve necessary image data from internal storage (R2).RESULT_UNAVAILABLE
- The job was marked as completed, but the final image URL or data could not be retrieved or provided.QUEUE_INVALID_INPUT_DATA
- The job message received from the processing queue had malformed or missing data.CONSUMER_CONFIG_ERROR
- The backend processing service encountered a configuration problem (e.g., missing API keys for AI models).INVALID_SERVICE_PROVIDER
- The configured try-on service provider is not recognized or supported.QUEUE_PROCESSING_FAILED
- A generic error occurred during the processing of the job from the queue.SERVICE_SPECIFIC_ERROR
- An error specific to the underlying AI service occurred (details often in result.error
).INTERNAL_ERROR
- An unexpected internal server error occurred.
You should poll this endpoint at regular intervals (e.g., every 2-5 seconds) until the job status is no longer processing
.
Examples of how to use the API in different programming languages.