Apparel Try-On API
Virtually try on apparel on a model or generate professional fashion photos.
GET/api/image/apparel-try-on-prompts
Retrieve a list of all available pre-defined scene instructions for the Apparel Try-On endpoint.
Example Request
curl -X GET 'https://codingmantra.com/api/image/apparel-try-on-prompts'Example Response
{
"data": [
{
"id": "minimalist-studio",
"title": "Minimalist Studio",
"categoryId": "studio-fashion",
"categoryTitle": "Studio & Fashion Shoots",
"demoImageUrl": "https://..."
},
// ... more prompts
]
}POST/api/image/apparel-try-on
Virtually try on apparel on a model or generate a professional fashion photo.
Request Body
| Field | Type | Description |
|---|---|---|
| apparelImages | Array of Objects | Required. An array of apparel image objects. Each object must have either a `dataUrl` or `url`. Supports optional `label` and `prompt`. |
| modelImage | string | Optional. A data URI or URL of a person to model the apparel. If omitted, an AI model will be generated. |
| prompt | string | Optional. Additional instructions for the scene or model style. |
| logoImage | string | Optional. A data URI or URL of a logo to place on the image. |
| logoPlacement | string | Optional. Instructions for logo placement (e.g., 'top-left', 'center'). |
| logoSize | number | Optional. A numeric value (0.1 to 0.5) representing the logo size as a percentage of the image. |
| referenceImage | string | Optional. A data URI or URL of a reference image to guide the style. |
| aspectRatio | string | Optional. Default: `'9:16'`. |
| outputResult | string | Optional. `'base64'` (default) or `'url'`. |
Example Request
curl -X POST 'https://codingmantra.com/api/image/apparel-try-on' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"apparelImages": [
{ "url": "https://example.com/t-shirt.png", "label": "white t-shirt" }
],
"modelImage": "https://example.com/model.jpg",
"prompt": "urban street style",
"aspectRatio": "9:16"
}'Example Response
{
"data": {
"photoDataUri": "data:image/png;base64,..."
}
}