Skip to content

Attach an asset to a canvas

POST
/projects/{projectId}/assets/{assetId}/attach
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const asset = await client.projects.assets.attach({
projectId: '<projectId>',
assetId: '<assetId>',
width: 0,
height: 0,
});
console.log(asset);

Attaches an existing ready asset to a project canvas as a static media node. Images and videos use their native aspect ratio by default. For a new image node with known dimensions, optionally set width or height in canvas pixels; an omitted side follows the native aspect ratio, and both sides must preserve it. The frame cannot shrink below its default size or grow beyond 1024 pixels on either edge. This does not change the asset. Sizing an already attached asset is rejected; use changeset update[].size instead. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate.

Error responses use the standard error body.

projectId
required

Project identifier

string
/^prj_\S+$/

Project identifier

assetId
required

Asset identifier

string
/^asset_\S+$/

Asset identifier

Media type application/json
object
width

Display width in canvas pixels for a static image. Omit height to derive it from the image’s aspect ratio.

number
height

Display height in canvas pixels for a static image. Omit width to derive it from the image’s aspect ratio.

number
Example generated
{
"width": 1,
"height": 1
}

Asset attached to canvas.

Media type application/json
object
project_id
required

Project identifier

string
/^prj_\S+$/
asset_id
required

Asset identifier

string
/^asset_\S+$/
node_id
required

Canvas node identifier

string
>= 1 characters
canvas_url
required

Project canvas URL

string format: uri
Example
{
"project_id": "prj_abc123",
"asset_id": "asset_abc123",
"node_id": "node_abc123"
}