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.
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.
operation(required): Returned field operation.resource(required): Returned field resource.placement(required): Returned field placement.
Show complete result JSON Schema
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"operation":{"type":"object","properties":{"canvasId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"clientToken":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","const":"canvas-asset"}},"required":["canvasId","clientToken","kind"],"additionalProperties":false},"resource":{"type":"object","properties":{"canvasId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"clientToken":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"assetId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","enum":["image","font"]},"contentType":{"type":"string"},"bytes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"path":{"type":"string","pattern":"^\\/v1\\/canvas-assets\\/.*"},"state":{"type":"string","const":"ready"},"metadata":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"image"},"width":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"height":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","width","height"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"font"},"family":{"type":"string","minLength":1},"subfamily":{"type":"string"},"style":{"type":"string","enum":["normal","italic","oblique"]},"minimumWeight":{"type":"number","minimum":1,"maximum":1000},"maximumWeight":{"type":"number","minimum":1,"maximum":1000}},"required":["kind","family","subfamily","style","minimumWeight","maximumWeight"],"additionalProperties":false}]}},"required":["canvasId","clientToken","assetId","kind","contentType","bytes","sha256","path","state","metadata"],"additionalProperties":false},"placement":{"type":"string","const":"not_requested"}},"required":["operation","resource","placement"],"additionalProperties":false}
Example result
Show example result
{
"operation": {
"kind": "canvas-asset",
"canvasId": "00000000-0000-4000-8000-000000000010",
"clientToken": "00000000-0000-4000-8000-000000000010"
},
"resource": {
"canvasId": "00000000-0000-4000-8000-000000000010",
"clientToken": "00000000-0000-4000-8000-000000000010",
"assetId": "00000000-0000-4000-8000-000000000010",
"kind": "image",
"contentType": "image/png",
"bytes": 1024,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"path": "/v1/canvas-assets/00000000-0000-4000-8000-000000000010/00000000-0000-4000-8000-000000000010",
"state": "ready",
"metadata": {
"kind": "image",
"width": 64,
"height": 64
}
},
"placement": "not_requested"
}
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.
Versions
Compatibility: 93dfb93847340b2a2b7553aff12abea934d18db4e97e0f2ddcb2f1ea592d8202.
Minimum tested versions: Enhance CLI and MCP runtime 0.1.40, plugin 1.0.38, Node.js 24. No older floor is published.