Try On (Beta)
POST/v1/try-on
BETA - This endpoint is currently in beta and may change without notice.
Places a garment onto a person image.
For Best Results:
- Person Image:
- There should only be one person in the image.
- Plain backgrounds and no accessories are best
- The person should take up most of the frame, a 3/4 body view works best.
- The person should be standing facing forward, side/seated views work less well.
- Garment Image:
- The garment image should only contain a single garment.
- Plain "stock photos" of garments work best, however the model is capable of transferring garments from one person to another.
- The garment should take up most of the frame.
Limitations:
- The API may not work with all garments, it works best with top garments like t-shirts, blouses, etc.
- Text and fine details in the garment image may not be reproduced perfectly in the resulting image.
- Colors in the resulting image may be slightly different to the colors in the garment image.
Input Image Limits:
- Max size: 25MB
- Min resolution: 256x256px
- Max resolution: 1920x1920px
Request
Header Parameters
Acceptable response media type(s). application/json
.
- application/json
- multipart/form-data
Body
URL of the person's image.
URL of the garment image.
Possible values: [auto
, full
, upper
, lower
]
Default value: auto
Indicates the garment type for the try-on service. Determines how the garment is applied on the person image.
- auto: Automatically detects if the garment is full-body, upper-body, or lower-body.
- full: Garment covers the full body (e.g., dresses, jumpsuits).
- upper: Garment covers the upper body (e.g., shirts, jackets).
- lower: Garment covers the lower body (e.g., pants, skirts).
Possible values: [true
, false
]
Default value: true
When true, the garment will be preprocessed to remove background. Defaults to true. In some cases results of model will be improved by skipping pre-processing.
Possible values: [true
, false
]
Default value: false
When true, the background will be removed from the final result. Defaults to false.
Possible values: [true
, false
]
Default value: true
When true, the API will wait for processing to complete and return the result directly. When false, it returns a job ID for polling.
Body
URL of the person's image.
Binary file of the image to be processed, this is mutually exclusive with image_url, if both are provided the image will be used.
URL of the garment image.
Binary file of the image to be processed, this is mutually exclusive with image_url, if both are provided the image will be used.
Possible values: [auto
, full
, upper
, lower
]
Default value: auto
Indicates the garment type for the try-on service. Determines how the garment is applied on the person image.
- auto: Automatically detects if the garment is full-body, upper-body, or lower-body.
- full: Garment covers the full body (e.g., dresses, jumpsuits).
- upper: Garment covers the upper body (e.g., shirts, jackets).
- lower: Garment covers the lower body (e.g., pants, skirts).
Possible values: [true
, false
]
Default value: true
When true, the garment will be preprocessed to remove background. Defaults to true. In some cases results of model will be improved by skipping pre-processing.
Possible values: [true
, false
]
Default value: false
When true, the background will be removed from the final result. Defaults to false.
Possible values: [true
, false
]
Default value: true
When true, the API will wait for processing to complete and return the result directly. When false, it returns a job ID for polling.
Responses
- 200
- 202
- 400
- 401
- 403
- 429
- 500
Success - returned when wait_for_result is true and processing completes successfully.
- application/json
- Schema
- Example (from schema)
Schema
A URL to access the resultant image which is valid for 1 hour. File format will be jpeg.
{
"result_url": "https://assets.pixelcut.app/public/result/a16646be-91c8-4e3a-b359.jpg"
}
Accepted - returned when wait_for_result is false, indicates that processing has started.
Response Headers
Location
string
Endpoint to poll for job status
- application/json
- Schema
- Example (from schema)
Schema
A unique identifier for this job that can be used to check status.
{
"job_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
The input could not be processed, often returned when the input image exceeds API limits.
- application/json
- Schema
- Example (from schema)
Schema
invalid_request_body
: The request body was empty or invalid.missing_parameter
: A required parameter was not provided.invalid_parameter
: A parameter was provided but it was invalid.unsupported_content_type
: The content type of the request was not application/json or multipart/form-data.malformed_image
: The image could not be decoded.unsupported_image_format
: The image format is not supported.file_size_too_large
: The image file size is too large.resolution_too_high
: The image resolution is too high.unknown_foreground
: The foreground subject of the image could not be detected.
A description of the error.
Possible values: [invalid_request_body
, missing_parameter
, invalid_parameter
, unsupported_content_type
, malformed_image
, unsupported_image_format
, file_size_too_large
, resolution_too_high
, unknown_foreground
]
The error codes provide a way to programmatically handle errors.
The following error codes are currently in use:
{
"error": "File size too large",
"error_code": "file_size_too_large"
}
The authentication token is missing or invalid.
- application/json
- Schema
- Example (from schema)
Schema
Possible values: [invalid_auth_token
]
{
"error": "API Token not found",
"error_code": "invalid_auth_token"
}
Returned when you have insufficient credits to perform the requested action.
- application/json
- Schema
- Example (from schema)
Schema
Possible values: [insufficient_api_credits
]
{
"error": "Insufficient credits available",
"error_code": "insufficient_api_credits"
}
Rate limit exceeded
- application/json
- Schema
- Example (from schema)
Schema
Possible values: [rate_limit_exceeded
]
{
"error": "Too many requests",
"error_code": "rate_limit_exceeded"
}
Internal service error