Hand it off through the API
Upload the photos, hand off the work, and get the result files when it’s done.
Work handed off through the API is kept as a project, as it is on screen, and comes off the same balance.
-
Create a key
Sign in and create one under “API keys” in the left menu. Each person has one key per workspace.
Every request carries the key in an
Authorization: Bearerheader. The code below reads the key and the address from these two lines.export FLOW_API_KEY="<api_key>" export FLOW_URL="https://flow.unblanq.com" -
Upload photos
Call once for each photo, with
slotset tomain_item_reference_images. Keep thedescriptorfrom each answer.It takes PNG, JPEG and WebP, up to 6 photos in one hand-off. An uploaded photo is kept until the
expires_atin itsdescriptor.curl -X POST \ "$FLOW_URL/v1/agencies/agency%3Afashion_atelier/actions/fashion_studio_create_product_cuts/uploads" \ -H "Authorization: Bearer $FLOW_API_KEY" \ -F "slot=main_item_reference_images" \ -F "file=@<file>" -
Hand it off
Put the
descriptorof each photo inapparel.main_item_reference_imagesand send.idempotency_keyis your own reference for this request.Use
result.run_idfrom the answer to check the status, andresult.admission.target_idto find the result.Send the same
idempotency_keywith the sameinputsagain within 24 hours, and nothing new is handed off: you get the first answer back (deduplicated: true). If theinputsdiffer, it is refused with 409.curl -X POST \ "$FLOW_URL/v1/agencies/agency%3Afashion_atelier/actions/fashion_studio_create_product_cuts/runs" \ -H "Authorization: Bearer $FLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": { "schema_version": "fashion_studio_create_product_cuts.input.v12", "generation_mode": "initial", "initial_source": {"mode": "uploads"}, "product": {"title": "Tracksuit", "target_gender": "unisex"}, "apparel": { "main_item_title": "Tracksuit", "main_item_reference_images": [<descriptor>, <descriptor>] }, "model": {"selection_mode": "auto", "pose_mode": "auto"}, "space": {"mode": "auto"}, "outputs": { "model_editorial": {"enabled": true, "count": 4}, "product_detail": {"enabled": true, "count": 4, "style": "styled_flat_lay"} } }, "idempotency_key": "request-001" }' -
Check the status
Call it every few seconds until the work ends. It has ended when
statusis one ofsucceeded,failed,cancelled.If it
failed,public_errorssays why.curl "$FLOW_URL/v1/runs/<run_id>" \ -H "Authorization: Bearer $FLOW_API_KEY" -
Get the result
The result is kept as a project. First find, in the list, the
record_idof the item whoserecord_keyis yourtarget_id. If it isn’t on the first page, put the answer’snext_cursorincursorfor the next page.Read with that
record_id, and the result files come back as a list inresult.outputs. Pick therecord_idandrevision_idof the one you want. Never put thetarget_idwhere therecord_idgoes.To download, send the project’s
record_id, and therecord_id(asoutput_record_id) andrevision_idof the file you picked. Call the answer’sresult.download_urlwith the same key to get the file.# 1. List: the record_id of the item whose record_key is your target_id curl -X POST \ "$FLOW_URL/v1/agencies/agency%3Afashion_atelier/actions/fashion_studio_list_products/runs" \ -H "Authorization: Bearer $FLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{"inputs": {"relation": "owned", "limit": 50}}' # 2. Read: the result files are listed in result.outputs curl -X POST \ "$FLOW_URL/v1/agencies/agency%3Afashion_atelier/actions/fashion_studio_read_product/runs" \ -H "Authorization: Bearer $FLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{"inputs": {"record_id": "<record_id>"}}' # 3. Download: the file’s address is in result.download_url curl -X POST \ "$FLOW_URL/v1/agencies/agency%3Afashion_atelier/actions/fashion_studio_download_product_version/runs" \ -H "Authorization: Bearer $FLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": { "record_id": "<record_id>", "output_record_id": "<output_record_id>", "revision_id": "<revision_id>", "output_format": "png" } }' # 4. Get the file: download_url goes after $FLOW_URL curl -L "$FLOW_URL<download_url>" \ -H "Authorization: Bearer $FLOW_API_KEY" \ -o <filename>
What you sendfashion_studio_create_product_cuts
| Name | Type | Required | Description |
|---|---|---|---|
apparel |
object |
No | The main item’s name and photos, required for a new project. |
camera |
object |
No | The camera type (camera_class) and film style (film_profile). If you don’t send it, it’s dslr. |
composition_preferences |
object | null |
No | Choose the aspect ratio (aspect_ratio), focus (focus) and framing (framing). If you don’t send it, they’re auto. |
design_text |
object |
No | Write the language of the text in story cuts and creative cuts as a sentence in language_direction. |
environment_setting |
object |
No | The weather (weather) and time of day (time_of_day). If you don’t send it, it’s clear, late morning to early afternoon. |
generation_mode |
enum: "initial", "additional" |
Yes | Send initial to make a new project. |
initial_source |
object | null |
No | What the project starts from, required for a new project. To start from the photos you uploaded, send {"mode": "uploads"}. |
model |
object |
No | The model in the cuts, and the poses, required for a new project. With auto, it picks a model that fits the target gender from the models you made or that were shared with you (for an administrator, also those of the people they administer), and sets the poses automatically. |
outputs |
object | null |
No | The resolution (resolution_tier) and the number of cuts of each type. If you send it, turn on at least one of model_editorial, product_detail, story_card and creative with enabled. |
product |
object |
Yes | The product name (title) and the target gender (target_gender: female, male or unisex). |
round_request_id |
stringminLength: 1 · maxLength: 256 |
Yes | This request’s reference. |
schema_version |
const: "fashion_studio_create_product_cuts.input.v12" |
Yes | The version of the input format. Send the value shown, as it is. |
smart_retouch |
object |
No | Smart Retouch. With on (the default), you get each model cut and creative cut as one retouched image. |
smart_retry |
object |
No | Smart Retry. Turn it on (enabled), and it remakes any cut whose result has a problem, adding a charge each time. |
space |
object |
No | The shooting space, required for a new project. With auto, it’s set automatically. |
You don’t need to send product.product_version_id, product.product_id or round_request_id: Flow fills them in from idempotency_key.