enhancedocs
For agentsOpen Enhance ↗
CLI commands / enhance-dev canvas import-asset

Enhance documentation

enhance-dev canvas import-asset

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

enhance-dev canvas import-asset

enhance-dev canvas import-asset [options]

Arguments

This command takes no positional arguments.

Options

OptionRequiredDefaultMeaning
--input <json-or-@path>YesNoneCanvas reference and selected local file source.
--client-token <uuid>YesNoneStable UUID to reuse when retrying the exact same mutation.

Input

This command presents the capability canvas.importAsset. It has write effect and composite idempotency.

Show complete input 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}

Output

This command writes JSON records to standard output. Returns a typed canvas.importAsset result from the Enhance API without transport-specific prose.

Show complete output 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}

Examples

enhance-dev canvas import-asset --input <json-or-@path> --client-token <uuid>
Show example input
{
 "canvasRef": "00000000-0000-4000-8000-000000000010",
 "source": {
  "kind": "file",
  "path": "/project/logo.png"
 }
}
Show example output
{
 "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"
}

Exit behaviour

Exit codeMeaning
0The command succeeded.
1The command failed for another reason (INTERNAL). A write may have an unknown outcome.
2The command line was malformed. Nothing ran.
3The API refused the input (BAD_REQUEST).
4The credential is missing or expired (UNAUTHORIZED).
5The API refused the request (FORBIDDEN, NOT_FOUND, CONFLICT, RATE_LIMITED).
6A batch finished only in part. Retry with the same --client-token.

Versions

Minimum tested versions: Enhance CLI and MCP runtime 0.1.40, plugin 1.0.38, Node.js 24. No older floor is published.