# Assets ## Create an asset upload `$ flora assets create` **post** `/assets` Creates an asset from an allowlisted source URL or reserves a signed upload URL. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate. ### Parameters - `--source: string` Asset source URL or signed-url upload mode - `--workspace-id: string` Workspace identifier - `--content-type: optional string` Asset content type - `--file-name: optional string` Asset file name - `--folder: optional string` Destination folder ### Returns - `AssetNewResponse: object { asset_id, status, uploaded_via, 6 more }` - `asset_id: string` Asset identifier - `status: "pending_upload" or "ready" or "failed"` - `"pending_upload"` - `"ready"` - `"failed"` - `uploaded_via: "url" or "signed_url"` Asset source - `"url"` - `"signed_url"` - `url: string` Asset URL - `visibility: "workspace"` - `workspace_id: string` Workspace identifier - `expires_at: optional string` Expiration time for the upload URL - `upload: optional object { content_type, file_field, form_fields, 2 more }` - `content_type: "multipart/form-data"` - `file_field: "file"` - `form_fields: map[string]` Upload form fields - `method: "POST"` - `url: string` Upload URL - `upload_url: optional string` Upload URL (serialized) ### Example ```cli flora assets create \ --api-key 'My API Key' \ --source signed-url \ --workspace-id ws_abc123 ``` #### Response ```json { "asset_id": "asset_abc123", "status": "pending_upload", "uploaded_via": "url", "url": "https://example.com", "visibility": "workspace", "workspace_id": "ws_abc123", "expires_at": "2019-12-27T18:11:19.117Z", "upload": { "content_type": "multipart/form-data", "file_field": "file", "form_fields": { "foo": "string" }, "method": "POST", "url": "https://example.com" }, "upload_url": "https://upload.imagekit.io/api/v1/files/upload" } ``` ## Complete a signed asset upload `$ flora assets complete` **post** `/assets/{assetId}/complete` Marks a signed asset upload as complete after the file has been uploaded. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate. ### Parameters - `--asset-id: string` Asset identifier ### Returns - `AssetCompleteResponse: object { asset_id, status, url, 6 more }` - `asset_id: string` Asset identifier - `status: "pending_upload" or "ready" or "failed"` - `"pending_upload"` - `"ready"` - `"failed"` - `url: string` Asset URL - `visibility: "workspace"` - `workspace_id: string` Workspace identifier - `expires_at: optional string` Expiration time for the upload URL - `failure_message: optional string` Failure message when the asset is in failed status - `upload: optional object { content_type, file_field, form_fields, 2 more }` - `content_type: "multipart/form-data"` - `file_field: "file"` - `form_fields: map[string]` Upload form fields - `method: "POST"` - `url: string` Upload URL - `upload_url: optional string` Upload URL (serialized) ### Example ```cli flora assets complete \ --api-key 'My API Key' \ --asset-id asset_abc123 ``` #### Response ```json { "asset_id": "asset_abc123", "status": "pending_upload", "url": "https://example.com", "visibility": "workspace", "workspace_id": "ws_abc123", "expires_at": "2019-12-27T18:11:19.117Z", "failure_message": "failure_message", "upload": { "content_type": "multipart/form-data", "file_field": "file", "form_fields": { "foo": "string" }, "method": "POST", "url": "https://example.com" }, "upload_url": "https://upload.imagekit.io/api/v1/files/upload" } ``` ## Retry a signed asset upload `$ flora assets retry` **post** `/assets/{assetId}/retry` Creates a fresh signed upload reservation for a failed or expired asset upload. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate. ### Parameters - `--asset-id: string` Asset identifier ### Returns - `AssetRetryResponse: object { asset_id, status, url, 6 more }` - `asset_id: string` Asset identifier - `status: "pending_upload" or "ready" or "failed"` - `"pending_upload"` - `"ready"` - `"failed"` - `url: string` Asset URL - `visibility: "workspace"` - `workspace_id: string` Workspace identifier - `expires_at: optional string` Expiration time for the upload URL - `failure_message: optional string` Failure message when the asset is in failed status - `upload: optional object { content_type, file_field, form_fields, 2 more }` - `content_type: "multipart/form-data"` - `file_field: "file"` - `form_fields: map[string]` Upload form fields - `method: "POST"` - `url: string` Upload URL - `upload_url: optional string` Upload URL (serialized) ### Example ```cli flora assets retry \ --api-key 'My API Key' \ --asset-id asset_abc123 ``` #### Response ```json { "asset_id": "asset_abc123", "status": "pending_upload", "url": "https://example.com", "visibility": "workspace", "workspace_id": "ws_abc123", "expires_at": "2019-12-27T18:11:19.117Z", "failure_message": "failure_message", "upload": { "content_type": "multipart/form-data", "file_field": "file", "form_fields": { "foo": "string" }, "method": "POST", "url": "https://example.com" }, "upload_url": "https://upload.imagekit.io/api/v1/files/upload" } ``` ## List assets `$ flora assets list` **get** `/assets` Returns assets visible to the authenticated public API key. Filter by workspace, project canvas, search query, cursor, and limit without exposing raw file bytes or internal graph data. ### Parameters - `--cursor: optional string` Opaque cursor for fetching the next page - `--limit: optional number` Maximum number of results to return - `--project-id: optional string` Project identifier - `--query: optional string` Search query - `--workspace-id: optional string` Workspace identifier ### Returns - `unnamed_schema_1: object { assets, meta }` - `assets: array of object { asset_id, content_type, created_at, 12 more }` - `asset_id: string` Asset identifier - `content_type: string` Asset content type - `created_at: number` - `description: string` Asset description - `height: number` - `name: string` Asset name - `size_bytes: number` - `status: "pending_upload" or "ready" or "failed"` - `"pending_upload"` - `"ready"` - `"failed"` - `upload_content_type: string` Content type provided at upload time - `uploaded_via: string` Asset source - `url: string` Asset URL - `width: number` - `workspace_id: string` Workspace identifier - `node_id: optional string` Associated node identifier - `project_id: optional string` Project identifier - `meta: object { next_cursor, total_estimate }` - `next_cursor: string` Opaque cursor for fetching the next page - `total_estimate: optional number` Estimated total matching items ### Example ```cli flora assets list \ --api-key 'My API Key' ``` #### Response ```json { "assets": [ { "asset_id": "asset_abc123", "content_type": "content_type", "created_at": 0, "description": "description", "height": 0, "name": "name", "size_bytes": 0, "status": "pending_upload", "upload_content_type": "upload_content_type", "uploaded_via": "uploaded_via", "url": "https://example.com", "width": 0, "workspace_id": "ws_abc123", "node_id": "node_abc123", "project_id": "prj_abc123" } ], "meta": { "next_cursor": "eyJvZmZzZXQiOjIwfQ", "total_estimate": 0 } } ``` ## Get an asset `$ flora assets retrieve` **get** `/assets/{assetId}` Returns metadata for one asset when it is accessible to the authenticated public API key. Missing and inaccessible assets both return 404. ### Parameters - `--asset-id: string` Asset identifier ### Returns - `AssetGetResponse: object { asset_id, content_type, created_at, 11 more }` - `asset_id: string` Asset identifier - `content_type: string` Asset content type - `created_at: string` Asset creation time (ISO 8601 datetime) - `description: string` Asset description - `failure_message: string` Failure message when the asset is in failed status - `height: number` - `name: string` Asset name - `size_bytes: number` - `status: "pending_upload" or "ready" or "failed"` - `"pending_upload"` - `"ready"` - `"failed"` - `upload_content_type: string` Content type provided at upload time - `uploaded_via: string` Asset source - `url: string` Asset URL - `width: number` - `workspace_id: string` Workspace identifier ### Example ```cli flora assets retrieve \ --api-key 'My API Key' \ --asset-id asset_abc123 ``` #### Response ```json { "asset_id": "asset_abc123", "content_type": "content_type", "created_at": "2019-12-27T18:11:19.117Z", "description": "description", "failure_message": "failure_message", "height": 0, "name": "name", "size_bytes": 0, "status": "pending_upload", "upload_content_type": "upload_content_type", "uploaded_via": "uploaded_via", "url": "https://example.com", "width": 0, "workspace_id": "ws_abc123" } ```