API Reference

Quick Start Try-On πŸ‘•

Implement AI solutions and let your customers try products digitally with new software.

πŸ“˜

The overall API call flow is:

  1. Each request requires an api key (X-API-key header) to submit a generation task, which returns an event_id
  2. Using the event_id, you can check the generation status.
  3. When the generation status is READY, you can download the file via the provided URL.

Prerequisites

Generate

Use the tryon method to start generation process.

Select the photo you want to try on and pass its URL to the media_url parameter.

Select a photo of the clothing item you want to try on and pass its URL to the garment_url parameter..

Specify the mask_type parameter

Possible mask_type value

  • overall - replace completely
  • upper - replace top
  • lower - replace bottom

POST:

curl --request POST \
     --url https://api.glam.ai/api/v1/tryon \
     --header 'X-API-Key: DeqSDwfWwec' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "media_url": "https://i.etsystatic.com/7799304/r/il/a945af/1501300791/il_570xN.1501300791_88yl.jp",
  "garment_url": "https://www.bunaai.com/cdn/shop/files/DSC_7160.jpg",
  "mask_type": "overall"
}
'

Response:

event_id - The generation ID, required to retrieve the result of the generation process

{
  "event_id": "c0a76988-27ea-4b1a-8115-9239c93a895c"
}

Get result

Use the tryon method along with the event_id from the previous step to retrieve the result.

GET:

curl --request GET \
     --url https://api.glam.ai/api/v1/tryon/c0a76988-27ea-4b1a-8115-9239c93a895c \
     --header 'X-API-Key: DeqSDwfWwec' \
     --header 'accept: application/json'

Response:

media_urls - A list of generated result URLs

status - The current generation status

{
  "media_urls": [
    "https://static.getglam.app/comfyui/processings/api/outputs/b15ddc55-fb69-4281-bf28-238c319e0e58-u1_0.jpg"
  ],
  "status": "READY"
}

Possible generation statuses

  • IN_PROGRESS - the generation process is ongoing
  • IN_QUEUE - the generation is waiting in the queue
  • READY - the generation is complete, and the result is available
  • FAILED - the generation process failed due to an error
❗️

The number of parallel generations depends on your current plan

You can check and change the current plan in Billing section (see Max parallel requests plan field)