Skip to main content
POST
Generate creative variations of an image
Genera variazioni creative di una image sorgente. La chiamata restituisce 202 Accepted con un id del job; interroga GET /images/variations/{id} per il risultato. L’image prende esattamente uno tra image_id, url o base64 + mime_type. Richiede lo scope images.transform.

Esempio: una sorgente per modalità

La risposta 202 è l’handle del job asincrono:
202 Accepted
Invia esattamente una modalità sorgente in image. target — cosa possono cambiare le variazioni — è everything (predefinito), person, object o scene. creativity è subtle o creative (predefinito). variation_instructions (cosa cambiare) e preservation_instructions (cosa mantenere) sono testo libero facoltativo, ≤ 2000 caratteri ciascuno. num_outputs (1–4) è 1 per impostazione predefinita e ogni output viene addebitato. Non c’è un parametro resolution — la risoluzione di output è ereditata dalla sorgente.

Credits

Ogni output costa 5 credits a 1K, con scalatura in base al livello di risoluzione dell’immagine sorgente (1K ×1, 2K ×2, 4K ×4) e moltiplicato per num_outputs. Vedi Prezzi.

Errori

Autorizzazioni

Authorization
string
header
obbligatorio

Organization API key as a bearer token: Authorization: Bearer samsa_sk_....

Corpo

application/json

POST /images/variations body (SAM-816 / S8.4 — ADR §8, §10).

Generate creative variations of ONE source image (the app's Gemini 3 Pro variations flow). The source is exactly one of image_id (an image in your organization's context), an https url, or base64+mime_type. The output resolution is inherited from the source (there is no resolution param); each output is billed at 5 x resolution_multiplier credits (1K:1x, 2K:2x, 4K:4x) where the multiplier is the source image's resolution tier. target and creativity are lowercase public aliases of the internal Gemini variation controls; num_outputs defaults to 1 (the app default is 4).

image
PublicImageEditSource · object
obbligatorio

The source image: exactly one of image_id, url, or base64+mime_type.

target
enum<string>
predefinito:everything

What the variations may change: everything (default), person, object, or scene.

Opzioni disponibili:
everything,
person,
object,
scene
Esempio:

"everything"

creativity
enum<string>
predefinito:creative

How far the variations may deviate from the source: subtle or creative (default).

Opzioni disponibili:
subtle,
creative
Esempio:

"creative"

variation_instructions
string | null

Optional free-text guidance for WHAT to change (<= 2000 chars).

Maximum string length: 2000
Esempio:

"Try different background colors and lighting"

preservation_instructions
string | null

Optional free-text guidance for WHAT to keep (<= 2000 chars).

Maximum string length: 2000
Esempio:

"Keep the product label and shape unchanged"

num_outputs
integer
predefinito:1

Number of variations to generate (1-4). Defaults to 1 (the app default is 4); each output is billed.

Intervallo richiesto: 1 <= x <= 4
Esempio:

1

webhook_url
string | null

Optional https webhook notified once on terminal status (signed per the webhook signature scheme; see the webhooks docs).

Esempio:

"https://example.com/webhooks/samsa"

Risposta

Successful Response

Shared 202 body for the transform-op submits (SAM-813 / S8 wave).

Every POST /images/<op> returns the async job handle {id, status, estimated_credits}. The initial status is pending (the job is queued), with ONE exception: background-removals and vectorizations answer an owned-image_id cache hit (a ready result already exists for that image) with status: "completed" and estimated_credits: 0 — no new job is queued, the completed webhook event is emitted immediately for a supplied webhook_url, and the result is already available from the op's GET .../{id} endpoint. The other transform ops (img2img, variations, resizes, upscales) always start pending.

id
string<uuid>
obbligatorio

The job id — poll the op's GET .../{id} endpoint.

status
enum<string>
obbligatorio

Initial status: pending (job queued — enter the polling flow), or completed with estimated_credits: 0 when background-removals / vectorizations serve an owned-image cache hit (the result is immediately available).

Opzioni disponibili:
pending,
processing,
completed,
failed,
cancelled
Esempio:

"pending"

estimated_credits
integer
obbligatorio

Credits this job is expected to cost — 0 on a cache-hit completed response.

Esempio:

5