Sign in
Image Localization Studio

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.

  1. 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: Bearer header. The code below reads the key and the address from these two lines.

    shell
    export FLOW_API_KEY="<api_key>"
    export FLOW_URL="https://flow.unblanq.com"
  2. Upload photos

    Call once for each photo, with slot set to source_images. Keep the descriptor from each answer.

    It takes PNG, JPEG and WebP, up to 1,000 photos in one hand-off. An uploaded photo is kept until the expires_at in its descriptor.

    curl
    curl -X POST \
      "$FLOW_URL/v1/agencies/agency%3Aproduct_detail_translation_studio/actions/generate_product_detail_translation/uploads" \
      -H "Authorization: Bearer $FLOW_API_KEY" \
      -F "slot=source_images" \
      -F "file=@<file>"
  3. Hand it off

    Put the descriptor of each photo in source_images and send. idempotency_key is your own reference for this request.

    Use result.run_id from the answer to check the status, and result.admission.target_id to find the result.

    Send the same idempotency_key with the same inputs again within 24 hours, and nothing new is handed off: you get the first answer back (deduplicated: true). If the inputs differ, it is refused with 409.

    curl
    curl -X POST \
      "$FLOW_URL/v1/agencies/agency%3Aproduct_detail_translation_studio/actions/generate_product_detail_translation/runs" \
      -H "Authorization: Bearer $FLOW_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "inputs": {
          "image_source": "upload",
          "source_images": [<descriptor>, <descriptor>],
          "target_language": "Friendly Japanese for Japanese customers in their 30s"
        },
        "idempotency_key": "request-001"
      }'
  4. Check the status

    Call it every few seconds until the work ends. It has ended when status is one of succeeded, failed, cancelled.

    If it failed, public_errors says why.

    curl
    curl "$FLOW_URL/v1/runs/<run_id>" \
      -H "Authorization: Bearer $FLOW_API_KEY"
  5. Get the result

    The result is kept as a project. First find, in the list, the record_id of the item whose record_key is your target_id. If it isn’t on the first page, put the answer’s next_cursor in cursor for the next page.

    Read with that record_id, and the result files come back as a list in result.outputs. Pick the record_id and revision_id of the one you want. Never put the target_id where the record_id goes.

    To download, send the project’s record_id, and the record_id (as output_record_id) and revision_id of the file you picked. Call the answer’s result.download_url with the same key to get the file.

    curl
    # 1. List: the record_id of the item whose record_key is your target_id
    curl -X POST \
      "$FLOW_URL/v1/agencies/agency%3Aproduct_detail_translation_studio/actions/list_product_detail_translation_projects/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%3Aproduct_detail_translation_studio/actions/read_product_detail_translation_project/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%3Aproduct_detail_translation_studio/actions/download_product_detail_translation_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 sendgenerate_product_detail_translation

NameTypeRequiredDescription
brand_name object No How the brand name is written. Give the original (source_text) and the style (mode: keep as it is, exact a spelling you set, auto translated), and with exact, exact_target_text too.
image_source stringenum: "upload", "product_page" No Where the source images come from: upload (the default) for uploaded images, product_page for a product page URL.
product_name object No How the product name is written. It works the same way as brand_name.
product_page_url string No The product page URL, required when image_source is product_page.
project_id stringminLength: 1 Yes The project’s reference.
request_id stringminLength: 1 Yes This request’s reference.
schema_version string No The version of the input format. You don’t need to send it.
source_images arrayminItems: 1 · maxItems: 1000 · items: object No The product-detail images to translate, required when image_source is upload. Put in the descriptor from each upload, in order.
source_layout_mode stringenum: "independent_sections", "continuous_fragments" No continuous_fragments if the images are pieces of one long page, independent_sections (the default) if each stands on its own.
target_language stringminLength: 1 · maxLength: 320 Yes Write the language to translate into, and the tone, as a sentence.

You don’t need to send project_id or request_id: Flow fills them in from idempotency_key.

Image Localization Studio

Hand it off now