Skip to Content

Images

Queue image generation, editing, and variation jobs.

Base URL: https://app.gavana.ai/api/canvas-agent/v1 · Authentication: HTTP bearer, token format cba_<token-id>.<secret>

Operations

OperationPurposeScopes
POST /images/editQueue an image editcanvas:read, asset:read
POST /images/generateQueue image generationcanvas:read, asset:read
POST /images/importImport a public HTTPS image as a durable canvas nodecanvas:read, canvas:write, asset:read, image:generate
POST /images/variationsQueue image variationscanvas:read, asset:read

POST /images/edit

Queue an image edit

  • Operation id: startImageEdit
  • Scopes: Requires canvas:read + asset:read. When dryRun is false or omitted, also requires canvas:write + image:generate. When elements contains at least one version-pinned Element, also requires element:read.
  • CLI equivalent: gavana image edit

Request body (application/json, required)

At least one of references or source is required.

FieldTypeRequiredNotes
canvasIdstringYesA plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle.
baseRevisionstringNomin length 1, max length 200.
idempotencyKeystringNomin length 8, max length 200.
targetNodeIdstringNoPattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$.
targetNodeIdsarray of stringNomin items 1, max items 4.
promptstringNomin length 1, max length 8000.
promptNodeIdstringNoPattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$.
referencesarray of string | ImageReferenceInputNoExtra guidance for the job (identity, construction, texture, fit, style), not the image being edited unless a reference has role source. Stable image handles or role-bearing reference objects. Across references and source, at most 16 handles are allowed and every handle must be unique. When omitted for one named target, Gavana may derive visible incoming mode:reference image edges; hidden provider plumbing is never derived. min items 1, max items 16.
elementsarray of ElementGenerationReferenceNoUp to eight reusable Elements pinned to exact immutable versions. All source images, including exact sources omitted from provider input, share the 16-image limit with references and source. Exact PNGs are frozen before provider dispatch and are additionally bounded to 16 MB, 16 placements, two output-area equivalents, 16 million pixels per source, and 32 million source pixels total. element:read is required when this array is non-empty. max items 8.
sourcestringNoFor an edit, the image being edited. Gavana sends it to the model first, as Image 1, and labels it as the image to keep except for the requested changes. A reference { handle, role: “source” } declares the same thing; declare only one. It must be unique across source and references, and the combined maximum is 16. Pattern ^(?:node:[A-Za-z0-9_-]{1,180}|asset:(?:[A-Za-z0-9_-]{1,180}:)?[A-Za-z0-9_-]{1,180})$.
changeRegionsarray of objectNoThe only areas of the source an edit may change, as normalized 0-1 rectangles. Requires a declared source (source, or a reference with role source). Gavana keeps the source’s pixels outside these regions. min items 1, max items 8.
changeRegions[].xnumberYesmin 0, max 1.
changeRegions[].ynumberYesmin 0, max 1.
changeRegions[].widthnumberYesmax 1.
changeRegions[].heightnumberYesmax 1.
countintegerNoNumber of outputs. When supplied, it must equal the selected target count; when omitted, Gavana uses the selected target count. min 1, max 4.
connectionIdstringNoPattern ^[A-Za-z0-9_-]{1,180}$.
modelstringNoA provider model id or opaque model:<key> handle from GET /models. max length 650.
sizestringNomax length 80.
qualitystringNomax length 80.
webhookImageJobWebhookInputNo—
webhook.urlstring (uri)YesA public HTTPS callback endpoint. Private, loopback, local-network, credential-bearing, and fragment-bearing URLs are rejected. max length 2048. Pattern ^https://.
webhook.secretstringYesA caller-owned HMAC secret encrypted at rest and never returned by the API. min length 32, max length 512.
requestContractCreativeImageRequestNoImmutable request snapshot stored with the existing image job; original user wording, explicit requirements, roles, destination and selection remain traceable. Source fingerprints fence changes to selected assets. A revision returned by MCP image_request_revise does not submit work or modify the original run.
requestContract.schemaVersion1Yes—
requestContract.versionintegerYesmax 9007199254740991.
requestContract.originalWordingstringYesmin length 1, max length 8000.
requestContract.imagePromptstringNomin length 1, max length 8000.
requestContract.operationstringYesOne of generate, edit, variations.
requestContract.destinationobjectYes—
requestContract.destination.canvasIdstringYesmin length 1.
requestContract.destination.targetNodeIdsarray of stringYes—
requestContract.referencesarray of objectYesmax items 16.
requestContract.references[].handlestringYesmin length 1.
requestContract.references[].rolestringNoOne of source, identity, product, construction, texture, fit, style.
requestContract.elementsarray of string | objectNomax items 8.
requestContract.changeRegionsarray of objectNomin items 1, max items 8.
requestContract.changeRegions[].xnumberYesmin 0, max 1.
requestContract.changeRegions[].ynumberYesmin 0, max 1.
requestContract.changeRegions[].widthnumberYesmax 1.
requestContract.changeRegions[].heightnumberYesmax 1.
requestContract.requirementsobjectYes—
requestContract.requirements.countintegerNomin 1, max 4.
requestContract.requirements.aspectRatiostringNoPattern ^\d{1,4}:\d{1,4}$.
requestContract.requirements.compositionstringNoOne of single-frame, comparison, grid.
requestContract.requirements.panelsintegerNomin 1, max 16.
requestContract.requirements.textstringNoOne of none, specified, unspecified.
requestContract.requirements.copystringNomax length 2000.
requestContract.requirements.languagestringNomin length 1, max length 80.
requestContract.preservearray of stringYesmax items 32.
requestContract.changesarray of stringYesmax items 32.
requestContract.forbiddenAdditionsarray of stringYesmax items 32.
requestContract.selectionobjectYes—
requestContract.selection.modelstringNo—
requestContract.selection.sizestringNo—
requestContract.selection.qualitystringNo—
requestContract.selection.defaultsarray of stringYes—
requestContract.selection.workflowstringNo—
requestContract.sourceFingerprintsarray of objectNo—
requestContract.sourceFingerprints[].handlestringYes—
requestContract.sourceFingerprints[].fingerprintstringYes—
requestContract.idempotencyKeystringNomin length 8, max length 200.
requestContract.parentRunstringNo—
requestContract.refinementsarray of objectNo—
requestContract.refinements[].versionintegerYesmax 9007199254740991.
requestContract.refinements[].patchobjectYes—
requirementsCreativeImageRequirementsNoValidated output constraints. No-text conflicts with nonempty copy; single-frame composition conflicts with panels greater than one. Output count is separate from panels inside each image.
requirements.countintegerNomin 1, max 4.
requirements.aspectRatiostringNoPattern ^\d{1,4}:\d{1,4}$.
requirements.compositionstringNoOne of single-frame, comparison, grid.
requirements.panelsintegerNomin 1, max 16.
requirements.textstringNoOne of none, specified, unspecified.
requirements.copystringNomax length 2000.
requirements.languagestringNomin length 1, max length 80.
compositionstringNoOne of single-frame, comparison, grid.
preservearray of stringNomax items 32.
changesarray of stringNomax items 32.
forbiddenAdditionsarray of stringNomax items 32.
originalWordingstringNoComplete original user wording, kept separately from the per-image prompt and carried in the immutable request snapshot. min length 1, max length 8000.
(variant 2) (variant 1).count1No—
(variant 3) (variant 1).count2No—
(variant 4) (variant 1).count3No—
(variant 5) (variant 1).count4No—

Validation rules the service enforces across these fields:

  • references and source contain at most 16 handles combined
  • references and source are unique when combined
  • role-bearing references retain their exact handle and role in job and canvas provenance
  • count equals the selected target count
  • x + width and y + height must each be at most 1

Responses

StatusPayloadMeaning
200ImagePreflightResponseA validated dry-run reference plan when dryRun is true.
202ImageJob | VideoJobAn image, Action, or video job state or finalized result. Image and Action results follow the documented Run retention policy. Video records are retained for 30 days and expose a protected download URL after completion.
defaultErrorResponseA stable machine-readable error. The response always includes X-Request-ID.

200 response body

FieldTypeRequiredNotes
canvasIdstringYesPattern ^canvas:.
operationstringYesOne of generate, edit, variations.
promptstringYes—
finalPromptstringYes—
referencePlanarray of ImageReferencePlanEntryYes—
referencePlan[].orderintegerYesmin 1.
referencePlan[].providerOrderintegerNomin 1.
referencePlan[].handlestringYesmin length 1.
referencePlan[].labelstringYesmin length 1.
referencePlan[].rolestringYesOne of source, identity, construction, texture, fit, style.
referencePlan[].applicationModestringYescreative permits reinterpretation; identity is guided preservation, not pixel-exact; exact is deterministic source-pixel composition. One of creative, identity, exact.
referencePlan[].elementobjectNo—
referencePlan[].element.idstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
referencePlan[].element.versionintegerYesmin 1.
referencePlan[].providerInputbooleanYes—
plannedResultClassstringYesImage provenance: action is a deterministic or AI-assisted Image Action, not an image-generation request. Historical records without this class remain unchanged. One of generated, identity-guided, exact-composed, action.
exactElementsarray of ExactElementCompositionYes—
exactElements[].elementIdstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
exactElements[].versionintegerYesmin 1.
exactElements[].handlestringYesPattern ^element:.
exactElements[].sourceAssetIdstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
exactElements[].sourceStorageKeystringYesmin length 1.
exactElements[].sourceHashstringYesmin length 1.
exactElements[].placementsarray of ExactElementPlacementYesmin items 1, max items 16.
exactElements[].placements[].xnumberYesmin 0, max 1.
exactElements[].placements[].ynumberYesmin 0, max 1.
exactElements[].placements[].widthnumberYesmax 1.
exactElements[].placements[].heightnumberYesmax 1.
referencesarray of objectYes—
references[].handlestringYes—
references[].storageKeystringYes—
settingsImageJobSettingsNo—
settings.modelstringNo—
settings.countintegerNomin 1.
settings.requestedSizestringNo—
settings.effectiveSizestringNo—
settings.qualitystringNo—
parameterAdjustmentsarray of ImageJobParameterAdjustmentNo—
parameterAdjustments[].fieldstringYes—
parameterAdjustments[].requestedstringYes—
parameterAdjustments[].effectivestringYes—
parameterAdjustments[].reasonstringYes—
warningsarray of stringNo—

Callbacks

  • imageJobTerminal → {$request.body#/webhook/url}: Receive a signed terminal image-job event. Gavana signs ${timestamp}.${rawBody} with HMAC-SHA256 and the caller-owned secret. Return any 2xx response to acknowledge delivery. Delivery uses four total attempts. Retryable network failures and 408, 425, 429, or 5xx responses back off for 10 seconds, 60 seconds, then 5 minutes; redirects and other 4xx responses stop delivery. Successful Image and Action callbacks already contain durable asset and node handles in data.run.images, so callback-only clients do not need a follow-up GET. A caller with job:manage may read the shared Run later for inspection. Successful image and Action results retain their temporary observation record for 24 hours before the first successful server finalization and 15 minutes after it; an authenticated Run GET or pre-callback worker finalization both count. Failed and canceled records keep the normal 24-hour window.

Example

curl -X POST "https://app.gavana.ai/api/canvas-agent/v1/images/edit" \ -H "Authorization: Bearer $GAVANA_AGENT_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'

POST /images/generate

Queue image generation

  • Operation id: startImageGeneration
  • Scopes: Requires canvas:read + asset:read. When dryRun is false or omitted, also requires canvas:write + image:generate. When elements contains at least one version-pinned Element, also requires element:read.
  • CLI equivalent: gavana image generate

Request body (application/json, required)

FieldTypeRequiredNotes
canvasIdstringYesA plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle.
baseRevisionstringNomin length 1, max length 200.
idempotencyKeystringNomin length 8, max length 200.
targetNodeIdstringNoPattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$.
targetNodeIdsarray of stringNomin items 1, max items 4.
promptstringNomin length 1, max length 8000.
promptNodeIdstringNoPattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$.
referencesarray of string | ImageReferenceInputNoExtra guidance for the job (identity, construction, texture, fit, style), not the image being edited unless a reference has role source. Stable image handles or role-bearing reference objects. Across references and source, at most 16 handles are allowed and every handle must be unique. When omitted for one named target, Gavana may derive visible incoming mode:reference image edges; hidden provider plumbing is never derived. min items 1, max items 16.
elementsarray of ElementGenerationReferenceNoUp to eight reusable Elements pinned to exact immutable versions. All source images, including exact sources omitted from provider input, share the 16-image limit with references and source. Exact PNGs are frozen before provider dispatch and are additionally bounded to 16 MB, 16 placements, two output-area equivalents, 16 million pixels per source, and 32 million source pixels total. element:read is required when this array is non-empty. max items 8.
sourcestringNoFor an edit, the image being edited. Gavana sends it to the model first, as Image 1, and labels it as the image to keep except for the requested changes. A reference { handle, role: “source” } declares the same thing; declare only one. It must be unique across source and references, and the combined maximum is 16. Pattern ^(?:node:[A-Za-z0-9_-]{1,180}|asset:(?:[A-Za-z0-9_-]{1,180}:)?[A-Za-z0-9_-]{1,180})$.
changeRegionsarray of objectNoThe only areas of the source an edit may change, as normalized 0-1 rectangles. Requires a declared source (source, or a reference with role source). Gavana keeps the source’s pixels outside these regions. min items 1, max items 8.
changeRegions[].xnumberYesmin 0, max 1.
changeRegions[].ynumberYesmin 0, max 1.
changeRegions[].widthnumberYesmax 1.
changeRegions[].heightnumberYesmax 1.
countintegerNoNumber of outputs. When supplied, it must equal the selected target count; when omitted, Gavana uses the selected target count. min 1, max 4.
connectionIdstringNoPattern ^[A-Za-z0-9_-]{1,180}$.
modelstringNoA provider model id or opaque model:<key> handle from GET /models. max length 650.
sizestringNomax length 80.
qualitystringNomax length 80.
webhookImageJobWebhookInputNo—
webhook.urlstring (uri)YesA public HTTPS callback endpoint. Private, loopback, local-network, credential-bearing, and fragment-bearing URLs are rejected. max length 2048. Pattern ^https://.
webhook.secretstringYesA caller-owned HMAC secret encrypted at rest and never returned by the API. min length 32, max length 512.
requestContractCreativeImageRequestNoImmutable request snapshot stored with the existing image job; original user wording, explicit requirements, roles, destination and selection remain traceable. Source fingerprints fence changes to selected assets. A revision returned by MCP image_request_revise does not submit work or modify the original run.
requestContract.schemaVersion1Yes—
requestContract.versionintegerYesmax 9007199254740991.
requestContract.originalWordingstringYesmin length 1, max length 8000.
requestContract.imagePromptstringNomin length 1, max length 8000.
requestContract.operationstringYesOne of generate, edit, variations.
requestContract.destinationobjectYes—
requestContract.destination.canvasIdstringYesmin length 1.
requestContract.destination.targetNodeIdsarray of stringYes—
requestContract.referencesarray of objectYesmax items 16.
requestContract.references[].handlestringYesmin length 1.
requestContract.references[].rolestringNoOne of source, identity, product, construction, texture, fit, style.
requestContract.elementsarray of string | objectNomax items 8.
requestContract.changeRegionsarray of objectNomin items 1, max items 8.
requestContract.changeRegions[].xnumberYesmin 0, max 1.
requestContract.changeRegions[].ynumberYesmin 0, max 1.
requestContract.changeRegions[].widthnumberYesmax 1.
requestContract.changeRegions[].heightnumberYesmax 1.
requestContract.requirementsobjectYes—
requestContract.requirements.countintegerNomin 1, max 4.
requestContract.requirements.aspectRatiostringNoPattern ^\d{1,4}:\d{1,4}$.
requestContract.requirements.compositionstringNoOne of single-frame, comparison, grid.
requestContract.requirements.panelsintegerNomin 1, max 16.
requestContract.requirements.textstringNoOne of none, specified, unspecified.
requestContract.requirements.copystringNomax length 2000.
requestContract.requirements.languagestringNomin length 1, max length 80.
requestContract.preservearray of stringYesmax items 32.
requestContract.changesarray of stringYesmax items 32.
requestContract.forbiddenAdditionsarray of stringYesmax items 32.
requestContract.selectionobjectYes—
requestContract.selection.modelstringNo—
requestContract.selection.sizestringNo—
requestContract.selection.qualitystringNo—
requestContract.selection.defaultsarray of stringYes—
requestContract.selection.workflowstringNo—
requestContract.sourceFingerprintsarray of objectNo—
requestContract.sourceFingerprints[].handlestringYes—
requestContract.sourceFingerprints[].fingerprintstringYes—
requestContract.idempotencyKeystringNomin length 8, max length 200.
requestContract.parentRunstringNo—
requestContract.refinementsarray of objectNo—
requestContract.refinements[].versionintegerYesmax 9007199254740991.
requestContract.refinements[].patchobjectYes—
requirementsCreativeImageRequirementsNoValidated output constraints. No-text conflicts with nonempty copy; single-frame composition conflicts with panels greater than one. Output count is separate from panels inside each image.
requirements.countintegerNomin 1, max 4.
requirements.aspectRatiostringNoPattern ^\d{1,4}:\d{1,4}$.
requirements.compositionstringNoOne of single-frame, comparison, grid.
requirements.panelsintegerNomin 1, max 16.
requirements.textstringNoOne of none, specified, unspecified.
requirements.copystringNomax length 2000.
requirements.languagestringNomin length 1, max length 80.
compositionstringNoOne of single-frame, comparison, grid.
preservearray of stringNomax items 32.
changesarray of stringNomax items 32.
forbiddenAdditionsarray of stringNomax items 32.
originalWordingstringNoComplete original user wording, kept separately from the per-image prompt and carried in the immutable request snapshot. min length 1, max length 8000.
(variant 2) (variant 1).count1No—
(variant 3) (variant 1).count2No—
(variant 4) (variant 1).count3No—
(variant 5) (variant 1).count4No—

Validation rules the service enforces across these fields:

  • references and source contain at most 16 handles combined
  • references and source are unique when combined
  • role-bearing references retain their exact handle and role in job and canvas provenance
  • count equals the selected target count
  • x + width and y + height must each be at most 1

Responses

StatusPayloadMeaning
200ImagePreflightResponseA validated dry-run reference plan when dryRun is true.
202ImageJob | VideoJobAn image, Action, or video job state or finalized result. Image and Action results follow the documented Run retention policy. Video records are retained for 30 days and expose a protected download URL after completion.
defaultErrorResponseA stable machine-readable error. The response always includes X-Request-ID.

200 response body

FieldTypeRequiredNotes
canvasIdstringYesPattern ^canvas:.
operationstringYesOne of generate, edit, variations.
promptstringYes—
finalPromptstringYes—
referencePlanarray of ImageReferencePlanEntryYes—
referencePlan[].orderintegerYesmin 1.
referencePlan[].providerOrderintegerNomin 1.
referencePlan[].handlestringYesmin length 1.
referencePlan[].labelstringYesmin length 1.
referencePlan[].rolestringYesOne of source, identity, construction, texture, fit, style.
referencePlan[].applicationModestringYescreative permits reinterpretation; identity is guided preservation, not pixel-exact; exact is deterministic source-pixel composition. One of creative, identity, exact.
referencePlan[].elementobjectNo—
referencePlan[].element.idstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
referencePlan[].element.versionintegerYesmin 1.
referencePlan[].providerInputbooleanYes—
plannedResultClassstringYesImage provenance: action is a deterministic or AI-assisted Image Action, not an image-generation request. Historical records without this class remain unchanged. One of generated, identity-guided, exact-composed, action.
exactElementsarray of ExactElementCompositionYes—
exactElements[].elementIdstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
exactElements[].versionintegerYesmin 1.
exactElements[].handlestringYesPattern ^element:.
exactElements[].sourceAssetIdstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
exactElements[].sourceStorageKeystringYesmin length 1.
exactElements[].sourceHashstringYesmin length 1.
exactElements[].placementsarray of ExactElementPlacementYesmin items 1, max items 16.
exactElements[].placements[].xnumberYesmin 0, max 1.
exactElements[].placements[].ynumberYesmin 0, max 1.
exactElements[].placements[].widthnumberYesmax 1.
exactElements[].placements[].heightnumberYesmax 1.
referencesarray of objectYes—
references[].handlestringYes—
references[].storageKeystringYes—
settingsImageJobSettingsNo—
settings.modelstringNo—
settings.countintegerNomin 1.
settings.requestedSizestringNo—
settings.effectiveSizestringNo—
settings.qualitystringNo—
parameterAdjustmentsarray of ImageJobParameterAdjustmentNo—
parameterAdjustments[].fieldstringYes—
parameterAdjustments[].requestedstringYes—
parameterAdjustments[].effectivestringYes—
parameterAdjustments[].reasonstringYes—
warningsarray of stringNo—

Callbacks

  • imageJobTerminal → {$request.body#/webhook/url}: Receive a signed terminal image-job event. Gavana signs ${timestamp}.${rawBody} with HMAC-SHA256 and the caller-owned secret. Return any 2xx response to acknowledge delivery. Delivery uses four total attempts. Retryable network failures and 408, 425, 429, or 5xx responses back off for 10 seconds, 60 seconds, then 5 minutes; redirects and other 4xx responses stop delivery. Successful Image and Action callbacks already contain durable asset and node handles in data.run.images, so callback-only clients do not need a follow-up GET. A caller with job:manage may read the shared Run later for inspection. Successful image and Action results retain their temporary observation record for 24 hours before the first successful server finalization and 15 minutes after it; an authenticated Run GET or pre-callback worker finalization both count. Failed and canceled records keep the normal 24-hour window.

Example

curl -X POST "https://app.gavana.ai/api/canvas-agent/v1/images/generate" \ -H "Authorization: Bearer $GAVANA_AGENT_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'

POST /images/import

Import a public HTTPS image as a durable canvas node

Downloads a bounded raster image through Gavana’s SSRF-safe fetcher, stores it as a canvas-scoped asset, and adds one deterministic image node. Reuse the idempotency key only for the exact same import.

  • Operation id: importImageToCanvas
  • Scopes: Requires canvas:read + canvas:write + asset:read + image:generate.

Request body (application/json, required)

FieldTypeRequiredNotes
canvasIdstringYesA plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle. min length 1, max length 600.
imageUrlstring (uri)Yesmax length 4096. Pattern ^https://.
sourceIdstringNoOptional stable source identity, such as ChatGPT file_id. When present, Gavana uses it instead of the expiring download URL to match idempotent retries. min length 1, max length 1000.
titlestringNoDefault "Image from ChatGPT". min length 1, max length 160.
idempotencyKeystringYesmin length 8, max length 200.
xnumberNomin -100000, max 100000.
ynumberNomin -100000, max 100000.

Responses

StatusPayloadMeaning
200ImageImportResponseA durable canvas image import result.
defaultErrorResponseA stable machine-readable error. The response always includes X-Request-ID.

200 response body

FieldTypeRequiredNotes
replayedbooleanYes—
canvasIdstringYesPattern ^canvas:.
canvasRevisionstringYes—
canvasUrlstring (uri)Yes—
imageobjectYes—
image.assetIdstringYesPattern ^asset:.
image.nodeIdstringYesPattern ^node:.
image.mediaTypestringYesOne of image/png, image/jpeg, image/webp, image/gif.
image.widthintegerYesmin 1.
image.heightintegerYesmin 1.
image.bytesintegerYesmin 1, max 52428800.
image.previewUrlstring (uri)Yes—
image.markdownstringYes—

Example

curl -X POST "https://app.gavana.ai/api/canvas-agent/v1/images/import" \ -H "Authorization: Bearer $GAVANA_AGENT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "canvasId": "canvas:8f2c1d40-9a77-4c2e-9c11-2b0a5f6d7e31", "imageUrl": "https://example.com/gavana-webhook", "idempotencyKey": "2026-08-04-first-attempt" }'

POST /images/variations

Queue image variations

  • Operation id: startImageVariations
  • Scopes: Requires canvas:read + asset:read. When dryRun is false or omitted, also requires canvas:write + image:generate. When elements contains at least one version-pinned Element, also requires element:read.
  • CLI equivalent: gavana image variations

Request body (application/json, required)

At least one of references or source is required.

FieldTypeRequiredNotes
canvasIdstringYesA plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle.
baseRevisionstringNomin length 1, max length 200.
idempotencyKeystringNomin length 8, max length 200.
targetNodeIdstringNoPattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$.
targetNodeIdsarray of stringNomin items 1, max items 4.
promptstringNomin length 1, max length 8000.
promptNodeIdstringNoPattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$.
referencesarray of string | ImageReferenceInputNoExtra guidance for the job (identity, construction, texture, fit, style), not the image being edited unless a reference has role source. Stable image handles or role-bearing reference objects. Across references and source, at most 16 handles are allowed and every handle must be unique. When omitted for one named target, Gavana may derive visible incoming mode:reference image edges; hidden provider plumbing is never derived. min items 1, max items 16.
elementsarray of ElementGenerationReferenceNoUp to eight reusable Elements pinned to exact immutable versions. All source images, including exact sources omitted from provider input, share the 16-image limit with references and source. Exact PNGs are frozen before provider dispatch and are additionally bounded to 16 MB, 16 placements, two output-area equivalents, 16 million pixels per source, and 32 million source pixels total. element:read is required when this array is non-empty. max items 8.
sourcestringNoFor an edit, the image being edited. Gavana sends it to the model first, as Image 1, and labels it as the image to keep except for the requested changes. A reference { handle, role: “source” } declares the same thing; declare only one. It must be unique across source and references, and the combined maximum is 16. Pattern ^(?:node:[A-Za-z0-9_-]{1,180}|asset:(?:[A-Za-z0-9_-]{1,180}:)?[A-Za-z0-9_-]{1,180})$.
changeRegionsarray of objectNoThe only areas of the source an edit may change, as normalized 0-1 rectangles. Requires a declared source (source, or a reference with role source). Gavana keeps the source’s pixels outside these regions. min items 1, max items 8.
changeRegions[].xnumberYesmin 0, max 1.
changeRegions[].ynumberYesmin 0, max 1.
changeRegions[].widthnumberYesmax 1.
changeRegions[].heightnumberYesmax 1.
countintegerNoNumber of outputs. When supplied, it must equal the selected target count; when omitted, Gavana uses the selected target count. min 1, max 4.
connectionIdstringNoPattern ^[A-Za-z0-9_-]{1,180}$.
modelstringNoA provider model id or opaque model:<key> handle from GET /models. max length 650.
sizestringNomax length 80.
qualitystringNomax length 80.
webhookImageJobWebhookInputNo—
webhook.urlstring (uri)YesA public HTTPS callback endpoint. Private, loopback, local-network, credential-bearing, and fragment-bearing URLs are rejected. max length 2048. Pattern ^https://.
webhook.secretstringYesA caller-owned HMAC secret encrypted at rest and never returned by the API. min length 32, max length 512.
requestContractCreativeImageRequestNoImmutable request snapshot stored with the existing image job; original user wording, explicit requirements, roles, destination and selection remain traceable. Source fingerprints fence changes to selected assets. A revision returned by MCP image_request_revise does not submit work or modify the original run.
requestContract.schemaVersion1Yes—
requestContract.versionintegerYesmax 9007199254740991.
requestContract.originalWordingstringYesmin length 1, max length 8000.
requestContract.imagePromptstringNomin length 1, max length 8000.
requestContract.operationstringYesOne of generate, edit, variations.
requestContract.destinationobjectYes—
requestContract.destination.canvasIdstringYesmin length 1.
requestContract.destination.targetNodeIdsarray of stringYes—
requestContract.referencesarray of objectYesmax items 16.
requestContract.references[].handlestringYesmin length 1.
requestContract.references[].rolestringNoOne of source, identity, product, construction, texture, fit, style.
requestContract.elementsarray of string | objectNomax items 8.
requestContract.changeRegionsarray of objectNomin items 1, max items 8.
requestContract.changeRegions[].xnumberYesmin 0, max 1.
requestContract.changeRegions[].ynumberYesmin 0, max 1.
requestContract.changeRegions[].widthnumberYesmax 1.
requestContract.changeRegions[].heightnumberYesmax 1.
requestContract.requirementsobjectYes—
requestContract.requirements.countintegerNomin 1, max 4.
requestContract.requirements.aspectRatiostringNoPattern ^\d{1,4}:\d{1,4}$.
requestContract.requirements.compositionstringNoOne of single-frame, comparison, grid.
requestContract.requirements.panelsintegerNomin 1, max 16.
requestContract.requirements.textstringNoOne of none, specified, unspecified.
requestContract.requirements.copystringNomax length 2000.
requestContract.requirements.languagestringNomin length 1, max length 80.
requestContract.preservearray of stringYesmax items 32.
requestContract.changesarray of stringYesmax items 32.
requestContract.forbiddenAdditionsarray of stringYesmax items 32.
requestContract.selectionobjectYes—
requestContract.selection.modelstringNo—
requestContract.selection.sizestringNo—
requestContract.selection.qualitystringNo—
requestContract.selection.defaultsarray of stringYes—
requestContract.selection.workflowstringNo—
requestContract.sourceFingerprintsarray of objectNo—
requestContract.sourceFingerprints[].handlestringYes—
requestContract.sourceFingerprints[].fingerprintstringYes—
requestContract.idempotencyKeystringNomin length 8, max length 200.
requestContract.parentRunstringNo—
requestContract.refinementsarray of objectNo—
requestContract.refinements[].versionintegerYesmax 9007199254740991.
requestContract.refinements[].patchobjectYes—
requirementsCreativeImageRequirementsNoValidated output constraints. No-text conflicts with nonempty copy; single-frame composition conflicts with panels greater than one. Output count is separate from panels inside each image.
requirements.countintegerNomin 1, max 4.
requirements.aspectRatiostringNoPattern ^\d{1,4}:\d{1,4}$.
requirements.compositionstringNoOne of single-frame, comparison, grid.
requirements.panelsintegerNomin 1, max 16.
requirements.textstringNoOne of none, specified, unspecified.
requirements.copystringNomax length 2000.
requirements.languagestringNomin length 1, max length 80.
compositionstringNoOne of single-frame, comparison, grid.
preservearray of stringNomax items 32.
changesarray of stringNomax items 32.
forbiddenAdditionsarray of stringNomax items 32.
originalWordingstringNoComplete original user wording, kept separately from the per-image prompt and carried in the immutable request snapshot. min length 1, max length 8000.
(variant 2) (variant 1).count1No—
(variant 3) (variant 1).count2No—
(variant 4) (variant 1).count3No—
(variant 5) (variant 1).count4No—

Validation rules the service enforces across these fields:

  • references and source contain at most 16 handles combined
  • references and source are unique when combined
  • role-bearing references retain their exact handle and role in job and canvas provenance
  • count equals the selected target count
  • x + width and y + height must each be at most 1

Responses

StatusPayloadMeaning
200ImagePreflightResponseA validated dry-run reference plan when dryRun is true.
202ImageJob | VideoJobAn image, Action, or video job state or finalized result. Image and Action results follow the documented Run retention policy. Video records are retained for 30 days and expose a protected download URL after completion.
defaultErrorResponseA stable machine-readable error. The response always includes X-Request-ID.

200 response body

FieldTypeRequiredNotes
canvasIdstringYesPattern ^canvas:.
operationstringYesOne of generate, edit, variations.
promptstringYes—
finalPromptstringYes—
referencePlanarray of ImageReferencePlanEntryYes—
referencePlan[].orderintegerYesmin 1.
referencePlan[].providerOrderintegerNomin 1.
referencePlan[].handlestringYesmin length 1.
referencePlan[].labelstringYesmin length 1.
referencePlan[].rolestringYesOne of source, identity, construction, texture, fit, style.
referencePlan[].applicationModestringYescreative permits reinterpretation; identity is guided preservation, not pixel-exact; exact is deterministic source-pixel composition. One of creative, identity, exact.
referencePlan[].elementobjectNo—
referencePlan[].element.idstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
referencePlan[].element.versionintegerYesmin 1.
referencePlan[].providerInputbooleanYes—
plannedResultClassstringYesImage provenance: action is a deterministic or AI-assisted Image Action, not an image-generation request. Historical records without this class remain unchanged. One of generated, identity-guided, exact-composed, action.
exactElementsarray of ExactElementCompositionYes—
exactElements[].elementIdstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
exactElements[].versionintegerYesmin 1.
exactElements[].handlestringYesPattern ^element:.
exactElements[].sourceAssetIdstringYesPattern ^[A-Za-z0-9_-]{1,180}$.
exactElements[].sourceStorageKeystringYesmin length 1.
exactElements[].sourceHashstringYesmin length 1.
exactElements[].placementsarray of ExactElementPlacementYesmin items 1, max items 16.
exactElements[].placements[].xnumberYesmin 0, max 1.
exactElements[].placements[].ynumberYesmin 0, max 1.
exactElements[].placements[].widthnumberYesmax 1.
exactElements[].placements[].heightnumberYesmax 1.
referencesarray of objectYes—
references[].handlestringYes—
references[].storageKeystringYes—
settingsImageJobSettingsNo—
settings.modelstringNo—
settings.countintegerNomin 1.
settings.requestedSizestringNo—
settings.effectiveSizestringNo—
settings.qualitystringNo—
parameterAdjustmentsarray of ImageJobParameterAdjustmentNo—
parameterAdjustments[].fieldstringYes—
parameterAdjustments[].requestedstringYes—
parameterAdjustments[].effectivestringYes—
parameterAdjustments[].reasonstringYes—
warningsarray of stringNo—

Callbacks

  • imageJobTerminal → {$request.body#/webhook/url}: Receive a signed terminal image-job event. Gavana signs ${timestamp}.${rawBody} with HMAC-SHA256 and the caller-owned secret. Return any 2xx response to acknowledge delivery. Delivery uses four total attempts. Retryable network failures and 408, 425, 429, or 5xx responses back off for 10 seconds, 60 seconds, then 5 minutes; redirects and other 4xx responses stop delivery. Successful Image and Action callbacks already contain durable asset and node handles in data.run.images, so callback-only clients do not need a follow-up GET. A caller with job:manage may read the shared Run later for inspection. Successful image and Action results retain their temporary observation record for 24 hours before the first successful server finalization and 15 minutes after it; an authenticated Run GET or pre-callback worker finalization both count. Failed and canceled records keep the normal 24-hour window.

Example

curl -X POST "https://app.gavana.ai/api/canvas-agent/v1/images/variations" \ -H "Authorization: Bearer $GAVANA_AGENT_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'

Errors

Every failure uses the shared error envelope described in Errors and X-Request-ID. The response always carries X-Request-ID; share that value with support instead of the request payload.

Last updated on