Aidge Resource
Try for freeWorkplace
  • LATEST ADVANCEMENTS
    • Introducing Marco-MT: Bringing Translation to the Next Level with LLM
  • GETTING STARTED
    • Quick Start
    • Account and Authentication
    • Your First API Request
    • Test Your API Requests
    • Service Level Agreement
    • FAQ
  • API REFERENCE
    • E-commerce Information Translation
      • Marco Translator
        • Marco Translator API Reference
      • Image Translation
        • Image Translation Pro Version API Reference
        • Image Translation Pro Version Result API Call Description
        • Image Translation Standard Version API Reference
    • E-commerce Image Editing
      • Image Background Removal
        • Image Background Removal API Reference
      • Image Upscaling
        • Image Upscaling API Reference
      • Image Cropping
        • Image Cropping API Reference
      • Image Elements Removal
        • Image Elements Removal API Reference
      • Image Elements Detection
        • Image Elements Detection API Reference
    • E-commerce Virtual Model
      • Virtual Model Alternation
        • Virtual Model Alternation Submit API Reference
        • Virtual Model Alternation Result Query API Reference
      • Virtual TryOn
        • Virtual Try-on Submit API Reference
        • Virtual Try-On Query API Reference
        • General Model Library Reference
      • Hands&Feet Repair
        • Hands&Feet Repair Submit API Reference
        • Hands&Feet Repair Query API Reference
    • Editor Documentation
      • AI Model Editor
      • AI Image Editor
        • Image Workbench
        • Background Removal
        • Elements Removal
        • Image Translation
Powered by GitBook
On this page
  • Virtual Try-On Submit API
  • Request Parameters
  • Sample Request
  • Response Parameters
  • Sample Response
  • Error Code

Was this helpful?

  1. API REFERENCE
  2. E-commerce Virtual Model
  3. Virtual TryOn

Virtual Try-on Submit API Reference

Virtual Try-On Submit API

Standard Ver: POST /ai/virtual/tryon

Pro Ver: POST /ai/virtual/tryon-pro

Supports uploading individual clothing item image URLs and clothing types. Generates real-time virtual try-on images based on the selected model type.

Request Parameters

String

Yes

The value is a List, but should be transferred to String value. e.g. "[{\"clothesList\":[{\"imageUrl\":\"https://ae-pic-a1.aliexpress-media.com/kf/H7588ee37b7674fea814b55f2f516fda1z.jpg\",\"type\":\"tops\"}],\"model\":{\"base\":\"General\",\"name\":\"James\"},\"viewType\":\"mixed\",\"inputQualityDetect\":0,\"generateCount\":4}]"

clothesList

Object[]

Yes

"clothesList" represents a suit of garments, not a batch. "clothesList" can contain 2 elements at most and the 'type' parameter in these elements MUST be 'tops' and 'bottoms' (eg. it does not support 2 tops).

imageUrl

String

Yes

Clothing image URL, with a minimum side length ≥150 pixels and maximum side length ≤3000 pixels.

type

String

No

Type of garments includes:

"tops": Upper body clothing

"bottoms": Lower body clothing

"dresses": One-pieces garments For single clothing try-on, you can leave blank for automatic type recognition. For suits tryon, type is required.

modelImage

String[]

No

A list of URLs for customized model images with maximum 8.

model

Object

No

Users can select the type of model or a specific model from the model base.

base

String

No

The model library to be used.

"General": Public model library.

name

String

No

The name of the model. Refer to the model library documentation for the list of available model names.

gender

String

No

The gender of the model for virtual try-on:

"male", "female" Default is "female".

style

String

No

The style of the model for virtual try-on

"universal_1":

"universal_2":

"universal_3":

age

String

No

The age of the model. "children", "youngadult"

body

String

No

The body type of the model.

"slim": slim model

"curvy": plus-size model Default is "slim".

viewType

String

No

The perspective for the generated images:

"fullbody": Full body view

"halfbody": Half body view

"mixed": Mixed full body and half body views

Default "fullbody".

generateCount

Number

No

The number of images to be generated, supporting an input range of 1 to 8.

Default is 4.

inputQualityDetect

Number

No

Whether to automatically filter out low-quality or incomplete flat-lay input images:

"1": Yes, filter low-quality images

"0": No, do not filter low-quality images

Default is 0.

Sample Request

Specify the model type for virtual try-on:

IopClient client = new IopClientImp(url, appkey, appSecret);
IopRequest request = new IopRequest();
// Adding this trial tag in header means using the trial resource to test, 
// request.addHeaderParameter("x-iop-trial","true")
request.setApiName("/ai/virtual/tryon");
request.addApiParameter("requestParams", "[{\"clothesList\":[{\"imageUrl\":\"https://ae-pic-a1.aliexpress-media.com/kf/H7588ee37b7674fea814b55f2f516fda1z.jpg\",\"type\":\"tops\"}],\"model\":{\"base\":\"General\",\"gender\":\"female\",\"style\":\"universal_1\",\"body\":\"slim\"},\"viewType\":\"mixed\",\"inputQualityDetect\":0,\"generateCount\":4}]");
IopResponse response = client.execute(request);
System.out.println(response.getBody());
Thread.sleep(10);

We provide http based sample codes in the git code repository.

Specify the model for virtual try-on:

IopClient client = new IopClientImp(url, appkey, appSecret);
IopRequest request = new IopRequest();
// Adding this trial tag in header means using the trial resource to test, 
// request.addHeaderParameter("x-iop-trial","true")
request.setApiName("/ai/virtual/tryon");
String newRequestParams = "[{\"clothesList\":[{\"imageUrl\":\"https://ae-pic-a1.aliexpress-media.com/kf/H7588ee37b7674fea814b55f2f516fda1z.jpg\",\"type\":\"tops\"}],\"model\":{\"base\":\"General\",\"name\":\"James\"},\"viewType\":\"mixed\",\"inputQualityDetect\":0,\"generateCount\":4}]";
request.addApiParameter("requestParams", newRequestParams);
IopResponse response = client.execute(request);
System.out.println(response.getBody());
Thread.sleep(10);

We provide http based sample codes in the git code repository.

Upload your own model image for virtual try-on:

IopClient client = new IopClientImp(url, appkey, appSecret);
IopRequest request = new IopRequest();
request.setApiName("/ai/virtual/tryon");
String newRequestParams = "[{\"clothesList\":[{\"imageUrl\":\"https://ae-pic-a1.aliexpress-media.com/kf/H7588ee37b7674fea814b55f2f516fda1z.jpg\",\"type\":\"tops\"}],\"modelImage\":[\"http://ai-business-algo-pai.oss-ap-southeast-1.aliyuncs.com/pengxin.zpx%2Fdatasets%2Ftest_images%2F365b8862-71cb-11ef-a6f9-964d09221cfd.png?OSSAccessKeyId=LTAI5tAGoBnm5eYsnZ5E1zMr&Expires=1883910332&Signature=ebJZT4eoEN3kpsSiSpK4minOdRM%3D\"]}]";
request.addApiParameter("requestParams", newRequestParams);
IopResponse response = client.execute(request);
System.out.println(response.getBody());
Thread.sleep(10);

We provide http based sample codes in the git code repository.

Response Parameters

Parameter
Type
Description

resCode

Number

The returned result code, where 200 indicates success. For detailed error codes, please refer to the error code list.

data

Object

The returned JSON result data. the task id can be used to query the generation api to obtain results

requestId

String

A unique request ID used for troubleshooting.

success

Boolean

The status of the returned request, indicating whether the request was successful.

resMessage

String

The returned request information.

Sample Response

{
  "code": "0",
  "data": {
    "result": "{\"taskId\":\"1ce4fd33-b9d5-4e21-a24c-0c4027d2b105\"}"
  },
  "requestId": "212cd83017085872506144758e3fca",
  "success": "true",
  "resCode": "200",
  "resMessage": "success",
  "request_id": "0ba2887315178178017221014"
}

Error Code

code
msg
Description

500

system error

System error.

501

rate limit exceed

The current interface has reached the current limit. Please contact us via navigation bar or email us (aidge_support@service.alibaba.com) to increase the current limit value.

700

invalid input

The format of the input parameters does not meet the requirements, and resMessage will return detailed fields that do not meet the requirements.

701

Clothing image dowloading failed, please try another input

Clothing image dowloading failed, please try another image url.

703

Input clothes image resoulution low, please try other image

The resolution of the clothing image does not meet the requirements. Please try another image.

707

Input clothing image is not a complete flat lay. Please try another image.

The clothing image is not a complete flat lay and does not meet the quality requirements for virtual try-on. Please try another image.

1001

content control failed, please retry

Content risk failed, please try other input. If an error persists,please contact us via navigation bar or email us (aidge_support@service.alibaba.com) for troubleshooting.

1002

content risk filter failed, please contact us

Content risk failed, please ccontact us via navigation bar or email us (aidge_support@service.alibaba.com).

PreviousVirtual TryOnNextVirtual Try-On Query API Reference

Last updated 1 month ago

Was this helpful?

Default is "universal_1"

requestParams
https://github.com/Aidge-AI
https://github.com/Aidge-AI
https://github.com/Aidge-AI