Quickstart
Two examples: a synchronous call (virtual try-on) and an asynchronous one (video). Both assume you already have an access token.
export TOKEN="<your access token>"
Virtual try-on
Send a photo of a person and a photo of a garment. The call returns when the result is ready.
curl -X POST https://api.tryonlabs.ai/api/v1/vton/generate/ \
-H "Authorization: Bearer $TOKEN" \
-F "person_image=@person.jpg" \
-F "garment_image=@shirt.jpg" \
-F "resolution=2k" \
-F "generation_mode=quality"
The response is an experiment object. Download the result image with its id:
curl -G https://api.tryonlabs.ai/api/v1/vton/download/ \
-H "Authorization: Bearer $TOKEN" \
--data-urlencode "experiment_id=<id>" \
-o result.png
Resolution and generation mode change how many credits a call costs. If you don't have enough credits, the API returns 400 with a message saying how many are required.
Generate an image
curl -X POST https://api.tryonlabs.ai/api/v1/image/generate/ \
-H "Authorization: Bearer $TOKEN" \
-F "prompt=A studio photo of a model in a red linen dress" \
-F "resolution=2K"
Attach -F "image=@photo.jpg" to edit an existing image instead. The response contains a download_url.
Generate a video (asynchronous)
Video takes longer, so the flow is start, poll, download.
# 1. Start. Returns 202 and a generation_id.
curl -X POST https://api.tryonlabs.ai/api/v1/video/generate/ \
-H "Authorization: Bearer $TOKEN" \
-F "prompt=A model walking down a runway" \
-F "duration=8" \
-F "resolution=1080p" \
-F "aspect_ratio=16:9"
# 2. Poll until status is "completed".
curl -G https://api.tryonlabs.ai/api/v1/video/status/ \
-H "Authorization: Bearer $TOKEN" \
--data-urlencode "generation_id=<generation_id>"
# 3. Download the MP4.
curl -G https://api.tryonlabs.ai/api/v1/video/download/ \
-H "Authorization: Bearer $TOKEN" \
--data-urlencode "generation_id=<generation_id>" \
-o video.mp4
Downloading before the video is ready returns 409.
Errors
Errors are JSON with an HTTP status code of 400 (bad input or not enough credits), 401 (missing or invalid token), 403 (no access to a resource) or 404 (not found). See each endpoint in the API Reference for the exact responses.