Skip to content

API Endpoints

EnvironmentBase URL
Non-productionhttps://api-nonprod.thg.dev/agentic-commerce/v1/vto
Productionhttps://api.thg.dev/agentic-commerce/v1/vto

All endpoints require an X-API-Key header (forwarded to Vertex AI / internal services via Apigee). Pass x-session-id on subsequent requests after upload to keep analytics, history, and cache coherent.


Upload and process a person photo for virtual try-on.

{
"personImageBase64": "base64-encoded-jpeg",
"processBackground": false
}
FieldTypeRequiredDescription
personImageUrlstringYes*Public URL of the person photo
personImageBase64stringYes*Base64-encoded person photo
processBackgroundbooleanNoReplace background with studio gray. Default: false

*Provide either personImageUrl or personImageBase64, not both.

Client-side validation (SDK, before upload): file type jpeg|png|webp|heic|heif, size ≤ 10 MB, min dimension 512 px, max aspect ratio 4:1.

Server-side validation: format/size, Cloud Vision SafeSearch moderation, and a Gemini photo-suitability check that can return warnings and suggestions.


Lightweight cache check — does a try-on result already exist for this (person, product) pair under the active pipeline config? No image data is transferred.

GET /try-on/check?person=<ref>&model=<imageUrl>&productName=<name>
Query paramRequiredDescription
personYespersonImageRef from /upload-photo (or a model ID like model-01)
modelYesProduct image URL
productNameNoIncluded in cache key when provided
productDescriptionNoIncluded in cache key when provided
productCategoryNoIncluded in cache key when provided

Generate a virtual try-on image.

{
"personImageRef": "uuid-from-upload",
"modelImageUrl": "https://cdn.example.com/product.jpg",
"productName": "Blue Oxford Shirt",
"productUrl": "https://example.com/p/blue-oxford",
"productDescription": "100% cotton regular fit shirt",
"productCategory": "shirts"
}
FieldTypeRequiredDescription
personImageRefstringYesUUID from POST /upload-photo, or a model ID (model-01 …)
modelImageUrlstringYes*Product/garment image URL
candidateImageUrlsstring[]Yes*Up to 5 gallery URLs — server AI-picks the best
productNamestringNoEnriches the garment description prompt
productUrlstringNoLink to PDP (used in share page)
productDescriptionstringNoPDP metadata — enriches description step
productCategorystringNoPDP metadata — enriches description step

*Provide modelImageUrl or candidateImageUrls (at least one).

Pipeline config is not accepted in the body — it is controlled by Apigee per API key (via the X-VTO-Pipeline-Config header injected from the API Product’s custom attributes).


List available predefined models.

Response (200)
{
"models": [
{ "id": "model-01", "thumbnailUrl": "/models/model-01/thumbnail", "label": "Model A" }
]
}

Returns the model thumbnail as image/jpeg.


HTML share page with OpenGraph tags for social previews. Linked from the modal’s share dropdown.

Raw PNG of the shared result — used as a source for cached-result rendering.


Submit quality feedback on a try-on result.

Request
{
"requestId": "uuid-from-try-on",
"value": "up",
"reason": null
}

value: "up" or "down". When "down", include reason: "garment_wrong", "body_mismatch", "quality", or "other".


The try-on pipeline is composable. Each step can be independently toggled per client, with model overrides:

StepDefaultDescription
Image selectionONPick the best product image from candidateImageUrls.
Product flat-layONStrip the model from the product image → garment on white. Cached per product.
Product descriptionONDetailed garment description (enriched with PDP metadata). Cached per product.
GenerationalwaysNano Banana 2 (gemini-3.1-flash-image-preview) produces the try-on image.
Quality scoringOFFScore result against inputs; retry on fail.

Flat-lay and description run in parallel. Results are cached per product (SHA256 of URL + metadata + active config) so expensive steps run once per product.