TryItOn
API Reference

Virtual Try-On — Hairstyle

Preview a new haircut (and optionally a new hair color) on a person from a single face photo.

Restyle a person's hair. Submit a face photo (face_image) and a haircut; the API returns a job id you poll on the Job Status endpoint until the result is ready.

POST https://tryiton.now/api/v1/tryon/hairstyle

All image fields accept either a public URL or a base64 data URL (data:image/png;base64,...).

Request

Use an official SDK (recommended) or call the endpoint directly.

import { TryItOn } from "tryiton";

const client = new TryItOn({ apiKey: process.env.TRYITON_API_KEY });

const jobId = await client.tryOnHairstyle({
  faceImage: "https://example.com/face.jpg",
  haircut: "BuzzCut",
  hairColor: "ash blonde with subtle highlights",
});

const [resultUrl] = await client.waitForResult(jobId);
import os
from tryiton import TryItOn

client = TryItOn(api_key=os.environ["TRYITON_API_KEY"])

job_id = client.try_on_hairstyle(
    face_image="https://example.com/face.jpg",
    haircut="BuzzCut",
    hair_color="ash blonde with subtle highlights",
)

urls = client.wait_for_result(job_id)
curl -X POST https://tryiton.now/api/v1/tryon/hairstyle \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
           "face_image": "https://example.com/face.jpg",
           "haircut": "BuzzCut",
           "hair_color": "ash blonde with subtle highlights"
         }'

Body Parameters

ParameterTypeDefaultDescription
face_imagestringRequired. URL or base64 data URL of the person's face. A portrait works best.
haircutstringRequired. One of the supported haircut values below.
hair_colorstring(current color)Optional free-text color description. Omit to keep the person's current color.
num_samplesinteger1Number of output images to generate (1–4). Charged per output image.
output_formatstringpngOutput image format: png or jpeg.

hair_color is free text now. It is no longer a fixed list of preset colors — describe whatever you want in natural language, including nuance: "ash blonde", "jet black with a blue tint", "copper red, subtle balayage".

Supported haircut values

Afro, BobCut, BowlCut, BoxBraids, BuzzCut, Chignon, CombOver, CornrowBraids, CurlyBob, CurlyShag, DoubleBun, Dreadlocks, FauxHawk, FishtailBraid, LongCurly, LongHairTiedUp, LongHimeCut, LongStraight, LongTwintails, LongWavy, LongWavyCurtainBangs, ManBun, MessyTousled, PixieCut, Pompadour, Ponytail, ShortCurlyPixie, ShortTwintails, ShoulderLengthHair, Spiky, TexturedFringe, TwinBraids, Updo, WavyShag.

Response

A successful submission returns a jobId. Poll /api/v1/status/{jobId} until status is completed.

201 Created
{
  "ok": true,
  "jobId": "64b7f1a9d9a3b8e5c7f9a123"
}

Credits: 1 credit per output image. With num_samples: 3 you are charged 3 credits. Failed jobs are never charged.

On this page