Virtual try-on API

Add virtual try-on to your app or site with one HTTP request. JSON responses; results via polling or webhook.

Authentication

Send the key in the Authorization header. Test keys start with hk_test_ and live keys with hk_live_.

Authorization: Bearer hk_live_xxxxxxxxxxxxxxxx

Create a try-on

POST https://houshstyle.ir/api/v1/try-on/ — multipart/form-data, or JSON with image URLs

ParameterDescription
person_image / person_image_urlPerson photo (one required)
garment_image / garment_image_url / garment_idGarment photo or product ID (one required)
garment_typeGarment or accessory type key (table at the bottom); default w_gown
on_modeltrue if the garment photo is worn by a model or mannequin (the model's face and body are not transferred)
genderw or m; for unisex items such as backpacks and caps
garment_image_2, garment_type_2, on_model_2 …Second and third items (optional), e.g. outfit + shoes + bag
resolutionstandard (1 credit) | hd (2 credits)
lock_face, remove_garment_backgroundtrue / false
webhook_url, client_refoptional
curl -X POST https://houshstyle.ir/api/v1/try-on/ \
  -H "Authorization: Bearer $HUSH_KEY" \
  -F person_image=@person.jpg \
  -F garment_image=@dress.jpg \
  -F garment_type=w_gown \
  -F garment_image_2=@heels.jpg \
  -F garment_type_2=w_heels \
  -F resolution=hd \
  -F webhook_url=https://your-app.com/hooks/tryon

Response (202):

{"id": "8b1c…", "status": "queued", "result_url": null, "credits_charged": 2, ...}

Get the result

GET https://houshstyle.ir/api/v1/try-on/{id}/

Statuses: queued, processing, completed, failed. When completed, result_url is the final image. If a try-on fails, the credit is refunded automatically (refunded=true).

Python example

import requests, time
H = {"Authorization": "Bearer hk_live_..."}
r = requests.post("https://houshstyle.ir/api/v1/try-on/", headers=H,
    files={"person_image": open("me.jpg", "rb"), "garment_image": open("dress.jpg", "rb")},
    data={"garment_type": "w_cocktail"})
job = r.json()
while job["status"] in ("queued", "processing"):
    time.sleep(2)
    job = requests.get(f"https://houshstyle.ir/api/v1/try-on/{job['id']}/", headers=H).json()
print(job["result_url"])

JavaScript (Node) example

const fd = new FormData();
fd.append("person_image_url", "https://cdn.example.com/u/123.jpg");
fd.append("garment_id", "42");
const res = await fetch("https://houshstyle.ir/api/v1/try-on/", {
  method: "POST", headers: { Authorization: `Bearer ${process.env.HUSH_KEY}` }, body: fd });
console.log(await res.json());

PHP example

$ch = curl_init("https://houshstyle.ir/api/v1/try-on/");
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("HUSH_KEY")],
  CURLOPT_POSTFIELDS => ["person_image" => new CURLFile("me.jpg"), "garment_image" => new CURLFile("coat.jpg"),
                         "garment_type" => "m_blazer"]]);
echo curl_exec($ch);

Webhook

When processing finishes, a POST with a JSON body and the following headers is sent to webhook_url:

X-Hush-Timestamp: 1760780000
X-Hush-Signature: sha256=HMAC_SHA256(webhook_secret, timestamp + "." + raw_body)

{"event": "tryon.completed", "data": {"id": "...", "status": "completed", "result_url": "..."}}
# Python verify
import hmac, hashlib
expected = hmac.new(SECRET.encode(), ts.encode() + b"." + body, hashlib.sha256).hexdigest()
assert hmac.compare_digest("sha256=" + expected, signature)

Other endpoints

Error codes

400 invalid_imageInvalid, too small or too large image
401Invalid or disabled key
402 org_creditsOrganisation credit exhausted
429Rate limit exceeded (default 60 requests per minute)
503 unavailableService temporarily unavailable; retry in a few seconds

Garment and accessory types (garment_type)

u_ keys are unisex. Old English names (such as cocktail dress) are still accepted.

Clothing — Women

KeyTypeGroup
w_gownLong evening gown / maxiEvening & bridal
w_midi_formalMidi evening dressEvening & bridal
w_cocktailShort / cocktail dressEvening & bridal
w_laceLace / guipure / sheer evening dressEvening & bridal
w_sequinSequined / beaded evening gownEvening & bridal
w_straplessStrapless evening dressEvening & bridal
w_offshoulderOff-the-shoulder evening dressEvening & bridal
w_ballgownBall gown / princess dressEvening & bridal
w_mermaidMermaid evening gownEvening & bridal
w_bridalWedding dressEvening & bridal
w_dressEveryday women's dressEveryday dresses
w_knitdressKnit dressEveryday dresses
w_mantoManteau (long coat)Jackets, manteaux & coats
w_kimonoOpen-front manteau / kimono / long cardiganJackets, manteaux & coats
w_coatWomen's coat / trenchJackets, manteaux & coats
w_blazerWomen's blazer (keep your own top)Jackets, manteaux & coats
w_blazer_innerWomen's blazer with the top/blouse in the photoJackets, manteaux & coats
w_jacketWomen's jacket (denim, leather…)Jackets, manteaux & coats
w_pufferWomen's puffer jacketJackets, manteaux & coats
w_cardiganWomen's cardiganJackets, manteaux & coats
w_vestWomen's vest / giletJackets, manteaux & coats
w_chadorChadorChador & abaya
w_chador_sleevedSleeved chador (national / Lebanese)Chador & abaya
w_abayaAbayaChador & abaya
w_topWomen's T-shirt / topTops
w_blouseWomen's blouse / shirtTops
w_tunicTunicTops
w_knitWomen's sweaterTops
w_hoodieWomen's hoodie / sweatshirtTops
w_jeansWomen's jeansBottoms
w_trousersWomen's trousers / chinosBottoms
w_widelegWide-leg / palazzo trousersBottoms
w_joggersWomen's joggersBottoms
w_skirtSkirtBottoms
w_shortsWomen's shortsBottoms
w_leggingsLeggingsSocks, tights & leggings
w_tights_sheerSheer tights / pantyhoseSocks, tights & leggings
w_tights_opaqueOpaque / colored tightsSocks, tights & leggings
w_tights_patternPatterned / fishnet tightsSocks, tights & leggings
w_kneesocksKnee-high socksSocks, tights & leggings
w_socksWomen's ankle socksSocks, tights & leggings
w_kaftanKaftan / jalabiyaTraditional
w_localWomen's traditional costumeTraditional

Clothing — Men

KeyTypeGroup
m_blazerMen's blazer (keep your own shirt)Jackets, manteaux & coats
m_blazer_shirtMen's blazer with the shirt in the photoJackets, manteaux & coats
m_jacketMen's jacket (leather, denim…)Jackets, manteaux & coats
m_pufferMen's puffer jacketJackets, manteaux & coats
m_overcoatMen's overcoat / trenchJackets, manteaux & coats
m_cardiganMen's cardiganJackets, manteaux & coats
m_vestMen's vest / giletJackets, manteaux & coats
m_shirtMen's dress shirtTops
m_shirt_casualMen's casual / checked shirtTops
m_tshirtMen's T-shirtTops
m_poloPolo shirtTops
m_knitMen's sweaterTops
m_hoodieMen's hoodie / sweatshirtTops
m_jeansMen's jeansBottoms
m_trousersMen's trousers / chinosBottoms
m_cargoCargo trousersBottoms
m_joggersMen's joggersBottoms
m_shortsMen's shortsBottoms
m_socksMen's socksSocks, tights & leggings
m_compressionMen's compression tightsSocks, tights & leggings
m_thobeThobe / dishdashaTraditional
m_bishtBisht / men's cloakTraditional
m_kurdishMen's Kurdish suitTraditional

Sets & one-pieces — Women

KeyTypeGroup
w_suitWomen's trouser suit (keep your own top)Suits & formal sets
w_suit_fullWomen's trouser suit with the top in the photoSuits & formal sets
w_skirtsuitWomen's skirt suitSuits & formal sets
w_manto_setManteau & trousers setCasual, sport & loungewear sets
w_manto_set_scarfManteau, trousers & shawl setCasual, sport & loungewear sets
w_twopieceTwo-piece set (top + skirt/trousers)Casual, sport & loungewear sets
w_tracksuitWomen's tracksuitCasual, sport & loungewear sets
w_activewearActivewear set (leggings + top)Casual, sport & loungewear sets
w_pajamaWomen's pajama / lounge setCasual, sport & loungewear sets
w_jumpsuitWomen's jumpsuitJumpsuits & overalls
w_playsuitWomen's playsuitJumpsuits & overalls
w_overallsWomen's dungarees / overallsJumpsuits & overalls
w_lookComplete women's look from one photo (clothes + shoes + bag)Complete look from one photo
w_bridal_setWedding gown with veilComplete look from one photo

Sets & one-pieces — Men

KeyTypeGroup
m_suitMen's suit (keep your own shirt)Suits & formal sets
m_suit_shirtMen's suit with the shirt and tie in the photoSuits & formal sets
m_threepieceThree-piece suit (with waistcoat)Suits & formal sets
m_tuxTuxedoSuits & formal sets
m_tracksuitMen's tracksuitCasual, sport & loungewear sets
m_pajamaMen's pajama / lounge setCasual, sport & loungewear sets
m_shirt_pantsMen's shirt & trousers setCasual, sport & loungewear sets
m_tee_shortsMen's T-shirt & shorts setCasual, sport & loungewear sets
m_jumpsuitMen's jumpsuitJumpsuits & overalls
m_coverallWork coverallJumpsuits & overalls
m_overallsMen's dungarees / overallsJumpsuits & overalls
m_lookComplete men's look from one photo (clothes + shoes + bag)Complete look from one photo

Sets & one-pieces — Unisex

KeyTypeGroup
u_onesie_hoodHooded onesie (top + trousers + hood)Jumpsuits & overalls

Accessories — Women

KeyTypeGroup
w_heelsHigh heels / evening shoesShoes
w_flatsWomen's flats / ballerinas / loafersShoes
w_sneakersWomen's sneakersShoes
w_sandalsWomen's sandals / slidesShoes
w_anklebootsWomen's ankle bootsShoes
w_bootsWomen's tall bootsShoes
w_handbagHandbagBags
w_shoulderbagShoulder / crossbody bagBags
w_clutchEvening clutchBags
w_necklaceNecklace / gold necklaceJewelry
w_earringsEarringsJewelry
w_braceletBracelet / bangleJewelry
w_ringRingJewelry
w_jewelsetJewelry setJewelry
w_ankletAnkletJewelry
w_broochBroochJewelry
w_watchWomen's wristwatchWatches
w_sunglassesWomen's sunglassesEyewear
w_hatWomen's brimmed / straw / fedora hatHats & caps
w_headscarfHeadscarfHeadscarves, shawls & maghnaeh
w_shawlShawlHeadscarves, shawls & maghnaeh
w_maghnaehMaghnaeh (hood scarf)Headscarves, shawls & maghnaeh
w_turbanTurban / hijab capHeadscarves, shawls & maghnaeh
w_silkscarfSilk neckerchiefScarves, ties & bow ties
w_beltWomen's beltBelts & gloves
w_tiaraTiara / crownTiaras & hair accessories
w_hairclipHeadband / hair clipTiaras & hair accessories
w_veilBridal veilTiaras & hair accessories

Accessories — Men

KeyTypeGroup
m_dressshoesMen's dress shoesShoes
m_loafersMen's loafersShoes
m_sneakersMen's sneakersShoes
m_bootsMen's bootsShoes
m_sandalsMen's sandals / slidesShoes
m_bagMen's briefcase / shoulder bagBags
m_chainMen's chain necklaceJewelry
m_braceletMen's braceletJewelry
m_ringMen's ringJewelry
m_cufflinksCufflinksJewelry
m_watchMen's wristwatchWatches
m_sunglassesMen's sunglassesEyewear
m_hatMen's fedora hatHats & caps
m_tieNecktieScarves, ties & bow ties
m_bowtieBow tieScarves, ties & bow ties
m_pocketsquarePocket squareScarves, ties & bow ties
m_beltMen's beltBelts & gloves

Accessories — Unisex

KeyTypeGroup
u_backpackBackpackBags
u_beltbagBelt bag / small crossbodyBags
u_smartwatchSmartwatchWatches
u_eyeglassesEyeglasses / framesEyewear
u_capBaseball capHats & caps
u_beanieKnit beanieHats & caps
u_bucketBucket hatHats & caps
u_neckscarfScarf (neck)Scarves, ties & bow ties
u_glovesGlovesBelts & gloves