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, canvas:write, asset:read, image:generate
POST /images/generateQueue image generationcanvas:read, canvas:write, asset:read, image:generate
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, canvas:write, asset:read, image:generate

POST /images/edit

Queue an image edit

  • Operation id: startImageEdit
  • Scopes: Requires canvas:read + canvas:write + asset:read + 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.
baseRevisionstringYesmin length 1, max length 200.
idempotencyKeystringYesmin 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 | ImageReferenceInputNoStable 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. Their source images share the 16-image limit with references and source. element:read is required when this array is non-empty. max items 8.
sourcestringNoA convenience reference appended to references. It must be unique across both fields, 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})$.
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.
(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

Responses

StatusPayloadMeaning
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.

202 response body

FieldTypeRequiredNotes
(ImageJob).idstringYesPattern ^job:.
(ImageJob).runstringYesPattern ^run:.
(ImageJob).kindstringYesOne of image, action.
(ImageJob).pollUrlstringYesPattern ^/api/canvas-agent/v1/runs/.
(ImageJob).rawIdstring (uuid)No—
(ImageJob).statusstringYesCurrent temporary job state. Successful results retain the 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. Expired tombstones remain seven days. One of preparing, queued, running, finalizing, canceling, succeeded, failed, canceled, expired.
(ImageJob).estimatedSecondsintegerNoTypical provider runtime for the selected model. This is guidance, not a deadline. min 1.
(ImageJob).durationMsintegerNoTotal observed duration once the job is terminal. min 0.
(ImageJob).timingImageJobTimingNo—
(ImageJob).timing.createdAtstring (date-time)No—
(ImageJob).timing.queuedAtstring (date-time)No—
(ImageJob).timing.startedAtstring (date-time)No—
(ImageJob).timing.completedAtstring (date-time)No—
(ImageJob).timing.queueDurationMsintegerNomin 0.
(ImageJob).timing.executionDurationMsintegerNomin 0.
(ImageJob).timing.totalDurationMsintegerNomin 0.
(ImageJob).failureImageJobFailureNo—
(ImageJob).failure.codestringYesOne of provider_authentication_failed, provider_timeout, provider_rate_limited, provider_rejected, provider_unavailable, runtime_failed, action_input_invalid, result_expired.
(ImageJob).failure.messagestringYes—
(ImageJob).failure.retryablebooleanYes—
(ImageJob).failure.providerStatusintegerNomin 400, max 599.
(ImageJob).webhookImageJobWebhookDeliveryNoDurable delivery state. Gavana makes 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.
(ImageJob).webhook.idstringYesPattern ^webhook:.
(ImageJob).webhook.statusstringYesOne of pending, delivering, delivered, failed.
(ImageJob).webhook.attemptsintegerYesmin 0.
(ImageJob).webhook.nextAttemptAtstring (date-time)No—
(ImageJob).webhook.lastAttemptAtstring (date-time)No—
(ImageJob).webhook.deliveredAtstring (date-time)No—
(ImageJob).webhook.lastStatusintegerNomin 100, max 599.
(ImageJob).webhook.errorCodestringNoOne of invalid_destination, delivery_failed, redirect_not_allowed, endpoint_rejected, secret_unavailable, finalization_unavailable, finalization_auth_unavailable, finalization_auth_expired, finalization_failed.
(ImageJob).replayedbooleanNo—
(ImageJob).operationstringNoOne of generate, edit, variations, action.
(ImageJob).actionIdstringNoPattern ^action:.
(ImageJob).actionVersionstringNo—
(ImageJob).canvasIdstringNoPattern ^canvas:.
(ImageJob).canvasRevisionstringNo—
(ImageJob).canvasUrlstring (uri)No—
(ImageJob).canceledAtstring (date-time)No—
(ImageJob).cancelReasonstringNoOne of stale_preparing, user_requested, setup_failed.
(ImageJob).targetsarray of stringNo—
(ImageJob).referencesarray of stringNo—
(ImageJob).referenceInputsarray of ImageReferenceInputNoExact reference handles and optional semantic roles used by the provider request.
(ImageJob).referenceInputs[].handlestringYesPattern ^(?:node:[A-Za-z0-9_-]{1,180}|asset:(?:[A-Za-z0-9_-]{1,180}:)?[A-Za-z0-9_-]{1,180})$.
(ImageJob).referenceInputs[].rolestringNoOne of identity, construction, texture, fit, style.
(ImageJob).imagesarray of ImageJobResultImageNo—
(ImageJob).images[].assetIdstringYesPattern ^asset:.
(ImageJob).images[].nodeIdstringYesPattern ^node:.
(ImageJob).images[].mediaTypestringNoPattern ^image/.
(ImageJob).images[].widthintegerNomin 1.
(ImageJob).images[].heightintegerNomin 1.
(ImageJob).images[].bytesintegerNomin 1.
(ImageJob).images[].previewUrlstring (uri)Yes—
(ImageJob).images[].markdownstringNo—
(ImageJob).completionReviewCanvasCompletionReviewNo—
(ImageJob).completionReview.statusstringYesOne of ready, needs-review, blocked.
(ImageJob).completionReview.doneClaimAllowedbooleanYesFalse while agent-owned spatial or lineage findings remain, or a generated output is pending, failed, or non-durable.
(ImageJob).completionReview.instructionstringYes—
(ImageJob).completionReview.outputsCanvasCompletionOutputsYesGenerated-output count and durable, pending, and failed breakdown.
(ImageJob).completionReview.outputs.countintegerYesmin 0.
(ImageJob).completionReview.outputs.durableCountintegerYesmin 0.
(ImageJob).completionReview.outputs.pendingCountintegerYesmin 0.
(ImageJob).completionReview.outputs.failedCountintegerYesmin 0.
(ImageJob).completionReview.outputs.handlesarray of stringYes—
(ImageJob).completionReview.overlapCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.overlap.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.overlap.findingCodesarray of stringYes—
(ImageJob).completionReview.overlap.nodeHandlesarray of stringYes—
(ImageJob).completionReview.overlap.connectionHandlesarray of stringYes—
(ImageJob).completionReview.containmentCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.containment.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.containment.findingCodesarray of stringYes—
(ImageJob).completionReview.containment.nodeHandlesarray of stringYes—
(ImageJob).completionReview.containment.connectionHandlesarray of stringYes—
(ImageJob).completionReview.referenceLineageCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.referenceLineage.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.referenceLineage.findingCodesarray of stringYes—
(ImageJob).completionReview.referenceLineage.nodeHandlesarray of stringYes—
(ImageJob).completionReview.referenceLineage.connectionHandlesarray of stringYes—
(ImageJob).completionReview.productFidelityCanvasProductFidelityReviewYesA conservative review signal, not an authoritative visual inspection.
(ImageJob).completionReview.productFidelity.statusstringYesOne of not-applicable, needs-review, passed.
(ImageJob).completionReview.productFidelity.reviewedOutputCountintegerYesmin 0.
(ImageJob).completionReview.productFidelity.needsReviewOutputHandlesarray of stringYes—
(ImageJob).completionReview.productFidelity.evidenceMissingOutputHandlesarray of stringYes—
(ImageJob).completionReview.productFidelity.reasonsarray of objectNo—
(ImageJob).completionReview.productFidelity.reasons[].nodeHandlestringYesPattern ^node:.
(ImageJob).completionReview.productFidelity.reasons[].reasonstringYes—
(ImageJob).completionReview.deliveryCanvasCompletionDeliveryYesGenerated-output delivery evidence. A blocked state prevents a Done claim.
(ImageJob).completionReview.delivery.statusstringYesOne of clear, blocked.
(ImageJob).completionReview.delivery.reasonsarray of stringNo—
(ImageJob).completionReview.delivery.pendingOutputHandlesarray of stringYes—
(ImageJob).completionReview.delivery.failedOutputHandlesarray of stringYes—
(ImageJob).completionReview.delivery.nonDurableOutputHandlesarray of stringYes—
(ImageJob).completionReview.blockingFindingCodesarray of stringYes—
(ImageJob).completionReview.advisoryFindingCodesarray of stringYes—
(VideoJob).idstringYesPattern ^job:.
(VideoJob).rawIdstring (uuid)Yes—
(VideoJob).kind“video”Yes—
(VideoJob).operation“generate”Yes—
(VideoJob).pollUrlstringYesPattern ^/api/canvas-agent/v1/jobs/.
(VideoJob).statusstringYesOne of queued, running, succeeded, failed, canceled.
(VideoJob).modelobjectYes—
(VideoJob).model.idstringYes—
(VideoJob).model.namestringYes—
(VideoJob).progressnumberYesmin 0, max 100.
(VideoJob).estimatedSecondsintegerYesmin 1.
(VideoJob).providerRunIdstringNo—
(VideoJob).failureVideoJobFailureNo—
(VideoJob).failure.codestringYesOne of video_generation_failed, canceled.
(VideoJob).failure.messagestringYes—
(VideoJob).failure.retryablebooleanYes—
(VideoJob).videoobjectNo—
(VideoJob).video.downloadUrlstringYesPattern ^/api/canvas-agent/v1/jobs/.+/output$.
(VideoJob).replayedbooleanNo—
(VideoJob).createdAtstring (date-time)Yes—
(VideoJob).updatedAtstring (date-time)Yes—

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 + canvas:write + asset:read + 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.
baseRevisionstringYesmin length 1, max length 200.
idempotencyKeystringYesmin 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 | ImageReferenceInputNoStable 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. Their source images share the 16-image limit with references and source. element:read is required when this array is non-empty. max items 8.
sourcestringNoA convenience reference appended to references. It must be unique across both fields, 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})$.
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.
(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

Responses

StatusPayloadMeaning
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.

202 response body

FieldTypeRequiredNotes
(ImageJob).idstringYesPattern ^job:.
(ImageJob).runstringYesPattern ^run:.
(ImageJob).kindstringYesOne of image, action.
(ImageJob).pollUrlstringYesPattern ^/api/canvas-agent/v1/runs/.
(ImageJob).rawIdstring (uuid)No—
(ImageJob).statusstringYesCurrent temporary job state. Successful results retain the 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. Expired tombstones remain seven days. One of preparing, queued, running, finalizing, canceling, succeeded, failed, canceled, expired.
(ImageJob).estimatedSecondsintegerNoTypical provider runtime for the selected model. This is guidance, not a deadline. min 1.
(ImageJob).durationMsintegerNoTotal observed duration once the job is terminal. min 0.
(ImageJob).timingImageJobTimingNo—
(ImageJob).timing.createdAtstring (date-time)No—
(ImageJob).timing.queuedAtstring (date-time)No—
(ImageJob).timing.startedAtstring (date-time)No—
(ImageJob).timing.completedAtstring (date-time)No—
(ImageJob).timing.queueDurationMsintegerNomin 0.
(ImageJob).timing.executionDurationMsintegerNomin 0.
(ImageJob).timing.totalDurationMsintegerNomin 0.
(ImageJob).failureImageJobFailureNo—
(ImageJob).failure.codestringYesOne of provider_authentication_failed, provider_timeout, provider_rate_limited, provider_rejected, provider_unavailable, runtime_failed, action_input_invalid, result_expired.
(ImageJob).failure.messagestringYes—
(ImageJob).failure.retryablebooleanYes—
(ImageJob).failure.providerStatusintegerNomin 400, max 599.
(ImageJob).webhookImageJobWebhookDeliveryNoDurable delivery state. Gavana makes 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.
(ImageJob).webhook.idstringYesPattern ^webhook:.
(ImageJob).webhook.statusstringYesOne of pending, delivering, delivered, failed.
(ImageJob).webhook.attemptsintegerYesmin 0.
(ImageJob).webhook.nextAttemptAtstring (date-time)No—
(ImageJob).webhook.lastAttemptAtstring (date-time)No—
(ImageJob).webhook.deliveredAtstring (date-time)No—
(ImageJob).webhook.lastStatusintegerNomin 100, max 599.
(ImageJob).webhook.errorCodestringNoOne of invalid_destination, delivery_failed, redirect_not_allowed, endpoint_rejected, secret_unavailable, finalization_unavailable, finalization_auth_unavailable, finalization_auth_expired, finalization_failed.
(ImageJob).replayedbooleanNo—
(ImageJob).operationstringNoOne of generate, edit, variations, action.
(ImageJob).actionIdstringNoPattern ^action:.
(ImageJob).actionVersionstringNo—
(ImageJob).canvasIdstringNoPattern ^canvas:.
(ImageJob).canvasRevisionstringNo—
(ImageJob).canvasUrlstring (uri)No—
(ImageJob).canceledAtstring (date-time)No—
(ImageJob).cancelReasonstringNoOne of stale_preparing, user_requested, setup_failed.
(ImageJob).targetsarray of stringNo—
(ImageJob).referencesarray of stringNo—
(ImageJob).referenceInputsarray of ImageReferenceInputNoExact reference handles and optional semantic roles used by the provider request.
(ImageJob).referenceInputs[].handlestringYesPattern ^(?:node:[A-Za-z0-9_-]{1,180}|asset:(?:[A-Za-z0-9_-]{1,180}:)?[A-Za-z0-9_-]{1,180})$.
(ImageJob).referenceInputs[].rolestringNoOne of identity, construction, texture, fit, style.
(ImageJob).imagesarray of ImageJobResultImageNo—
(ImageJob).images[].assetIdstringYesPattern ^asset:.
(ImageJob).images[].nodeIdstringYesPattern ^node:.
(ImageJob).images[].mediaTypestringNoPattern ^image/.
(ImageJob).images[].widthintegerNomin 1.
(ImageJob).images[].heightintegerNomin 1.
(ImageJob).images[].bytesintegerNomin 1.
(ImageJob).images[].previewUrlstring (uri)Yes—
(ImageJob).images[].markdownstringNo—
(ImageJob).completionReviewCanvasCompletionReviewNo—
(ImageJob).completionReview.statusstringYesOne of ready, needs-review, blocked.
(ImageJob).completionReview.doneClaimAllowedbooleanYesFalse while agent-owned spatial or lineage findings remain, or a generated output is pending, failed, or non-durable.
(ImageJob).completionReview.instructionstringYes—
(ImageJob).completionReview.outputsCanvasCompletionOutputsYesGenerated-output count and durable, pending, and failed breakdown.
(ImageJob).completionReview.outputs.countintegerYesmin 0.
(ImageJob).completionReview.outputs.durableCountintegerYesmin 0.
(ImageJob).completionReview.outputs.pendingCountintegerYesmin 0.
(ImageJob).completionReview.outputs.failedCountintegerYesmin 0.
(ImageJob).completionReview.outputs.handlesarray of stringYes—
(ImageJob).completionReview.overlapCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.overlap.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.overlap.findingCodesarray of stringYes—
(ImageJob).completionReview.overlap.nodeHandlesarray of stringYes—
(ImageJob).completionReview.overlap.connectionHandlesarray of stringYes—
(ImageJob).completionReview.containmentCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.containment.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.containment.findingCodesarray of stringYes—
(ImageJob).completionReview.containment.nodeHandlesarray of stringYes—
(ImageJob).completionReview.containment.connectionHandlesarray of stringYes—
(ImageJob).completionReview.referenceLineageCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.referenceLineage.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.referenceLineage.findingCodesarray of stringYes—
(ImageJob).completionReview.referenceLineage.nodeHandlesarray of stringYes—
(ImageJob).completionReview.referenceLineage.connectionHandlesarray of stringYes—
(ImageJob).completionReview.productFidelityCanvasProductFidelityReviewYesA conservative review signal, not an authoritative visual inspection.
(ImageJob).completionReview.productFidelity.statusstringYesOne of not-applicable, needs-review, passed.
(ImageJob).completionReview.productFidelity.reviewedOutputCountintegerYesmin 0.
(ImageJob).completionReview.productFidelity.needsReviewOutputHandlesarray of stringYes—
(ImageJob).completionReview.productFidelity.evidenceMissingOutputHandlesarray of stringYes—
(ImageJob).completionReview.productFidelity.reasonsarray of objectNo—
(ImageJob).completionReview.productFidelity.reasons[].nodeHandlestringYesPattern ^node:.
(ImageJob).completionReview.productFidelity.reasons[].reasonstringYes—
(ImageJob).completionReview.deliveryCanvasCompletionDeliveryYesGenerated-output delivery evidence. A blocked state prevents a Done claim.
(ImageJob).completionReview.delivery.statusstringYesOne of clear, blocked.
(ImageJob).completionReview.delivery.reasonsarray of stringNo—
(ImageJob).completionReview.delivery.pendingOutputHandlesarray of stringYes—
(ImageJob).completionReview.delivery.failedOutputHandlesarray of stringYes—
(ImageJob).completionReview.delivery.nonDurableOutputHandlesarray of stringYes—
(ImageJob).completionReview.blockingFindingCodesarray of stringYes—
(ImageJob).completionReview.advisoryFindingCodesarray of stringYes—
(VideoJob).idstringYesPattern ^job:.
(VideoJob).rawIdstring (uuid)Yes—
(VideoJob).kind“video”Yes—
(VideoJob).operation“generate”Yes—
(VideoJob).pollUrlstringYesPattern ^/api/canvas-agent/v1/jobs/.
(VideoJob).statusstringYesOne of queued, running, succeeded, failed, canceled.
(VideoJob).modelobjectYes—
(VideoJob).model.idstringYes—
(VideoJob).model.namestringYes—
(VideoJob).progressnumberYesmin 0, max 100.
(VideoJob).estimatedSecondsintegerYesmin 1.
(VideoJob).providerRunIdstringNo—
(VideoJob).failureVideoJobFailureNo—
(VideoJob).failure.codestringYesOne of video_generation_failed, canceled.
(VideoJob).failure.messagestringYes—
(VideoJob).failure.retryablebooleanYes—
(VideoJob).videoobjectNo—
(VideoJob).video.downloadUrlstringYesPattern ^/api/canvas-agent/v1/jobs/.+/output$.
(VideoJob).replayedbooleanNo—
(VideoJob).createdAtstring (date-time)Yes—
(VideoJob).updatedAtstring (date-time)Yes—

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 + canvas:write + asset:read + 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.
baseRevisionstringYesmin length 1, max length 200.
idempotencyKeystringYesmin 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 | ImageReferenceInputNoStable 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. Their source images share the 16-image limit with references and source. element:read is required when this array is non-empty. max items 8.
sourcestringNoA convenience reference appended to references. It must be unique across both fields, 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})$.
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.
(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

Responses

StatusPayloadMeaning
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.

202 response body

FieldTypeRequiredNotes
(ImageJob).idstringYesPattern ^job:.
(ImageJob).runstringYesPattern ^run:.
(ImageJob).kindstringYesOne of image, action.
(ImageJob).pollUrlstringYesPattern ^/api/canvas-agent/v1/runs/.
(ImageJob).rawIdstring (uuid)No—
(ImageJob).statusstringYesCurrent temporary job state. Successful results retain the 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. Expired tombstones remain seven days. One of preparing, queued, running, finalizing, canceling, succeeded, failed, canceled, expired.
(ImageJob).estimatedSecondsintegerNoTypical provider runtime for the selected model. This is guidance, not a deadline. min 1.
(ImageJob).durationMsintegerNoTotal observed duration once the job is terminal. min 0.
(ImageJob).timingImageJobTimingNo—
(ImageJob).timing.createdAtstring (date-time)No—
(ImageJob).timing.queuedAtstring (date-time)No—
(ImageJob).timing.startedAtstring (date-time)No—
(ImageJob).timing.completedAtstring (date-time)No—
(ImageJob).timing.queueDurationMsintegerNomin 0.
(ImageJob).timing.executionDurationMsintegerNomin 0.
(ImageJob).timing.totalDurationMsintegerNomin 0.
(ImageJob).failureImageJobFailureNo—
(ImageJob).failure.codestringYesOne of provider_authentication_failed, provider_timeout, provider_rate_limited, provider_rejected, provider_unavailable, runtime_failed, action_input_invalid, result_expired.
(ImageJob).failure.messagestringYes—
(ImageJob).failure.retryablebooleanYes—
(ImageJob).failure.providerStatusintegerNomin 400, max 599.
(ImageJob).webhookImageJobWebhookDeliveryNoDurable delivery state. Gavana makes 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.
(ImageJob).webhook.idstringYesPattern ^webhook:.
(ImageJob).webhook.statusstringYesOne of pending, delivering, delivered, failed.
(ImageJob).webhook.attemptsintegerYesmin 0.
(ImageJob).webhook.nextAttemptAtstring (date-time)No—
(ImageJob).webhook.lastAttemptAtstring (date-time)No—
(ImageJob).webhook.deliveredAtstring (date-time)No—
(ImageJob).webhook.lastStatusintegerNomin 100, max 599.
(ImageJob).webhook.errorCodestringNoOne of invalid_destination, delivery_failed, redirect_not_allowed, endpoint_rejected, secret_unavailable, finalization_unavailable, finalization_auth_unavailable, finalization_auth_expired, finalization_failed.
(ImageJob).replayedbooleanNo—
(ImageJob).operationstringNoOne of generate, edit, variations, action.
(ImageJob).actionIdstringNoPattern ^action:.
(ImageJob).actionVersionstringNo—
(ImageJob).canvasIdstringNoPattern ^canvas:.
(ImageJob).canvasRevisionstringNo—
(ImageJob).canvasUrlstring (uri)No—
(ImageJob).canceledAtstring (date-time)No—
(ImageJob).cancelReasonstringNoOne of stale_preparing, user_requested, setup_failed.
(ImageJob).targetsarray of stringNo—
(ImageJob).referencesarray of stringNo—
(ImageJob).referenceInputsarray of ImageReferenceInputNoExact reference handles and optional semantic roles used by the provider request.
(ImageJob).referenceInputs[].handlestringYesPattern ^(?:node:[A-Za-z0-9_-]{1,180}|asset:(?:[A-Za-z0-9_-]{1,180}:)?[A-Za-z0-9_-]{1,180})$.
(ImageJob).referenceInputs[].rolestringNoOne of identity, construction, texture, fit, style.
(ImageJob).imagesarray of ImageJobResultImageNo—
(ImageJob).images[].assetIdstringYesPattern ^asset:.
(ImageJob).images[].nodeIdstringYesPattern ^node:.
(ImageJob).images[].mediaTypestringNoPattern ^image/.
(ImageJob).images[].widthintegerNomin 1.
(ImageJob).images[].heightintegerNomin 1.
(ImageJob).images[].bytesintegerNomin 1.
(ImageJob).images[].previewUrlstring (uri)Yes—
(ImageJob).images[].markdownstringNo—
(ImageJob).completionReviewCanvasCompletionReviewNo—
(ImageJob).completionReview.statusstringYesOne of ready, needs-review, blocked.
(ImageJob).completionReview.doneClaimAllowedbooleanYesFalse while agent-owned spatial or lineage findings remain, or a generated output is pending, failed, or non-durable.
(ImageJob).completionReview.instructionstringYes—
(ImageJob).completionReview.outputsCanvasCompletionOutputsYesGenerated-output count and durable, pending, and failed breakdown.
(ImageJob).completionReview.outputs.countintegerYesmin 0.
(ImageJob).completionReview.outputs.durableCountintegerYesmin 0.
(ImageJob).completionReview.outputs.pendingCountintegerYesmin 0.
(ImageJob).completionReview.outputs.failedCountintegerYesmin 0.
(ImageJob).completionReview.outputs.handlesarray of stringYes—
(ImageJob).completionReview.overlapCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.overlap.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.overlap.findingCodesarray of stringYes—
(ImageJob).completionReview.overlap.nodeHandlesarray of stringYes—
(ImageJob).completionReview.overlap.connectionHandlesarray of stringYes—
(ImageJob).completionReview.containmentCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.containment.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.containment.findingCodesarray of stringYes—
(ImageJob).completionReview.containment.nodeHandlesarray of stringYes—
(ImageJob).completionReview.containment.connectionHandlesarray of stringYes—
(ImageJob).completionReview.referenceLineageCanvasCompletionFindingAreaYes—
(ImageJob).completionReview.referenceLineage.statusstringYesOne of clear, needs-review, blocked.
(ImageJob).completionReview.referenceLineage.findingCodesarray of stringYes—
(ImageJob).completionReview.referenceLineage.nodeHandlesarray of stringYes—
(ImageJob).completionReview.referenceLineage.connectionHandlesarray of stringYes—
(ImageJob).completionReview.productFidelityCanvasProductFidelityReviewYesA conservative review signal, not an authoritative visual inspection.
(ImageJob).completionReview.productFidelity.statusstringYesOne of not-applicable, needs-review, passed.
(ImageJob).completionReview.productFidelity.reviewedOutputCountintegerYesmin 0.
(ImageJob).completionReview.productFidelity.needsReviewOutputHandlesarray of stringYes—
(ImageJob).completionReview.productFidelity.evidenceMissingOutputHandlesarray of stringYes—
(ImageJob).completionReview.productFidelity.reasonsarray of objectNo—
(ImageJob).completionReview.productFidelity.reasons[].nodeHandlestringYesPattern ^node:.
(ImageJob).completionReview.productFidelity.reasons[].reasonstringYes—
(ImageJob).completionReview.deliveryCanvasCompletionDeliveryYesGenerated-output delivery evidence. A blocked state prevents a Done claim.
(ImageJob).completionReview.delivery.statusstringYesOne of clear, blocked.
(ImageJob).completionReview.delivery.reasonsarray of stringNo—
(ImageJob).completionReview.delivery.pendingOutputHandlesarray of stringYes—
(ImageJob).completionReview.delivery.failedOutputHandlesarray of stringYes—
(ImageJob).completionReview.delivery.nonDurableOutputHandlesarray of stringYes—
(ImageJob).completionReview.blockingFindingCodesarray of stringYes—
(ImageJob).completionReview.advisoryFindingCodesarray of stringYes—
(VideoJob).idstringYesPattern ^job:.
(VideoJob).rawIdstring (uuid)Yes—
(VideoJob).kind“video”Yes—
(VideoJob).operation“generate”Yes—
(VideoJob).pollUrlstringYesPattern ^/api/canvas-agent/v1/jobs/.
(VideoJob).statusstringYesOne of queued, running, succeeded, failed, canceled.
(VideoJob).modelobjectYes—
(VideoJob).model.idstringYes—
(VideoJob).model.namestringYes—
(VideoJob).progressnumberYesmin 0, max 100.
(VideoJob).estimatedSecondsintegerYesmin 1.
(VideoJob).providerRunIdstringNo—
(VideoJob).failureVideoJobFailureNo—
(VideoJob).failure.codestringYesOne of video_generation_failed, canceled.
(VideoJob).failure.messagestringYes—
(VideoJob).failure.retryablebooleanYes—
(VideoJob).videoobjectNo—
(VideoJob).video.downloadUrlstringYesPattern ^/api/canvas-agent/v1/jobs/.+/output$.
(VideoJob).replayedbooleanNo—
(VideoJob).createdAtstring (date-time)Yes—
(VideoJob).updatedAtstring (date-time)Yes—

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