APIDOCUMENTATIONFOR TRY-ON FLOWS
Use the MEFIT API to send garment try-on requests, track queued jobs, and return generated images inside your own product.
Three Calls To Your First Result
Authenticate your request, submit the person and garment images, then poll the returned job id until the result is ready.
Authenticate
Use your approved platform key or JWT token in the request headers.
Submit Images
Send the person image, garment image, garment description, and customer_id for business API calls.
Read Result
Poll the job endpoint and display the generated try-on image when ready.
MEFIT_API_URLUse the production base URL issued with your business account. Keep it in an environment variable and never hard-code secret keys in frontend code.
MEFIT_API_URL=https://api.your-mefit-domain.com
HeadersServer-side integrations should use the issued platform key. Logged-in user flows can use a JWT bearer token. Business API calls must include a stable customer ID for usage tracking.
X-API-Key: vton_pk_your_key X-Customer-ID: shop_user_12345 X-Session-ID: cart_session_789 Authorization: Bearer <jwt_token>
Customer AttributionFor business keys, every generation is logged by API key and customer_id. Use your own stable customer/user ID so billing and analytics can be grouped per shopper.
customer_id=shop_user_12345
customer_email=optional@example.com
session_id=cart_session_789
metadata={"store":"delhi","sku":"dress_42"}Submit a try-on jobcurl -X POST "$MEFIT_API_URL/api/tryon" \ -H "X-API-Key: vton_pk_your_key" \ -H "X-Customer-ID: shop_user_12345" \ -H "X-Session-ID: cart_session_789" \ -F "human_image=@person.jpg" \ -F "garment_image=@dress.png" \ -F "garment_description=rose gold evening gown" \ -F "customer_id=shop_user_12345"
Poll the resultcurl -X GET "$MEFIT_API_URL/api/jobs/job_12345" \ -H "X-API-Key: vton_pk_your_key"
Browser or Node upload flowconst form = new FormData();
form.append("human_image", personFile);
form.append("garment_image", garmentFile);
form.append("garment_description", "rose gold evening gown");
form.append("customer_id", "shop_user_12345");
form.append("session_id", "cart_session_789");
const submit = await fetch(apiUrl + "/api/tryon", {
method: "POST",
headers: {
"X-API-Key": "vton_pk_your_key",
"X-Customer-ID": "shop_user_12345"
},
body: form
});
const job = await submit.json();
const status = await fetch(apiUrl + "/api/jobs/" + job.job_id, {
headers: { "X-API-Key": "vton_pk_your_key" }
});
const result = await status.json();Status codes400 Bad Request: missing image or invalid payload 401 Unauthorized: missing or invalid token/API key 429 Rate Limited: plan limit or queue protection reached 500 Server Error: generation failed unexpectedly
Submit a virtual try-on job with a person image and garment image. Returns a job id for status tracking.
Headers:
Authorization: Bearer <jwt_token>
or
X-API-Key: vton_pk_your_key
Body: multipart/form-data
human_image: file
garment_image: file
garment_description: string
customer_id: string, required with X-API-Key
customer_email: string, optional
session_id: string, optional
metadata: string, optional
seed: number, optional
Response:
{
"job_id": "job_12345",
"status": "queued"
}Need API Access?
Submit your business request and we will review the integration use case.