AI Fabric Virtual Try-On
Transform your look with stunning realism! Explore unique fabric styles with photo mode — whether it's the elegance of silky textures or the vibrance of bold prints, the AI Fabric API brings materials to life! Developers can craft immersive experiences that let users see and feel fabrics like never before. Plus, fresh fabric updates are always on the way!
- AI Fabric API Usage Guide
This guide explains how to upload images, fetch predefined fabric styles, and create virtual try-on tasks using the AI Fabric API.
- Step 1. Upload a File Using the File API
Use the File API (/s2s/v2.0/file) to upload a target user image.
Image Requirements:
- Upload a high-resolution full-body photo.
- Ensure the photo clearly shows the entire body.
- Avoid backgrounds with multiple people or distracting objects.
Example Request:
curl --request POST \
--url https://yce-api-01.makeupar.com/s2s/v2.0/file \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'content-type: application/json' \
--data '{
"files": [
{
"content_type": "image/jpg",
"file_name": "full_body_photo_01_3dbd1b6683.jpg",
"file_size": 547541
}
]
}'- Step 2. Retrieve File API Response
The response includes:
file_idfor creating an AI task.requests.urlfor uploading the actual image file.
Sample Response:
{
"status": 200,
"data": {
"files": [
{
"content_type": "image/jpg",
"file_name": "full_body_photo_01_3dbd1b6683.jpg",
"file_id": "SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9/13W5TOD8/u/FfjK3xgCQ+hRt9MJXBFaud",
"requests": [
{
"method": "PUT",
"url": "https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...",
"headers": {
"Content-Length": "547541",
"Content-Type": "image/jpg"
}
}
]
}
]
}
}- Step 3. Upload Image to Provided URL
Use the requests.url from the File API response to upload the image:
curl --location --request PUT 'https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...' \
--header 'Content-Type: image/jpg' \
--header 'Content-Length: 547541' \
--data-binary @'./full_body_photo_01_3dbd1b6683.jpg'- Step 4. Fetch Predefined Fabric Templates
Use the Template API (/s2s/v2.0/task/template/fabric) to retrieve a list of predefined fabric templates:
curl --request GET \
--url 'https://yce-api-01.makeupar.com/s2s/v2.0/task/template/fabric?page_size=20&starting_token=73a3c9e69b89' \
--header 'Authorization: Bearer YOUR_API_KEY'- Step 5. Create an AI Task
Use the AI Task API (/s2s/v2.0/task/fabric) to create a virtual try-on task.
Parameters:
- For the user image:
src_file_idorsrc_file_url. - For the fabric style:
template_id.
Example Request:
curl --request POST \
--url https://yce-api-01.makeupar.com/s2s/v2.0/task/fabric \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'content-type: application/json' \
--data '{
"template_id":"good_template_001",
"src_file_url":"https://example.com/selfie.jpg"
}'Sample Response:
{
"status": 200,
"data": {
"task_id": "SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9_13W5TOD8_u_GPi6NqQ3dhlmN-6ntFwhzT"
}
}- Step 6. Poll for Task Result
Use the task ID to check the status:
curl --request GET \
--url https://yce-api-01.makeupar.com/s2s/v2.0/task/fabric/<YOUR_TASK_ID> \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'content-type: application/json'- Step 7. Retrieve Result
A successful response includes a download URL for the result image:
{
"status": 200,
"data": {
"error": null,
"results": {
"url": "https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature..."
},
"task_status": "success"
}
}Invalid API Key error response:
{
"status": 401,
"error": "Unauthorized",
"error_code": "InvalidAccessToken"
}Use cases: 


Suggestions for How to Shoot: 
- Supported Formats & Dimensions
| AI Feature | Supported Dimensions | Supported File Size | Supported Formats |
|---|---|---|---|
| AI Fabric | long side <= 4096, single person only, The abdomen, face, and shoulders should all be visible. The face must not be obstructed. The body should be upright and facing forward, without any unusual poses like sitting or squatting. | < 10MB | jpg/jpeg |
- Error Codes
| Error Code | Description |
|---|---|
| error_apply_region_not_detected | The clothing area is either too small or wasn’t detected in the input image |
- Environment & Dependency
| Sample Code Language / Tool | Recommended Runtime Versions |
|---|---|
| cURL | - bash >= 3.2 - curl >= 7.58 (modern TLS/HTTP support) - jq >= 1.6 (robust JSON parsing) |
| Node.js (JavaScript) | Node >= 18 (for global fetch) |
| JavaScript | - Chrome / Edge >= 80 - Firefox >= 74 - Safari >= 13.1 |
| PHP | PHP >= 7.4 (for modern TLS/compat), ext-curl (recommended) or allow_url_fopen=On + ext-openssl, ext-json |
| Python | Python >= 3.10 (for f-strings), requests >= 2.20.0 |
| Java | Java 11+ (for HttpClient), Jackson Databind >= 2.12.0 |