enhancedocs
For agentsOpen Enhance ↗
Reference / canvas.importAsset

Enhance documentation

canvas.importAsset

Import one selected local image or font into the native canvas asset lifecycle, verify its bytes, and return a durable resource without placing it.

↓ Markdown

canvas.importAsset

mutation write

Use when the requested change exactly matches canvas.importAsset; read the current state first when a version or identifier may have changed.

Before calling

  • Authenticate as the accountable Enhance person.
  • Use only resource identifiers returned by an earlier capability result or supplied by the person.
  • Reuse clientToken only when retrying this exact mutation input.

Input

Show complete JSON Schema
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"canvasRef":{"type":"string","minLength":1},"source":{"type":"object","properties":{"kind":{"type":"string","const":"file"},"path":{"type":"string","minLength":1,"description":"Explicit local file path. PNG, JPEG, GIF, WebP, AVIF, TTF, OTF, WOFF or WOFF2."}},"required":["kind","path"],"additionalProperties":false}},"required":["canvasRef","source"],"additionalProperties":false}

Example

Show example input
{
 "canvasRef": "00000000-0000-4000-8000-000000000010",
 "source": {
  "kind": "file",
  "path": "/project/logo.png"
 }
}

Result

Returns a typed canvas.importAsset result from the Enhance API without transport-specific prose.

Recovery

  • BAD_REQUEST: correct the named fields and call again.
  • UNAUTHORIZED: restore Enhance authentication, then retry once.
  • FORBIDDEN or NOT_FOUND: check the supplied resource and selection; do not substitute unrelated content. Ask for corrected access or scope if needed.
  • CONFLICT: read the current resource, merge the intended change, and retry with its version.
  • INTERNAL: run Enhance diagnostics, report the failure, and stop repeating the call.

Continue with

  • Read the affected canvas resource to confirm the result.

Compatibility: 93dfb93847340b2a2b7553aff12abea934d18db4e97e0f2ddcb2f1ea592d8202.