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
| Operation | Purpose | Scopes |
|---|---|---|
POST /images/edit | Queue an image edit | canvas:read, asset:read |
POST /images/generate | Queue image generation | canvas:read, asset:read |
POST /images/import | Import a public HTTPS image as a durable canvas node | canvas:read, canvas:write, asset:read, image:generate |
POST /images/variations | Queue image variations | canvas: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 requirescanvas:write+image:generate. When elements contains at least one version-pinned Element, also requireselement:read. - CLI equivalent:
gavana image edit
Request body (application/json, required)
At least one of references or source is required.
| Field | Type | Required | Notes |
|---|---|---|---|
canvasId | string | Yes | A plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle. |
baseRevision | string | No | min length 1, max length 200. |
idempotencyKey | string | No | min length 8, max length 200. |
targetNodeId | string | No | Pattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$. |
targetNodeIds | array of string | No | min items 1, max items 4. |
prompt | string | No | min length 1, max length 8000. |
promptNodeId | string | No | Pattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$. |
references | array of string | ImageReferenceInput | No | Extra 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. |
elements | array of ElementGenerationReference | No | Up 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. |
source | string | No | For 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})$. |
changeRegions | array of object | No | The 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[].x | number | Yes | min 0, max 1. |
changeRegions[].y | number | Yes | min 0, max 1. |
changeRegions[].width | number | Yes | max 1. |
changeRegions[].height | number | Yes | max 1. |
count | integer | No | Number of outputs. When supplied, it must equal the selected target count; when omitted, Gavana uses the selected target count. min 1, max 4. |
connectionId | string | No | Pattern ^[A-Za-z0-9_-]{1,180}$. |
model | string | No | A provider model id or opaque model:<key> handle from GET /models. max length 650. |
size | string | No | max length 80. |
quality | string | No | max length 80. |
webhook | ImageJobWebhookInput | No | — |
webhook.url | string (uri) | Yes | A public HTTPS callback endpoint. Private, loopback, local-network, credential-bearing, and fragment-bearing URLs are rejected. max length 2048. Pattern ^https://. |
webhook.secret | string | Yes | A caller-owned HMAC secret encrypted at rest and never returned by the API. min length 32, max length 512. |
requestContract | CreativeImageRequest | No | Immutable 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.schemaVersion | 1 | Yes | — |
requestContract.version | integer | Yes | max 9007199254740991. |
requestContract.originalWording | string | Yes | min length 1, max length 8000. |
requestContract.imagePrompt | string | No | min length 1, max length 8000. |
requestContract.operation | string | Yes | One of generate, edit, variations. |
requestContract.destination | object | Yes | — |
requestContract.destination.canvasId | string | Yes | min length 1. |
requestContract.destination.targetNodeIds | array of string | Yes | — |
requestContract.references | array of object | Yes | max items 16. |
requestContract.references[].handle | string | Yes | min length 1. |
requestContract.references[].role | string | No | One of source, identity, product, construction, texture, fit, style. |
requestContract.elements | array of string | object | No | max items 8. |
requestContract.changeRegions | array of object | No | min items 1, max items 8. |
requestContract.changeRegions[].x | number | Yes | min 0, max 1. |
requestContract.changeRegions[].y | number | Yes | min 0, max 1. |
requestContract.changeRegions[].width | number | Yes | max 1. |
requestContract.changeRegions[].height | number | Yes | max 1. |
requestContract.requirements | object | Yes | — |
requestContract.requirements.count | integer | No | min 1, max 4. |
requestContract.requirements.aspectRatio | string | No | Pattern ^\d{1,4}:\d{1,4}$. |
requestContract.requirements.composition | string | No | One of single-frame, comparison, grid. |
requestContract.requirements.panels | integer | No | min 1, max 16. |
requestContract.requirements.text | string | No | One of none, specified, unspecified. |
requestContract.requirements.copy | string | No | max length 2000. |
requestContract.requirements.language | string | No | min length 1, max length 80. |
requestContract.preserve | array of string | Yes | max items 32. |
requestContract.changes | array of string | Yes | max items 32. |
requestContract.forbiddenAdditions | array of string | Yes | max items 32. |
requestContract.selection | object | Yes | — |
requestContract.selection.model | string | No | — |
requestContract.selection.size | string | No | — |
requestContract.selection.quality | string | No | — |
requestContract.selection.defaults | array of string | Yes | — |
requestContract.selection.workflow | string | No | — |
requestContract.sourceFingerprints | array of object | No | — |
requestContract.sourceFingerprints[].handle | string | Yes | — |
requestContract.sourceFingerprints[].fingerprint | string | Yes | — |
requestContract.idempotencyKey | string | No | min length 8, max length 200. |
requestContract.parentRun | string | No | — |
requestContract.refinements | array of object | No | — |
requestContract.refinements[].version | integer | Yes | max 9007199254740991. |
requestContract.refinements[].patch | object | Yes | — |
requirements | CreativeImageRequirements | No | Validated 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.count | integer | No | min 1, max 4. |
requirements.aspectRatio | string | No | Pattern ^\d{1,4}:\d{1,4}$. |
requirements.composition | string | No | One of single-frame, comparison, grid. |
requirements.panels | integer | No | min 1, max 16. |
requirements.text | string | No | One of none, specified, unspecified. |
requirements.copy | string | No | max length 2000. |
requirements.language | string | No | min length 1, max length 80. |
composition | string | No | One of single-frame, comparison, grid. |
preserve | array of string | No | max items 32. |
changes | array of string | No | max items 32. |
forbiddenAdditions | array of string | No | max items 32. |
originalWording | string | No | Complete 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).count | 1 | No | — |
(variant 3) (variant 1).count | 2 | No | — |
(variant 4) (variant 1).count | 3 | No | — |
(variant 5) (variant 1).count | 4 | No | — |
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
| Status | Payload | Meaning |
|---|---|---|
200 | ImagePreflightResponse | A validated dry-run reference plan when dryRun is true. |
202 | ImageJob | VideoJob | An 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. |
default | ErrorResponse | A stable machine-readable error. The response always includes X-Request-ID. |
200 response body
| Field | Type | Required | Notes |
|---|---|---|---|
canvasId | string | Yes | Pattern ^canvas:. |
operation | string | Yes | One of generate, edit, variations. |
prompt | string | Yes | — |
finalPrompt | string | Yes | — |
referencePlan | array of ImageReferencePlanEntry | Yes | — |
referencePlan[].order | integer | Yes | min 1. |
referencePlan[].providerOrder | integer | No | min 1. |
referencePlan[].handle | string | Yes | min length 1. |
referencePlan[].label | string | Yes | min length 1. |
referencePlan[].role | string | Yes | One of source, identity, construction, texture, fit, style. |
referencePlan[].applicationMode | string | Yes | creative permits reinterpretation; identity is guided preservation, not pixel-exact; exact is deterministic source-pixel composition. One of creative, identity, exact. |
referencePlan[].element | object | No | — |
referencePlan[].element.id | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
referencePlan[].element.version | integer | Yes | min 1. |
referencePlan[].providerInput | boolean | Yes | — |
plannedResultClass | string | Yes | Image 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. |
exactElements | array of ExactElementComposition | Yes | — |
exactElements[].elementId | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
exactElements[].version | integer | Yes | min 1. |
exactElements[].handle | string | Yes | Pattern ^element:. |
exactElements[].sourceAssetId | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
exactElements[].sourceStorageKey | string | Yes | min length 1. |
exactElements[].sourceHash | string | Yes | min length 1. |
exactElements[].placements | array of ExactElementPlacement | Yes | min items 1, max items 16. |
exactElements[].placements[].x | number | Yes | min 0, max 1. |
exactElements[].placements[].y | number | Yes | min 0, max 1. |
exactElements[].placements[].width | number | Yes | max 1. |
exactElements[].placements[].height | number | Yes | max 1. |
references | array of object | Yes | — |
references[].handle | string | Yes | — |
references[].storageKey | string | Yes | — |
settings | ImageJobSettings | No | — |
settings.model | string | No | — |
settings.count | integer | No | min 1. |
settings.requestedSize | string | No | — |
settings.effectiveSize | string | No | — |
settings.quality | string | No | — |
parameterAdjustments | array of ImageJobParameterAdjustment | No | — |
parameterAdjustments[].field | string | Yes | — |
parameterAdjustments[].requested | string | Yes | — |
parameterAdjustments[].effective | string | Yes | — |
parameterAdjustments[].reason | string | Yes | — |
warnings | array of string | No | — |
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 indata.run.images, so callback-only clients do not need a follow-up GET. A caller withjob:managemay 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 requirescanvas:write+image:generate. When elements contains at least one version-pinned Element, also requireselement:read. - CLI equivalent:
gavana image generate
Request body (application/json, required)
| Field | Type | Required | Notes |
|---|---|---|---|
canvasId | string | Yes | A plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle. |
baseRevision | string | No | min length 1, max length 200. |
idempotencyKey | string | No | min length 8, max length 200. |
targetNodeId | string | No | Pattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$. |
targetNodeIds | array of string | No | min items 1, max items 4. |
prompt | string | No | min length 1, max length 8000. |
promptNodeId | string | No | Pattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$. |
references | array of string | ImageReferenceInput | No | Extra 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. |
elements | array of ElementGenerationReference | No | Up 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. |
source | string | No | For 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})$. |
changeRegions | array of object | No | The 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[].x | number | Yes | min 0, max 1. |
changeRegions[].y | number | Yes | min 0, max 1. |
changeRegions[].width | number | Yes | max 1. |
changeRegions[].height | number | Yes | max 1. |
count | integer | No | Number of outputs. When supplied, it must equal the selected target count; when omitted, Gavana uses the selected target count. min 1, max 4. |
connectionId | string | No | Pattern ^[A-Za-z0-9_-]{1,180}$. |
model | string | No | A provider model id or opaque model:<key> handle from GET /models. max length 650. |
size | string | No | max length 80. |
quality | string | No | max length 80. |
webhook | ImageJobWebhookInput | No | — |
webhook.url | string (uri) | Yes | A public HTTPS callback endpoint. Private, loopback, local-network, credential-bearing, and fragment-bearing URLs are rejected. max length 2048. Pattern ^https://. |
webhook.secret | string | Yes | A caller-owned HMAC secret encrypted at rest and never returned by the API. min length 32, max length 512. |
requestContract | CreativeImageRequest | No | Immutable 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.schemaVersion | 1 | Yes | — |
requestContract.version | integer | Yes | max 9007199254740991. |
requestContract.originalWording | string | Yes | min length 1, max length 8000. |
requestContract.imagePrompt | string | No | min length 1, max length 8000. |
requestContract.operation | string | Yes | One of generate, edit, variations. |
requestContract.destination | object | Yes | — |
requestContract.destination.canvasId | string | Yes | min length 1. |
requestContract.destination.targetNodeIds | array of string | Yes | — |
requestContract.references | array of object | Yes | max items 16. |
requestContract.references[].handle | string | Yes | min length 1. |
requestContract.references[].role | string | No | One of source, identity, product, construction, texture, fit, style. |
requestContract.elements | array of string | object | No | max items 8. |
requestContract.changeRegions | array of object | No | min items 1, max items 8. |
requestContract.changeRegions[].x | number | Yes | min 0, max 1. |
requestContract.changeRegions[].y | number | Yes | min 0, max 1. |
requestContract.changeRegions[].width | number | Yes | max 1. |
requestContract.changeRegions[].height | number | Yes | max 1. |
requestContract.requirements | object | Yes | — |
requestContract.requirements.count | integer | No | min 1, max 4. |
requestContract.requirements.aspectRatio | string | No | Pattern ^\d{1,4}:\d{1,4}$. |
requestContract.requirements.composition | string | No | One of single-frame, comparison, grid. |
requestContract.requirements.panels | integer | No | min 1, max 16. |
requestContract.requirements.text | string | No | One of none, specified, unspecified. |
requestContract.requirements.copy | string | No | max length 2000. |
requestContract.requirements.language | string | No | min length 1, max length 80. |
requestContract.preserve | array of string | Yes | max items 32. |
requestContract.changes | array of string | Yes | max items 32. |
requestContract.forbiddenAdditions | array of string | Yes | max items 32. |
requestContract.selection | object | Yes | — |
requestContract.selection.model | string | No | — |
requestContract.selection.size | string | No | — |
requestContract.selection.quality | string | No | — |
requestContract.selection.defaults | array of string | Yes | — |
requestContract.selection.workflow | string | No | — |
requestContract.sourceFingerprints | array of object | No | — |
requestContract.sourceFingerprints[].handle | string | Yes | — |
requestContract.sourceFingerprints[].fingerprint | string | Yes | — |
requestContract.idempotencyKey | string | No | min length 8, max length 200. |
requestContract.parentRun | string | No | — |
requestContract.refinements | array of object | No | — |
requestContract.refinements[].version | integer | Yes | max 9007199254740991. |
requestContract.refinements[].patch | object | Yes | — |
requirements | CreativeImageRequirements | No | Validated 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.count | integer | No | min 1, max 4. |
requirements.aspectRatio | string | No | Pattern ^\d{1,4}:\d{1,4}$. |
requirements.composition | string | No | One of single-frame, comparison, grid. |
requirements.panels | integer | No | min 1, max 16. |
requirements.text | string | No | One of none, specified, unspecified. |
requirements.copy | string | No | max length 2000. |
requirements.language | string | No | min length 1, max length 80. |
composition | string | No | One of single-frame, comparison, grid. |
preserve | array of string | No | max items 32. |
changes | array of string | No | max items 32. |
forbiddenAdditions | array of string | No | max items 32. |
originalWording | string | No | Complete 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).count | 1 | No | — |
(variant 3) (variant 1).count | 2 | No | — |
(variant 4) (variant 1).count | 3 | No | — |
(variant 5) (variant 1).count | 4 | No | — |
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
| Status | Payload | Meaning |
|---|---|---|
200 | ImagePreflightResponse | A validated dry-run reference plan when dryRun is true. |
202 | ImageJob | VideoJob | An 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. |
default | ErrorResponse | A stable machine-readable error. The response always includes X-Request-ID. |
200 response body
| Field | Type | Required | Notes |
|---|---|---|---|
canvasId | string | Yes | Pattern ^canvas:. |
operation | string | Yes | One of generate, edit, variations. |
prompt | string | Yes | — |
finalPrompt | string | Yes | — |
referencePlan | array of ImageReferencePlanEntry | Yes | — |
referencePlan[].order | integer | Yes | min 1. |
referencePlan[].providerOrder | integer | No | min 1. |
referencePlan[].handle | string | Yes | min length 1. |
referencePlan[].label | string | Yes | min length 1. |
referencePlan[].role | string | Yes | One of source, identity, construction, texture, fit, style. |
referencePlan[].applicationMode | string | Yes | creative permits reinterpretation; identity is guided preservation, not pixel-exact; exact is deterministic source-pixel composition. One of creative, identity, exact. |
referencePlan[].element | object | No | — |
referencePlan[].element.id | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
referencePlan[].element.version | integer | Yes | min 1. |
referencePlan[].providerInput | boolean | Yes | — |
plannedResultClass | string | Yes | Image 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. |
exactElements | array of ExactElementComposition | Yes | — |
exactElements[].elementId | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
exactElements[].version | integer | Yes | min 1. |
exactElements[].handle | string | Yes | Pattern ^element:. |
exactElements[].sourceAssetId | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
exactElements[].sourceStorageKey | string | Yes | min length 1. |
exactElements[].sourceHash | string | Yes | min length 1. |
exactElements[].placements | array of ExactElementPlacement | Yes | min items 1, max items 16. |
exactElements[].placements[].x | number | Yes | min 0, max 1. |
exactElements[].placements[].y | number | Yes | min 0, max 1. |
exactElements[].placements[].width | number | Yes | max 1. |
exactElements[].placements[].height | number | Yes | max 1. |
references | array of object | Yes | — |
references[].handle | string | Yes | — |
references[].storageKey | string | Yes | — |
settings | ImageJobSettings | No | — |
settings.model | string | No | — |
settings.count | integer | No | min 1. |
settings.requestedSize | string | No | — |
settings.effectiveSize | string | No | — |
settings.quality | string | No | — |
parameterAdjustments | array of ImageJobParameterAdjustment | No | — |
parameterAdjustments[].field | string | Yes | — |
parameterAdjustments[].requested | string | Yes | — |
parameterAdjustments[].effective | string | Yes | — |
parameterAdjustments[].reason | string | Yes | — |
warnings | array of string | No | — |
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 indata.run.images, so callback-only clients do not need a follow-up GET. A caller withjob:managemay 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)
| Field | Type | Required | Notes |
|---|---|---|---|
canvasId | string | Yes | A plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle. min length 1, max length 600. |
imageUrl | string (uri) | Yes | max length 4096. Pattern ^https://. |
sourceId | string | No | Optional 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. |
title | string | No | Default "Image from ChatGPT". min length 1, max length 160. |
idempotencyKey | string | Yes | min length 8, max length 200. |
x | number | No | min -100000, max 100000. |
y | number | No | min -100000, max 100000. |
Responses
| Status | Payload | Meaning |
|---|---|---|
200 | ImageImportResponse | A durable canvas image import result. |
default | ErrorResponse | A stable machine-readable error. The response always includes X-Request-ID. |
200 response body
| Field | Type | Required | Notes |
|---|---|---|---|
replayed | boolean | Yes | — |
canvasId | string | Yes | Pattern ^canvas:. |
canvasRevision | string | Yes | — |
canvasUrl | string (uri) | Yes | — |
image | object | Yes | — |
image.assetId | string | Yes | Pattern ^asset:. |
image.nodeId | string | Yes | Pattern ^node:. |
image.mediaType | string | Yes | One of image/png, image/jpeg, image/webp, image/gif. |
image.width | integer | Yes | min 1. |
image.height | integer | Yes | min 1. |
image.bytes | integer | Yes | min 1, max 52428800. |
image.previewUrl | string (uri) | Yes | — |
image.markdown | string | Yes | — |
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 requirescanvas:write+image:generate. When elements contains at least one version-pinned Element, also requireselement:read. - CLI equivalent:
gavana image variations
Request body (application/json, required)
At least one of references or source is required.
| Field | Type | Required | Notes |
|---|---|---|---|
canvasId | string | Yes | A plain id, canvas:<id>, or canvas:<ownerUid>:<id> handle. |
baseRevision | string | No | min length 1, max length 200. |
idempotencyKey | string | No | min length 8, max length 200. |
targetNodeId | string | No | Pattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$. |
targetNodeIds | array of string | No | min items 1, max items 4. |
prompt | string | No | min length 1, max length 8000. |
promptNodeId | string | No | Pattern ^(?:node:)?[A-Za-z0-9_-]{1,180}$. |
references | array of string | ImageReferenceInput | No | Extra 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. |
elements | array of ElementGenerationReference | No | Up 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. |
source | string | No | For 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})$. |
changeRegions | array of object | No | The 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[].x | number | Yes | min 0, max 1. |
changeRegions[].y | number | Yes | min 0, max 1. |
changeRegions[].width | number | Yes | max 1. |
changeRegions[].height | number | Yes | max 1. |
count | integer | No | Number of outputs. When supplied, it must equal the selected target count; when omitted, Gavana uses the selected target count. min 1, max 4. |
connectionId | string | No | Pattern ^[A-Za-z0-9_-]{1,180}$. |
model | string | No | A provider model id or opaque model:<key> handle from GET /models. max length 650. |
size | string | No | max length 80. |
quality | string | No | max length 80. |
webhook | ImageJobWebhookInput | No | — |
webhook.url | string (uri) | Yes | A public HTTPS callback endpoint. Private, loopback, local-network, credential-bearing, and fragment-bearing URLs are rejected. max length 2048. Pattern ^https://. |
webhook.secret | string | Yes | A caller-owned HMAC secret encrypted at rest and never returned by the API. min length 32, max length 512. |
requestContract | CreativeImageRequest | No | Immutable 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.schemaVersion | 1 | Yes | — |
requestContract.version | integer | Yes | max 9007199254740991. |
requestContract.originalWording | string | Yes | min length 1, max length 8000. |
requestContract.imagePrompt | string | No | min length 1, max length 8000. |
requestContract.operation | string | Yes | One of generate, edit, variations. |
requestContract.destination | object | Yes | — |
requestContract.destination.canvasId | string | Yes | min length 1. |
requestContract.destination.targetNodeIds | array of string | Yes | — |
requestContract.references | array of object | Yes | max items 16. |
requestContract.references[].handle | string | Yes | min length 1. |
requestContract.references[].role | string | No | One of source, identity, product, construction, texture, fit, style. |
requestContract.elements | array of string | object | No | max items 8. |
requestContract.changeRegions | array of object | No | min items 1, max items 8. |
requestContract.changeRegions[].x | number | Yes | min 0, max 1. |
requestContract.changeRegions[].y | number | Yes | min 0, max 1. |
requestContract.changeRegions[].width | number | Yes | max 1. |
requestContract.changeRegions[].height | number | Yes | max 1. |
requestContract.requirements | object | Yes | — |
requestContract.requirements.count | integer | No | min 1, max 4. |
requestContract.requirements.aspectRatio | string | No | Pattern ^\d{1,4}:\d{1,4}$. |
requestContract.requirements.composition | string | No | One of single-frame, comparison, grid. |
requestContract.requirements.panels | integer | No | min 1, max 16. |
requestContract.requirements.text | string | No | One of none, specified, unspecified. |
requestContract.requirements.copy | string | No | max length 2000. |
requestContract.requirements.language | string | No | min length 1, max length 80. |
requestContract.preserve | array of string | Yes | max items 32. |
requestContract.changes | array of string | Yes | max items 32. |
requestContract.forbiddenAdditions | array of string | Yes | max items 32. |
requestContract.selection | object | Yes | — |
requestContract.selection.model | string | No | — |
requestContract.selection.size | string | No | — |
requestContract.selection.quality | string | No | — |
requestContract.selection.defaults | array of string | Yes | — |
requestContract.selection.workflow | string | No | — |
requestContract.sourceFingerprints | array of object | No | — |
requestContract.sourceFingerprints[].handle | string | Yes | — |
requestContract.sourceFingerprints[].fingerprint | string | Yes | — |
requestContract.idempotencyKey | string | No | min length 8, max length 200. |
requestContract.parentRun | string | No | — |
requestContract.refinements | array of object | No | — |
requestContract.refinements[].version | integer | Yes | max 9007199254740991. |
requestContract.refinements[].patch | object | Yes | — |
requirements | CreativeImageRequirements | No | Validated 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.count | integer | No | min 1, max 4. |
requirements.aspectRatio | string | No | Pattern ^\d{1,4}:\d{1,4}$. |
requirements.composition | string | No | One of single-frame, comparison, grid. |
requirements.panels | integer | No | min 1, max 16. |
requirements.text | string | No | One of none, specified, unspecified. |
requirements.copy | string | No | max length 2000. |
requirements.language | string | No | min length 1, max length 80. |
composition | string | No | One of single-frame, comparison, grid. |
preserve | array of string | No | max items 32. |
changes | array of string | No | max items 32. |
forbiddenAdditions | array of string | No | max items 32. |
originalWording | string | No | Complete 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).count | 1 | No | — |
(variant 3) (variant 1).count | 2 | No | — |
(variant 4) (variant 1).count | 3 | No | — |
(variant 5) (variant 1).count | 4 | No | — |
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
| Status | Payload | Meaning |
|---|---|---|
200 | ImagePreflightResponse | A validated dry-run reference plan when dryRun is true. |
202 | ImageJob | VideoJob | An 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. |
default | ErrorResponse | A stable machine-readable error. The response always includes X-Request-ID. |
200 response body
| Field | Type | Required | Notes |
|---|---|---|---|
canvasId | string | Yes | Pattern ^canvas:. |
operation | string | Yes | One of generate, edit, variations. |
prompt | string | Yes | — |
finalPrompt | string | Yes | — |
referencePlan | array of ImageReferencePlanEntry | Yes | — |
referencePlan[].order | integer | Yes | min 1. |
referencePlan[].providerOrder | integer | No | min 1. |
referencePlan[].handle | string | Yes | min length 1. |
referencePlan[].label | string | Yes | min length 1. |
referencePlan[].role | string | Yes | One of source, identity, construction, texture, fit, style. |
referencePlan[].applicationMode | string | Yes | creative permits reinterpretation; identity is guided preservation, not pixel-exact; exact is deterministic source-pixel composition. One of creative, identity, exact. |
referencePlan[].element | object | No | — |
referencePlan[].element.id | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
referencePlan[].element.version | integer | Yes | min 1. |
referencePlan[].providerInput | boolean | Yes | — |
plannedResultClass | string | Yes | Image 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. |
exactElements | array of ExactElementComposition | Yes | — |
exactElements[].elementId | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
exactElements[].version | integer | Yes | min 1. |
exactElements[].handle | string | Yes | Pattern ^element:. |
exactElements[].sourceAssetId | string | Yes | Pattern ^[A-Za-z0-9_-]{1,180}$. |
exactElements[].sourceStorageKey | string | Yes | min length 1. |
exactElements[].sourceHash | string | Yes | min length 1. |
exactElements[].placements | array of ExactElementPlacement | Yes | min items 1, max items 16. |
exactElements[].placements[].x | number | Yes | min 0, max 1. |
exactElements[].placements[].y | number | Yes | min 0, max 1. |
exactElements[].placements[].width | number | Yes | max 1. |
exactElements[].placements[].height | number | Yes | max 1. |
references | array of object | Yes | — |
references[].handle | string | Yes | — |
references[].storageKey | string | Yes | — |
settings | ImageJobSettings | No | — |
settings.model | string | No | — |
settings.count | integer | No | min 1. |
settings.requestedSize | string | No | — |
settings.effectiveSize | string | No | — |
settings.quality | string | No | — |
parameterAdjustments | array of ImageJobParameterAdjustment | No | — |
parameterAdjustments[].field | string | Yes | — |
parameterAdjustments[].requested | string | Yes | — |
parameterAdjustments[].effective | string | Yes | — |
parameterAdjustments[].reason | string | Yes | — |
warnings | array of string | No | — |
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 indata.run.images, so callback-only clients do not need a follow-up GET. A caller withjob:managemay 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.