Repeat session

How to clone a session — the same configuration, optionally a different image count per product, with the required Idempotency-Key header.

What you'll achieve

The merchant wants more images in the same style — or wasn't quite happy with the previous round. In this tutorial you'll clone an existing session with a single call: the same configuration (style, scenery, model, aspect ratio), the same products, optionally a different image count per product.

Prerequisites

  • A plugin installation API key (how to get one) with the plugin.jobs:create, plugin.jobs:read permissions.
  • The order_id of the session you want to repeat (from the POST /jobs response, or from GET /jobs/{id} — the order_id field).

In the examples, replace mk_live_… with your own key. The base address is https://qamera.ai.

Flow

1. GET /orders/{id}         → (optional) review the source session
2. POST /orders/{id}/clone  → a new session (Idempotency-Key required)
   ├─ empty body            → the same products and image counts
   └─ body with subjects[]  → new image counts per product
3. Receive results as usual

Steps

1. (Optional) Review the source session

curl https://qamera.ai/api/v1/plugin/orders/00000000-0000-0000-0000-000000000099 \
  -H "X-Api-Key: mk_live_xxxxxxxx.yyyyyyyy"

The response contains session_config, the list of products with job counters (jobs_total, jobs_completed, jobs_failed), the generated images, and the credits consumed (summary.credits_consumed). Useful for showing the merchant exactly what will be repeated.

2. Clone the session

The Idempotency-Key header is mandatory when cloning — it protects against double-charging credits if you retry the request after a timeout. A call without it returns 400 invalid_input.

An empty body repeats the session 1:1 — the same products, the same image counts:

curl -X POST https://qamera.ai/api/v1/plugin/orders/00000000-0000-0000-0000-000000000099/clone \
  -H "X-Api-Key: mk_live_xxxxxxxx.yyyyyyyy" \
  -H "Idempotency-Key: sklep1-klon-99-runda2" \
  -H "Content-Type: application/json" \
  -d '{}'

Want to change the image count or repeat only some of the products? Provide subjects[] — this is a full replacement of the list: only the products in the list are cloned, each with a new images_count. Products left off the list don't go into the new session.

curl -X POST https://qamera.ai/api/v1/plugin/orders/00000000-0000-0000-0000-000000000099/clone \
  -H "X-Api-Key: mk_live_xxxxxxxx.yyyyyyyy" \
  -H "Idempotency-Key: sklep1-klon-99-runda3" \
  -H "Content-Type: application/json" \
  -d '{
    "subjects": [
      { "product_ref": "sklep1:produkt-7", "images_count": 8 }
    ]
  }'

The response (HTTP 201) is a complete new session — with a new order_id:

{
  "order_id": "00000000-0000-0000-0000-000000000150",
  "status": "pending",
  "session_config": { "aspect_ratio": "4:5", "model_id": null, "scenery_id": null, "preset_id": null },
  "subjects": [
    {
      "product_ref": "sklep1:produkt-7",
      "product_label": "Kubek ceramiczny 300 ml",
      "packshot_asset_id": "…",
      "jobs_total": 8,
      "jobs_completed": 0,
      "jobs_failed": 0,
      "outputs": []
    }
  ],
  "summary": { "credits_consumed": 80, "credits_refunded": 0 },
  "external_metadata": null,
  "created_at": "2026-06-03T09:00:00.000Z",
  "updated_at": "2026-06-03T09:00:00.000Z"
}

Save the new order_id. Three things worth keeping in mind:

  • Ratings don't carry over — a clone is a fresh start; you rate the new round's images from scratch.
  • Credits are charged anew — you pay for a new session like any other (402 quota_exceeded when you run out).
  • A clone clones normally — you can clone a session that is itself a clone.

3. Receive the results

Exactly as with a regular session — webhooks or polling. See receiving results.

Common errors

ErrorWhy it happenedWhat to do
400 invalid_inputMissing Idempotency-Key headerAdd the header with a value unique to this round — details
409 idempotency_conflictThe same Idempotency-Key used with a different bodyEach cloning round needs its own key — details
404 not_foundorder_id doesn't exist or belongs to another installationCheck order_id; you can only clone your own sessions — details
402 quota_exceededNot enough credits for the new roundTop up credits; check the balance in GET /medetails

Next steps

  • Receiving results — webhooks and refreshing URLs.
  • Session parameters — when the new round should have a different style, send a new session via POST /jobs instead of cloning.