Try-On API

Virtual Try-On API

The Try-On API allows you to programmatically apply garments to person images.

Endpoints

Core endpoints for virtual try-on integration.

POST

Upload Person Image

Upload a person's photo to the virtual try-on system. This stores the image and returns a tryon_person_image_id which you will need for the task generation.

Parameters

  • imageRequired
    The person's photo file.
  • image_nameOptional
    A label for the image (e.g., 'front_model_1').
POST/v2/tryon/person-images/
Request

Headers

x-api-key: "YOUR_API_KEY"

Content-Type: "multipart/form-data"

200 OKResponse
{
  "id": 181,
  "image_url": "https://cdn.vtryon.com/img/..."
}
GET

List Person Images

Retrieves a paginated list of all person images you have uploaded.

Parameters

  • image_nameOptional
    Filter by image name (e.g., 'front_model_1').
  • pageOptional
    The page number to retrieve (e.g., page=1).
  • page_sizeOptional
    The number of items to return per page (e.g., page_size=10).
GET/v2/tryon/person-images/
Request

Headers

x-api-key: "YOUR_API_KEY"

200 OKResponse
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 181,
      "image_url": "https://cdn.vtryon.com/img/...",
      "image_name": "front_model"
    }
  ]
}
DELETE

Delete Person Image

Permanently deletes a specific person image from the system using its ID.

Parameters

  • person_image_idRequired
    Unique ID of the person image to delete.
DELETE/v2/tryon/person-images/{person_image_id}/
Request

Headers

x-api-key: "YOUR_API_KEY"

200 OKResponse
{
  "detail": "Deleted successfully"
}
POST

Upload Garment Image

Upload the garment photo file. This returns a unique garment_image_id for the uploaded clothing item.

Parameters

  • imageRequired
    The garment photo file.
  • image_nameOptional
    A label for the garment (e.g., 'red_tshirt').
POST/v2/tryon/garment-images/
Request

Headers

x-api-key: "YOUR_API_KEY"

Content-Type: "multipart/form-data"

200 OKResponse
{
  "id": 88,
  "image_url": "https://cdn.vtryon.com/img/garments/..."
}
GET

List Garment Images

Retrieves a list of all garment images stored in your library.

Parameters

  • image_nameOptional
    Filter by image name (e.g., 'red_tshirt').
  • pageOptional
    The page number to retrieve (e.g., page=1).
  • page_sizeOptional
    The number of items to return per page (e.g., page_size=10).
GET/v2/tryon/garment-images/
Request

Headers

x-api-key: "YOUR_API_KEY"

200 OKResponse
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 88,
      "image_url": "https://cdn.vtryon.com/img/garments/...",
      "image_name": "red_tshirt"
    }
  ]
}
DELETE

Delete Garment Image

Permanently deletes a specific garment image from your library using its ID.

Parameters

  • idRequired
    Unique ID of the garment image to delete.
DELETE/v2/tryon/garment-images/{id}/
Request

Headers

x-api-key: "YOUR_API_KEY"

200 OKResponse
{
  "detail": "Deleted successfully"
}
POST

Validate Person Image (Recommended)

Check if the uploaded person image is suitable for the AI model (e.g., correct lighting, pose, and visibility). Returns validation details indicating whether the image passes quality checks.

Parameters

  • tryon_person_image_idRequired
    ID of the person image to validate.
POST/v2/tryon/person-validations/
Request

Headers

x-api-key: "YOUR_API_KEY"

Body (JSON)

{
  "tryon_person_image_id": 185
}
200 OKResponse
{
  "tryon_person_image_id": 185,
  "is_valid": true,
  "issues": []
}
GET

Get Validation Result

Retrieve the existing validation result for a person image to check its suitability.

Parameters

  • tryon_person_image_idRequired
    ID of the person image.
GET/v2/tryon/person-validations/
Request

Headers

x-api-key: "YOUR_API_KEY"

200 OKResponse
{
  "tryon_person_image_id": 185,
  "is_valid": true,
  "issues": []
}
POST

Initiate the Try-On Task

Once you have valid IDs for both the person and the garment, you can start the generation job. The API queues the task for processing and returns a Task Object.

Parameters

  • tryon_person_image_idRequired
    Unique ID of the uploaded person photo.
  • garment_image_idsRequired
    Array of garment IDs to apply.
POST/v2/tryon/tasks/
Request

Headers

x-api-key: "YOUR_API_KEY"

Body (JSON)

{
  "tryon_person_image_id": 181,
  "garment_image_ids": [88]
}
200 OKResponse
{
  "id": 200,
  "status": "queued",
  "created_at": "2024-05-05T12:00:00Z"
}
GET

List All Try-On Tasks

Retrieves a paginated list of all virtual try-on tasks associated with your account.

Parameters

  • garment_imagesOptional
    Filter tasks by garment image ID.
  • tryon_person_imageOptional
    Filter tasks by person image ID.
  • pageOptional
    The page number to retrieve (e.g., page=1).
  • page_sizeOptional
    The number of items to return per page (e.g., page_size=10).
GET/v2/tryon/tasks/
Request

Headers

x-api-key: "YOUR_API_KEY"

200 OKResponse
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 200,
      "status": "completed",
      "tryon_person_image": 181,
      "garment_image_ids": [88],
      "result_url": "https://cdn.vtryon.com/res/...",
      "created_at": "2024-05-05T12:05:00Z"
    }
  ]
}
GET

Poll for Task Status & Results

Because AI image generation is asynchronous, you must poll the server (e.g., every 3-5 seconds) to get the final image.

Task Statuses

queued/pending: Task is in the queue.
processing: AI is currently generating the image.
completed: The response will contain the result URL.
failed: Check the response for error details.
GET/v2/tryon/tasks/{task_id}/
Request

Headers

x-api-key: "YOUR_API_KEY"

200 OKResponse
{
  "id": 200,
  "status": "completed",
  "result_url": "https://cdn.vtryon.com/res/..."
}

What's Next?

Master the Vtryon API to build your own custom fashion applications.